```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(user): 添加申请商店功能

- 新增ReqShop接口用于用户申请成为商店角色
- 验证用户是否满足申请条件(任务完成状态)
- 将符合条件的用户分配到商店角色ID 27

feat(pet): 设置宠物价格最小值限制

- 为宠物价格设置最低5的限制
- 防止价格过低影响游戏平衡

feat(task): 实现商店申请条件检查

- 添加CanShop方法检查用户是否完成特定任务
- 使用位集验证任务ID 500
This commit is contained in:
昔念
2026-03-11 00:43:17 +08:00
parent ed8b1b71c1
commit b0130f39d5
3 changed files with 49 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import (
"blazing/cool"
"blazing/modules/base/model"
"blazing/modules/base/service"
config "blazing/modules/config/service"
@@ -47,6 +48,22 @@ func (c *BaseSysUserController) Move(ctx context.Context, req *UserMoveReq) (res
return
}
type ReqShopReq struct {
g.Meta `path:"/reqshop" method:"POST"`
Authorization string `json:"Authorization" in:"header"`
}
func (c *BaseSysUserController) ReqShop(ctx context.Context, req *ReqShopReq) (res *cool.BaseRes, err error) {
t := cool.GetAdmin(ctx)
if !playerservice.NewTaskService(uint32(t.UserId)).CanShop() {
return cool.Fail("不满足申请条件"), nil
}
cool.DBM(&model.BaseSysUserRole{}).Data("roleId", "27", "userId", t.UserId).Save()
res = cool.Ok(nil)
return
}
type SessionReq struct {
g.Meta `path:"/getSession" method:"GET"`
Authorization string `json:"Authorization" in:"header"`