feat(service): 宠物添加功能增加销售计数参数并优化价格更新逻辑 - 修改PetAdd方法签名,增加salecount参数用于追踪宠物销售次数 - 在多个控制器中统一调用PetAdd方法时传入0作为初始销售次数 - 临时禁用寒流枪活动中的宠物发放功能 - 优化UPdatePrice方法,添加错误处理和价格范围验证逻辑 - 调整宠物购买逻辑,使用免费金币系统并计算递增购买
This commit is contained in:
@@ -168,3 +168,22 @@ func (c *BaseSysUserController) GoldAdd(ctx context.Context, req *UserGoldAddReq
|
||||
res = cool.Ok(nil)
|
||||
return
|
||||
}
|
||||
|
||||
type DuihuanGoldAddReq struct {
|
||||
g.Meta `path:"/duihuan" method:"POST"`
|
||||
Authorization string `json:"Authorization" in:"header"`
|
||||
|
||||
Gold float32 `json:"gold"`
|
||||
}
|
||||
|
||||
func (c *BaseSysUserController) DuihuanGold(ctx context.Context, req *DuihuanGoldAddReq) (res *cool.BaseRes, err error) {
|
||||
t := cool.GetAdmin(ctx)
|
||||
|
||||
if service.NewBaseSysUserService().GetGold(t.UserId) < int64(req.Gold*100) {
|
||||
res = cool.Fail("余额不足")
|
||||
return
|
||||
}
|
||||
service.NewBaseSysUserService().DuihuanFreeGold(uint32(t.UserId), int64(req.Gold*100))
|
||||
res = cool.Ok(nil)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user