```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(game): 实现扭蛋系统批量物品添加功能并优化地图逻辑

- 新增ItemAddBatch方法用于批量添加物品,支持普通道具和特殊道具的分别处理
- 优化扭蛋游戏玩法中的物品添加逻辑,使用新的批量接口提升性能
- 在扭蛋机器人命令中实现完整的物品检查和批量添加流程

refactor(map): 重构地图控制器代码结构并添加注释

- 为EnterMap、LeaveMap、GetMapPlayerList等方法添加中文注释
- 统一地图相关的命名规范,如enter
This commit is contained in:
昔念
2026-04-01 20:10:29 +08:00
parent 1b6586aedc
commit 5995f0670c
14 changed files with 597 additions and 214 deletions

View File

@@ -138,30 +138,46 @@ func NewBaseSysRoleService() *BaseSysRoleService {
Model: model.NewBaseSysRole(),
ListQueryOp: &cool.QueryOp{
Where: func(ctx context.Context) [][]interface{} {
return [][]interface{}{
{"label != ?", g.Slice{"admin"}, true},
}
},
Extend: func(ctx g.Ctx, m *gdb.Model) *gdb.Model {
var (
admin = cool.GetAdmin(ctx)
userId = admin.UserId
roleIds = garray.NewIntArrayFromCopy(gconv.Ints(admin.RoleIds))
)
return [][]interface{}{
{"label != ?", g.Slice{"admin"}, true},
{"(userId=? or id in (?))", g.Slice{userId, admin.RoleIds}, !roleIds.Contains(1)},
if roleIds.Contains(1) {
return m
}
if roleIds.Len() == 0 {
return m.Where("userId", userId)
}
return m.Wheref("(userId = ? or id in (?))", userId, admin.RoleIds)
},
},
PageQueryOp: &cool.QueryOp{
KeyWordField: []string{"name", "label"},
AddOrderby: map[string]string{},
Where: func(ctx context.Context) [][]interface{} {
return [][]interface{}{
{"label != ?", g.Slice{"admin"}, true},
}
},
Extend: func(ctx g.Ctx, m *gdb.Model) *gdb.Model {
var (
admin = cool.GetAdmin(ctx)
userId = admin.UserId
roleIds = garray.NewIntArrayFromCopy(gconv.Ints(admin.RoleIds))
)
return [][]interface{}{
{"label != ?", g.Slice{"admin"}, true},
{"(userid=? or id in (?))", g.Slice{gconv.String(userId), admin.RoleIds}, !roleIds.Contains(1)},
if roleIds.Contains(1) {
return m
}
if roleIds.Len() == 0 {
return m.Where("userid", gconv.String(userId))
}
return m.Wheref("(userid = ? or id in (?))", gconv.String(userId), admin.RoleIds)
},
},
InsertParam: func(ctx context.Context) map[string]interface{} {