This commit is contained in:
@@ -3,6 +3,7 @@ package service
|
||||
import (
|
||||
"blazing/common/data"
|
||||
"blazing/cool"
|
||||
basemodel "blazing/modules/base/model"
|
||||
"blazing/modules/player/model"
|
||||
"context"
|
||||
"strings"
|
||||
@@ -345,17 +346,32 @@ func NewItemService(id uint32) *ItemService {
|
||||
Service: &cool.Service{Model: model.NewPlayerBag(), UniqueKey: map[string]string{
|
||||
"player_id": "角色名称不能重复",
|
||||
}, PageQueryOp: &cool.QueryOp{
|
||||
KeyWordField: []string{"player_id"},
|
||||
FieldEQ: []string{"player_id"},
|
||||
Select: `player_item.*, base_sys_user.username`,
|
||||
Join: []*cool.JoinOp{
|
||||
{
|
||||
Model: basemodel.NewBaseSysUser(),
|
||||
Alias: "base_sys_user",
|
||||
Type: cool.LeftJoin,
|
||||
Condition: `player_item.player_id = base_sys_user.id`,
|
||||
},
|
||||
},
|
||||
KeyWordField: []string{"player_item.player_id", "base_sys_user.username"},
|
||||
FieldEQ: []string{"player_id", "item_id"},
|
||||
Where: func(ctx context.Context) [][]interface{} {
|
||||
var (
|
||||
//admin = cool.GetAdmin(ctx)
|
||||
//userId = admin.UserId
|
||||
r = g.RequestFromCtx(ctx)
|
||||
)
|
||||
return [][]interface{}{
|
||||
|
||||
where := [][]interface{}{
|
||||
// {"player_id", userId, true},
|
||||
// {"free", 0, true},
|
||||
}
|
||||
|
||||
if username := strings.TrimSpace(r.Get("username").String()); username != "" {
|
||||
where = append(where, []interface{}{`LOWER(base_sys_user.username) LIKE ?`, "%" + strings.ToLower(username) + "%"})
|
||||
}
|
||||
|
||||
return where
|
||||
},
|
||||
}},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user