Files
bl/modules/player/service/gold_list.go
昔念 baf0d1fc06
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
fix(config): 修复宠物蛋系统中概率计算错误

- 修正了EggService中宠物产出概率计算时错误使用的字段名
- 将pet.OutputMons修正为pet.Probs以正确累加等级权重

refactor(player): 优化金币列表服务参数处理逻辑

- 移除未使用的gconv导入包
- 简化ModifyBefore方法中的用户ID验证逻辑
- 统一设置
2026-03-19 15:08:14 +08:00

51 lines
986 B
Go

package service
import (
"blazing/cool"
"blazing/modules/player/model"
"context"
"fmt"
"github.com/gogf/gf/v2/frame/g"
)
type GoldListService struct {
BaseService
}
func (s *GoldListService) ModifyBefore(ctx context.Context, method string, param map[string]interface{}) (err error) {
admin := cool.GetAdmin(ctx)
userId := admin.UserId
s.userid = uint32(userId)
param["player_id"] = userId
if method == "Add" {
t, _ := s.dbm_fix(s.Model).Count()
if t > 0 {
return fmt.Errorf("不允许多挂单")
}
}
return
}
func NewGoldListService(id uint32) *GoldListService {
return &GoldListService{
BaseService: BaseService{userid: id,
Service: &cool.Service{Model: model.NewGoldBeanOrder(),
ListQueryOp: &cool.QueryOp{
AddOrderby: g.MapStrStr{"updateTime": "asc"},
},
InsertParam: func(ctx context.Context) g.MapStrAny {
admin := cool.GetAdmin(ctx)
return g.MapStrAny{
"player_id": admin.UserId,
}
},
},
},
}
}