This commit is contained in:
meixiongfeng 2023-06-06 10:26:56 +08:00
parent 047ab5fb9d
commit e5eb0d5b19
5 changed files with 27 additions and 23 deletions

View File

@ -25,8 +25,9 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateRe
atlasConf, err := this.module.configure.GetPandoAtlasConf(req.Id) atlasConf, err := this.module.configure.GetPandoAtlasConf(req.Id)
if err != nil { if err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound, Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(), Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
} }
return return
} }

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); errdata != nil { if errdata = this.GetListCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
list, err := this.module.modelCaravan.getCaravanList(session.GetUserId()) 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 { if conf, err := this.module.configure.GetCaravanLv(list.Lv); err == nil {
this.module.ModuleItems.CleanItemById(session, conf.Tickettop.T) // 清理之前的门票数据 this.module.ModuleItems.CleanItemById(session, conf.Tickettop.T) // 清理之前的门票数据
} 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 code = this.module.InitCaravanTicket(session, list.Lv); errdata != nil { if errdata = this.module.InitCaravanTicket(session, list.Lv); errdata != nil {
return return
} }
} }

View File

@ -25,18 +25,18 @@ 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); errdata != nil { if errdata = this.GetStoryCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId()) list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId())
conf, err := this.module.configure.GetCaravanEventById(req.Cid) conf, err := this.module.configure.GetCaravanEventById(req.Cid)
if err != nil { if err != nil {
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 list.Eventid != req.Cid { if list.Eventid != req.Cid {

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); errdata != nil { if errdata = this.GotoCityCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
} }
list, _ := this.module.modelCaravan.getCaravanList(session.GetUserId()) 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 list.Tasktime-configure.Now().Unix() > int64(event.Eventtime) { //TODO 任务超时
} }
if event.Eventtype == 1 { if event.Eventtype == 1 { // 需要完成强制任务
code = pb.ErrorCode_TrollTask // 需要完成强制任务 errdata = &pb.ErrorData{
Code: pb.ErrorCode_TrollTask,
Title: pb.ErrorCode_TrollTask.ToString(),
}
return return
} else { } else {
bNewTask = false bNewTask = false
} }
} 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
} }
} }
@ -82,14 +85,14 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
N: req.Ticket, N: req.Ticket,
} }
} 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 code = this.module.ConsumeRes(session, []*cfg.Gameatn{res}, true); errdata != nil { // 校验门票数量 if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{res}, true); errdata != nil { // 校验门票数量
return return
} }

View File

@ -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) { 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 { if conf, _ := this.modelCaravan.module.configure.GetCaravanLv(lv); conf != nil {
var res []*cfg.Gameatn var res []*cfg.Gameatn
res = append(res, conf.Tickettop) res = append(res, conf.Tickettop)
res = append(res, conf.Moneynumtop) res = append(res, conf.Moneynumtop)
code = this.DispenseRes(session, res, true) // 推送门票和虚拟币资源 errdata = this.DispenseRes(session, res, true) // 推送门票和虚拟币资源
} }
return return
} }