diff --git a/modules/user/api_modifyname.go b/modules/user/api_modifyname.go index d7c517ad5..88c4d7529 100644 --- a/modules/user/api_modifyname.go +++ b/modules/user/api_modifyname.go @@ -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 diff --git a/modules/user/model_expand.go b/modules/user/model_expand.go index 3ea6a7af8..63890dbb3 100644 --- a/modules/user/model_expand.go +++ b/modules/user/model_expand.go @@ -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 {