From baf0d1fc06c9f6329ba5aad41e70a25a512e0e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:08:14 +0800 Subject: [PATCH] =?UTF-8?q?```=20fix(config):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AE=A0=E7=89=A9=E8=9B=8B=E7=B3=BB=E7=BB=9F=E4=B8=AD=E6=A6=82?= =?UTF-8?q?=E7=8E=87=E8=AE=A1=E7=AE=97=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正了EggService中宠物产出概率计算时错误使用的字段名 - 将pet.OutputMons修正为pet.Probs以正确累加等级权重 refactor(player): 优化金币列表服务参数处理逻辑 - 移除未使用的gconv导入包 - 简化ModifyBefore方法中的用户ID验证逻辑 - 统一设置 --- modules/config/service/egg.go | 2 +- modules/player/service/gold_list.go | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/modules/config/service/egg.go b/modules/config/service/egg.go index bce96282..3043a939 100644 --- a/modules/config/service/egg.go +++ b/modules/config/service/egg.go @@ -43,7 +43,7 @@ func (s *EggService) GetResult(m, f, level uint32) (uint32, bool) { md.Wheref(`male_pet_ids @> ARRAY[?]::integer[]`, m). Wheref(`female_pet_ids @> ARRAY[?]::integer[]`, f).Scan(&pet) if pet != nil { - pet.OutputMons[len(pet.OutputMons)-1] += int32(level) + pet.Probs[len(pet.OutputMons)-1] += int32(level) t, _ := utils.RandomByWeight(pet.OutputMons, pet.Probs) if pet.OutputMons[len(pet.OutputMons)-1] == int32(t) { return uint32(t), true diff --git a/modules/player/service/gold_list.go b/modules/player/service/gold_list.go index 0881d217..ed588602 100644 --- a/modules/player/service/gold_list.go +++ b/modules/player/service/gold_list.go @@ -7,7 +7,6 @@ import ( "fmt" "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/util/gconv" ) type GoldListService struct { @@ -18,16 +17,12 @@ func (s *GoldListService) ModifyBefore(ctx context.Context, method string, param 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("不允许多挂单") } - } else { - if userId != gconv.Uint(param["player_id"]) { - err = fmt.Errorf("修改失败") - } } return