From e5eb0d5b19e134bbc5d130573174f97f7b0d2811 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 6 Jun 2023 10:26:56 +0800 Subject: [PATCH] updata --- modules/atlas/api_atlasactivate.go | 5 +++-- modules/caravan/api_getlist.go | 10 +++++----- modules/caravan/api_getstory.go | 8 ++++---- modules/caravan/api_gotocity.go | 23 +++++++++++++---------- modules/caravan/module.go | 4 ++-- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/modules/atlas/api_atlasactivate.go b/modules/atlas/api_atlasactivate.go index 9ce39ad76..5fabb1ae1 100644 --- a/modules/atlas/api_atlasactivate.go +++ b/modules/atlas/api_atlasactivate.go @@ -25,8 +25,9 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateRe atlasConf, err := this.module.configure.GetPandoAtlasConf(req.Id) if err != nil { errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ConfigNoFound, - Title: pb.ErrorCode_ConfigNoFound.ToString(), + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + Message: err.Error(), } return } diff --git a/modules/caravan/api_getlist.go b/modules/caravan/api_getlist.go index c59063fd0..e4a7dc9c0 100644 --- a/modules/caravan/api_getlist.go +++ b/modules/caravan/api_getlist.go @@ -18,7 +18,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListRe resp *pb.CaravanGetListResp ) resp = &pb.CaravanGetListResp{} - if code = this.GetListCheck(session, req); errdata != nil { + if errdata = this.GetListCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } list, err := this.module.modelCaravan.getCaravanList(session.GetUserId()) @@ -27,14 +27,14 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListRe if conf, err := this.module.configure.GetCaravanLv(list.Lv); err == nil { this.module.ModuleItems.CleanItemById(session, conf.Tickettop.T) // 清理之前的门票数据 } else { - data = &pb.ErrorData{ - Title: pb.GetErrorCodeMsg(code), + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: err.Error(), } - code = pb.ErrorCode_ConfigNoFound return } - if code = this.module.InitCaravanTicket(session, list.Lv); errdata != nil { + if errdata = this.module.InitCaravanTicket(session, list.Lv); errdata != nil { return } } diff --git a/modules/caravan/api_getstory.go b/modules/caravan/api_getstory.go index 4b3deee86..6265a46c1 100644 --- a/modules/caravan/api_getstory.go +++ b/modules/caravan/api_getstory.go @@ -25,18 +25,18 @@ func (this *apiComp) GetStory(session comm.IUserSession, req *pb.CaravanGetStory ) resp = &pb.CaravanGetStoryResp{} update = make(map[string]interface{}) - if code = this.GetStoryCheck(session, req); errdata != nil { + if errdata = this.GetStoryCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId()) conf, err := this.module.configure.GetCaravanEventById(req.Cid) if err != nil { - data = &pb.ErrorData{ - Title: pb.GetErrorCodeMsg(code), + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: err.Error(), } - code = pb.ErrorCode_ConfigNoFound return } if list.Eventid != req.Cid { diff --git a/modules/caravan/api_gotocity.go b/modules/caravan/api_gotocity.go index c8aad7504..509907f28 100644 --- a/modules/caravan/api_gotocity.go +++ b/modules/caravan/api_gotocity.go @@ -26,7 +26,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity ) resp = &pb.CaravanGotoCityResp{} bNewTask = false - if code = this.GotoCityCheck(session, req); errdata != nil { + if errdata = this.GotoCityCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId()) @@ -38,18 +38,21 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity if list.Tasktime-configure.Now().Unix() > int64(event.Eventtime) { //TODO 任务超时 } - if event.Eventtype == 1 { - code = pb.ErrorCode_TrollTask // 需要完成强制任务 + if event.Eventtype == 1 { // 需要完成强制任务 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_TrollTask, + Title: pb.ErrorCode_TrollTask.ToString(), + } return } else { bNewTask = false } } else { - data = &pb.ErrorData{ - Title: pb.GetErrorCodeMsg(code), + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: err.Error(), } - code = pb.ErrorCode_ConfigNoFound return } } @@ -82,14 +85,14 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity N: req.Ticket, } } else { - data = &pb.ErrorData{ - Title: pb.GetErrorCodeMsg(code), + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: err.Error(), } - code = pb.ErrorCode_ConfigNoFound return } - if code = this.module.ConsumeRes(session, []*cfg.Gameatn{res}, true); errdata != nil { // 校验门票数量 + if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{res}, true); errdata != nil { // 校验门票数量 return } diff --git a/modules/caravan/module.go b/modules/caravan/module.go index c80b1f69b..cc8b3c9c9 100644 --- a/modules/caravan/module.go +++ b/modules/caravan/module.go @@ -114,12 +114,12 @@ func (this *Caravan) InitCaravanItemData(uid string, data *pb.DBCaravan) { // 初始化门票和虚拟币 func (this *Caravan) InitCaravanTicket(session comm.IUserSession, lv int32) (errdata *pb.ErrorData) { - code = pb.ErrorCode_ConfigNoFound + if conf, _ := this.modelCaravan.module.configure.GetCaravanLv(lv); conf != nil { var res []*cfg.Gameatn res = append(res, conf.Tickettop) res = append(res, conf.Moneynumtop) - code = this.DispenseRes(session, res, true) // 推送门票和虚拟币资源 + errdata = this.DispenseRes(session, res, true) // 推送门票和虚拟币资源 } return }