From 9c172d4ff79b793e4eab176f192d5ebb06538950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <1@72wo.cn> Date: Thu, 4 Dec 2025 01:33:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(common):=20=E6=9B=B4=E6=96=B0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=93=8D=E4=BD=9C=E5=AD=97=E6=AE=B5=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E5=B9=B6=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新 `common/cool/service.go` 中 `QueryOp` 结构体字段的注释,明确 `FieldEQ` 和 `KeyWordField` 的用途。 同时修改玩家物品添加逻辑中的错误码,从 `ErrBaseItemTypeLimit` 改为 `ErrSystemError200007`。 在 `modules/blazing/service/item.go` 中为分页查询添加 `KeyWordField` 配置,支持按 `player_id` 搜索。 注释掉 `modules/blazing/service/pet_fusion --- common/cool/service.go | 4 ++-- logic/service/player/player.go | 2 +- modules/blazing/service/item.go | 1 + modules/blazing/service/pet_fusion_material_service.go | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/cool/service.go b/common/cool/service.go index 9bd2944b9..325f4fc82 100644 --- a/common/cool/service.go +++ b/common/cool/service.go @@ -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 diff --git a/logic/service/player/player.go b/logic/service/player/player.go index 889d8bb71..7b97dd6b8 100644 --- a/logic/service/player/player.go +++ b/logic/service/player/player.go @@ -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 diff --git a/modules/blazing/service/item.go b/modules/blazing/service/item.go index 4717e1430..ebd3baa29 100644 --- a/modules/blazing/service/item.go +++ b/modules/blazing/service/item.go @@ -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) diff --git a/modules/blazing/service/pet_fusion_material_service.go b/modules/blazing/service/pet_fusion_material_service.go index 60b029b24..27e2ff206 100644 --- a/modules/blazing/service/pet_fusion_material_service.go +++ b/modules/blazing/service/pet_fusion_material_service.go @@ -22,6 +22,7 @@ func NewPetFusionMaterialService() *PetFusionMaterialService { return &PetFusionMaterialService{ &cool.Service{ Model: model.NewPetFusionMaterial(), // 绑定PetFusionMaterial模型(默认参数占位) + // PageQueryOp: &cool.QueryOp{KeyWordField: []string{"material1", "material2", "material3", "material4"}}, }, } }