fix(config): 修复宠物蛋系统中概率计算错误 - 修正了EggService中宠物产出概率计算时错误使用的字段名 - 将pet.OutputMons修正为pet.Probs以正确累加等级权重 refactor(player): 优化金币列表服务参数处理逻辑 - 移除未使用的gconv导入包 - 简化ModifyBefore方法中的用户ID验证逻辑 - 统一设置
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user