gm 调整vip 等级做校验
This commit is contained in:
parent
acfcdbd4b1
commit
1267ff1129
@ -163,7 +163,7 @@ type (
|
||||
CheckTujianHero(session IUserSession, heros []string) []bool
|
||||
// bingo设置玩家等级
|
||||
BingoSetUserLv(session IUserSession, lv int32) error
|
||||
BingoSetUserVipLv(session IUserSession, lv int32) error
|
||||
BingoSetUserVipLv(session IUserSession, lv int32) (errdata *pb.ErrorData)
|
||||
//添加皮肤资源接口
|
||||
AddPer(session IUserSession, pers map[string]int32, bPush bool) (errdata *pb.ErrorData)
|
||||
}
|
||||
|
@ -469,7 +469,8 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
||||
}
|
||||
return
|
||||
}
|
||||
if err = module1.(comm.IUser).BingoSetUserVipLv(session, int32(num)); err == nil {
|
||||
if errdata = module1.(comm.IUser).BingoSetUserVipLv(session, int32(num)); errdata != nil {
|
||||
return
|
||||
}
|
||||
this.Debug("使用bingo命令:uid = %s ",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
|
@ -999,16 +999,28 @@ func (this *User) recoverUserPs(uid string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (this *User) BingoSetUserVipLv(session comm.IUserSession, lv int32) error {
|
||||
func (this *User) BingoSetUserVipLv(session comm.IUserSession, lv int32) (errdata *pb.ErrorData) {
|
||||
if lv <= 0 {
|
||||
return comm.NewCustomError(pb.ErrorCode_ReqParameterError)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
update := map[string]interface{}{
|
||||
"vip": lv,
|
||||
"vipexp": 0,
|
||||
}
|
||||
// vip 等级校验
|
||||
if conf := this.configure.GetVipConfigureData(lv); conf == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if err := this.modelUser.Change(session.GetUserId(), update); err == nil {
|
||||
if err := session.SendMsg(string(this.GetType()), UserSubTypeLvChangedPush,
|
||||
if err := session.SendMsg(string(this.GetType()), UserSubTypeVipChangedPush,
|
||||
&pb.UserVipChangedPush{Uid: session.GetUserId(), VipExp: 0, VipLv: lv}); err != nil {
|
||||
this.Error("Bingo玩家等级变化 UserVipChangedPush推送失败",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
@ -1032,8 +1044,8 @@ func (this *User) AddPer(session comm.IUserSession, pers map[string]int32, bPush
|
||||
)
|
||||
if user = this.GetUser(session.GetUserId()); user == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_UserSessionNobeing,
|
||||
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||
Code: pb.ErrorCode_UserSessionNobeing,
|
||||
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user