This commit is contained in:
wh_zcy 2023-06-06 10:33:46 +08:00
commit d446065b0e
261 changed files with 711 additions and 624 deletions

View File

@ -153,7 +153,7 @@ func (c *ConnServiceImpl) ReceiveMsg() (errdata *pb.ErrorData, msg *pb.UserMessa
return return
} }
if code = c.handleNotify(msg); code != pb.ErrorCode_Success { if code = c.handleNotify(msg); errdata != nil {
return return
} }

View File

@ -297,7 +297,7 @@ func (ui *MainWindowImpl) createLoginWin(sid, sname string) {
ui.tb.toolbar.Hide() ui.tb.toolbar.Hide()
// call after ui.createWindowContainer // call after ui.createWindowContainer
ui.connService.ListenerPush() ui.connService.ListenerPush()
if code := ui.pttService.Login(sid, account.Text); code != pb.ErrorCode_Success { if code := ui.pttService.Login(sid, account.Text); errdata != nil {
err := fmt.Errorf("login err: %v[%d]", code, int32(code)) err := fmt.Errorf("login err: %v[%d]", code, int32(code))
dialog.ShowError(err, ui.w) dialog.ShowError(err, ui.w)
} else { } else {
@ -417,7 +417,7 @@ func (ui *MainWindowImpl) createRoleWindowPopUp() {
d := dialog.NewForm(common.FORM_TITLE_CREATEROLE, common.BUTTON_OK, common.BUTTON_CANCEL, items, func(b bool) { d := dialog.NewForm(common.FORM_TITLE_CREATEROLE, common.BUTTON_OK, common.BUTTON_CANCEL, items, func(b bool) {
if nickname.Text != "" { if nickname.Text != "" {
logrus.WithField("nickname", nickname.Text).Debug("submit crete role") logrus.WithField("nickname", nickname.Text).Debug("submit crete role")
if code := ui.pttService.CreateRole(nickname.Text, gender, cast.ToInt32(figure.Text)); code != pb.ErrorCode_Success { if code := ui.pttService.CreateRole(nickname.Text, gender, cast.ToInt32(figure.Text)); errdata != nil {
err := fmt.Errorf("login err: %v[%d]", code, int32(code)) err := fmt.Errorf("login err: %v[%d]", code, int32(code))
dialog.ShowError(err, ui.w) dialog.ShowError(err, ui.w)
} else { } else {

View File

@ -17,7 +17,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.AcademyInfoReq) (er
info *pb.DBAcademy info *pb.DBAcademy
err error err error
) )
if code = this.InfoCheck(session, req); code != pb.ErrorCode_Success { if code = this.InfoCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelAcademy.queryInfo(session.GetUserId()); err != nil { if info, err = this.module.modelAcademy.queryInfo(session.GetUserId()); err != nil {

View File

@ -21,10 +21,10 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe
// group []*cfg.GameTeachingData // group []*cfg.GameTeachingData
err error err error
) )
if code = this.ReceiveCheck(session, req); code != pb.ErrorCode_Success { if code = this.ReceiveCheck(session, req); errdata != nil {
return return
} }
if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success { if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); errdata != nil {
return return
} }
if iswin { if iswin {

View File

@ -21,10 +21,10 @@ func (this *apiComp) TeachingReceive(session comm.IUserSession, req *pb.AcademyT
info *pb.DBAcademy info *pb.DBAcademy
err error err error
) )
if code = this.TeachingReceiveCheck(session, req); code != pb.ErrorCode_Success { if code = this.TeachingReceiveCheck(session, req); errdata != nil {
return return
} }
if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success { if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); errdata != nil {
return return
} }
if iswin { if iswin {

View File

@ -29,7 +29,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (errdat
maxbuy, vipbuy int32 maxbuy, vipbuy int32
err error err error
) )
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success { if code = this.BuyCheck(session, req); errdata != nil {
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code), Title: pb.GetErrorCodeMsg(code),
Message: fmt.Sprintf("请求参数:%+v", req), Message: fmt.Sprintf("请求参数:%+v", req),
@ -82,11 +82,11 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (errdat
} }
} }
if code = this.module.ConsumeRes(session, need, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, need, true); errdata != nil {
return return
} }
info.Buynum += req.BuyNum info.Buynum += req.BuyNum
if code = this.module.DispenseRes(session, []*cfg.Gameatn{{A: ticketitem.A, T: ticketitem.T, N: req.BuyNum}}, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, []*cfg.Gameatn{{A: ticketitem.A, T: ticketitem.T, N: req.BuyNum}}, true); errdata != nil {
return return
} }
// info.Ticket += req.BuyNum // info.Ticket += req.BuyNum

View File

@ -27,7 +27,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
err error err error
iswin bool iswin bool
) )
if code = this.ChallengeRewardCheck(session, req); code != pb.ErrorCode_Success { if code = this.ChallengeRewardCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil {
@ -39,7 +39,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
return return
} }
if req.Iswin { if req.Iswin {
if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success { if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); errdata != nil {
return return
} }
if !iswin { if !iswin {
@ -56,7 +56,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
} }
return return
} }
if code = this.module.DispenseRes(session, reward.WinReward, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, reward.WinReward, true); errdata != nil {
return return
} }
if req.Revengeid != "" { if req.Revengeid != "" {

View File

@ -23,7 +23,7 @@ func (this *apiComp) DelReward(session comm.IUserSession, req *pb.ArenaDelReward
info *pb.DBArenaUser info *pb.DBArenaUser
err error err error
) )
if code = this.DelRewardCheck(session, req); code != pb.ErrorCode_Success { if code = this.DelRewardCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil && err != mgo.MongodbNil { if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil && err != mgo.MongodbNil {

View File

@ -26,7 +26,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ArenaInfoReq) (errd
err error err error
) )
if code = this.InfoCheck(session, req); code != pb.ErrorCode_Success { if code = this.InfoCheck(session, req); errdata != nil {
return return
} }
if model, err = this.module.GetDBNodule(session, comm.TableUser, time.Hour); err != nil { if model, err = this.module.GetDBNodule(session, comm.TableUser, time.Hour); err != nil {

View File

@ -22,7 +22,7 @@ func (this *apiComp) Matche(session comm.IUserSession, req *pb.ArenaMatcheReq) (
ai []*pb.ArenaPlayer ai []*pb.ArenaPlayer
err error err error
) )
if code = this.MatcheCheck(session, req); code != pb.ErrorCode_Success { if code = this.MatcheCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil {

View File

@ -23,7 +23,7 @@ func (this *apiComp) OtherInfo(session comm.IUserSession, req *pb.ArenaOtherInfo
info *pb.DBArenaUser info *pb.DBArenaUser
err error err error
) )
if code = this.OtherInfoCheck(session, req); code != pb.ErrorCode_Success { if code = this.OtherInfoCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelArena.queryPlayerInfo(req.OtherId); err != nil && err != mgo.MongodbNil { if info, err = this.module.modelArena.queryPlayerInfo(req.OtherId); err != nil && err != mgo.MongodbNil {

View File

@ -28,7 +28,7 @@ func (this *apiComp) PlotReward(session comm.IUserSession, req *pb.ArenaPlotRewa
err error err error
) )
if code = this.PlotRewardCheck(session, req); code != pb.ErrorCode_Success { if code = this.PlotRewardCheck(session, req); errdata != nil {
return return
} }
if npc, err = this.module.configure.getChallengenpc(req.Pid); err != nil { if npc, err = this.module.configure.getChallengenpc(req.Pid); err != nil {
@ -39,7 +39,7 @@ func (this *apiComp) PlotReward(session comm.IUserSession, req *pb.ArenaPlotRewa
} }
return return
} }
if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success { if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); errdata != nil {
return return
} }
if !iswin { if !iswin {

View File

@ -21,7 +21,7 @@ func (this *apiComp) Rank(session comm.IUserSession, req *pb.ArenaRankReq) (errd
err error err error
) )
if code = this.RankCheck(session, req); code != pb.ErrorCode_Success { if code = this.RankCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil {

View File

@ -18,7 +18,7 @@ func (this *apiComp) SetAttFormt(session comm.IUserSession, req *pb.ArenaSetAttF
heros []*pb.DBHero heros []*pb.DBHero
err error err error
) )
if code = this.SetAttFormtCheck(session, req); code != pb.ErrorCode_Success { if code = this.SetAttFormtCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil {

View File

@ -18,7 +18,7 @@ func (this *apiComp) SetDefFormt(session comm.IUserSession, req *pb.ArenaSetDefF
heros []*pb.DBHero heros []*pb.DBHero
err error err error
) )
if code = this.SetDefFormtCheck(session, req); code != pb.ErrorCode_Success { if code = this.SetDefFormtCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil {

View File

@ -151,7 +151,7 @@ func (this *Arena) GetMatcheBattleRoles(uid string) (captain int32, rules []*pb.
} }
if len(players) > 0 { if len(players) > 0 {
captain = players[0].Defend.Leadpos captain = players[0].Defend.Leadpos
if rules, code = this.battle.CreateRolesByHeros(players[0].Defend.Formt); code != pb.ErrorCode_Success { if rules, code = this.battle.CreateRolesByHeros(players[0].Defend.Formt); errdata != nil {
err = fmt.Errorf("Player CreateRolesByHeros fail:%d", code) err = fmt.Errorf("Player CreateRolesByHeros fail:%d", code)
return return
} }
@ -161,7 +161,7 @@ func (this *Arena) GetMatcheBattleRoles(uid string) (captain int32, rules []*pb.
} }
if len(ais) > 0 { if len(ais) > 0 {
captain = ais[0].Defend.Leadpos captain = ais[0].Defend.Leadpos
if rules, code = this.battle.CreateRolesByHeros(ais[0].Defend.Formt); code != pb.ErrorCode_Success { if rules, code = this.battle.CreateRolesByHeros(ais[0].Defend.Formt); errdata != nil {
err = fmt.Errorf("AI CreateRolesByHeros fail:%d", code) err = fmt.Errorf("AI CreateRolesByHeros fail:%d", code)
return return
} }

View File

@ -18,16 +18,15 @@ func (this *apiComp) ActivateCheck(session comm.IUserSession, req *pb.AtlasActiv
// 激活图鉴信息 // 激活图鉴信息
func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateReq) (errdata *pb.ErrorData) { func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateReq) (errdata *pb.ErrorData) {
if code = this.ActivateCheck(session, req); code != pb.ErrorCode_Success { if errdata = this.ActivateCheck(session, req); errdata != nil {
return return
} }
atlasConf, err := this.module.configure.GetPandoAtlasConf(req.Id) atlasConf, err := this.module.configure.GetPandoAtlasConf(req.Id)
if err != nil { if err != nil {
code = pb.ErrorCode_ConfigNoFound // 返回错误码 errdata = &pb.ErrorData{
data = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound,
Title: pb.GetErrorCodeMsg(code), Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
} }
return return
} }
@ -45,9 +44,15 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateRe
}) })
return return
} else { } else {
code = pb.ErrorCode_MartialhallAtlasError errdata = &pb.ErrorData{
Code: pb.ErrorCode_MartialhallAtlasError,
Title: pb.ErrorCode_MartialhallAtlasError.ToString(),
}
} }
} }
code = pb.ErrorCode_SmithyNoFoundAtlas errdata = &pb.ErrorData{
Code: pb.ErrorCode_SmithyNoFoundAtlas,
Title: pb.ErrorCode_SmithyNoFoundAtlas.ToString(),
}
return return
} }

View File

@ -32,12 +32,18 @@ func (this *apiComp) Award(session comm.IUserSession, req *pb.AtlasAwardReq) (er
res = append(res, conf.ItemId...) res = append(res, conf.ItemId...)
} }
if len(res) == 0 { // 没有奖励可领取 if len(res) == 0 { // 没有奖励可领取
code = pb.ErrorCode_MartialhallAtlasNoReward errdata = &pb.ErrorData{
Code: pb.ErrorCode_MartialhallAtlasNoReward,
Title: pb.ErrorCode_MartialhallAtlasNoReward.ToString(),
}
return return
} }
if code = this.module.DispenseRes(session, res, true); code != pb.ErrorCode_Success {
if errdata = this.module.DispenseRes(session, res, true); errdata != nil {
buff, _ := json.Marshal(res) buff, _ := json.Marshal(res)
data = &pb.ErrorData{Title: "图鉴奖励领取失败!", Datastring: string(buff)} //data = &pb.ErrorData{Title: "图鉴奖励领取失败!", Datastring: string(buff)}
errdata.Title = "图鉴奖励领取失败!"
errdata.Datastring = string(buff)
return return
} }

View File

@ -16,7 +16,10 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.AtlasGetListReq)
list, err := this.module.modelPandaAtlas.getPandaAtlasList(session.GetUserId()) list, err := this.module.modelPandaAtlas.getPandaAtlasList(session.GetUserId())
if err != nil { if err != nil {
code = pb.ErrorCode_DBError errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
}
return return
} }
session.SendMsg(string(this.module.GetType()), "getlist", &pb.AtlasGetListResp{ session.SendMsg(string(this.module.GetType()), "getlist", &pb.AtlasGetListResp{

View File

@ -82,7 +82,7 @@ func (this *modelBattleComp) createeve(session comm.IUserSession, conn *db.DBCon
return return
} }
tid := 100 + i tid := 100 + i
if record.Redflist[0].Team[i], code = this.createBattleRole(hero, tid, i); code != pb.ErrorCode_Success { if record.Redflist[0].Team[i], code = this.createBattleRole(hero, tid, i); errdata != nil {
return return
} }
if buff != nil { if buff != nil {
@ -123,7 +123,7 @@ func (this *modelBattleComp) createeve(session comm.IUserSession, conn *db.DBCon
} }
} }
tid := 100 + i tid := 100 + i
if record.Redflist[0].Team[i], code = this.createBattleRole(hero, tid, i); code != pb.ErrorCode_Success { if record.Redflist[0].Team[i], code = this.createBattleRole(hero, tid, i); errdata != nil {
return return
} }
record.Redflist[0].Team[i].Ishelp = true record.Redflist[0].Team[i].Ishelp = true
@ -141,7 +141,7 @@ func (this *modelBattleComp) createeve(session comm.IUserSession, conn *db.DBCon
if v == 0 { if v == 0 {
continue continue
} }
if captain, masters, code = this.createMasterRoles(100, i, v); code != pb.ErrorCode_Success { if captain, masters, code = this.createMasterRoles(100, i, v); errdata != nil {
return return
} }
record.Redflist[i].Systeam = masters record.Redflist[i].Systeam = masters
@ -164,7 +164,7 @@ func (this *modelBattleComp) createeve(session comm.IUserSession, conn *db.DBCon
if v == 0 { if v == 0 {
continue continue
} }
if captain, masters, code = this.createMasterRoles(100, i, v); code != pb.ErrorCode_Success { if captain, masters, code = this.createMasterRoles(100, i, v); errdata != nil {
return return
} }
record.Redflist[i].Backupteam = masters record.Redflist[i].Backupteam = masters
@ -182,7 +182,7 @@ func (this *modelBattleComp) createeve(session comm.IUserSession, conn *db.DBCon
} else { } else {
record.Redflist = make([]*pb.DBBattleFormt, len(req.Sysformat)) record.Redflist = make([]*pb.DBBattleFormt, len(req.Sysformat))
for i, v := range req.Sysformat { for i, v := range req.Sysformat {
if captain, masters, code = this.createMasterRoles(100, i, v); code != pb.ErrorCode_Success { if captain, masters, code = this.createMasterRoles(100, i, v); errdata != nil {
return return
} }
record.Redflist[i] = &pb.DBBattleFormt{ record.Redflist[i] = &pb.DBBattleFormt{
@ -201,7 +201,7 @@ func (this *modelBattleComp) createeve(session comm.IUserSession, conn *db.DBCon
} }
if req.Backupformat != nil && len(req.Backupformat) > 0 { if req.Backupformat != nil && len(req.Backupformat) > 0 {
for i, v := range req.Backupformat { for i, v := range req.Backupformat {
if captain, masters, code = this.createMasterRoles(100, i, v); code != pb.ErrorCode_Success { if captain, masters, code = this.createMasterRoles(100, i, v); errdata != nil {
return return
} }
record.Redflist[i].Backupteam = masters record.Redflist[i].Backupteam = masters
@ -219,7 +219,7 @@ func (this *modelBattleComp) createeve(session comm.IUserSession, conn *db.DBCon
} }
for i, v := range req.Buleformat { for i, v := range req.Buleformat {
if captain, masters, code = this.createMasterRoles(200, i, v); code != pb.ErrorCode_Success { if captain, masters, code = this.createMasterRoles(200, i, v); errdata != nil {
return return
} }
record.Buleflist[i] = &pb.DBBattleFormt{ record.Buleflist[i] = &pb.DBBattleFormt{
@ -262,7 +262,7 @@ func (this *modelBattleComp) createpve(session comm.IUserSession, conn *db.DBCon
return return
} }
tid := 100 + i tid := 100 + i
if record.Redflist[0].Team[i], code = this.createBattleRole(heros[i], tid, i); code != pb.ErrorCode_Success { if record.Redflist[0].Team[i], code = this.createBattleRole(heros[i], tid, i); errdata != nil {
return return
} }
if buff != nil { if buff != nil {
@ -302,7 +302,7 @@ func (this *modelBattleComp) createpve(session comm.IUserSession, conn *db.DBCon
} }
} }
tid := 100 + i tid := 100 + i
if record.Redflist[0].Team[i], code = this.createBattleRole(heros[i], tid, i); code != pb.ErrorCode_Success { if record.Redflist[0].Team[i], code = this.createBattleRole(heros[i], tid, i); errdata != nil {
return return
} }
record.Redflist[0].Team[i].Ishelp = true record.Redflist[0].Team[i].Ishelp = true
@ -324,7 +324,7 @@ func (this *modelBattleComp) createpve(session comm.IUserSession, conn *db.DBCon
masters []*pb.BattleRole masters []*pb.BattleRole
) )
for i, v := range req.Mformat { for i, v := range req.Mformat {
if captain, masters, code = this.createMasterRoles(200, i, v); code != pb.ErrorCode_Success { if captain, masters, code = this.createMasterRoles(200, i, v); errdata != nil {
return return
} }
record.Buleflist[i] = &pb.DBBattleFormt{ record.Buleflist[i] = &pb.DBBattleFormt{
@ -368,7 +368,7 @@ func (this *modelBattleComp) createpvb(session comm.IUserSession, conn *db.DBCon
return return
} }
tid := 100 + i tid := 100 + i
if record.Redflist[ii].Team[i], code = this.createBattleRole(heros[i], tid, i); code != pb.ErrorCode_Success { if record.Redflist[ii].Team[i], code = this.createBattleRole(heros[i], tid, i); errdata != nil {
return return
} }
if buff != nil { if buff != nil {
@ -408,7 +408,7 @@ func (this *modelBattleComp) createpvb(session comm.IUserSession, conn *db.DBCon
} }
} }
tid := 100 + i tid := 100 + i
if record.Redflist[ii].Team[i], code = this.createBattleRole(heros[i], tid, i); code != pb.ErrorCode_Success { if record.Redflist[ii].Team[i], code = this.createBattleRole(heros[i], tid, i); errdata != nil {
return return
} }
record.Redflist[ii].Team[i].Ishelp = true record.Redflist[ii].Team[i].Ishelp = true
@ -432,7 +432,7 @@ func (this *modelBattleComp) createpvb(session comm.IUserSession, conn *db.DBCon
masters []*pb.BattleRole masters []*pb.BattleRole
) )
for i, v := range req.Mformat { for i, v := range req.Mformat {
if captain, masters, code = this.createMasterRoles(200, i, v); code != pb.ErrorCode_Success { if captain, masters, code = this.createMasterRoles(200, i, v); errdata != nil {
return return
} }
record.Buleflist[i] = &pb.DBBattleFormt{ record.Buleflist[i] = &pb.DBBattleFormt{
@ -464,7 +464,7 @@ func (this *modelBattleComp) createpvp(session comm.IUserSession, conn *db.DBCon
for i, v := range req.Redformat.Format { for i, v := range req.Redformat.Format {
if v != nil { if v != nil {
tid := 100 + i tid := 100 + i
if record.Redflist[0].Team[i], code = this.createBattleRole(v, tid, i); code != pb.ErrorCode_Success { if record.Redflist[0].Team[i], code = this.createBattleRole(v, tid, i); errdata != nil {
return return
} }
} else { } else {
@ -484,7 +484,7 @@ func (this *modelBattleComp) createpvp(session comm.IUserSession, conn *db.DBCon
for i, v := range req.Buleformat.Format { for i, v := range req.Buleformat.Format {
if v != nil { if v != nil {
tid := 200 + i tid := 200 + i
if record.Buleflist[0].Team[i], code = this.createBattleRole(v, tid, i); code != pb.ErrorCode_Success { if record.Buleflist[0].Team[i], code = this.createBattleRole(v, tid, i); errdata != nil {
return return
} }
} else { } else {
@ -525,7 +525,7 @@ func (this *modelBattleComp) creatertpvp(redmodel, bluemodel *db.DBModel, btype
return return
} }
tid := 100 + i tid := 100 + i
if record.Redflist[ii].Team[i], code = this.createBattleRole(heros[i], tid, i); code != pb.ErrorCode_Success { if record.Redflist[ii].Team[i], code = this.createBattleRole(heros[i], tid, i); errdata != nil {
return return
} }
} else { } else {
@ -551,7 +551,7 @@ func (this *modelBattleComp) creatertpvp(redmodel, bluemodel *db.DBModel, btype
return return
} }
tid := 200 + i tid := 200 + i
if record.Buleflist[ii].Team[i], code = this.createBattleRole(heros[i], tid, i); code != pb.ErrorCode_Success { if record.Buleflist[ii].Team[i], code = this.createBattleRole(heros[i], tid, i); errdata != nil {
return return
} }
} else { } else {
@ -598,7 +598,7 @@ func (this *modelBattleComp) createlpve(session comm.IUserSession, conn *db.DBCo
return return
} }
tid := 100 + i tid := 100 + i
if record.Redflist[0].Team[i], code = this.createBattleRole(heros[i], tid, i); code != pb.ErrorCode_Success { if record.Redflist[0].Team[i], code = this.createBattleRole(heros[i], tid, i); errdata != nil {
return return
} }
if buff != nil { if buff != nil {
@ -638,7 +638,7 @@ func (this *modelBattleComp) createlpve(session comm.IUserSession, conn *db.DBCo
} }
} }
tid := 100 + i tid := 100 + i
if record.Redflist[0].Team[i], code = this.createBattleRole(heros[i], tid, i); code != pb.ErrorCode_Success { if record.Redflist[0].Team[i], code = this.createBattleRole(heros[i], tid, i); errdata != nil {
return return
} }
record.Redflist[0].Team[i].Ishelp = true record.Redflist[0].Team[i].Ishelp = true

View File

@ -107,7 +107,7 @@ func (this *Battle) CreateEveBattle(session comm.IUserSession, req *pb.BattleEVE
return return
} }
if record, code = this.modelBattle.createeve(session, conn, pb.BattleType_eve, req); code != pb.ErrorCode_Success { if record, code = this.modelBattle.createeve(session, conn, pb.BattleType_eve, req); errdata != nil {
return return
} }
return return
@ -150,7 +150,7 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
} }
} }
if record, code = this.modelBattle.createpve(session, conn, pb.BattleType_pve, req); code != pb.ErrorCode_Success { if record, code = this.modelBattle.createpve(session, conn, pb.BattleType_pve, req); errdata != nil {
return return
} }
if req.Format.Friendformat != nil { if req.Format.Friendformat != nil {
@ -182,7 +182,7 @@ func (this *Battle) CreatePvbBattle(session comm.IUserSession, req *pb.BattlePVB
} }
return return
} }
if record, code = this.modelBattle.createpvb(session, conn, pb.BattleType_pvb, req); code != pb.ErrorCode_Success { if record, code = this.modelBattle.createpvb(session, conn, pb.BattleType_pvb, req); errdata != nil {
return return
} }
return return
@ -204,7 +204,7 @@ func (this *Battle) CreatePvpBattle(session comm.IUserSession, req *pb.BattlePVP
this.Errorf("session:%v err:", session, err) this.Errorf("session:%v err:", session, err)
return return
} }
if record, code = this.modelBattle.createpvp(session, conn, pb.BattleType_pvp, req); code != pb.ErrorCode_Success { if record, code = this.modelBattle.createpvp(session, conn, pb.BattleType_pvp, req); errdata != nil {
return return
} }
return return
@ -229,7 +229,7 @@ func (this *Battle) CreateRtPvpBattle(req *pb.BattleRTPVPReq) (errdata *pb.Error
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
if record, code = this.modelBattle.creatertpvp(redmodel, bluemodel, pb.BattleType_rtpvp, req); code != pb.ErrorCode_Success { if record, code = this.modelBattle.creatertpvp(redmodel, bluemodel, pb.BattleType_rtpvp, req); errdata != nil {
return return
} }
return return
@ -272,7 +272,7 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP
} }
} }
if record, code = this.modelBattle.createlpve(session, conn, pb.BattleType_lpev, req); code != pb.ErrorCode_Success { if record, code = this.modelBattle.createlpve(session, conn, pb.BattleType_lpev, req); errdata != nil {
return return
} }
if req.Format.Friendformat != nil { if req.Format.Friendformat != nil {
@ -292,7 +292,7 @@ func (this *Battle) CreateRolesByHeros(heros []*pb.DBHero) (roles []*pb.BattleRo
roles = make([]*pb.BattleRole, len(heros)) roles = make([]*pb.BattleRole, len(heros))
for i, v := range heros { for i, v := range heros {
if v != nil { if v != nil {
if roles[i], code = this.modelBattle.createBattleRole(v, 200+i, i); code != pb.ErrorCode_Success { if roles[i], code = this.modelBattle.createBattleRole(v, 200+i, i); errdata != nil {
return return
} }
} }

View File

@ -23,7 +23,7 @@ func (this *apiComp) InquireProgress(session comm.IUserSession, req *pb.BuriedIn
condis []*pb.ConIProgress condis []*pb.ConIProgress
err error err error
) )
if code = this.SendCheck(session, req); code != pb.ErrorCode_Success { if code = this.SendCheck(session, req); errdata != nil {
return return
} }

View File

@ -27,25 +27,27 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
) )
update = make(map[string]interface{}) update = make(map[string]interface{})
if code = this.BuyOrSellCheck(session, req); code != pb.ErrorCode_Success { if errdata = this.BuyOrSellCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
caravan, _ := this.module.modelCaravan.getCaravanList(session.GetUserId()) caravan, _ := this.module.modelCaravan.getCaravanList(session.GetUserId())
cityInfo, ok = caravan.City[req.City] if cityInfo, ok = caravan.City[req.City]; !ok {
if !ok { errdata = &pb.ErrorData{
code = pb.ErrorCode_ConfigNoFound Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
}
return return
} }
c, err := this.module.configure.GetCaravanLv(caravan.Lv) c, err := this.module.configure.GetCaravanLv(caravan.Lv)
if err == nil { if err == nil {
upperLimit = c.Bagtagnum // 获取单个格子堆叠数 upperLimit = c.Bagtagnum // 获取单个格子堆叠数
} else { } else {
data = &pb.ErrorData{ errdata = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code), Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(), Message: err.Error(),
} }
code = pb.ErrorCode_ConfigNoFound
return return
} }
@ -56,7 +58,10 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
// 校验背包数据够不够 // 校验背包数据够不够
caravan.Items[k].Count -= v caravan.Items[k].Count -= v
if caravan.Items[k].Count < 0 { if caravan.Items[k].Count < 0 {
code = pb.ErrorCode_TrollItemNoEnough // 道具数量不足 errdata = &pb.ErrorData{
Code: pb.ErrorCode_TrollItemNoEnough, // 道具数量不足
Title: pb.ErrorCode_TrollItemNoEnough.ToString(),
}
return return
} }
items := caravan.Items[k] items := caravan.Items[k]
@ -69,11 +74,11 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
price = cityConf.Specialnum * price / 1000 price = cityConf.Specialnum * price / 1000
bFound = true bFound = true
} else { } else {
data = &pb.ErrorData{ errdata = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code), Code: pb.ErrorCode_TrollItemNoEnough, // 道具数量不足
Title: pb.ErrorCode_TrollItemNoEnough.ToString(),
Message: err.Error(), Message: err.Error(),
} }
code = pb.ErrorCode_ConfigNoFound
return return
} }
break break
@ -87,9 +92,9 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
} }
} }
} else { } else {
code = pb.ErrorCode_DataNotFound errdata = &pb.ErrorData{
data = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, // 道具数量不足
Title: pb.GetErrorCodeMsg(code), Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(), Message: err.Error(),
} }
} }
@ -97,7 +102,10 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
addScore += price * v // 卖出收益 addScore += price * v // 卖出收益
} }
if this.module.ArrayBag(caravan, upperLimit) { // 背包满了 if this.module.ArrayBag(caravan, upperLimit) { // 背包满了
code = pb.ErrorCode_TrollMaxItemCount errdata = &pb.ErrorData{
Code: pb.ErrorCode_TrollMaxItemCount, // 道具数量不足
Title: pb.ErrorCode_TrollMaxItemCount.ToString(),
}
return return
} }
// 统计 收益 // 统计 收益
@ -112,19 +120,25 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
update["lv"] = curLv update["lv"] = curLv
update["baglimit"] = c.Bagtop update["baglimit"] = c.Bagtop
} else { } else {
data = &pb.ErrorData{ errdata = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code), Code: pb.ErrorCode_ConfigNoFound, // 道具数量不足
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(), Message: err.Error(),
} }
code = pb.ErrorCode_ConfigNoFound
return return
} }
} }
caravan.Lv = curLv caravan.Lv = curLv
} }
if len(lvReward) > 0 { if len(lvReward) > 0 {
if reward := this.module.DispenseRes(session, lvReward, true); reward != pb.ErrorCode_Success { if reward := this.module.DispenseRes(session, lvReward, true); reward != nil {
this.module.Errorf("lv reward dispenseRes err:%v", lvReward) this.module.Errorf("lv reward dispenseRes err:%v", lvReward)
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound, // 道具数量不足
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
}
return
} }
} }
@ -148,7 +162,10 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
} }
} }
if !bFound { if !bFound {
code = pb.ErrorCode_TrollCityUnSellItem // 城市不卖这个物品 errdata = &pb.ErrorData{
Code: pb.ErrorCode_TrollCityUnSellItem, // 城市不卖这个物品
Title: pb.ErrorCode_TrollCityUnSellItem.ToString(),
}
return return
} }
caravan.Items[k].Count += v caravan.Items[k].Count += v
@ -159,31 +176,37 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
cityInfo.Count[k] += v cityInfo.Count[k] += v
if itemConf, err := this.configure.GetCaravanGoods(k); err == nil { // 更新商店库存 if itemConf, err := this.configure.GetCaravanGoods(k); err == nil { // 更新商店库存
if cityInfo.Count[k] > itemConf.Goodsnum { if cityInfo.Count[k] > itemConf.Goodsnum {
code = pb.ErrorCode_TrollBuyMax // 商品数量不足 errdata = &pb.ErrorData{
Code: pb.ErrorCode_TrollBuyMax, // 商品数量不足
Title: pb.ErrorCode_TrollBuyMax.ToString(),
}
return return
} }
update["city"] = caravan.City update["city"] = caravan.City
addScore -= price * v addScore -= price * v
} else { } else {
data = &pb.ErrorData{ errdata = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code), Code: pb.ErrorCode_ConfigNoFound, // 商品数量不足
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(), Message: err.Error(),
} }
code = pb.ErrorCode_ConfigNoFound
return return
} }
} }
if this.module.ArrayBag(caravan, upperLimit) { // 背包满了 if this.module.ArrayBag(caravan, upperLimit) { // 背包满了
code = pb.ErrorCode_TrollMaxItemCount errdata = &pb.ErrorData{
Code: pb.ErrorCode_TrollMaxItemCount,
Title: pb.ErrorCode_TrollMaxItemCount.ToString(),
}
return return
} }
} }
if code = this.module.DispenseRes(session, []*cfg.Gameatn{{ if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{{
A: "attr", A: "attr",
T: "merchantmoney", T: "merchantmoney",
N: addScore, N: addScore,
}}, true); code != pb.ErrorCode_Success { }}, true); errdata != nil {
this.module.Errorf("获得虚拟币失败:%d", code) this.module.Errorf("获得虚拟币失败:%v", errdata)
} }
update["items"] = caravan.Items update["items"] = caravan.Items
update["baglimit"] = caravan.Baglimit update["baglimit"] = caravan.Baglimit

View File

@ -18,7 +18,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListRe
resp *pb.CaravanGetListResp resp *pb.CaravanGetListResp
) )
resp = &pb.CaravanGetListResp{} resp = &pb.CaravanGetListResp{}
if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success { if code = this.GetListCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
list, err := this.module.modelCaravan.getCaravanList(session.GetUserId()) list, err := this.module.modelCaravan.getCaravanList(session.GetUserId())
@ -34,7 +34,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListRe
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
} }
if code = this.module.InitCaravanTicket(session, list.Lv); code != pb.ErrorCode_Success { if code = this.module.InitCaravanTicket(session, list.Lv); errdata != nil {
return return
} }
} }

View File

@ -25,7 +25,7 @@ func (this *apiComp) GetStory(session comm.IUserSession, req *pb.CaravanGetStory
) )
resp = &pb.CaravanGetStoryResp{} resp = &pb.CaravanGetStoryResp{}
update = make(map[string]interface{}) update = make(map[string]interface{})
if code = this.GetStoryCheck(session, req); code != pb.ErrorCode_Success { if code = this.GetStoryCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId()) list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId())

View File

@ -26,7 +26,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
) )
resp = &pb.CaravanGotoCityResp{} resp = &pb.CaravanGotoCityResp{}
bNewTask = false bNewTask = false
if code = this.GotoCityCheck(session, req); code != pb.ErrorCode_Success { if code = this.GotoCityCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId()) list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId())
@ -89,7 +89,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
} }
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{res}, true); code != pb.ErrorCode_Success { // 校验门票数量 if code = this.module.ConsumeRes(session, []*cfg.Gameatn{res}, true); errdata != nil { // 校验门票数量
return return
} }

View File

@ -17,7 +17,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.CaravanRankList
rankid int32 rankid int32
) )
resp := &pb.CaravanRankListResp{} resp := &pb.CaravanRankListResp{}
if code = this.RankListCheck(session, req); code != pb.ErrorCode_Success { if code = this.RankListCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
resp.List, rankid = this.module.modelCaravan.GetRankListData(comm.MaxRankList, session.GetUserId()) resp.List, rankid = this.module.modelCaravan.GetRankListData(comm.MaxRankList, session.GetUserId())

View File

@ -17,7 +17,7 @@ func (this *apiComp) RefreshCity(session comm.IUserSession, req *pb.CaravanRefre
resp *pb.CaravanRefreshCityResp resp *pb.CaravanRefreshCityResp
) )
resp = &pb.CaravanRefreshCityResp{} resp = &pb.CaravanRefreshCityResp{}
if code = this.RefreshCityCheck(session, req); code != pb.ErrorCode_Success { if code = this.RefreshCityCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId()) list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId())

View File

@ -291,7 +291,7 @@ func (this *Caravan) TaskComplete(session comm.IUserSession, taskid int32) {
N: v.N, N: v.N,
}) })
} }
if code := this.ModuleBase.DispenseRes(session, conf.Reword, true); code != pb.ErrorCode_Success { if code := this.ModuleBase.DispenseRes(session, conf.Reword, true); errdata != nil {
this.Errorf("Caravan DispenseRes err:%v", conf.Reword) this.Errorf("Caravan DispenseRes err:%v", conf.Reword)
} }
session.SendMsg(string(this.GetType()), "taskcomplete", resp) session.SendMsg(string(this.GetType()), "taskcomplete", resp)

View File

@ -17,7 +17,7 @@ func (this *apiComp) CrossChannel(session comm.IUserSession, req *pb.ChatCrossCh
channel int32 channel int32
err error err error
) )
if code = this.CrossChannelCheck(session, req); code != pb.ErrorCode_Success { if code = this.CrossChannelCheck(session, req); errdata != nil {
return return
} }
if channel, err = this.module.modelChat.addCrossChannelMember(session); err != nil { if channel, err = this.module.modelChat.addCrossChannelMember(session); err != nil {

View File

@ -25,7 +25,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
list []*pb.DBChat list []*pb.DBChat
) )
if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success { if code = this.GetListCheck(session, req); errdata != nil {
return return
} }

View File

@ -30,7 +30,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (errda
userexpand *pb.DBUserExpand userexpand *pb.DBUserExpand
max_chat int32 max_chat int32
) )
if code = this.SendCheck(session, req); code != pb.ErrorCode_Success { if code = this.SendCheck(session, req); errdata != nil {
return return
} }

View File

@ -24,7 +24,7 @@ func (this *apiComp) Ask(session comm.IUserSession, req *pb.CombatAskReq) (errda
ok bool ok bool
err error err error
) )
if code = this.AskCheck(session, req); code != pb.ErrorCode_Success { if code = this.AskCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil { if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil {

View File

@ -19,7 +19,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.CombatChalleng
record *pb.DBBattleRecord record *pb.DBBattleRecord
err error err error
) )
if code = this.ChallengeCheck(session, req); code != pb.ErrorCode_Success { if code = this.ChallengeCheck(session, req); errdata != nil {
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
Message: req.String(), Message: req.String(),
@ -39,7 +39,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.CombatChalleng
Ptype: pb.PlayType_combat, Ptype: pb.PlayType_combat,
Format: req.Battle, Format: req.Battle,
Mformat: manster.FormatList, Mformat: manster.FormatList,
}); code != pb.ErrorCode_Success { }); errdata != nil {
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
Message: req.String(), Message: req.String(),

View File

@ -25,10 +25,10 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
err error err error
) )
if code = this.ChallengeReceiveCheck(session, req); code != pb.ErrorCode_Success { if code = this.ChallengeReceiveCheck(session, req); errdata != nil {
return return
} }
if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success { if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); errdata != nil {
return return
} }
if iswin { if iswin {

View File

@ -22,7 +22,7 @@ func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (err
ok bool ok bool
err error err error
) )
if code = this.DropCheck(session, req); code != pb.ErrorCode_Success { if code = this.DropCheck(session, req); errdata != nil {
return return
} }

View File

@ -19,7 +19,7 @@ func (this *apiComp) In(session comm.IUserSession, req *pb.CombatInReq) (errdata
ok bool ok bool
err error err error
) )
if code = this.InCheck(session, req); code != pb.ErrorCode_Success { if code = this.InCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil { if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil {

View File

@ -19,7 +19,7 @@ func (this *apiComp) UpdateLevel(session comm.IUserSession, req *pb.CombatUpdate
ok bool ok bool
err error err error
) )
if code = this.UpdateLevelCheck(session, req); code != pb.ErrorCode_Success { if code = this.UpdateLevelCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil { if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil {

View File

@ -32,7 +32,7 @@ func (a *apiComp) DoCheck(session comm.IUserSession, req *pb.DispatchDoReq) (err
} }
func (this *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (errdata *pb.ErrorData) { func (this *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (errdata *pb.ErrorData) {
if code = this.DoCheck(session, req); code != pb.ErrorCode_Success { if code = this.DoCheck(session, req); errdata != nil {
return return
} }
@ -61,7 +61,7 @@ func (this *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (errda
//校验门票 //校验门票
ticketAtn := this.module.ModuleTools.GetGlobalConf().DispatchNumtools ticketAtn := this.module.ModuleTools.GetGlobalConf().DispatchNumtools
if code = this.module.CheckRes(session, []*cfg.Gameatn{ticketAtn}); code != pb.ErrorCode_Success { if code = this.module.CheckRes(session, []*cfg.Gameatn{ticketAtn}); errdata != nil {
code = pb.ErrorCode_DispatchTicketNoEnough code = pb.ErrorCode_DispatchTicketNoEnough
return return
} }

View File

@ -19,7 +19,7 @@ func (a *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.DispatchReceiv
} }
func (a *apiComp) Receive(session comm.IUserSession, req *pb.DispatchReceiveReq) (errdata *pb.ErrorData) { func (a *apiComp) Receive(session comm.IUserSession, req *pb.DispatchReceiveReq) (errdata *pb.ErrorData) {
if code = a.ReceiveCheck(session, req); code != pb.ErrorCode_Success { if code = a.ReceiveCheck(session, req); errdata != nil {
return return
} }
d := a.module.modelDispatch.getDBDispatch(session.GetUserId()) d := a.module.modelDispatch.getDBDispatch(session.GetUserId())

View File

@ -41,11 +41,11 @@ func (a *apiComp) Refresh(session comm.IUserSession, req *pb.DispatchRefreshReq)
} }
//消耗金币 //消耗金币
money := a.module.ModuleTools.GetGlobalConf().DispatchCheckmoney money := a.module.ModuleTools.GetGlobalConf().DispatchCheckmoney
if code = a.module.CheckRes(session, []*cfg.Gameatn{money}); code != pb.ErrorCode_Success { if code = a.module.CheckRes(session, []*cfg.Gameatn{money}); errdata != nil {
return return
} }
if code = a.module.ConsumeRes(session, []*cfg.Gameatn{money}, true); code != pb.ErrorCode_Success { if code = a.module.ConsumeRes(session, []*cfg.Gameatn{money}, true); errdata != nil {
return return
} }
if err := a.module.modelDispatch.updateRefreshCount(session.GetUserId(), d.Nb); err != nil { if err := a.module.modelDispatch.updateRefreshCount(session.GetUserId(), d.Nb); err != nil {

View File

@ -16,7 +16,7 @@ func (a *apiComp) WeekreciveCheck(session comm.IUserSession, req *pb.DispatchWee
} }
func (a *apiComp) Weekrecive(session comm.IUserSession, req *pb.DispatchWeekReciveReq) (errdata *pb.ErrorData) { func (a *apiComp) Weekrecive(session comm.IUserSession, req *pb.DispatchWeekReciveReq) (errdata *pb.ErrorData) {
if code = a.WeekreciveCheck(session, req); code != pb.ErrorCode_Success { if code = a.WeekreciveCheck(session, req); errdata != nil {
return return
} }
rsp := &pb.DispatchWeekReciveResp{} rsp := &pb.DispatchWeekReciveResp{}

View File

@ -22,7 +22,7 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.EnchantCh
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallengeReq) (errdata *pb.ErrorData) { func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallengeReq) (errdata *pb.ErrorData) {
code = this.ChallengeCheck(session, req) code = this.ChallengeCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId()) enchant, err := this.module.modelEnchant.getEnchantList(session.GetUserId())
@ -44,7 +44,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
} }
if code = this.module.CheckRes(session, cfgData[0].PsConsume); code != pb.ErrorCode_Success { if code = this.module.CheckRes(session, cfgData[0].PsConsume); errdata != nil {
code = pb.ErrorCode_ItemsNoEnough code = pb.ErrorCode_ItemsNoEnough
return return
@ -72,7 +72,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen
Mformat: format, Mformat: format,
}) })
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
session.SendMsg(string(this.module.GetType()), EnchantChallengeResp, &pb.EnchantChallengeResp{ session.SendMsg(string(this.module.GetType()), EnchantChallengeResp, &pb.EnchantChallengeResp{

View File

@ -27,7 +27,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
mapData = make(map[string]interface{}, 0) mapData = make(map[string]interface{}, 0)
// reward = make([]*cfg.Gameatn, 0) // reward = make([]*cfg.Gameatn, 0)
code = this.ChallengeOverCheck(session, req) code = this.ChallengeOverCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
@ -49,18 +49,18 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
// check // check
code, bWin = this.module.battle.CheckBattleReport(session, req.Report) code, bWin = this.module.battle.CheckBattleReport(session, req.Report)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
if !bWin { // 战斗失败了 直接返回 if !bWin { // 战斗失败了 直接返回
if code = this.module.ConsumeRes(session, cfgEnchant[0].PsMg, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, cfgEnchant[0].PsMg, true); errdata != nil {
return return
} }
session.SendMsg(string(this.module.GetType()), EnchantChallengeOverResp, &pb.EnchantChallengeOverResp{Data: enchant}) session.SendMsg(string(this.module.GetType()), EnchantChallengeOverResp, &pb.EnchantChallengeOverResp{Data: enchant})
return return
} }
if code = this.module.ConsumeRes(session, cfgEnchant[0].PsConsume, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, cfgEnchant[0].PsConsume, true); errdata != nil {
return return
} }
key := req.BossType key := req.BossType
@ -77,7 +77,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
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.configure.GetDropReward(v1) // 获取掉落奖励 reward := this.module.configure.GetDropReward(v1) // 获取掉落奖励
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, reward, true); errdata != nil {
return return
} }
} }

View File

@ -17,7 +17,7 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.EnchantGetL
func (this *apiComp) GetList(session comm.IUserSession, req *pb.EnchantGetListReq) (errdata *pb.ErrorData) { func (this *apiComp) GetList(session comm.IUserSession, req *pb.EnchantGetListReq) (errdata *pb.ErrorData) {
// 刷新挑战卷 // 刷新挑战卷
if code = this.module.ModuleItems.RecoverTicket(session); code != pb.ErrorCode_Success { if code = this.module.ModuleItems.RecoverTicket(session); errdata != nil {
return return
} }

View File

@ -23,7 +23,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.EnchantRankList
rd *redis.StringSliceCmd rd *redis.StringSliceCmd
) )
code = this.RankListCheck(session, req) code = this.RankListCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
conn, _ := db.Local() conn, _ := db.Local()

View File

@ -31,7 +31,7 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
AttrValue int32 AttrValue int32
err error err error
) )
if code = this.EnchCheck(session, req); code != pb.ErrorCode_Success { if code = this.EnchCheck(session, req); errdata != nil {
return return
} }
if conf, err = this.module.configure.getEquipenchanting(req.Itemid); err != nil { if conf, err = this.module.configure.getEquipenchanting(req.Itemid); err != nil {
@ -49,7 +49,7 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
T: req.Itemid, T: req.Itemid,
N: 1, N: 1,
}) })
if code = this.module.ConsumeRes(session, need, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, need, true); errdata != nil {
return return
} }
@ -91,7 +91,7 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
} }
if equip.HeroId != "" { if equip.HeroId != "" {
equipments = make([]*pb.DB_Equipment, 8) equipments = make([]*pb.DB_Equipment, 8)
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equip.HeroId); code != pb.ErrorCode_Success { if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equip.HeroId); errdata != nil {
this.module.Errorf("Upgrade code:%d", code) this.module.Errorf("Upgrade code:%d", code)
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
@ -116,7 +116,7 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
} }
} }
} }
if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); code != pb.ErrorCode_Success { if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); errdata != nil {
return return
} }
} }

View File

@ -38,7 +38,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
) )
if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success { if code = this.EquipCheck(session, req); errdata != nil {
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
Message: req.String(), Message: req.String(),
@ -50,7 +50,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
equipments = make([]*pb.DB_Equipment, len(req.EquipmentId)) equipments = make([]*pb.DB_Equipment, len(req.EquipmentId))
//获取英雄数据 //获取英雄数据
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), req.HeroCardId); code != pb.ErrorCode_Success { if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), req.HeroCardId); errdata != nil {
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
Message: fmt.Sprintf("获取英雄数据失败:%s", req.HeroCardId), Message: fmt.Sprintf("获取英雄数据失败:%s", req.HeroCardId),
@ -196,7 +196,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
hero.Suite2Lv = 0 hero.Suite2Lv = 0
} }
//更新装备数据加成 //更新装备数据加成
if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); code != pb.ErrorCode_Success { if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); errdata != nil {
this.module.Errorf("Equip ModuleHero UpdateEquipment code%v", code) this.module.Errorf("Equip ModuleHero UpdateEquipment code%v", code)
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),

View File

@ -26,7 +26,7 @@ func (this *apiComp) Forg(session comm.IUserSession, req *pb.EquipmentForgReq) (
reward []*pb.UserAssets reward []*pb.UserAssets
err error err error
) )
if code = this.ForgCheck(session, req); code != pb.ErrorCode_Success { if code = this.ForgCheck(session, req); errdata != nil {
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
Message: req.String(), Message: req.String(),
@ -59,11 +59,11 @@ func (this *apiComp) Forg(session comm.IUserSession, req *pb.EquipmentForgReq) (
index := comm.GetRandW(conf.Probability) index := comm.GetRandW(conf.Probability)
equis[conf.Equip[index]]++ equis[conf.Equip[index]]++
} }
if code = this.module.ConsumeRes(session, need, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, need, true); errdata != nil {
return return
} }
if _, code = this.module.AddNewEquipments(session, equis, true); code != pb.ErrorCode_Success { if _, code = this.module.AddNewEquipments(session, equis, true); errdata != nil {
return return
} }

View File

@ -22,7 +22,7 @@ func (this *apiComp) Lock(session comm.IUserSession, req *pb.EquipmentLockReq) (
err error err error
equipment *pb.DB_Equipment equipment *pb.DB_Equipment
) )
if code = this.LockCheck(session, req); code != pb.ErrorCode_Success { if code = this.LockCheck(session, req); errdata != nil {
return return
} }
if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.EquipmentId); err != nil { if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.EquipmentId); err != nil {

View File

@ -27,7 +27,7 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.EquipmentSellReq) (
confs []*cfg.GameEquipData confs []*cfg.GameEquipData
sale [][]*cfg.Gameatn sale [][]*cfg.Gameatn
) )
if code = this.SellCheck(session, req); code != pb.ErrorCode_Success { if code = this.SellCheck(session, req); errdata != nil {
return return
} }
if equipments, err = this.module.modelEquipment.QueryUserEquipmentsByIds(session.GetUserId(), req.EquipIds); err != nil { if equipments, err = this.module.modelEquipment.QueryUserEquipmentsByIds(session.GetUserId(), req.EquipIds); err != nil {
@ -85,10 +85,10 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.EquipmentSellReq) (
for _, v := range sale { for _, v := range sale {
sales = append(sales, v...) sales = append(sales, v...)
} }
if code = this.module.DispenseRes(session, sales, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, sales, true); errdata != nil {
return return
} }
if code = this.module.DelEquipments(session, req.EquipIds, true); code != pb.ErrorCode_Success { if code = this.module.DelEquipments(session, req.EquipIds, true); errdata != nil {
return return
} }
session.SendMsg(string(this.module.GetType()), "sell", &pb.EquipmentSellResp{IsSucc: true}) session.SendMsg(string(this.module.GetType()), "sell", &pb.EquipmentSellResp{IsSucc: true})

View File

@ -40,7 +40,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
user *pb.DBUser user *pb.DBUser
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
) )
if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success { if code = this.UpgradeCheck(session, req); errdata != nil {
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
Message: req.String(), Message: req.String(),
@ -75,7 +75,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
} }
return return
} }
if code = this.module.ConsumeRes(session, intensify.Need, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, intensify.Need, true); errdata != nil {
return return
} }
if equipment.KeepFailNum >= intensify.Num { //没有达到保底次数 根据概率随机成功失败 if equipment.KeepFailNum >= intensify.Num { //没有达到保底次数 根据概率随机成功失败
@ -175,7 +175,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
confs = make([]*cfg.GameEquipData, 8) confs = make([]*cfg.GameEquipData, 8)
//已装备 重新计算属性 //已装备 重新计算属性
if equipment.HeroId != "" { if equipment.HeroId != "" {
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equipment.HeroId); code != pb.ErrorCode_Success { if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equipment.HeroId); errdata != nil {
this.module.Errorf("Upgrade code:%d", code) this.module.Errorf("Upgrade code:%d", code)
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),

View File

@ -28,7 +28,7 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
adverbEntry []*pb.EquipmentAttributeEntry adverbEntry []*pb.EquipmentAttributeEntry
err error err error
) )
if code = this.WashCheck(session, req); code != pb.ErrorCode_Success { if code = this.WashCheck(session, req); errdata != nil {
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
Message: req.String(), Message: req.String(),
@ -54,7 +54,7 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
return return
} }
gole := this.module.ModuleTools.GetGlobalConf().EquipmentConsumption[conf.Color-1] gole := this.module.ModuleTools.GetGlobalConf().EquipmentConsumption[conf.Color-1]
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{{A: comm.AttrType, T: comm.ResGold, N: gole}}, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, []*cfg.Gameatn{{A: comm.AttrType, T: comm.ResGold, N: gole}}, true); errdata != nil {
return return
} }

View File

@ -25,7 +25,7 @@ func (this *apiComp) WashConfirm(session comm.IUserSession, req *pb.EquipmentWas
attrlibrary *cfg.GameEquipAttrlibrarySData attrlibrary *cfg.GameEquipAttrlibrarySData
err error err error
) )
if code = this.WashConfirmCheck(session, req); code != pb.ErrorCode_Success { if code = this.WashConfirmCheck(session, req); errdata != nil {
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
Message: req.String(), Message: req.String(),

View File

@ -273,10 +273,10 @@ func (this *Equipment) SellEquipments(session comm.IUserSession, equs []string)
for _, v := range sale { for _, v := range sale {
sales = append(sales, v...) sales = append(sales, v...)
} }
if code, atno = this.DispenseAtno(session, sales, true); code != pb.ErrorCode_Success { if code, atno = this.DispenseAtno(session, sales, true); errdata != nil {
return return
} }
if code = this.DelEquipments(session, equs, true); code != pb.ErrorCode_Success { if code = this.DelEquipments(session, equs, true); errdata != nil {
return return
} }
return return
@ -335,10 +335,10 @@ func (this *Equipment) RecycleEquipments(session comm.IUserSession, equs []strin
for _, v := range sale { for _, v := range sale {
sales = append(sales, v...) sales = append(sales, v...)
} }
if code, atno = this.DispenseAtno(session, sales, true); code != pb.ErrorCode_Success { if code, atno = this.DispenseAtno(session, sales, true); errdata != nil {
return return
} }
if code = this.DelEquipments(session, equs, true); code != pb.ErrorCode_Success { if code = this.DelEquipments(session, equs, true); errdata != nil {
return return
} }
return return

View File

@ -22,7 +22,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ForumGetListReq)
err error err error
list []*pb.DBComment list []*pb.DBComment
) )
if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success { if code = this.GetListCheck(session, req); errdata != nil {
return return
} }
if list, err = this.module.modelForum.getComment(req.Herocid); err != nil { if list, err = this.module.modelForum.getComment(req.Herocid); err != nil {

View File

@ -25,7 +25,7 @@ func (this *apiComp) ReleaseComment(session comm.IUserSession, req *pb.ForumRele
err error err error
comment *pb.DBComment comment *pb.DBComment
) )
if code = this.ReleaseCommentCheck(session, req); code != pb.ErrorCode_Success { if code = this.ReleaseCommentCheck(session, req); errdata != nil {
return return
} }
comment = &pb.DBComment{ comment = &pb.DBComment{

View File

@ -23,7 +23,7 @@ func (this *apiComp) WatchHero(session comm.IUserSession, req *pb.ForumWatchHero
err error err error
equip []*pb.DB_Equipment equip []*pb.DB_Equipment
) )
if code = this.WatchHeroCheck(session, req); code != pb.ErrorCode_Success { if code = this.WatchHeroCheck(session, req); errdata != nil {
return return
} }
if hero, err = this.module.modelForum.watchHero(req.Stag, req.Uid, req.HerocId); err != nil { if hero, err = this.module.modelForum.watchHero(req.Stag, req.Uid, req.HerocId); err != nil {

View File

@ -20,7 +20,7 @@ func (this *apiComp) AcceptCheck(session comm.IUserSession, req *pb.FriendAccept
} }
func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq) (errdata *pb.ErrorData) { func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq) (errdata *pb.ErrorData) {
if code = this.AcceptCheck(session, req); code != pb.ErrorCode_Success { if code = this.AcceptCheck(session, req); errdata != nil {
return return
} }

View File

@ -21,7 +21,7 @@ func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.FriendAddB
} }
func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackReq) (errdata *pb.ErrorData) { func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackReq) (errdata *pb.ErrorData) {
if code = this.AddblackCheck(session, req); code != pb.ErrorCode_Success { if code = this.AddblackCheck(session, req); errdata != nil {
return return
} }

View File

@ -22,7 +22,7 @@ func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.FriendAgreeRe
} }
func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (errdata *pb.ErrorData) { func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (errdata *pb.ErrorData) {
if code = this.AgreeCheck(session, req); code != pb.ErrorCode_Success { if code = this.AgreeCheck(session, req); errdata != nil {
return return
} }
var ( var (

View File

@ -21,7 +21,7 @@ func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.FriendApplyRe
} }
func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (errdata *pb.ErrorData) { func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (errdata *pb.ErrorData) {
if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success { if code = this.ApplyCheck(session, req); errdata != nil {
return return
} }

View File

@ -21,7 +21,7 @@ func (this *apiComp) AssistheroCheck(session comm.IUserSession, req *pb.FriendAs
} }
func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssistheroReq) (errdata *pb.ErrorData) { func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssistheroReq) (errdata *pb.ErrorData) {
if code = this.AssistheroCheck(session, req); code != pb.ErrorCode_Success { if code = this.AssistheroCheck(session, req); errdata != nil {
return return
} }
uid := session.GetUserId() uid := session.GetUserId()

View File

@ -20,7 +20,7 @@ func (this *apiComp) DelCheck(session comm.IUserSession, req *pb.FriendDelReq) (
} }
func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (errdata *pb.ErrorData) { func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (errdata *pb.ErrorData) {
if code = this.DelCheck(session, req); code != pb.ErrorCode_Success { if code = this.DelCheck(session, req); errdata != nil {
return return
} }

View File

@ -20,7 +20,7 @@ func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.FriendDelB
} }
func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackReq) (errdata *pb.ErrorData) { func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackReq) (errdata *pb.ErrorData) {
if code = this.DelblackCheck(session, req); code != pb.ErrorCode_Success { if code = this.DelblackCheck(session, req); errdata != nil {
return return
} }
var ( var (

View File

@ -20,7 +20,7 @@ func (this *apiComp) GetRelationCheck(session comm.IUserSession, req *pb.FriendG
} }
func (this *apiComp) GetRelation(session comm.IUserSession, req *pb.FriendGetRelationReq) (errdata *pb.ErrorData) { func (this *apiComp) GetRelation(session comm.IUserSession, req *pb.FriendGetRelationReq) (errdata *pb.ErrorData) {
if code = this.GetRelationCheck(session, req); code != pb.ErrorCode_Success { if code = this.GetRelationCheck(session, req); errdata != nil {
return return
} }

View File

@ -39,7 +39,7 @@ func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewar
} }
globalConf := this.module.ModuleTools.GetGlobalConf() globalConf := this.module.ModuleTools.GetGlobalConf()
if code = this.module.DispenseRes(session, globalConf.FriendPeize, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, globalConf.FriendPeize, true); errdata != nil {
this.module.Error("好友领奖励", this.module.Error("好友领奖励",
log.Field{Key: "uid", Value: uid}, log.Field{Key: "uid", Value: uid},
log.Field{Key: "reward", Value: globalConf.FriendPeize}, log.Field{Key: "reward", Value: globalConf.FriendPeize},

View File

@ -18,7 +18,7 @@ func (this *apiComp) QiecuoCheck(session comm.IUserSession, req *pb.FriendQiecuo
} }
func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.FriendQiecuoReq) (errdata *pb.ErrorData) { func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.FriendQiecuoReq) (errdata *pb.ErrorData) {
if code = this.QiecuoCheck(session, req); code != pb.ErrorCode_Success { if code = this.QiecuoCheck(session, req); errdata != nil {
return return
} }

View File

@ -22,7 +22,7 @@ func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.FriendRefuse
// 单个/批量拒绝 // 单个/批量拒绝
func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq) (errdata *pb.ErrorData) { func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq) (errdata *pb.ErrorData) {
if code = this.RefuseCheck(session, req); code != pb.ErrorCode_Success { if code = this.RefuseCheck(session, req); errdata != nil {
return return
} }
uid := session.GetUserId() uid := session.GetUserId()

View File

@ -18,7 +18,7 @@ func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearch
} }
func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq) (errdata *pb.ErrorData) { func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq) (errdata *pb.ErrorData) {
if code = this.SearchCheck(session, req); code != pb.ErrorCode_Success { if code = this.SearchCheck(session, req); errdata != nil {
return return
} }

View File

@ -11,7 +11,7 @@ func (this *apiComp) StopCheck(session comm.IUserSession, req *pb.FriendStopReq)
} }
func (this *apiComp) Stop(session comm.IUserSession, req *pb.FriendStopReq) (errdata *pb.ErrorData) { func (this *apiComp) Stop(session comm.IUserSession, req *pb.FriendStopReq) (errdata *pb.ErrorData) {
if code = this.StopCheck(session, req); code != pb.ErrorCode_Success { if code = this.StopCheck(session, req); errdata != nil {
return return
} }

View File

@ -20,7 +20,7 @@ func (this *apiComp) ZanCheck(session comm.IUserSession, req *pb.FriendZanReq) (
} }
func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (errdata *pb.ErrorData) { func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (errdata *pb.ErrorData) {
if code = this.ZanCheck(session, req); code != pb.ErrorCode_Success { if code = this.ZanCheck(session, req); errdata != nil {
return return
} }

View File

@ -12,7 +12,7 @@ func (this *apiComp) ZanlistCheck(session comm.IUserSession, req *pb.FriendZanli
// Deprecated: // Deprecated:
func (this *apiComp) Zanlist(session comm.IUserSession, req *pb.FriendZanlistReq) (errdata *pb.ErrorData) { func (this *apiComp) Zanlist(session comm.IUserSession, req *pb.FriendZanlistReq) (errdata *pb.ErrorData) {
if code = this.ZanlistCheck(session, req); code != pb.ErrorCode_Success { if code = this.ZanlistCheck(session, req); errdata != nil {
return return
} }

View File

@ -21,7 +21,7 @@ func (this *apiComp) ZanreceiveCheck(session comm.IUserSession, req *pb.FriendZa
} }
func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanreceiveReq) (errdata *pb.ErrorData) { func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanreceiveReq) (errdata *pb.ErrorData) {
if code = this.ZanreceiveCheck(session, req); code != pb.ErrorCode_Success { if code = this.ZanreceiveCheck(session, req); errdata != nil {
return return
} }

View File

@ -52,7 +52,7 @@ func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (errd
///解析GM 指令 ///解析GM 指令
func (this *apiComp) Cmd(session comm.IUserSession, req *pb.GMCmdReq) (errdata *pb.ErrorData) { func (this *apiComp) Cmd(session comm.IUserSession, req *pb.GMCmdReq) (errdata *pb.ErrorData) {
if code = this.CmdCheck(session, req); code != pb.ErrorCode_Success { if code = this.CmdCheck(session, req); errdata != nil {
return return
} }
var ( var (

View File

@ -147,7 +147,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
}) })
} }
code = this.DispenseRes(session, res, true) code = this.DispenseRes(session, res, true)
if code != pb.ErrorCode_Success { if errdata != nil {
this.Errorf("资源发放失败,%v", code) this.Errorf("资源发放失败,%v", code)
} }
this.Debug("使用bingo命令", this.Debug("使用bingo命令",
@ -331,7 +331,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
} }
code = this.DispenseRes(session, res, true) code = this.DispenseRes(session, res, true)
if code != pb.ErrorCode_Success { if errdata != nil {
this.Errorf("资源发放失败,%v", code) this.Errorf("资源发放失败,%v", code)
} }
this.Debug("使用bingo命令", this.Debug("使用bingo命令",
@ -374,7 +374,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
return return
} }
for i := 0; i < num; i++ { for i := 0; i < num; i++ {
if code = module1.(comm.IPay).ModulePayDelivery(session, "8", 64800); code != pb.ErrorCode_Success { if code = module1.(comm.IPay).ModulePayDelivery(session, "8", 64800); errdata != nil {
return return
} }
} }
@ -390,7 +390,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
return return
} }
if code = module1.(comm.IItems).CleanItems(session); code != pb.ErrorCode_Success { if code = module1.(comm.IItems).CleanItems(session); errdata != nil {
return return
} }
@ -404,7 +404,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
return return
} }
if code = module1.(comm.IEquipment).AddAllEquipments(session); code != pb.ErrorCode_Success { if code = module1.(comm.IEquipment).AddAllEquipments(session); errdata != nil {
return return
} }
@ -422,7 +422,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
// return // return
// } // }
if module, err := this.service.GetModule(comm.ModuleChat); err == nil { if module, err := this.service.GetModule(comm.ModuleChat); err == nil {
if code = module.(comm.IChat).SendSysChatToWorld(comm.ChatSystem10, nil, 5, 0, "xxx", "25001"); code != pb.ErrorCode_Success { if code = module.(comm.IChat).SendSysChatToWorld(comm.ChatSystem10, nil, 5, 0, "xxx", "25001"); errdata != nil {
return return
} }
} }
@ -455,7 +455,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
T: v.Id, T: v.Id,
N: int32(num2), N: int32(num2),
} }
if code = this.DispenseRes(session, []*cfg.Gameatn{res}, true); code != pb.ErrorCode_Success { if code = this.DispenseRes(session, []*cfg.Gameatn{res}, true); errdata != nil {
this.Debugf("DispenseRes err :uid = %s,code = %d", datas[0], code) this.Debugf("DispenseRes err :uid = %s,code = %d", datas[0], code)
} }
} }

View File

@ -21,7 +21,7 @@ func (this *apiComp) ActivateAtlasCheck(session comm.IUserSession, req *pb.Gourm
func (this *apiComp) ActivateAtlas(session comm.IUserSession, req *pb.GourmetActivateAtlasReq) (errdata *pb.ErrorData) { func (this *apiComp) ActivateAtlas(session comm.IUserSession, req *pb.GourmetActivateAtlasReq) (errdata *pb.ErrorData) {
code = this.ActivateAtlasCheck(session, req) code = this.ActivateAtlasCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
conf, err := this.configure.GetGrormetCookBookConf(req.Cid) conf, err := this.configure.GetGrormetCookBookConf(req.Cid)

View File

@ -25,7 +25,7 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate
bFirst bool // 是否首次获得 bFirst bool // 是否首次获得
) )
code = this.CreateFoodCheck(session, req) code = this.CreateFoodCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
conf, err := this.configure.GetGrormetCookBookConf(req.Cid) conf, err := this.configure.GetGrormetCookBookConf(req.Cid)
@ -56,7 +56,7 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate
return return
} }
// 构建消耗 // 构建消耗
if code = this.module.CheckRes(session, res); code != pb.ErrorCode_Success { if code = this.module.CheckRes(session, res); errdata != nil {
return return
} }
@ -65,7 +65,7 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
} }
if code = this.module.ConsumeRes(session, res, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, res, true); errdata != nil {
return return
} }
atn := &cfg.Gameatn{ atn := &cfg.Gameatn{

View File

@ -15,7 +15,7 @@ func (this *apiComp) AtlasCheck(session comm.IUserSession, req *pb.GourmetAtlasR
func (this *apiComp) Atlas(session comm.IUserSession, req *pb.GourmetAtlasReq) (errdata *pb.ErrorData) { func (this *apiComp) Atlas(session comm.IUserSession, req *pb.GourmetAtlasReq) (errdata *pb.ErrorData) {
code = this.AtlasCheck(session, req) code = this.AtlasCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
_gourmet, err := this.module.modelAtlas.getGourmetAtlasList(session.GetUserId()) _gourmet, err := this.module.modelAtlas.getGourmetAtlasList(session.GetUserId())

View File

@ -33,7 +33,7 @@ func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.GourmetGetRa
) )
mapUser = make(map[string]struct{}, 0) mapUser = make(map[string]struct{}, 0)
code = this.GetRandUserCheck(session, req) code = this.GetRandUserCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }

View File

@ -18,7 +18,7 @@ func (this *apiComp) AdvreceiveCheck(session comm.IUserSession, req *pb.Growtask
} }
func (this *apiComp) Advreceive(session comm.IUserSession, req *pb.GrowtaskAdvReceiveReq) (errdata *pb.ErrorData) { func (this *apiComp) Advreceive(session comm.IUserSession, req *pb.GrowtaskAdvReceiveReq) (errdata *pb.ErrorData) {
if code = this.AdvreceiveCheck(session, req); code != pb.ErrorCode_Success { if code = this.AdvreceiveCheck(session, req); errdata != nil {
return return
} }
@ -70,7 +70,7 @@ func (this *apiComp) Advreceive(session comm.IUserSession, req *pb.GrowtaskAdvRe
} }
if conf, ok := rewardCnf.GetDataMap()[req.TaskType]; ok { if conf, ok := rewardCnf.GetDataMap()[req.TaskType]; ok {
if code := this.module.DispenseRes(session, conf.Allreward, true); code != pb.ErrorCode_Success { if code := this.module.DispenseRes(session, conf.Allreward, true); errdata != nil {
this.module.Errorf("进阶奖励发放失败 taskType:%v uid:%v", req.TaskType, uid) this.module.Errorf("进阶奖励发放失败 taskType:%v uid:%v", req.TaskType, uid)
} }
} }

View File

@ -18,7 +18,7 @@ func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.GrowtaskRec
} }
func (this *apiComp) Receive(session comm.IUserSession, req *pb.GrowtaskReceiveReq) (errdata *pb.ErrorData) { func (this *apiComp) Receive(session comm.IUserSession, req *pb.GrowtaskReceiveReq) (errdata *pb.ErrorData) {
if code = this.ReceiveCheck(session, req); code != pb.ErrorCode_Success { if code = this.ReceiveCheck(session, req); errdata != nil {
return return
} }
@ -42,7 +42,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.GrowtaskReceiveR
} }
if conf, ok := ggt.GetDataMap()[req.TaskId]; ok { if conf, ok := ggt.GetDataMap()[req.TaskId]; ok {
if code := this.module.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success { if code := this.module.DispenseRes(session, conf.Reward, true); errdata != nil {
this.module.Errorf("子任务奖励发放失败 taskId:%v uid:%v", req.TaskId, uid) this.module.Errorf("子任务奖励发放失败 taskId:%v uid:%v", req.TaskId, uid)
} }
} }

View File

@ -34,11 +34,11 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
_heroMap = make(map[string]interface{}, 0) _heroMap = make(map[string]interface{}, 0)
chanegCard = make([]*pb.DBHero, 0) chanegCard = make([]*pb.DBHero, 0)
code = this.AwakenCheck(session, req) // check code = this.AwakenCheck(session, req) // check
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID) _hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
@ -63,7 +63,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
} }
// 消耗校验 // 消耗校验
code = this.module.ConsumeRes(session, awakenData.Phaseneed, true) code = this.module.ConsumeRes(session, awakenData.Phaseneed, true)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }

View File

@ -35,7 +35,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (errdata
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
) )
update = make(map[string]interface{}) update = make(map[string]interface{})
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success { if code = this.BuyCheck(session, req); errdata != nil {
return return
} }
if udata = this.module.ModuleUser.GetUser(session.GetUserId()); udata == nil { if udata = this.module.ModuleUser.GetUser(session.GetUserId()); udata == nil {
@ -98,7 +98,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (errdata
} }
} }
// 消耗 // 消耗
if code = this.module.ConsumeRes(session, need, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, need, true); errdata != nil {
return return
} }
give = make([]*cfg.Gameatn, len(conf.Iteminfo)) give = make([]*cfg.Gameatn, len(conf.Iteminfo))
@ -110,7 +110,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (errdata
} }
} }
// 获得的道具 // 获得的道具
if code = this.module.DispenseRes(session, give, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, give, true); errdata != nil {
return return
} }

View File

@ -42,7 +42,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
return return
} }
code = this.DrawCardCheck(session, req) code = this.DrawCardCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
szCards = make([]string, 0) szCards = make([]string, 0)
@ -60,7 +60,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
} }
costRes = append(costRes, costAtn) costRes = append(costRes, costAtn)
code = this.module.CheckRes(session, costRes) code = this.module.CheckRes(session, costRes)
if code != pb.ErrorCode_Success { // 消耗数量不足直接返回 if errdata != nil { // 消耗数量不足直接返回
return return
} }
@ -246,7 +246,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
//阵营消耗 //阵营消耗
code = this.module.CheckRes(session, costRes) code = this.module.CheckRes(session, costRes)
if code != pb.ErrorCode_Success { // 消耗数量不足直接返回 if errdata != nil { // 消耗数量不足直接返回
return return
} }
for { for {
@ -311,7 +311,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
// 消耗道具 // 消耗道具
code = this.module.ConsumeRes(session, costRes, true) code = this.module.ConsumeRes(session, costRes, true)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
heroRecord.Totalcount += req.DrawCount heroRecord.Totalcount += req.DrawCount

View File

@ -28,7 +28,7 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (e
ChangeList = make([]*pb.DBHero, 0) ChangeList = make([]*pb.DBHero, 0)
_costMaphero = make(map[string]*pb.DBHero, 0) _costMaphero = make(map[string]*pb.DBHero, 0)
mapHero = make(map[string]int32) mapHero = make(map[string]int32)
if code = this.FusionCheck(session, req); code != pb.ErrorCode_Success { if code = this.FusionCheck(session, req); errdata != nil {
return return
} }
conf, err := this.module.configure.GetHeroFucionConfig(req.HeroId) conf, err := this.module.configure.GetHeroFucionConfig(req.HeroId)
@ -82,7 +82,7 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (e
for k, v := range req.Heros { for k, v := range req.Heros {
//mapHero[_costMaphero[k].HeroID] //mapHero[_costMaphero[k].HeroID]
code = this.module.DelCard(session.GetUserId(), _costMaphero[k], v) code = this.module.DelCard(session.GetUserId(), _costMaphero[k], v)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
ChangeList = append(ChangeList, _costMaphero[k]) ChangeList = append(ChangeList, _costMaphero[k])
@ -94,7 +94,7 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (e
T: conf.Hero, T: conf.Hero,
N: 1, N: 1,
} }
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, false); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, false); errdata != nil {
this.module.Errorf("err:%v,create hero:%s,uid,%ss", code, conf.Hero, session.GetUserId()) this.module.Errorf("err:%v,create hero:%s,uid,%ss", code, conf.Hero, session.GetUserId())
code = pb.ErrorCode_HeroCreate // 创建新英雄失败 code = pb.ErrorCode_HeroCreate // 创建新英雄失败

View File

@ -24,7 +24,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.HeroInfoReq) (errda
uid string uid string
) )
if code = this.InfoCheck(session, req); code != pb.ErrorCode_Success { if code = this.InfoCheck(session, req); errdata != nil {
return return
} }
rsp := &pb.HeroInfoResp{} rsp := &pb.HeroInfoResp{}

View File

@ -25,11 +25,11 @@ func (this *apiComp) Lock(session comm.IUserSession, req *pb.HeroLockReq) (errda
_hero *pb.DBHero _hero *pb.DBHero
) )
code = this.LockCheck(session, req) // check code = this.LockCheck(session, req) // check
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.Heroid) _hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.Heroid)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
_hero.Block = !_hero.Block // 修改是否锁定状态 _hero.Block = !_hero.Block // 修改是否锁定状态

View File

@ -23,7 +23,7 @@ func (this *apiComp) GetSpecifiedCheck(session comm.IUserSession, req *pb.HeroGe
func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (errdata *pb.ErrorData) { func (this *apiComp) GetSpecified(session comm.IUserSession, req *pb.HeroGetSpecifiedReq) (errdata *pb.ErrorData) {
code = this.GetSpecifiedCheck(session, req) // check code = this.GetSpecifiedCheck(session, req) // check
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
hero, err := this.module.modelHero.createSpecialHero(session.GetUserId(), req.HeroCoinfigID) hero, err := this.module.modelHero.createSpecialHero(session.GetUserId(), req.HeroCoinfigID)

View File

@ -29,11 +29,11 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
lvUpCount int32 // 技能升级的次数 lvUpCount int32 // 技能升级的次数
) )
code = this.StrengthenUpSkillCheck(session, req) // check code = this.StrengthenUpSkillCheck(session, req) // check
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在 _hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID) // 查询目标卡是否存在
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
// 查询配置表 找出原始品质 // 查询配置表 找出原始品质
@ -69,7 +69,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
} }
// 检查消耗 // 检查消耗
if code = this.module.CheckRes(session, cost); code != pb.ErrorCode_Success { if code = this.module.CheckRes(session, cost); errdata != nil {
return return
} }
for i := 0; i < int(lvUpCount); i++ { // 升级技能 for i := 0; i < int(lvUpCount); i++ { // 升级技能
@ -100,7 +100,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
_hero.NormalSkill[szIndex[upSkillPos]].SkillLv += 1 _hero.NormalSkill[szIndex[upSkillPos]].SkillLv += 1
} }
if code = this.module.ConsumeRes(session, cost, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, cost, true); errdata != nil {
return return
} }

View File

@ -27,11 +27,11 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
err error err error
) )
code = this.StrengthenUpStarCheck(session, req) // check code = this.StrengthenUpStarCheck(session, req) // check
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID) _hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
@ -60,13 +60,13 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
return return
} }
if code = this.module.ConsumeRes(session, starConf.Needrace, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, starConf.Needrace, true); errdata != nil {
return return
} }
// 加对应的天赋点数 // 加对应的天赋点数
if len(starConf.Starup) > 0 { if len(starConf.Starup) > 0 {
if code = this.module.DispenseRes(session, starConf.Starup, true); code != pb.ErrorCode_Success { // 加天赋点{ if code = this.module.DispenseRes(session, starConf.Starup, true); errdata != nil { // 加天赋点{
this.module.Errorf("DispenseRes err:uid:%s,res:%v", session.GetUserId(), starConf.Starup) this.module.Errorf("DispenseRes err:uid:%s,res:%v", session.GetUserId(), starConf.Starup)
} }
} }

View File

@ -29,12 +29,12 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
cost []*cfg.Gameatn // 消耗的道具 cost []*cfg.Gameatn // 消耗的道具
) )
code = this.StrengthenUplvCheck(session, req) // check code = this.StrengthenUplvCheck(session, req) // check
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
_hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID) _hero, code = this.module.GetHeroByObjID(session.GetUserId(), req.HeroObjID)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
for k, v := range req.Item { for k, v := range req.Item {
@ -65,7 +65,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
N: costGold, N: costGold,
}) })
// 金币消耗判断 // 金币消耗判断
if code = this.module.CheckRes(session, cost); code != pb.ErrorCode_Success { if code = this.module.CheckRes(session, cost); errdata != nil {
return return
} }
@ -80,11 +80,11 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
} }
// 执行升级逻辑 // 执行升级逻辑
_, code = this.module.modelHero.AddCardExp(session, _hero, addExp, nil) // 加经验 _, code = this.module.modelHero.AddCardExp(session, _hero, addExp, nil) // 加经验
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
// 消耗金币 // 消耗金币
if code = this.module.ConsumeRes(session, cost, true); code != pb.ErrorCode_Success { //道具扣除 if code = this.module.ConsumeRes(session, cost, true); errdata != nil { //道具扣除
code = pb.ErrorCode_ItemsNoEnough code = pb.ErrorCode_ItemsNoEnough
return return
} }

View File

@ -29,7 +29,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
) )
chanegCard = make([]*pb.DBHero, 0) chanegCard = make([]*pb.DBHero, 0)
if code = this.TalentLearnCheck(session, req); code != pb.ErrorCode_Success { if code = this.TalentLearnCheck(session, req); errdata != nil {
return return
} }
if req.ObjId != "" { if req.ObjId != "" {
@ -119,7 +119,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
T: generaltp.T, T: generaltp.T,
N: leftCount, N: leftCount,
} }
if code = this.module.CheckRes(session, []*cfg.Gameatn{fp}); code != pb.ErrorCode_Success { if code = this.module.CheckRes(session, []*cfg.Gameatn{fp}); errdata != nil {
code = pb.ErrorCode_ItemsNoEnough code = pb.ErrorCode_ItemsNoEnough
return return
} }
@ -134,7 +134,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
res = append(res, point) res = append(res, point)
} }
} }
if code = this.module.ConsumeRes(session, res, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, res, true); errdata != nil {
return return
} }

View File

@ -23,7 +23,7 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe
chanegCard []*pb.DBHero // 推送属性变化 chanegCard []*pb.DBHero // 推送属性变化
talentPoint int32 // 已经消耗的天赋点数 talentPoint int32 // 已经消耗的天赋点数
) )
if code = this.TalentResetCheck(session, req); code != pb.ErrorCode_Success { if code = this.TalentResetCheck(session, req); errdata != nil {
return return
} }
@ -40,7 +40,7 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe
chanegCard = make([]*pb.DBHero, 0) chanegCard = make([]*pb.DBHero, 0)
// 检查消耗够不够 // 检查消耗够不够
if code = this.module.ConsumeRes(session, this.module.ModuleTools.GetGlobalConf().TalentReset, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, this.module.ModuleTools.GetGlobalConf().TalentReset, true); errdata != nil {
return return
} }
@ -63,7 +63,7 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe
N: talentPoint, N: talentPoint,
} }
this.module.Debugf("返还天赋的点数%d,itemID=%s", talentPoint, t) this.module.Debugf("返还天赋的点数%d,itemID=%s", talentPoint, t)
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, true); errdata != nil {
this.module.Errorf("DispenseRes err,uid:%s,item:%v", session.GetUserId(), res) this.module.Errorf("DispenseRes err,uid:%s,item:%v", session.GetUserId(), res)
} // 返还升级的天赋点数 } // 返还升级的天赋点数
} }

View File

@ -281,7 +281,7 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]
if num == 0 { // 数量为0 不做处理 if num == 0 { // 数量为0 不做处理
continue continue
} }
if hero, bFirst, atno, code = this.createRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success { if hero, bFirst, atno, code = this.createRepeatHero(session, heroCfgId, num); errdata != nil {
this.Errorf("create hero %s failed", heroCfgId) this.Errorf("create hero %s failed", heroCfgId)
continue continue
} }
@ -324,18 +324,18 @@ func (this *Hero) AddHeroExp(session comm.IUserSession, heroObjID string, exp in
return return
} }
curAddExp, code = this.modelHero.AddCardExp(session, _hero, exp, model) curAddExp, code = this.modelHero.AddCardExp(session, _hero, exp, model)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
} }
} else { } else {
_hero, code = this.GetHeroByObjID(session.GetUserId(), heroObjID) _hero, code = this.GetHeroByObjID(session.GetUserId(), heroObjID)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
curAddExp, code = this.modelHero.AddCardExp(session, _hero, exp, nil) curAddExp, code = this.modelHero.AddCardExp(session, _hero, exp, nil)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
} }
@ -364,7 +364,7 @@ func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongf
} }
} else { } else {
_hero, code = this.GetHeroByObjID(session.GetUserId(), heroObjID) _hero, code = this.GetHeroByObjID(session.GetUserId(), heroObjID)
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
} }

View File

@ -17,7 +17,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.HoroscopeInfoReq) (
info *pb.DBHoroscope info *pb.DBHoroscope
err error err error
) )
if code = this.InfoCheck(session, req); code != pb.ErrorCode_Success { if code = this.InfoCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelHoroscope.queryInfo(session.GetUserId()); err != nil { if info, err = this.module.modelHoroscope.queryInfo(session.GetUserId()); err != nil {

View File

@ -21,7 +21,7 @@ func (this *apiComp) Reset(session comm.IUserSession, req *pb.HoroscopeResetReq)
conf *cfg.GameGlobalData conf *cfg.GameGlobalData
err error err error
) )
if code = this.ResetCheck(session, req); code != pb.ErrorCode_Success { if code = this.ResetCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelHoroscope.queryInfo(session.GetUserId()); err != nil { if info, err = this.module.modelHoroscope.queryInfo(session.GetUserId()); err != nil {
@ -36,7 +36,7 @@ func (this *apiComp) Reset(session comm.IUserSession, req *pb.HoroscopeResetReq)
} }
} }
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.HoroscopeResetCost}, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.HoroscopeResetCost}, true); errdata != nil {
return return
} }
info.Nodes = make(map[int32]int32) info.Nodes = make(map[int32]int32)

View File

@ -20,7 +20,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade
front *cfg.GameHoroscopeData front *cfg.GameHoroscopeData
err error err error
) )
if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success { if code = this.UpgradeCheck(session, req); errdata != nil {
return return
} }
if info, err = this.module.modelHoroscope.queryInfo(session.GetUserId()); err != nil { if info, err = this.module.modelHoroscope.queryInfo(session.GetUserId()); err != nil {
@ -51,7 +51,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade
} }
return return
} }
if code = this.module.ConsumeRes(session, conf.CostItem, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, conf.CostItem, true); errdata != nil {
return return
} }
info.Nodes[conf.NodeId] = conf.Lv + 1 info.Nodes[conf.NodeId] = conf.Lv + 1

View File

@ -24,7 +24,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
ps int32 ps int32
) )
code = this.ChallengeCheck(session, req) code = this.ChallengeCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
@ -44,7 +44,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
} }
if v1, ok := hunting.Ps[req.BossType]; ok && v1 == 0 { if v1, ok := hunting.Ps[req.BossType]; ok && v1 == 0 {
if code = this.module.ConsumeRes(session, cfgData.PsMg, true); code != pb.ErrorCode_Success { // 扣1点 if code = this.module.ConsumeRes(session, cfgData.PsMg, true); errdata != nil { // 扣1点
return return
} }
@ -64,7 +64,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
T: "ps", T: "ps",
N: ps, N: ps,
} }
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{psAnt}, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, []*cfg.Gameatn{psAnt}, true); errdata != nil {
return return
} }
@ -75,7 +75,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
"ps": hunting.Ps, "ps": hunting.Ps,
}) })
} }
// if code = this.module.CheckRes(session, cfgData.PsConsume); code != pb.ErrorCode_Success { // if code = this.module.CheckRes(session, cfgData.PsConsume); errdata != nil {
// if req.AutoBuy { // 不够的时候看是否能自动购买 // if req.AutoBuy { // 不够的时候看是否能自动购买
// var count int32 // var count int32
// for _, v := range cfgData.PsConsume { // for _, v := range cfgData.PsConsume {
@ -83,7 +83,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
// count += v.N // count += v.N
// } // }
// } // }
// if code = this.module.ModuleItems.BuyUnifiedTicket(session, count); code != pb.ErrorCode_Success { // if code = this.module.ModuleItems.BuyUnifiedTicket(session, count); errdata != nil {
// return // return
// } // }
// } else { // } else {
@ -107,7 +107,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
Format: req.Battle, Format: req.Battle,
Mformat: cfgData.Boss, Mformat: cfgData.Boss,
}) })
if code != pb.ErrorCode_Success { if errdata != nil {
return return
} }
session.SendMsg(string(this.module.GetType()), HuntingChallengeResp, &pb.HuntingChallengeResp{ session.SendMsg(string(this.module.GetType()), HuntingChallengeResp, &pb.HuntingChallengeResp{

View File

@ -34,7 +34,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
mapData = make(map[string]interface{}, 0) mapData = make(map[string]interface{}, 0)
reward = make([]*cfg.Gameatn, 0) reward = make([]*cfg.Gameatn, 0)
code = this.ChallengeOverCheck(session, req) code = this.ChallengeOverCheck(session, req)
if code != pb.ErrorCode_Success { if errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
@ -76,12 +76,12 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
} }
mapData["boss"] = hunting.Boss mapData["boss"] = hunting.Boss
code, bWin = this.module.battle.CheckBattleReport(session, req.Report) code, bWin = this.module.battle.CheckBattleReport(session, req.Report)
// if code = this.module.ModuleItems.RecoverTicket(session); code != pb.ErrorCode_Success { // if code = this.module.ModuleItems.RecoverTicket(session); errdata != nil {
// return // return
// } // }
if !bWin { // 战斗失败了 直接返回 if !bWin { // 战斗失败了 直接返回
if v, ok := hunting.Ps[req.BossType]; ok && v > 0 { if v, ok := hunting.Ps[req.BossType]; ok && v > 0 {
if code = this.module.DispenseRes(session, cfgHunting.PsConsume, true); code != pb.ErrorCode_Success { // 返还预扣体力 if code = this.module.DispenseRes(session, cfgHunting.PsConsume, true); errdata != nil { // 返还预扣体力
return return
} }
} }
@ -91,13 +91,13 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting}) session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting})
return return
} }
// if code = this.module.ConsumeRes(session, cfgHunting.PsConsume, true); code != pb.ErrorCode_Success { // if code = this.module.ConsumeRes(session, cfgHunting.PsConsume, true); errdata != nil {
// return // return
// } // }
key := strconv.Itoa(int(req.BossType)) + "_" + strconv.Itoa(int(req.Difficulty)) key := strconv.Itoa(int(req.BossType)) + "_" + strconv.Itoa(int(req.Difficulty))
if hunting.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励 if hunting.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励
mapData["boss"] = hunting.Boss mapData["boss"] = hunting.Boss
if code = this.module.DispenseRes(session, cfgHunting.Firstprize, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, cfgHunting.Firstprize, true); errdata != nil {
return return
} }
} }
@ -132,11 +132,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
res = append(res, v) res = append(res, v)
} }
} }
if code, atno = this.module.DispenseAtno(session, res, true); code != pb.ErrorCode_Success { if code, atno = this.module.DispenseAtno(session, res, true); errdata != nil {
return return
} }
if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励 if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励
if code = this.module.DispenseRes(session, cfgHunting.Firstprize, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, cfgHunting.Firstprize, true); errdata != nil {
return return
} }
hunting.Boss[req.BossType] += 1 hunting.Boss[req.BossType] += 1

Some files were not shown because too many files have changed in this diff Show More