查询玩家接口调整
This commit is contained in:
parent
5cf344907c
commit
765a02c1ff
@ -160,7 +160,7 @@ type (
|
|||||||
IUser interface {
|
IUser interface {
|
||||||
IGetReddot
|
IGetReddot
|
||||||
//获取本服用户数据
|
//获取本服用户数据
|
||||||
GetUser(uid string) *pb.DBUser
|
GetUser(uid string) (user *pb.DBUser, err error)
|
||||||
//获取用户回话
|
//获取用户回话
|
||||||
GetUserSession(uid string) *pb.CacheUser
|
GetUserSession(uid string) *pb.CacheUser
|
||||||
//批量查询用户会话数据
|
//批量查询用户会话数据
|
||||||
|
@ -28,12 +28,12 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ArenaInfoReq) (errd
|
|||||||
if errdata = this.InfoCheck(session, req); errdata != nil {
|
if errdata = this.InfoCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
user = this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err = this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
if user == nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: "no fund user!",
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.CapturesheepInfoReq
|
|||||||
if errdata = this.InfoCheck(session, req); errdata != nil {
|
if errdata = this.InfoCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
user = this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err = this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
if user == nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
@ -21,7 +21,15 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.CaravanRankList
|
|||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
resp.List, rankid = this.module.modelCaravan.GetRankListData(comm.MaxRankList, session.GetUserId())
|
resp.List, rankid = this.module.modelCaravan.GetRankListData(comm.MaxRankList, session.GetUserId())
|
||||||
userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
|
userinfo, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
resp.Userinfo = &pb.CaravanRankInfo{
|
resp.Userinfo = &pb.CaravanRankInfo{
|
||||||
Uid: session.GetUserId(),
|
Uid: session.GetUserId(),
|
||||||
Name: userinfo.Name,
|
Name: userinfo.Name,
|
||||||
|
@ -76,7 +76,7 @@ func (this *Dailytask) EventUserLogin(session comm.IUserSession) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !utils.IsToday(dtask.Rtime) { //不是同一天 重置
|
if !utils.IsToday(dtask.Rtime) { //不是同一天 重置
|
||||||
if user = this.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
this.Error("no found user", log.Field{Key: "uid", Value: session.GetUserId()})
|
this.Error("no found user", log.Field{Key: "uid", Value: session.GetUserId()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -66,21 +66,29 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
|
|||||||
if errdata = this.module.ConsumeRes(session, cfgEnchant[0].PsConsume, true); errdata != nil {
|
if errdata = this.module.ConsumeRes(session, cfgEnchant[0].PsConsume, true); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
userinfo, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
key := req.BossType
|
key := req.BossType
|
||||||
if enchant.BossTime[key] > req.Report.Costtime || enchant.BossTime[key] == 0 {
|
if enchant.BossTime[key] > req.Report.Costtime || enchant.BossTime[key] == 0 {
|
||||||
enchant.BossTime[key] = req.Report.Costtime
|
enchant.BossTime[key] = req.Report.Costtime
|
||||||
mapData["bossTime"] = enchant.BossTime // 更新时间
|
mapData["bossTime"] = enchant.BossTime // 更新时间
|
||||||
userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
|
|
||||||
this.module.CheckRank(session.GetUserId(), req.BossType, req.Report, userinfo, req.Score)
|
this.module.CheckRank(session.GetUserId(), req.BossType, req.Report, userinfo, req.Score)
|
||||||
}
|
}
|
||||||
//this.module.CheckRank(session.GetUserId(), req.BossType, enchant, req.Report, req.Score)
|
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
|
||||||
enchant.Boss[req.BossType] = req.Score // 获得的积分
|
enchant.Boss[req.BossType] = req.Score // 获得的积分
|
||||||
// 发放通关随机奖励
|
// 发放通关随机奖励
|
||||||
for _, v := range cfgEnchant {
|
for _, v := range cfgEnchant {
|
||||||
if score >= v.ScoreLow && score <= v.ScoreUp {
|
if score >= v.ScoreLow && score <= v.ScoreUp {
|
||||||
for _, v1 := range v.RewardDrop {
|
for _, v1 := range v.RewardDrop {
|
||||||
reward := this.module.ModuleTools.GetGroupDataByLottery(v1, user.Vip, user.Lv)
|
reward := this.module.ModuleTools.GetGroupDataByLottery(v1, userinfo.Vip, userinfo.Lv)
|
||||||
//reward := this.module.configure.GetDropReward(v1) // 获取掉落奖励
|
//reward := this.module.configure.GetDropReward(v1) // 获取掉落奖励
|
||||||
if errdata = this.module.DispenseRes(session, reward, true); errdata != nil {
|
if errdata = this.module.DispenseRes(session, reward, true); errdata != nil {
|
||||||
return
|
return
|
||||||
|
@ -123,7 +123,11 @@ func (this *Enchant) CheckRank(uid string, boosID int32, report *pb.BattleReport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !bFind {
|
if !bFind {
|
||||||
userinfo := this.ModuleUser.GetUser(uid)
|
userinfo, err := this.ModuleUser.GetUser(uid)
|
||||||
|
if err != nil {
|
||||||
|
this.Errorf("not found user:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
new := &pb.DBEnchantRank{
|
new := &pb.DBEnchantRank{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
|
@ -279,7 +279,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
|||||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype100, 1))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype100, 1))
|
||||||
}
|
}
|
||||||
//聊天系统通知
|
//聊天系统通知
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
this.module.chat.SendSysChatToWorld(comm.ChatSystem3, equipment, equipment.Lv, 0, user.Name, conf.Id)
|
this.module.chat.SendSysChatToWorld(comm.ChatSystem3, equipment, equipment.Lv, 0, user.Name, conf.Id)
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
|
@ -43,8 +43,7 @@ func (this *apiComp) Init(service core.IService, module core.IModule, comp core.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) setDefaultFriendUserBaseInfo(userId string) *pb.FriendBase {
|
func (this *apiComp) setDefaultFriendUserBaseInfo(userId string) *pb.FriendBase {
|
||||||
user := this.module.ModuleUser.GetUser(userId)
|
if user, err := this.module.ModuleUser.GetUser(userId); err == nil {
|
||||||
if user != nil {
|
|
||||||
return &pb.FriendBase{
|
return &pb.FriendBase{
|
||||||
ServerId: user.Sid,
|
ServerId: user.Sid,
|
||||||
UserId: userId,
|
UserId: userId,
|
||||||
|
@ -47,8 +47,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (e
|
|||||||
agreeIds := []string{}
|
agreeIds := []string{}
|
||||||
for _, friendId := range req.FriendIds {
|
for _, friendId := range req.FriendIds {
|
||||||
// 验证friendId是否有效
|
// 验证friendId是否有效
|
||||||
user := this.module.ModuleUser.GetUser(friendId)
|
if _, err = this.module.ModuleUser.GetUser(friendId); err != nil {
|
||||||
if user == nil {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _, ok := utils.Find(self.FriendIds, friendId); !ok {
|
if _, ok := utils.Find(self.FriendIds, friendId); !ok {
|
||||||
|
@ -89,7 +89,7 @@ func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.GourmetGetRa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for k := range mapUser {
|
for k := range mapUser {
|
||||||
if user := this.module.ModuleUser.GetUser(k); user != nil {
|
if user, err := this.module.ModuleUser.GetUser(k); err == nil {
|
||||||
szDbUser = append(szDbUser, user) // 转成user对象
|
szDbUser = append(szDbUser, user) // 转成user对象
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("%v", err)
|
this.module.Errorf("%v", err)
|
||||||
|
@ -75,11 +75,11 @@ func (this *apiComp) ChallengeFinish(session comm.IUserSession, req *pb.GuildGve
|
|||||||
// }
|
// }
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: "no found user data!",
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -154,7 +154,15 @@ func (this *apiComp) ChallengeFinish(session comm.IUserSession, req *pb.GuildGve
|
|||||||
if ok {
|
if ok {
|
||||||
member.Boosticket--
|
member.Boosticket--
|
||||||
this.module.modelGuildMember.updateGuildMember(member)
|
this.module.modelGuildMember.updateGuildMember(member)
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if prop = this.module.ModuleTools.GetGroupDataByLottery(score.Drop, user.Vip, user.Lv); len(prop) == 0 {
|
if prop = this.module.ModuleTools.GetGroupDataByLottery(score.Drop, user.Vip, user.Lv); len(prop) == 0 {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
@ -54,11 +54,11 @@ func (this *apiComp) Roulette(session comm.IUserSession, req *pb.GuildGveRoulett
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: "no user data",
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
|
|||||||
session.SendMsg(string(this.module.GetType()), Awaken, &pb.HeroAwakenResp{Hero: _hero})
|
session.SendMsg(string(this.module.GetType()), Awaken, &pb.HeroAwakenResp{Hero: _hero})
|
||||||
|
|
||||||
//英雄觉醒 【玩家名称】已将【英雄名称】觉醒至满级!
|
//英雄觉醒 【玩家名称】已将【英雄名称】觉醒至满级!
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem11, _hero, _hero.JuexingLv, 0, user.Name, _hero.HeroID)
|
this.chat.SendSysChatToWorld(comm.ChatSystem11, _hero, _hero.JuexingLv, 0, user.Name, _hero.HeroID)
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
|
@ -108,7 +108,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
for _, v := range atno {
|
for _, v := range atno {
|
||||||
if v.A == "hero" && v.T == heroRecord.WishHero && v.N == 1 {
|
if v.A == "hero" && v.T == heroRecord.WishHero && v.N == 1 {
|
||||||
firstGet[heroRecord.WishHero] = true
|
firstGet[heroRecord.WishHero] = true
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄
|
||||||
if HeroConf, err := this.module.configure.GetHeroConfig(heroRecord.WishHero); err == nil {
|
if HeroConf, err := this.module.configure.GetHeroConfig(heroRecord.WishHero); err == nil {
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, v.T)
|
this.chat.SendSysChatToWorld(comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, v.T)
|
||||||
}
|
}
|
||||||
@ -351,7 +351,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
for _, v := range atno {
|
for _, v := range atno {
|
||||||
if v.A == "hero" && v.T == heroId && v.N == 1 {
|
if v.A == "hero" && v.T == heroId && v.N == 1 {
|
||||||
firstGet[heroId] = true
|
firstGet[heroId] = true
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, v.T)
|
this.chat.SendSysChatToWorld(comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, v.T)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ func (this *apiComp) PeachReward(session comm.IUserSession, req *pb.HeroPeachRew
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
if drawConf.Etime != -1 {
|
if drawConf.Etime != -1 {
|
||||||
if user.Ctime+int64(drawConf.Etime*3600*24) < configure.Now().Unix() {
|
if user.Ctime+int64(drawConf.Etime*3600*24) < configure.Now().Unix() {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
|
@ -121,7 +121,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
|||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero})
|
session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero})
|
||||||
//英雄技能培养 【玩家名称】已将【英雄名称】技能培养至满级!
|
//英雄技能培养 【玩家名称】已将【英雄名称】技能培养至满级!
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem9, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
this.chat.SendSysChatToWorld(comm.ChatSystem9, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
|
@ -94,7 +94,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
|
|||||||
session.SendMsg(string(this.module.GetType()), StrengthenUpStar, &pb.HeroStrengthenUpStarResp{Hero: _hero})
|
session.SendMsg(string(this.module.GetType()), StrengthenUpStar, &pb.HeroStrengthenUpStarResp{Hero: _hero})
|
||||||
|
|
||||||
//英雄升星 【玩家名称】已将【英雄名称】培养至6星!
|
//英雄升星 【玩家名称】已将【英雄名称】培养至6星!
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem8, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
this.chat.SendSysChatToWorld(comm.ChatSystem8, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
|
@ -95,7 +95,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
|||||||
}
|
}
|
||||||
|
|
||||||
//英雄升级 【玩家名称】已将【英雄名称】培养至60级!
|
//英雄升级 【玩家名称】已将【英雄名称】培养至60级!
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem7, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
this.chat.SendSysChatToWorld(comm.ChatSystem7, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
|
@ -469,7 +469,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
|
|||||||
var maxLv int32 // 校验等级达到上限
|
var maxLv int32 // 校验等级达到上限
|
||||||
maxLv = this.module.configure.GetHeroMaxLv(hero.Star)
|
maxLv = this.module.configure.GetHeroMaxLv(hero.Star)
|
||||||
// 校验玩家等级
|
// 校验玩家等级
|
||||||
if _user := this.module.ModuleUser.GetUser(session.GetUserId()); _user != nil {
|
if _user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
if expConf := this.module.configure.GetPlayerlvConf(_user.Lv); expConf != nil {
|
if expConf := this.module.configure.GetPlayerlvConf(_user.Lv); expConf != nil {
|
||||||
if maxLv > expConf.HeroLv {
|
if maxLv > expConf.HeroLv {
|
||||||
maxLv = expConf.HeroLv // 英雄最大等级限制
|
maxLv = expConf.HeroLv // 英雄最大等级限制
|
||||||
|
@ -126,7 +126,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
|
|||||||
BossType: req.BossType,
|
BossType: req.BossType,
|
||||||
Difficulty: req.Difficulty,
|
Difficulty: req.Difficulty,
|
||||||
})
|
})
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem15, nil, req.BossType, req.Difficulty, user.Name)
|
this.chat.SendSysChatToWorld(comm.ChatSystem15, nil, req.BossType, req.Difficulty, user.Name)
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
|
@ -115,7 +115,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
|||||||
}
|
}
|
||||||
// 发放通关随机奖励
|
// 发放通关随机奖励
|
||||||
//reward = this.module.configure.GetDropReward(cfgHunting.Drop) // 获取掉落奖励
|
//reward = this.module.configure.GetDropReward(cfgHunting.Drop) // 获取掉落奖励
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
reward = this.module.ModuleTools.GetGroupDataByLottery(cfgHunting.Drop, user.Vip, user.Lv) // 走新的掉落
|
reward = this.module.ModuleTools.GetGroupDataByLottery(cfgHunting.Drop, user.Vip, user.Lv) // 走新的掉落
|
||||||
b := this.module.ModuleActivity.HDCelebration(session, 1, req.BossType)
|
b := this.module.ModuleActivity.HDCelebration(session, 1, req.BossType)
|
||||||
for _, v := range reward {
|
for _, v := range reward {
|
||||||
|
@ -85,7 +85,10 @@ func (this *Hunting) CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingR
|
|||||||
}
|
}
|
||||||
func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, report *pb.BattleReport) {
|
func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, report *pb.BattleReport) {
|
||||||
conn_, _ := db.Cross() // 获取跨服数据库对象
|
conn_, _ := db.Cross() // 获取跨服数据库对象
|
||||||
userinfo := this.ModuleUser.GetUser(uid)
|
userinfo, err := this.ModuleUser.GetUser(uid)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
model := db.NewDBModel(comm.TableHuntingRank, conn_)
|
model := db.NewDBModel(comm.TableHuntingRank, conn_)
|
||||||
|
|
||||||
costTime := report.Costtime
|
costTime := report.Costtime
|
||||||
|
@ -565,10 +565,11 @@ func (this *ModelItemsComp) recoverTicket(session comm.IUserSession) (errdata *p
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_CacheReadError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_CacheReadError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -740,7 +741,15 @@ func (this *ModelItemsComp) useitem(session comm.IUserSession, gid string, amoun
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
case itemuse_randombox: //宝箱
|
case itemuse_randombox: //宝箱
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
props := make([]*cfg.Gameatn, 0)
|
props := make([]*cfg.Gameatn, 0)
|
||||||
for i := int32(0); i < amount; i++ {
|
for i := int32(0); i < amount; i++ {
|
||||||
if prop := this.module.ModuleTools.GetGroupDataByLottery(itemcf.BoxId, user.Vip, user.Lv); len(prop) == 0 {
|
if prop := this.module.ModuleTools.GetGroupDataByLottery(itemcf.BoxId, user.Vip, user.Lv); len(prop) == 0 {
|
||||||
|
@ -54,11 +54,11 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.KFTaskReceiveReq
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: "no found user!",
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh
|
|||||||
aeward = append(aeward, atno...)
|
aeward = append(aeward, atno...)
|
||||||
|
|
||||||
}
|
}
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(conf.Lotteryward, user.Vip, user.Lv); len(lotteryward) > 0 {
|
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(conf.Lotteryward, user.Vip, user.Lv); len(lotteryward) > 0 {
|
||||||
if errdata, atno = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
if errdata, atno = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
||||||
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
||||||
|
@ -97,7 +97,15 @@ func (this *apiComp) LevelPass(session comm.IUserSession, req *pb.MainlineLevelP
|
|||||||
}
|
}
|
||||||
aeward = append(aeward, atno...)
|
aeward = append(aeward, atno...)
|
||||||
}
|
}
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(conf.Lotteryward, user.Vip, user.Lv); len(lotteryward) > 0 {
|
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(conf.Lotteryward, user.Vip, user.Lv); len(lotteryward) > 0 {
|
||||||
if errdata, atno = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
if errdata, atno = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
||||||
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
||||||
|
@ -184,7 +184,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(stageConf.Lotteryward, user.Vip, user.Lv); len(lotteryward) > 0 {
|
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(stageConf.Lotteryward, user.Vip, user.Lv); len(lotteryward) > 0 {
|
||||||
if errdata = this.module.DispenseRes(session, lotteryward, true); errdata != nil {
|
if errdata = this.module.DispenseRes(session, lotteryward, true); errdata != nil {
|
||||||
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
||||||
|
@ -85,7 +85,7 @@ func (this *apiComp) Ask(session comm.IUserSession, req *pb.MoonfantasyAskReq) (
|
|||||||
// this.module.modelUserMF.Change(session.GetUserId(), map[string]interface{}{
|
// this.module.modelUserMF.Change(session.GetUserId(), map[string]interface{}{
|
||||||
// "mfantasys": umfantasy.Mfantasys,
|
// "mfantasys": umfantasy.Mfantasys,
|
||||||
// })
|
// })
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
this.module.Errorf("no found uer:%d", session.GetUserId())
|
this.module.Errorf("no found uer:%d", session.GetUserId())
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
|
@ -109,7 +109,7 @@ func (this *modelDreamComp) trigger(session comm.IUserSession) {
|
|||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
this.module.Errorf("no found uer:%d", session.GetUserId())
|
this.module.Errorf("no found uer:%d", session.GetUserId())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ func (this *modelDreamComp) triggerbyid(session comm.IUserSession, boosid string
|
|||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
this.module.Errorf("no found uer:%d", session.GetUserId())
|
this.module.Errorf("no found uer:%d", session.GetUserId())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
|
|
||||||
errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData)
|
errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData)
|
||||||
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
|
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 发系统公告
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 发系统公告
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem4, nil, pagoda.PagodaId, 0, user.Name)
|
this.chat.SendSysChatToWorld(comm.ChatSystem4, nil, pagoda.PagodaId, 0, user.Name)
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
@ -148,7 +148,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
}
|
}
|
||||||
// 数据直接插入跨服数据库中
|
// 数据直接插入跨服数据库中
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
|
userinfo, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
newData := &pb.DBPagodaRecord{
|
newData := &pb.DBPagodaRecord{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: session.GetUserId(),
|
Uid: session.GetUserId(),
|
||||||
|
@ -131,7 +131,15 @@ func (this *apiComp) ChallengeRaceOver(session comm.IUserSession, req *pb.Pagoda
|
|||||||
|
|
||||||
// 数据直接插入跨服数据库中
|
// 数据直接插入跨服数据库中
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
userinfo := this.module.ModuleUser.GetUser(session.GetUserId()) //
|
userinfo, err := this.module.ModuleUser.GetUser(session.GetUserId()) //
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
newData := &pb.DBRacePagodaRecord{
|
newData := &pb.DBRacePagodaRecord{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: session.GetUserId(),
|
Uid: session.GetUserId(),
|
||||||
|
@ -55,7 +55,7 @@ func (this *apiComp) Invite(session comm.IUserSession, req *pb.ParkourInviteReq)
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if tuser = this.module.ModuleUser.GetUser(session.GetUserId()); tuser == nil {
|
if tuser, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_SystemError,
|
Code: pb.ErrorCode_SystemError,
|
||||||
Title: pb.ErrorCode_SystemError.ToString(),
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
@ -81,10 +81,11 @@ func (this *apiComp) Invite(session comm.IUserSession, req *pb.ParkourInviteReq)
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if tuser = this.module.ModuleUser.GetUser(req.Uid); tuser == nil {
|
if tuser, err = this.module.ModuleUser.GetUser(req.Uid); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_SystemError,
|
Code: pb.ErrorCode_SystemError,
|
||||||
Title: pb.ErrorCode_SystemError.ToString(),
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,16 @@ func (this *apiComp) JoinTeam(session comm.IUserSession, req *pb.ParkourJoinTeam
|
|||||||
}
|
}
|
||||||
users[i] = v.Uid
|
users[i] = v.Uid
|
||||||
}
|
}
|
||||||
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SystemError,
|
||||||
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if tean.Captainid == "" {
|
if tean.Captainid == "" {
|
||||||
user := this.module.ModuleUser.GetUser(tean.Uid)
|
|
||||||
|
|
||||||
member = &pb.DBRaceMember{Uid: user.Uid, Name: user.Name, Avatar: user.Avatar, Lv: user.Lv, Mount: tean.Dfmount, Maxhp: 10}
|
member = &pb.DBRaceMember{Uid: user.Uid, Name: user.Name, Avatar: user.Avatar, Lv: user.Lv, Mount: tean.Dfmount, Maxhp: 10}
|
||||||
tean.Captainid = tean.Uid
|
tean.Captainid = tean.Uid
|
||||||
@ -90,7 +98,6 @@ func (this *apiComp) JoinTeam(session comm.IUserSession, req *pb.ParkourJoinTeam
|
|||||||
|
|
||||||
users = append(users, session.GetUserId())
|
users = append(users, session.GetUserId())
|
||||||
|
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
|
||||||
member = &pb.DBRaceMember{Uid: user.Uid, Name: user.Name, Avatar: user.Avatar, Lv: user.Lv, Mount: info.Dfmount, Maxhp: 10}
|
member = &pb.DBRaceMember{Uid: user.Uid, Name: user.Name, Avatar: user.Avatar, Lv: user.Lv, Mount: info.Dfmount, Maxhp: 10}
|
||||||
tean.Member = append(tean.Member, member)
|
tean.Member = append(tean.Member, member)
|
||||||
if err = this.module.parkourComp.Change(session.GetUserId(), map[string]interface{}{
|
if err = this.module.parkourComp.Change(session.GetUserId(), map[string]interface{}{
|
||||||
|
@ -45,10 +45,11 @@ func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMat
|
|||||||
if team.Captainid == "" { //为组队情况
|
if team.Captainid == "" { //为组队情况
|
||||||
team.Captainid = team.Uid
|
team.Captainid = team.Uid
|
||||||
team.State = pb.RaceTeamState_teaming
|
team.State = pb.RaceTeamState_teaming
|
||||||
if tuser = this.module.ModuleUser.GetUser(session.GetUserId()); tuser == nil {
|
if tuser, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_SystemError,
|
Code: pb.ErrorCode_SystemError,
|
||||||
Title: pb.ErrorCode_SystemError.ToString(),
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,13 @@ func (this *apiComp) ViewPlayer(session comm.IUserSession, req *pb.ParkourViewPl
|
|||||||
Player: make([]*pb.ParkourData, 0),
|
Player: make([]*pb.ParkourData, 0),
|
||||||
}
|
}
|
||||||
for _, uid := range req.Uid {
|
for _, uid := range req.Uid {
|
||||||
if u := this.module.ModuleUser.GetUser(uid); u != nil {
|
if u, err := this.module.ModuleUser.GetUser(uid); err == nil {
|
||||||
{
|
{
|
||||||
var time int64
|
var time int64
|
||||||
if this.module.ModuleUser.IsOnline(uid) {
|
if this.module.ModuleUser.IsOnline(uid) {
|
||||||
if user := this.module.ModuleUser.GetUser(uid); user != nil {
|
//if user := this.module.ModuleUser.GetUser(uid); user != nil {
|
||||||
time = user.Offlinetime
|
time = u.Offlinetime
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
time = -1
|
time = -1
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ func (this *ModelParkourComp) getrusers(uid string) (recommend []*pb.DBRaceMembe
|
|||||||
r := rand.New(rand.NewSource(configure.Now().Unix()))
|
r := rand.New(rand.NewSource(configure.Now().Unix()))
|
||||||
for i, v := range r.Perm(num) {
|
for i, v := range r.Perm(num) {
|
||||||
if users[v].member == nil {
|
if users[v].member == nil {
|
||||||
if users[v].user = this.module.ModuleUser.GetUser(users[v].parkour.Uid); users[v].user == nil {
|
if users[v].user, err = this.module.ModuleUser.GetUser(users[v].parkour.Uid); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
users[v].member = &pb.DBRaceMember{
|
users[v].member = &pb.DBRaceMember{
|
||||||
@ -139,8 +139,8 @@ func (this *ModelParkourComp) queryinfo(uid string) (result *pb.DBParkour, err e
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err == mgo.MongodbNil {
|
if err == mgo.MongodbNil {
|
||||||
var tuser *pb.DBUser
|
//var tuser *pb.DBUser
|
||||||
if tuser = this.module.ModuleUser.GetUser(uid); tuser == nil {
|
if _, err = this.module.ModuleUser.GetUser(uid); err != nil {
|
||||||
err = fmt.Errorf("no found udata:%s", uid)
|
err = fmt.Errorf("no found udata:%s", uid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -175,8 +175,8 @@ func (this *ModelParkourComp) queryinfos(uids []string) (results []*pb.DBParkour
|
|||||||
}
|
}
|
||||||
if len(onfound) > 0 {
|
if len(onfound) > 0 {
|
||||||
for _, v := range onfound {
|
for _, v := range onfound {
|
||||||
var tuser *pb.DBUser
|
|
||||||
if tuser = this.module.ModuleUser.GetUser(v); tuser == nil {
|
if _, err = this.module.ModuleUser.GetUser(v); err != nil {
|
||||||
err = fmt.Errorf("no found udata:%s", v)
|
err = fmt.Errorf("no found udata:%s", v)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -215,8 +215,8 @@ func (this *ModelParkourComp) addUserMounts(uid string, mounts map[string]int32)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err == mgo.MongodbNil {
|
if err == mgo.MongodbNil {
|
||||||
var tuser *pb.DBUser
|
|
||||||
if tuser = this.module.ModuleUser.GetUser(uid); tuser == nil {
|
if _, err = this.module.ModuleUser.GetUser(uid); err != nil {
|
||||||
err = fmt.Errorf("no found udata:%s", uid)
|
err = fmt.Errorf("no found udata:%s", uid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,8 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.PracticeAcceptReq
|
|||||||
}
|
}
|
||||||
|
|
||||||
//发起者 red
|
//发起者 red
|
||||||
red := this.module.ModuleUser.GetUser(req.Uid)
|
red, err := this.module.ModuleUser.GetUser(req.Uid)
|
||||||
if red == nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserNofound,
|
Code: pb.ErrorCode_UserNofound,
|
||||||
Title: pb.ErrorCode_UserNofound.ToString(),
|
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||||
@ -86,8 +86,8 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.PracticeAcceptReq
|
|||||||
this.module.Error("未找到红方信息", log.Field{Key: "uid", Value: req.Uid})
|
this.module.Error("未找到红方信息", log.Field{Key: "uid", Value: req.Uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
blue := this.module.ModuleUser.GetUser(session.GetUserId())
|
blue, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
if blue == nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserNofound,
|
Code: pb.ErrorCode_UserNofound,
|
||||||
Title: pb.ErrorCode_UserNofound.ToString(),
|
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||||
|
@ -94,7 +94,7 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.PracticeQiecuoReq
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
@ -258,8 +258,12 @@ func (this *Practice) ChallengeResults(bid, red, bule string, winSide int32) {
|
|||||||
if winSide == 0 {
|
if winSide == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
reduser = this.ModuleUser.GetUser(red)
|
if reduser, err = this.ModuleUser.GetUser(red); err != nil {
|
||||||
buleuser = this.ModuleUser.GetUser(bule)
|
return
|
||||||
|
}
|
||||||
|
if buleuser, err = this.ModuleUser.GetUser(bule); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
if redroom, err = this.modelPandata.queryUserMartialhall(red); err != nil {
|
if redroom, err = this.modelPandata.queryUserMartialhall(red); err != nil {
|
||||||
this.Errorln(err)
|
this.Errorln(err)
|
||||||
return
|
return
|
||||||
|
@ -24,7 +24,15 @@ func (this *apiComp) BuyGift(session comm.IUserSession, req *pb.PrivilegeBuyGift
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
|
userinfo, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SystemError,
|
||||||
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if userinfo.Vip == 0 || userinfo.Vip < req.VipLv {
|
if userinfo.Vip == 0 || userinfo.Vip < req.VipLv {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_VipLvError, // vip 等级不足
|
Code: pb.ErrorCode_VipLvError, // vip 等级不足
|
||||||
|
@ -100,7 +100,6 @@ func (this *PushGiftbag) BuriedsNotify(session comm.IUserSession, condis []*pb.C
|
|||||||
var (
|
var (
|
||||||
confs []*cfg.GamePushGiftData
|
confs []*cfg.GamePushGiftData
|
||||||
info *pb.DBPushGiftbag
|
info *pb.DBPushGiftbag
|
||||||
user *pb.DBUser
|
|
||||||
condisMap map[int32]*pb.ConIProgress = make(map[int32]*pb.ConIProgress)
|
condisMap map[int32]*pb.ConIProgress = make(map[int32]*pb.ConIProgress)
|
||||||
comdisScils []int32 = make([]int32, 0)
|
comdisScils []int32 = make([]int32, 0)
|
||||||
targets map[int32]*cfg.GamePushGiftData = make(map[int32]*cfg.GamePushGiftData)
|
targets map[int32]*cfg.GamePushGiftData = make(map[int32]*cfg.GamePushGiftData)
|
||||||
@ -114,7 +113,7 @@ func (this *PushGiftbag) BuriedsNotify(session comm.IUserSession, condis []*pb.C
|
|||||||
this.Errorln(err)
|
this.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if user = this.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if _, err = this.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
this.Error("no found user!", log.Field{Key: "uid", Value: session.GetUserId()})
|
this.Error("no found user!", log.Field{Key: "uid", Value: session.GetUserId()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,11 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if udata = this.module.ModuleUser.GetUser(session.GetUserId()); udata == nil {
|
if udata, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_SystemError,
|
Code: pb.ErrorCode_SystemError,
|
||||||
Title: pb.ErrorCode_SystemError.ToString(),
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -75,11 +75,11 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
|||||||
Message: "activity is close",
|
Message: "activity is close",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: "no found user!",
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,14 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
|||||||
} else { // 普通打造
|
} else { // 普通打造
|
||||||
// 获取掉落id
|
// 获取掉落id
|
||||||
newdrop := this.module.modelStove.CheckUnlockSuid(req.ReelId, stove.Data[req.ReelId].Lv, reelcfg.BasicDrop)
|
newdrop := this.module.modelStove.CheckUnlockSuid(req.ReelId, stove.Data[req.ReelId].Lv, reelcfg.BasicDrop)
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SystemError,
|
||||||
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
// 检查是否命中双倍打造
|
// 检查是否命中双倍打造
|
||||||
for i := 0; i < int(req.Count); i++ {
|
for i := 0; i < int(req.Count); i++ {
|
||||||
res := this.module.ModuleTools.GetGroupDataByLottery(newdrop, user.Vip, user.Lv)
|
res := this.module.ModuleTools.GetGroupDataByLottery(newdrop, user.Vip, user.Lv)
|
||||||
|
@ -73,12 +73,12 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.ModuleUser.GetUser(uid)
|
user, err := this.module.ModuleUser.GetUser(uid)
|
||||||
if user == nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserNofound,
|
Code: pb.ErrorCode_UserNofound,
|
||||||
Title: pb.ErrorCode_UserNofound.ToString(),
|
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||||
Datastring: uid,
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -59,13 +59,13 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
user := this.module.ModuleUser.GetUser(uid)
|
user, err := this.module.ModuleUser.GetUser(uid)
|
||||||
if user == nil {
|
if err != nil {
|
||||||
this.module.Error("GetRmoteUser not found", log.Field{Key: "uid", Value: uid})
|
this.module.Error("GetRmoteUser not found", log.Field{Key: "uid", Value: uid})
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: fmt.Sprintf("not found user: %s", uid),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -94,9 +94,9 @@ func (this *ModelSociaty) isNameExist(name string) error {
|
|||||||
|
|
||||||
// 公会列表
|
// 公会列表
|
||||||
func (this *ModelSociaty) list(uid string, filter pb.SociatyListFilter) (list []*pb.DBSociaty) {
|
func (this *ModelSociaty) list(uid string, filter pb.SociatyListFilter) (list []*pb.DBSociaty) {
|
||||||
user := this.module.ModuleUser.GetUser(uid)
|
user, err := this.module.ModuleUser.GetUser(uid)
|
||||||
|
|
||||||
if user == nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,8 +297,8 @@ func (this *ModelSociaty) isApplied(uid string, sociaty *pb.DBSociaty) bool {
|
|||||||
// 申请列表
|
// 申请列表
|
||||||
func (this *ModelSociaty) applyList(sociaty *pb.DBSociaty) (list []*pb.SociatyMemberInfo) {
|
func (this *ModelSociaty) applyList(sociaty *pb.DBSociaty) (list []*pb.SociatyMemberInfo) {
|
||||||
for _, r := range sociaty.ApplyRecord {
|
for _, r := range sociaty.ApplyRecord {
|
||||||
user := this.module.ModuleUser.GetUser(r.Uid)
|
user, err := this.module.ModuleUser.GetUser(r.Uid)
|
||||||
if user == nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,8 +457,8 @@ func (this *ModelSociaty) sendMail(confId string, params []string, receiver []st
|
|||||||
// 成员列表
|
// 成员列表
|
||||||
func (this *ModelSociaty) members(sociaty *pb.DBSociaty) (list []*pb.SociatyMemberInfo) {
|
func (this *ModelSociaty) members(sociaty *pb.DBSociaty) (list []*pb.SociatyMemberInfo) {
|
||||||
for _, m := range sociaty.Members {
|
for _, m := range sociaty.Members {
|
||||||
user := this.module.ModuleUser.GetUser(m.Uid)
|
user, err := this.module.ModuleUser.GetUser(m.Uid)
|
||||||
if user == nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
list = append(list, &pb.SociatyMemberInfo{
|
list = append(list, &pb.SociatyMemberInfo{
|
||||||
@ -591,8 +591,8 @@ func (this *ModelSociaty) settingJob(targetId string, job pb.SociatyJob, sociaty
|
|||||||
func (this *ModelSociaty) getMasterInfo(sociaty *pb.DBSociaty) *pb.SociatyMemberInfo {
|
func (this *ModelSociaty) getMasterInfo(sociaty *pb.DBSociaty) *pb.SociatyMemberInfo {
|
||||||
for _, m := range sociaty.Members {
|
for _, m := range sociaty.Members {
|
||||||
if m.Job == pb.SociatyJob_PRESIDENT {
|
if m.Job == pb.SociatyJob_PRESIDENT {
|
||||||
user := this.module.ModuleUser.GetUser(m.Uid)
|
user, err := this.module.ModuleUser.GetUser(m.Uid)
|
||||||
if user == nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return &pb.SociatyMemberInfo{
|
return &pb.SociatyMemberInfo{
|
||||||
@ -614,8 +614,8 @@ func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error {
|
|||||||
return comm.NewCustomError(pb.ErrorCode_SociatyNoMaster)
|
return comm.NewCustomError(pb.ErrorCode_SociatyNoMaster)
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.ModuleUser.GetUser(master.Uid)
|
user, err := this.module.ModuleUser.GetUser(master.Uid)
|
||||||
if user == nil {
|
if err != nil {
|
||||||
return comm.NewCustomError(pb.ErrorCode_UserSessionNobeing)
|
return comm.NewCustomError(pb.ErrorCode_UserSessionNobeing)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string)
|
|||||||
return comm.NewCustomError(pb.ErrorCode_SociatyLogParams)
|
return comm.NewCustomError(pb.ErrorCode_SociatyLogParams)
|
||||||
}
|
}
|
||||||
for i := 0; i < len(params); i++ {
|
for i := 0; i < len(params); i++ {
|
||||||
user := this.moduleSociaty.ModuleUser.GetUser(params[i])
|
user, err := this.moduleSociaty.ModuleUser.GetUser(params[i])
|
||||||
if user != nil {
|
if err == nil {
|
||||||
content = strings.Replace(content, "%s", user.Name, 1)
|
content = strings.Replace(content, "%s", user.Name, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,8 +52,8 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string)
|
|||||||
return comm.NewCustomError(pb.ErrorCode_SociatyLogParams)
|
return comm.NewCustomError(pb.ErrorCode_SociatyLogParams)
|
||||||
}
|
}
|
||||||
for i := 0; i < len(params); i++ {
|
for i := 0; i < len(params); i++ {
|
||||||
user := this.moduleSociaty.ModuleUser.GetUser(params[i])
|
user, err := this.moduleSociaty.ModuleUser.GetUser(params[i])
|
||||||
if user != nil {
|
if err == nil {
|
||||||
content = strings.Replace(content, "%s", user.Name, 1)
|
content = strings.Replace(content, "%s", user.Name, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,8 +78,8 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string)
|
|||||||
}
|
}
|
||||||
content = strings.Replace(content, "%s", job, 1)
|
content = strings.Replace(content, "%s", job, 1)
|
||||||
} else {
|
} else {
|
||||||
user := this.moduleSociaty.ModuleUser.GetUser(params[i])
|
user, err := this.moduleSociaty.ModuleUser.GetUser(params[i])
|
||||||
if user != nil {
|
if err == nil {
|
||||||
content = strings.Replace(content, "%s", user.Name, 1)
|
content = strings.Replace(content, "%s", user.Name, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,9 +91,9 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string)
|
|||||||
return comm.NewCustomError(pb.ErrorCode_SociatyLogParams)
|
return comm.NewCustomError(pb.ErrorCode_SociatyLogParams)
|
||||||
}
|
}
|
||||||
for i := 0; i < len(params); i++ {
|
for i := 0; i < len(params); i++ {
|
||||||
user := this.moduleSociaty.ModuleUser.GetUser(params[i])
|
user, err := this.moduleSociaty.ModuleUser.GetUser(params[i])
|
||||||
if user != nil {
|
if err == nil {
|
||||||
content = strings.Replace(content, "%s", params[i], 1)
|
content = strings.Replace(content, "%s", user.Name, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case Log_Upgrade:
|
case Log_Upgrade:
|
||||||
|
@ -100,7 +100,15 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
|||||||
|
|
||||||
switch eventConf.EventType {
|
switch eventConf.EventType {
|
||||||
case EventType16: // 捡垃圾事件
|
case EventType16: // 捡垃圾事件
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(eventConf.Value1, user.Vip, user.Lv); len(lotteryward) > 0 {
|
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(eventConf.Value1, user.Vip, user.Lv); len(lotteryward) > 0 {
|
||||||
if errdata, reward = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
if errdata, reward = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
||||||
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
||||||
@ -165,7 +173,15 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
|||||||
// 掉落奖励
|
// 掉落奖励
|
||||||
if conf, err := this.module.configure.GetStoneEventDataById(req.Eventid); err == nil {
|
if conf, err := this.module.configure.GetStoneEventDataById(req.Eventid); err == nil {
|
||||||
if battleConf, err := this.module.configure.GetBattleConfById(conf.Value1); err == nil {
|
if battleConf, err := this.module.configure.GetBattleConfById(conf.Value1); err == nil {
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(battleConf.RewardLottery, user.Vip, user.Lv); len(lotteryward) > 0 {
|
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(battleConf.RewardLottery, user.Vip, user.Lv); len(lotteryward) > 0 {
|
||||||
if errdata, reward = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
if errdata, reward = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
||||||
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward)
|
||||||
@ -216,7 +232,15 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq
|
|||||||
}
|
}
|
||||||
// 次数校验
|
// 次数校验
|
||||||
if stone.Rooms.Box[req.Eventid] < eventConf.Value2 {
|
if stone.Rooms.Box[req.Eventid] < eventConf.Value2 {
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(eventConf.Value1, user.Vip, user.Lv); len(lotteryward) > 0 {
|
if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(eventConf.Value1, user.Vip, user.Lv); len(lotteryward) > 0 {
|
||||||
if errdata, reward = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
if errdata, reward = this.module.DispenseAtno(session, lotteryward, true); errdata != nil {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package tools
|
package tools
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
@ -74,11 +73,11 @@ func (this *Tools) GetPlayerlvConf(uid string) (conf *cfg.GamePlayerlvData, errd
|
|||||||
user *pb.DBUser
|
user *pb.DBUser
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if user = this.ModuleUser.GetUser(uid); user == nil {
|
if user, err = this.ModuleUser.GetUser(uid); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.String(),
|
Title: pb.ErrorCode_DBError.String(),
|
||||||
Message: fmt.Sprintf("found user:%s", uid),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -129,10 +129,12 @@ func (this *Turntable) EventUserLogin(session comm.IUserSession) {
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
endTime := this.ModuleTools.GetGlobalConf().SignAccount
|
endTime := this.ModuleTools.GetGlobalConf().SignAccount
|
||||||
if user := this.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err := this.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
if configure.Now().Unix() > user.Ctime+int64(endTime*24*3600) {
|
if configure.Now().Unix() > user.Ctime+int64(endTime*24*3600) {
|
||||||
bEnd = true
|
bEnd = true
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if !bEnd {
|
if !bEnd {
|
||||||
return
|
return
|
||||||
|
@ -18,7 +18,15 @@ func (this *apiComp) Battlerecord(session comm.IUserSession, req *pb.UserBattler
|
|||||||
uid = req.Uid
|
uid = req.Uid
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.GetUser(uid)
|
user, err := this.module.GetUser(uid)
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
userEx, err := this.module.GetUserExpand(uid)
|
userEx, err := this.module.GetUserExpand(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
|
@ -38,11 +38,12 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (e
|
|||||||
// resp := &pb.UserCreateResp{}
|
// resp := &pb.UserCreateResp{}
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
//获取用户
|
//获取用户
|
||||||
self := this.module.modelUser.GetUser(session.GetUserId())
|
self, err := this.module.modelUser.GetUser(session.GetUserId())
|
||||||
if self == nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserNofound,
|
Code: pb.ErrorCode_UserNofound,
|
||||||
Title: pb.ErrorCode_UserNofound.ToString(),
|
Title: pb.ErrorCode_UserNofound.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,13 @@ func (this *apiComp) Deposit(session comm.IUserSession, req *pb.UserDepositReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.GetUser(session.GetUserId())
|
user, err := this.module.GetUser(session.GetUserId())
|
||||||
|
|
||||||
if user == nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserSessionNobeing,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,12 @@ func (this *apiComp) Getdeposit(session comm.IUserSession, req *pb.UserGetdeposi
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.GetUser(session.GetUserId())
|
user, err := this.module.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
if user == nil {
|
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserSessionNobeing,
|
Code: pb.ErrorCode_UserSessionNobeing,
|
||||||
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,15 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.UserInfoReq) (errda
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dbUser := this.module.GetUser(session.GetUserId())
|
dbUser, err := this.module.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
ue, err := this.module.GetUserExpand(session.GetUserId())
|
ue, err := this.module.GetUserExpand(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
|
@ -22,12 +22,12 @@ func (this *apiComp) Modifyavatar(session comm.IUserSession, req *pb.UserModifya
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.GetUser(session.GetUserId())
|
_, err := this.module.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
if user == nil {
|
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserSessionNobeing,
|
Code: pb.ErrorCode_UserSessionNobeing,
|
||||||
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,13 @@ func (this *apiComp) Modifybgp(session comm.IUserSession, req *pb.UserModifybgpR
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.GetUser(session.GetUserId())
|
_, err := this.module.GetUser(session.GetUserId())
|
||||||
|
|
||||||
if user == nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserSessionNobeing,
|
Code: pb.ErrorCode_UserSessionNobeing,
|
||||||
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,11 @@ func (this *apiComp) Modifyfigure(session comm.IUserSession, req *pb.UserModifyf
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.GetUser(session.GetUserId())
|
if _, err := this.module.GetUser(session.GetUserId()); err != nil {
|
||||||
|
|
||||||
if user == nil {
|
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserSessionNobeing,
|
Code: pb.ErrorCode_UserSessionNobeing,
|
||||||
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,15 @@ func (this *apiComp) SwitchDefPer(session comm.IUserSession, req *pb.UserSwitchD
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user = this.module.GetUser(session.GetUserId())
|
user, err = this.module.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if req.CurSkin != "" {
|
if req.CurSkin != "" {
|
||||||
if conf, err = this.module.configure.GetPlayerOverview(req.CurSkin, user.Gender); err != nil {
|
if conf, err = this.module.configure.GetPlayerOverview(req.CurSkin, user.Gender); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
|
@ -90,14 +90,12 @@ func (this *ModelUser) User_Create(user *pb.DBUser) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户
|
// 获取用户
|
||||||
func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) {
|
func (this *ModelUser) GetUser(uid string) (user *pb.DBUser, err error) {
|
||||||
user = &pb.DBUser{}
|
user = &pb.DBUser{}
|
||||||
// if err := this.Get(uid, user); err != nil {
|
|
||||||
// this.module.Errorf("GetUser uid:%v err:%v",uid,err)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
if this.module.IsCross() {
|
if this.module.IsCross() {
|
||||||
if model, err := this.module.GetDBModelByUid(uid, this.TableName); err != nil {
|
var model *db.DBModel
|
||||||
|
if model, err = this.module.GetDBModelByUid(uid, this.TableName); err != nil {
|
||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
} else {
|
} else {
|
||||||
if err = model.Get(uid, user); err != nil {
|
if err = model.Get(uid, user); err != nil {
|
||||||
@ -105,7 +103,7 @@ func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := this.Get(uid, user); err != nil {
|
if err = this.Get(uid, user); err != nil {
|
||||||
this.module.Errorf("err:%v", err)
|
this.module.Errorf("err:%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,12 +152,11 @@ func (this *ModelUser) delete(uid string) {
|
|||||||
|
|
||||||
// 修改玩家名字
|
// 修改玩家名字
|
||||||
func (this *ModelUser) modifyName(uid string, newName string) (errdata *pb.ErrorData) {
|
func (this *ModelUser) modifyName(uid string, newName string) (errdata *pb.ErrorData) {
|
||||||
user := this.GetUser(uid)
|
if _, err := this.GetUser(uid); err != nil {
|
||||||
|
|
||||||
if user == nil {
|
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserSessionNobeing,
|
Code: pb.ErrorCode_UserSessionNobeing,
|
||||||
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -117,24 +117,9 @@ func (this *User) OnInstallComp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户数据
|
// 获取用户数据
|
||||||
func (this *User) GetUser(uid string) (user *pb.DBUser) {
|
func (this *User) GetUser(uid string) (user *pb.DBUser, err error) {
|
||||||
var err error
|
user, err = this.modelUser.GetUser(uid)
|
||||||
if this.IsCross() {
|
return
|
||||||
user, err = this.getRemoteUser(uid)
|
|
||||||
if err != nil {
|
|
||||||
this.Error("查询用户信息失败!", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
|
||||||
// this.Errorf("查询远程玩家信息 tag:%v err:%v", this.service.GetTag(), err)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
user = this.modelUser.GetUser(uid)
|
|
||||||
}
|
|
||||||
|
|
||||||
if user.Id == "" {
|
|
||||||
this.Errorf("查询玩家信息 uid:%v", uid)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return user
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取跨服用户数据
|
// 获取跨服用户数据
|
||||||
@ -341,7 +326,10 @@ func (this *User) QueryAttributeValue(uid string, attr string) (value int64) {
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
user = this.modelUser.GetUser(uid)
|
user, err = this.modelUser.GetUser(uid)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
userEx, err = this.GetUserExpand(uid)
|
userEx, err = this.GetUserExpand(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -407,7 +395,15 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
user = this.GetUser(uid)
|
user, err = this.GetUser(uid)
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_UserSessionNobeing,
|
||||||
|
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
userEx, err = this.GetUserExpand(uid)
|
userEx, err = this.GetUserExpand(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
@ -961,8 +957,8 @@ func (this *User) RecoverUserPsStart(session comm.IUserSession) (recoverTime int
|
|||||||
if re <= 0 {
|
if re <= 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
u := this.GetUser(session.GetUserId())
|
u, err := this.GetUser(session.GetUserId())
|
||||||
if u == nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
diff := time.Now().Unix() - u.LastRecoverPsSec
|
diff := time.Now().Unix() - u.LastRecoverPsSec
|
||||||
@ -1017,8 +1013,8 @@ func (this *User) recoverUserPs(uid string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u := this.GetUser(uid)
|
u, err := this.GetUser(uid)
|
||||||
if u == nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ggd := this.ModuleTools.GetGlobalConf()
|
ggd := this.ModuleTools.GetGlobalConf()
|
||||||
@ -1126,10 +1122,11 @@ func (this *User) AddPer(session comm.IUserSession, pers map[string]int32, bPush
|
|||||||
adds []string = make([]string, 0)
|
adds []string = make([]string, 0)
|
||||||
iskeep bool
|
iskeep bool
|
||||||
)
|
)
|
||||||
if user = this.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_UserSessionNobeing,
|
Code: pb.ErrorCode_UserSessionNobeing,
|
||||||
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
Title: pb.ErrorCode_UserSessionNobeing.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1221,9 +1218,10 @@ func (this *User) ConsumePsAddExp(session comm.IUserSession, ps int32) (addExp i
|
|||||||
func (this *User) RemainingPS(uid string) (ps int32) {
|
func (this *User) RemainingPS(uid string) (ps int32) {
|
||||||
var (
|
var (
|
||||||
user *pb.DBUser
|
user *pb.DBUser
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
if user = this.GetUser(uid); user == nil {
|
if user, err = this.GetUser(uid); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ggd := this.ModuleTools.GetGlobalConf()
|
ggd := this.ModuleTools.GetGlobalConf()
|
||||||
|
@ -47,10 +47,11 @@ func (this *apiComp) LvReward(session comm.IUserSession, req *pb.VentureLvReward
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 等级校验
|
// 等级校验
|
||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ func (this *apiComp) SignGetList(session comm.IUserSession, req *pb.VentureSignG
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
endTime := this.module.ModuleTools.GetGlobalConf().SignAccount
|
endTime := this.module.ModuleTools.GetGlobalConf().SignAccount
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
if configure.Now().Unix() > user.Ctime+int64(endTime*24*3600) {
|
if configure.Now().Unix() > user.Ctime+int64(endTime*24*3600) {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ActivityOver,
|
Code: pb.ErrorCode_ActivityOver,
|
||||||
|
@ -140,7 +140,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
this.module.CheckSeasonRank(session.GetUserId(), req.BossId, req.Difficulty, Leadpos, szLine, total)
|
this.module.CheckSeasonRank(session.GetUserId(), req.BossId, req.Difficulty, Leadpos, szLine, total)
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
reward = this.module.ModuleTools.GetGroupDataByLottery(vikingCfg.Drop, user.Vip, user.Lv)
|
reward = this.module.ModuleTools.GetGroupDataByLottery(vikingCfg.Drop, user.Vip, user.Lv)
|
||||||
|
|
||||||
b := this.module.ModuleActivity.HDCelebration(session, 2, req.BossId)
|
b := this.module.ModuleActivity.HDCelebration(session, 2, req.BossId)
|
||||||
@ -204,7 +212,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
Heroexp: changExp,
|
Heroexp: changExp,
|
||||||
UserExp: userExp,
|
UserExp: userExp,
|
||||||
})
|
})
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||||
this.chat.SendSysChatToWorld(comm.ChatSystem14, nil, req.BossId, req.Difficulty, user.Name)
|
this.chat.SendSysChatToWorld(comm.ChatSystem14, nil, req.BossId, req.Difficulty, user.Name)
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
|
@ -106,7 +106,10 @@ func (this *Viking) CheckRank(uid string, boosID int32, difficulty int32, report
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
userinfo := this.ModuleUser.GetUser(uid)
|
userinfo, err := this.ModuleUser.GetUser(uid)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
model := db.NewDBModelByExpired(comm.TableVikingRank, conn_)
|
model := db.NewDBModelByExpired(comm.TableVikingRank, conn_)
|
||||||
|
|
||||||
costTime := report.Costtime
|
costTime := report.Costtime
|
||||||
@ -308,7 +311,10 @@ func (this *Viking) CheckSeasonRank(uid string, boosID int32, difficulty int32,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userinfo := this.ModuleUser.GetUser(uid)
|
userinfo, err := this.ModuleUser.GetUser(uid)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
model := db.NewDBModelByExpired(comm.TableVikingSRank, conn_)
|
model := db.NewDBModelByExpired(comm.TableVikingSRank, conn_)
|
||||||
|
|
||||||
// 写入排行榜
|
// 写入排行榜
|
||||||
|
@ -64,7 +64,15 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.WTaskBattle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if conf.Reward > 0 {
|
if conf.Reward > 0 {
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if prop = this.module.ModuleTools.GetGroupDataByLottery(conf.Reward, user.Vip, user.Lv); len(prop) == 0 {
|
if prop = this.module.ModuleTools.GetGroupDataByLottery(conf.Reward, user.Vip, user.Lv); len(prop) == 0 {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
@ -71,7 +71,15 @@ func (this *apiComp) BoxReceive(session comm.IUserSession, req *pb.WTaskBoxRecei
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
user, err := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
|
if err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
if prop = this.module.ModuleTools.GetGroupDataByLottery(conf.Drown, user.Vip, user.Lv); len(prop) == 0 {
|
if prop = this.module.ModuleTools.GetGroupDataByLottery(conf.Drown, user.Vip, user.Lv); len(prop) == 0 {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
@ -165,7 +165,7 @@ func (this *WTask) OpenCmdNotice(uid string, keys ...string) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if user = this.ModuleUser.GetUser(uid); user == nil {
|
if user, err = this.ModuleUser.GetUser(uid); err != nil {
|
||||||
this.Error("获取用户信息失败!", log.Field{Key: "uid", Value: uid})
|
this.Error("获取用户信息失败!", log.Field{Key: "uid", Value: uid})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -655,6 +655,7 @@ func (this *WTask) fishtask(session comm.IUserSession, wtask *pb.DBWTask, ispush
|
|||||||
opencmdMap map[string]int32
|
opencmdMap map[string]int32
|
||||||
opencmd []string
|
opencmd []string
|
||||||
user *pb.DBUser
|
user *pb.DBUser
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
if opencmdMap, errdata = this.sys.QueryOpenCondData(session.GetUserId()); errdata != nil {
|
if opencmdMap, errdata = this.sys.QueryOpenCondData(session.GetUserId()); errdata != nil {
|
||||||
@ -667,7 +668,7 @@ func (this *WTask) fishtask(session comm.IUserSession, wtask *pb.DBWTask, ispush
|
|||||||
opencmd = append(opencmd, k)
|
opencmd = append(opencmd, k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if user = this.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user, err = this.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||||
this.Error("获取用户信息失败!", log.Field{Key: "uid", Value: session.GetUserId()})
|
this.Error("获取用户信息失败!", log.Field{Key: "uid", Value: session.GetUserId()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user