bingo 命令扩展 清理背包

模拟充值
This commit is contained in:
meixiongfeng 2022-12-28 18:36:59 +08:00
parent c81ca67c5f
commit d21a7ab716
2 changed files with 39 additions and 1 deletions

View File

@ -32,6 +32,9 @@ import (
16bingo:alltask // bingo所有任务 16bingo:alltask // bingo所有任务
16bingo:allhero // bingo所有英雄 16bingo:allhero // bingo所有英雄
17bingo:allgrowtask // 完成所有成长任务 17bingo:allgrowtask // 完成所有成长任务
18bingo:lv,50
19bingo:recharge,10
20bingo:cleanitem
*/ */
//参数校验 //参数校验
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) { func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) {

View File

@ -342,7 +342,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
log.Field{Key: "param", Value: datas[0]}, log.Field{Key: "param", Value: datas[0]},
log.Field{Key: "res", Value: res}, log.Field{Key: "res", Value: res},
) )
} else if len(datas) == 2 && (datas[0] == "userlv") { // 玩家等级 } else if len(datas) == 2 && (datas[0] == "lv") { // 玩家等级
module1, err := this.service.GetModule(comm.ModuleUser) module1, err := this.service.GetModule(comm.ModuleUser)
if err != nil { if err != nil {
return return
@ -360,6 +360,41 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
log.Field{Key: "0", Value: datas[0]}, log.Field{Key: "0", Value: datas[0]},
log.Field{Key: "N", Value: int32(num)}, log.Field{Key: "N", Value: int32(num)},
) )
} else if len(datas) == 2 && (datas[0] == "recharge") { // 充值次数
module1, err := this.service.GetModule(comm.ModulePay)
if err != nil {
return
}
num, err := strconv.Atoi(datas[1])
if err != nil {
code = pb.ErrorCode_ReqParameterError
return
}
for i := 0; i < num; i++ {
if code = module1.(comm.IPay).ModulePayDelivery(session, "8", 64800); code != pb.ErrorCode_Success {
return
}
}
this.Debug("使用bingo命令:uid = %s ",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "0", Value: datas[0]},
log.Field{Key: "N", Value: int32(num)},
)
} else if len(datas) == 1 && (datas[0] == "cleanitem") { // 充值次数
module1, err := this.service.GetModule(comm.ModuleItems)
if err != nil {
return
}
if code = module1.(comm.IItems).CleanItems(session); code != pb.ErrorCode_Success {
return
}
this.Debug("使用bingo命令:uid = %s ",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "0", Value: datas[0]},
)
} }
} }