fix(common): 更新查询操作字段注释并调整错误码
更新 `common/cool/service.go` 中 `QueryOp` 结构体字段的注释,明确 `FieldEQ` 和 `KeyWordField` 的用途。 同时修改玩家物品添加逻辑中的错误码,从 `ErrBaseItemTypeLimit` 改为 `ErrSystemError200007`。 在 `modules/blazing/service/item.go` 中为分页查询添加 `KeyWordField` 配置,支持按 `player_id` 搜索。 注释掉 `modules/blazing/service/pet_fusion
This commit is contained in:
@@ -34,8 +34,8 @@ type Service struct {
|
||||
|
||||
// List/Add接口条件配置
|
||||
type QueryOp struct {
|
||||
FieldEQ []string // 字段等于
|
||||
KeyWordField []string // 模糊搜索匹配的数据库字段
|
||||
FieldEQ []string // 字段等于 多个字段选择以及高级搜索都是这个
|
||||
KeyWordField []string // 模糊搜索匹配的数据库字段,对应普通搜索
|
||||
AddOrderby g.MapStrStr // 添加排序
|
||||
Where func(ctx context.Context) []g.Array // 自定义条件
|
||||
Select string // 查询字段,多个字段用逗号隔开 如: id,name 或 a.id,a.name,b.name AS bname
|
||||
|
||||
@@ -308,7 +308,7 @@ func (p *Player) ItemAdd(t ...model.ItemInfo) (result []model.ItemInfo) {
|
||||
cool.Loger.Error(context.TODO(), "物品不存在", v.ItemId)
|
||||
|
||||
t1 := common.NewTomeeHeader(2601, p.Info.UserID)
|
||||
t1.Result = uint32(errorcode.ErrorCodes.ErrBaseItemTypeLimit)
|
||||
t1.Result = uint32(errorcode.ErrorCodes.ErrSystemError200007)
|
||||
|
||||
p.SendPack(t1.Pack(nil)) //准备包由各自发,因为协议不一样
|
||||
continue
|
||||
|
||||
@@ -59,6 +59,7 @@ func NewItemService(id uint32) *ItemService {
|
||||
Service: &cool.Service{Model: model.NewPlayerBag(), UniqueKey: map[string]string{
|
||||
"player_id": "角色名称不能重复",
|
||||
}, PageQueryOp: &cool.QueryOp{
|
||||
KeyWordField: []string{"player_id"},
|
||||
Where: func(ctx context.Context) [][]interface{} {
|
||||
var (
|
||||
//admin = cool.GetAdmin(ctx)
|
||||
|
||||
@@ -22,6 +22,7 @@ func NewPetFusionMaterialService() *PetFusionMaterialService {
|
||||
return &PetFusionMaterialService{
|
||||
&cool.Service{
|
||||
Model: model.NewPetFusionMaterial(), // 绑定PetFusionMaterial模型(默认参数占位)
|
||||
// PageQueryOp: &cool.QueryOp{KeyWordField: []string{"material1", "material2", "material3", "material4"}},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user