feat(pet): 优化宠物融合错误码并记录原始捕获时间

- 将宠物融合过程中的错误码从 ErrSystemBusy 细分为多个更具体的错误码,
  如 ErrPokemonNotFusionReady、ErrPokemonNotFusionReady2 等,便于问题定位。
- 在融合成功后,新增记录主宠的旧捕捉时间(OldCatchTime)字段。
- 调整战斗捕捉逻辑,使用对手玩家的第一个宠物信息进行添加,并重置战斗结束原因。

refactor(service): 移除未使用的管理员会话结构体字段和清理部分冗余代码

- 注释掉 base_sys_user.go
This commit is contained in:
2025-12-04 00:26:49 +08:00
parent 8d7d9da0bf
commit f8ba7988d0
10 changed files with 62 additions and 13 deletions

View File

@@ -77,4 +77,5 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
type SessionRes struct {
UserID int `json:"userid"`
Session string `json:"session"`
//Server model.ServerList `json:"server"`
}

View File

@@ -308,7 +308,7 @@ func NewBaseSysUserService() *BaseSysUserService {
Extend: func(ctx g.Ctx, m *gdb.Model) *gdb.Model {
return m.Group(`base_sys_user.id`)
},
KeyWordField: []string{"username", "email"},
KeyWordField: []string{"username", "email", "id"},
},
},
}

View File

@@ -0,0 +1,22 @@
package admin
import (
"blazing/cool"
"blazing/modules/blazing/service"
)
type ItemBagController struct {
*cool.Controller
}
func init() {
var task_info_controller = &ItemBagController{
&cool.Controller{
Prefix: "/admin/sun/item",
Api: []string{"Delete", "Update", "Info", "List", "Page"},
Service: service.NewItemService(0), //因为page已经过滤所以这里需要改成0
},
}
// 注册路由
cool.RegisterController(task_info_controller)
}

View File

@@ -3,6 +3,7 @@ package service
import (
"blazing/cool"
"blazing/modules/blazing/model"
"context"
"github.com/gogf/gf/v2/frame/g"
)
@@ -57,6 +58,17 @@ func NewItemService(id uint32) *ItemService {
Service: &cool.Service{Model: model.NewPlayerBag(), UniqueKey: map[string]string{
"player_id": "角色名称不能重复",
}, PageQueryOp: &cool.QueryOp{
Where: func(ctx context.Context) [][]interface{} {
var (
//admin = cool.GetAdmin(ctx)
//userId = admin.UserId
)
return [][]interface{}{
// {"player_id", userId, true},
// {"free", 0, true},
}
},
}},
},
}

View File

@@ -108,10 +108,18 @@ func NewPetService(userid uint32) *PetService {
admin = cool.GetAdmin(ctx)
userId = admin.UserId
)
return [][]interface{}{
{"player_id", userId, true},
{"free", 0, true},
if userId != 10001 {
return [][]interface{}{
{"player_id", userId, true},
{"free", 0, true},
}
} else {
return [][]interface{}{
{"player_id", userId, true},
{"free", 0, true},
}
}
},
},
},

View File

@@ -17,8 +17,8 @@ type PetFusionService struct {
func NewPetFusionService() *PetFusionService {
return &PetFusionService{
&cool.Service{
Model: model.NewPetFusion(), // 绑定PetFusion模型
Model: model.NewPetFusion(), // 绑定PetFusion模型
PageQueryOp: &cool.QueryOp{FieldEQ: []string{"is_enable", "main_pet_id", "sub_pet_id", "result_pet_id"}},
},
}
}

View File

@@ -33,6 +33,10 @@ func NewUserService(id uint32) *UserService {
}
func (s *BaseService) GModel(m cool.IModel) *gdb.Model {
if s.userid != 0 {
return cool.DBM(m).Where("player_id", s.userid)
} else {
return cool.DBM(m)
}
return cool.DBM(m).Where("player_id", s.userid)
}