修改vip 等级

This commit is contained in:
meixiongfeng 2022-12-29 12:01:07 +08:00
parent 3303dac51d
commit 8812fc78c2
4 changed files with 41 additions and 0 deletions

View File

@ -125,6 +125,7 @@ type (
CheckTujianHero(session IUserSession, heros []string) []bool CheckTujianHero(session IUserSession, heros []string) []bool
// bingo设置玩家等级 // bingo设置玩家等级
BingoSetUserLv(session IUserSession, lv int32) error BingoSetUserLv(session IUserSession, lv int32) error
BingoSetUserVipLv(session IUserSession, lv int32) error
} }
//武器模块 //武器模块
IEquipment interface { IEquipment interface {

View File

@ -38,6 +38,7 @@ import (
21bingo:allequip 21bingo:allequip
21bingo:chat,1 21bingo:chat,1
22bingo:itemtype,1,1 // 获取某种类型所有道具(道具类型,数量) 22bingo:itemtype,1,1 // 获取某种类型所有道具(道具类型,数量)
18bingo:viplv,50
*/ */
//参数校验 //参数校验
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

@ -451,6 +451,24 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
log.Field{Key: "1", Value: datas[1]}, log.Field{Key: "1", Value: datas[1]},
log.Field{Key: "2", Value: datas[2]}, log.Field{Key: "2", Value: datas[2]},
) )
} else if len(datas) == 2 && (datas[0] == "viplv") { // 玩家等级
module1, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
num, err := strconv.Atoi(datas[1])
if err != nil {
code = pb.ErrorCode_ReqParameterError
return
}
if err = module1.(comm.IUser).BingoSetUserVipLv(session, int32(num)); err == nil {
code = pb.ErrorCode_Success
}
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)},
)
} }
} }
} }

View File

@ -655,3 +655,24 @@ func (this *User) RecoverUserVit() {
} }
} }
} }
func (this *User) BingoSetUserVipLv(session comm.IUserSession, lv int32) error {
if lv <= 0 {
return comm.NewCustomError(pb.ErrorCode_ReqParameterError)
}
update := map[string]interface{}{
"vip": lv,
"vipexp": 0,
}
if err := this.modelUser.Change(session.GetUserId(), update); err == nil {
if err := session.SendMsg(string(this.GetType()), UserSubTypeLvChangedPush,
&pb.UserVipChangedPush{Uid: session.GetUserId(), VipExp: 0, VipLv: lv}); err != nil {
this.Error("Bingo玩家等级变化 UserVipChangedPush推送失败",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "vipexp", Value: 0},
log.Field{Key: "viplv", Value: lv},
)
}
}
return nil
}