#31777 任务 【梦工场系统】 <-后端-> 【主角信息】 - 名称修改需求
This commit is contained in:
parent
97a8099117
commit
9d7df3fe53
@ -40,48 +40,48 @@ func (this *apiComp) Modifyname(session comm.IUserSession, req *pb.UserModifynam
|
||||
return
|
||||
}
|
||||
|
||||
expand, err := this.module.modelExpand.GetUserExpand(uid)
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// expand, err := this.module.modelExpand.GetUserExpand(uid)
|
||||
// if err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_DBError,
|
||||
// Title: pb.ErrorCode_DBError.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
//校验名称修改次数
|
||||
if expand.ModifynameCount <= 0 {
|
||||
errdata = this.module.ConsumeRes(session, this.module.globalConf.HeroName, true)
|
||||
if errdata != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// if expand.ModifynameCount <= 0 {
|
||||
// errdata = this.module.ConsumeRes(session, this.module.globalConf.HeroName, true)
|
||||
// if errdata != nil {
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
|
||||
//修改名称次数
|
||||
left := expand.ModifynameCount - 1
|
||||
if left < 0 {
|
||||
left = 0
|
||||
}
|
||||
mc := map[string]interface{}{
|
||||
"modifynameCount": left,
|
||||
}
|
||||
if err := this.module.modelExpand.ChangeUserExpand(uid, mc); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
this.module.Errorf("更新昵称失败 uid:%v name:%v err:%v", uid, req.Name, err)
|
||||
return
|
||||
}
|
||||
// //修改名称次数
|
||||
// left := expand.ModifynameCount - 1
|
||||
// if left < 0 {
|
||||
// left = 0
|
||||
// }
|
||||
// mc := map[string]interface{}{
|
||||
// "modifynameCount": left,
|
||||
// }
|
||||
// if err := this.module.modelExpand.ChangeUserExpand(uid, mc); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_DBError,
|
||||
// Title: pb.ErrorCode_DBError.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// this.module.Errorf("更新昵称失败 uid:%v name:%v err:%v", uid, req.Name, err)
|
||||
// return
|
||||
// }
|
||||
|
||||
// 修改名称
|
||||
if errdata = this.module.modelUser.modifyName(uid, name); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp.Count = uint32(left)
|
||||
//resp.Count = uint32(left)
|
||||
this.sendMsg(session, UserSubTypeModifyName, resp)
|
||||
|
||||
return
|
||||
|
@ -47,14 +47,14 @@ func (this *ModelExpand) GetUserExpand(uid string) (result *pb.DBUserExpand, err
|
||||
if err = this.Get(uid, result); err != nil && mongo.ErrNoDocuments == err {
|
||||
globalConf := this.module.ModuleTools.GetGlobalConf()
|
||||
initUpdate := map[string]interface{}{
|
||||
"uid": uid,
|
||||
"modifynameCount": 1, //修改名称1次
|
||||
"sociatyTicket": globalConf.GuildBossInitialNum, //公会BOSS挑战券
|
||||
"expitem": make(map[string]int32, 0), // 初始化
|
||||
"mline": make(map[string]int32, 0),
|
||||
"race": make(map[string]int32, 0),
|
||||
"givetime": configure.Now().Unix(),
|
||||
"herofrag": make(map[string]int32, 0), // 初始化
|
||||
"uid": uid,
|
||||
//"modifynameCount": 1, //修改名称1次
|
||||
"sociatyTicket": globalConf.GuildBossInitialNum, //公会BOSS挑战券
|
||||
"expitem": make(map[string]int32, 0), // 初始化
|
||||
"mline": make(map[string]int32, 0),
|
||||
"race": make(map[string]int32, 0),
|
||||
"givetime": configure.Now().Unix(),
|
||||
"herofrag": make(map[string]int32, 0), // 初始化
|
||||
}
|
||||
result.SociatyTicket = globalConf.GuildBossInitialNum
|
||||
if err = this.module.modelExpand.ChangeUserExpand(uid, initUpdate); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user