From 0ad64739ddaa328daf39e59b8bd4d001c5b39a2d Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 17 Nov 2022 19:58:35 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E8=A3=85=E5=A4=87?= =?UTF-8?q?=E7=A9=BA=E5=80=BC=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/forum/api_watchhero.go | 4 +--- modules/forum/modelForum.go | 37 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/modules/forum/api_watchhero.go b/modules/forum/api_watchhero.go index e5e9bd5cc..b39021438 100644 --- a/modules/forum/api_watchhero.go +++ b/modules/forum/api_watchhero.go @@ -28,9 +28,7 @@ func (this *apiComp) WatchHero(session comm.IUserSession, req *pb.ForumWatchHero if hero, err = this.module.modelForum.watchHero(req.Stag, req.Uid, req.HerocId); err != nil { code = pb.ErrorCode_HeroNoExist } - if equip, err = this.module.modelForum.watchHeroEquip(req.Stag, req.Uid, hero.EquipID...); err != nil { - code = pb.ErrorCode_EquipmentOnFoundEquipment - } + equip = this.module.modelForum.watchHeroEquip(req.Stag, req.Uid, hero.EquipID...) session.SendMsg(string(this.module.GetType()), "watchhero", &pb.ForumWatchHeroResp{ Hero: hero, EquipID: equip, diff --git a/modules/forum/modelForum.go b/modules/forum/modelForum.go index 995bba7a6..3a34421db 100644 --- a/modules/forum/modelForum.go +++ b/modules/forum/modelForum.go @@ -156,26 +156,27 @@ func (this *modelForumComp) watchHero(stage string, uid string, herocid string) return } -func (this *modelForumComp) watchHeroEquip(stage string, uid string, equipIds ...string) (equips []*pb.DB_Equipment, err error) { +func (this *modelForumComp) watchHeroEquip(stage string, uid string, equipIds ...string) (equips []*pb.DB_Equipment) { - var ( - tcoon *db.DBConn - ) - if tcoon, err = db.ServerDBConn(stage); err != nil { - this.module.Errorf("stage:%s err:%v", stage, err) - return - } - for id := range equipIds { - sr := tcoon.Mgo.FindOne(comm.TableEquipment, bson.M{ - "_id": id, - }) - equip := &pb.DB_Equipment{} - if err = sr.Decode(equip); err == nil { - equips = append(equips, equip) - } else { - this.module.Errorf("find hero equip error: %v", err) + if tcoon, err := db.ServerDBConn(stage); err == nil { + for _, id := range equipIds { + + if id == "" { + equips = append(equips, nil) + continue + } + sr := tcoon.Mgo.FindOne(comm.TableEquipment, bson.M{ + "_id": id, + }) + equip := &pb.DB_Equipment{} + if err = sr.Decode(equip); err == nil { + equips = append(equips, equip) + } else { + this.module.Errorf("find hero equip error: %v", err) + } } + } else { + this.module.Errorf("stage:%s err:%v", stage, err) } - return } From e1703ebe2f7b34ad8ea3504debbc0764c3259e2b Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Wed, 16 Nov 2022 19:18:37 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/v2/FyneApp.toml | 4 +- cmd/v2/service/sshService.go | 1 + comm/imodule.go | 2 +- modules/arena/modelarena.go | 2 +- modules/equipment/modelEquipment.go | 10 +- modules/gm/module.go | 4 +- modules/hero/model_hero.go | 6 +- modules/horoscope/modelhoroscope.go | 2 +- modules/items/modelitems.go | 10 +- modules/linestory/api_maintask.go | 2 + modules/linestory/api_receive.go | 5 +- modules/linestory/model_linestory.go | 4 +- modules/linestory/module.go | 36 +++- modules/modulebase.go | 2 +- modules/rtask/module.go | 16 +- modules/sociaty/api_cross_accuse.go | 17 +- modules/sociaty/api_cross_activitylist.go | 15 +- modules/sociaty/api_cross_activityreceive.go | 17 +- modules/sociaty/api_cross_agree.go | 36 ++-- modules/sociaty/api_cross_apply.go | 52 +++-- modules/sociaty/api_cross_applycancel.go | 17 +- modules/sociaty/api_cross_applylist.go | 9 +- modules/sociaty/api_cross_assign.go | 33 ++- modules/sociaty/api_cross_cancel.go | 18 -- modules/sociaty/api_cross_create.go | 35 +-- modules/sociaty/api_cross_discharge.go | 28 ++- modules/sociaty/api_cross_dismiss.go | 26 ++- modules/sociaty/api_cross_list.go | 5 + modules/sociaty/api_cross_log.go | 6 +- modules/sociaty/api_cross_members.go | 6 +- modules/sociaty/api_cross_mine.go | 80 ++++--- modules/sociaty/api_cross_quit.go | 14 +- modules/sociaty/api_cross_rank.go | 1 + modules/sociaty/api_cross_receive.go | 29 ++- modules/sociaty/api_cross_refuse.go | 18 +- modules/sociaty/api_cross_search.go | 4 +- modules/sociaty/api_cross_setting.go | 13 +- modules/sociaty/api_cross_settingjob.go | 20 +- modules/sociaty/api_cross_sign.go | 29 +-- modules/sociaty/api_cross_tasklist.go | 12 +- modules/sociaty/model_sociaty.go | 67 ++---- modules/sociaty/model_sociatylog.go | 20 +- modules/sociaty/model_sociatytask.go | 28 +-- modules/sociaty/module.go | 22 +- modules/user/model_expand.go | 16 +- modules/user/model_user.go | 4 +- modules/user/module.go | 6 +- modules/worldtask/api_battlefinish.go | 10 +- modules/worldtask/api_battlestart.go | 4 + modules/worldtask/api_finish.go | 8 +- modules/worldtask/api_mine.go | 2 + modules/worldtask/model_worldtask.go | 4 +- modules/worldtask/module.go | 67 +++--- pb/errorcode.pb.go | 211 ++++++++++--------- utils/strings.go | 11 + utils/utils_test.go | 6 + 56 files changed, 649 insertions(+), 483 deletions(-) delete mode 100644 modules/sociaty/api_cross_cancel.go diff --git a/cmd/v2/FyneApp.toml b/cmd/v2/FyneApp.toml index 9d5c6f92b..dff6c88bf 100644 --- a/cmd/v2/FyneApp.toml +++ b/cmd/v2/FyneApp.toml @@ -4,5 +4,5 @@ Website = "http://legu.cc" Icon = "app.png" Name = "RobotGUI" ID = "cc.legu.app" - Version = "1.0.20" - Build = 23 + Version = "1.0.21" + Build = 25 diff --git a/cmd/v2/service/sshService.go b/cmd/v2/service/sshService.go index 8c8d90d69..c7933bf02 100644 --- a/cmd/v2/service/sshService.go +++ b/cmd/v2/service/sshService.go @@ -300,6 +300,7 @@ func (ss *SSHService) ScpDownload(localDir, remoteFilePath string) error { fileName := path.Base(remoteFile.Name()) if err := os.MkdirAll(localDir, fs.ModePerm); err != nil { + logrus.Error(err) return err } diff --git a/comm/imodule.go b/comm/imodule.go index 8e50291ec..5506cd7a7 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -145,7 +145,7 @@ type ( IRtask interface { // 条件校验 CheckCondi(uid string, condiId int32) (code pb.ErrorCode) - // 远程条件校验 + // 远程任务条件校验 RemoteCheckCondi(uid string, condiId int32, rsp *pb.DBRtaskRecord) error //任务触发 SendToRtask(session IUserSession, rtaskType TaskType, params ...int32) (code pb.ErrorCode) diff --git a/modules/arena/modelarena.go b/modules/arena/modelarena.go index 60f21428a..879561b60 100644 --- a/modules/arena/modelarena.go +++ b/modules/arena/modelarena.go @@ -90,7 +90,7 @@ func (this *modelArena) queryUserHeros(uid string, heroids []string) (results [] var ( model *db.DBModel ) - if model, err = this.module.GetDBNoduleByUid(uid, comm.TableHero, time.Hour); err != nil { + if model, err = this.module.GetDBModuleByUid(uid, comm.TableHero, time.Hour); err != nil { this.module.Errorln(err) return } diff --git a/modules/equipment/modelEquipment.go b/modules/equipment/modelEquipment.go index a3f81948e..7075139e4 100644 --- a/modules/equipment/modelEquipment.go +++ b/modules/equipment/modelEquipment.go @@ -56,7 +56,7 @@ func (this *modelEquipmentComp) QueryUserEquipments(uId string) (equipments []*p ) equipments = make([]*pb.DB_Equipment, 0) if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.GetList(uId, &equipments); err != nil { @@ -121,7 +121,7 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.AddLists(uId, add); err != nil { @@ -145,7 +145,7 @@ func (this *modelEquipmentComp) addEquipment(equip *pb.DB_Equipment) (err error) model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(equip.UId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(equip.UId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.AddList(equip.UId, equip.Id, equip); err != nil { @@ -169,7 +169,7 @@ func (this *modelEquipmentComp) DelEquipments(uId string, eIds []string) (change ) change = make([]*pb.DB_Equipment, 0) if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.DelListlds(uId, eIds...); err != nil { @@ -199,7 +199,7 @@ func (this *modelEquipmentComp) UpdateByHeroId(uid string, equipments ...*pb.DB_ model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { for _, v := range equipments { diff --git a/modules/gm/module.go b/modules/gm/module.go index af5bb68d1..98551806b 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -124,7 +124,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC this.Errorf("资源发放失败,%v", code) } } - this.Debugf("使用bingo命令", log.Fields{"uid": session.GetUserId()}, datas[0], res) + this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "param": datas[0], "res": res}) } else if len(datas) == 3 && (datas[0] == "worldtask") { module, err := this.service.GetModule(comm.ModuleWorldtask) if err != nil { @@ -132,7 +132,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC } if wt, ok := module.(comm.IWorldtask); ok { if err = wt.BingoJumpTask(session, utils.ToInt32(datas[1]), utils.ToInt32(datas[2])); err != nil { - this.Errorf("bingo worldTask Failed ,Parameter :%s,%s %v", datas[1], datas[2], err) + this.Error("bingo 世界任务", log.Fields{"params": datas, "err": err.Error()}) } } diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 24abc6eb9..7851680a1 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -132,7 +132,7 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int if hero != nil { hero.SameCount = count if this.moduleHero.IsCross() { - if model, err = this.moduleHero.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err = this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.moduleHero.Errorln(err) } else { if err = model.AddList(uid, hero.Id, hero); err != nil { @@ -153,7 +153,7 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int func (this *ModelHero) createHeroOverlying(uid string, heroCfgId string, count int32) (hero *pb.DBHero, err error) { heros := make([]*pb.DBHero, 0) if this.moduleHero.IsCross() { - if dbModel, err := this.moduleHero.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil { + if dbModel, err := this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.moduleHero.Errorln(err) } else { @@ -178,7 +178,7 @@ func (this *ModelHero) createHeroOverlying(uid string, heroCfgId string, count i hero = h if this.moduleHero.IsCross() { - if model, err := this.moduleHero.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err := this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.moduleHero.Errorln(err) } else { if err := model.ChangeList(uid, h.Id, data); err != nil { diff --git a/modules/horoscope/modelhoroscope.go b/modules/horoscope/modelhoroscope.go index a8e02b1b8..6662532da 100644 --- a/modules/horoscope/modelhoroscope.go +++ b/modules/horoscope/modelhoroscope.go @@ -51,7 +51,7 @@ func (this *modelHoroscope) updateInfo(session comm.IUserSession, info *pb.DBHor "nodes": info.Nodes, "lastrest": info.Lastrest, }) - if model, err = this.module.GetDBNoduleByUid(info.Uid, this.TableName, time.Hour); err != nil { + if model, err = this.module.GetDBModuleByUid(info.Uid, this.TableName, time.Hour); err != nil { this.module.Errorln(err) return } diff --git a/modules/items/modelitems.go b/modules/items/modelitems.go index 6a2b4ed89..af7b723f9 100644 --- a/modules/items/modelitems.go +++ b/modules/items/modelitems.go @@ -41,7 +41,7 @@ func (this *ModelItemsComp) QueryUserPack(uId string) (itmes []*pb.DB_UserItemDa ) itmes = make([]*pb.DB_UserItemData, 0) if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.GetList(uId, &itmes); err != nil { @@ -65,7 +65,7 @@ func (this *ModelItemsComp) QueryUserPackByGridId(uId string, grid string) (itme itme = &pb.DB_UserItemData{} if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.GetListObj(uId, grid, itme); err != nil { @@ -91,7 +91,7 @@ func (this *ModelItemsComp) AddUserPack(uId string, itmes ...*pb.DB_UserItemData model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.AddLists(uId, data); err != nil { @@ -113,7 +113,7 @@ func (this *ModelItemsComp) UpdateUserPack(uid string, itmes ...*pb.DB_UserItemD model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { for _, v := range itmes { @@ -147,7 +147,7 @@ func (this *ModelItemsComp) DeleteUserPack(uid string, itmes ...*pb.DB_UserItemD gridIds[i] = v.GridId } if this.module.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.DelListlds(uid, gridIds...); err != nil { diff --git a/modules/linestory/api_maintask.go b/modules/linestory/api_maintask.go index 8a6b8d1df..c26e042e4 100644 --- a/modules/linestory/api_maintask.go +++ b/modules/linestory/api_maintask.go @@ -2,6 +2,7 @@ package linestory import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -10,6 +11,7 @@ import ( // 支线剧情-我的主线任务 func (this *apiComp) MaintaskCheck(session comm.IUserSession, req *pb.LinestoryMaintaskReq) (code pb.ErrorCode) { if req.ChapterId == 0 { + this.moduleLinestory.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } return diff --git a/modules/linestory/api_receive.go b/modules/linestory/api_receive.go index 187cd9bcb..c86c5d12e 100644 --- a/modules/linestory/api_receive.go +++ b/modules/linestory/api_receive.go @@ -12,6 +12,7 @@ import ( // 章节奖励领取 func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.LinestoryReceiveReq) (code pb.ErrorCode) { if req.ChapterId == 0 { + this.moduleLinestory.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } return @@ -24,7 +25,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive uid := session.GetUserId() conf := this.moduleLinestory.configure.getChapterCfgById(req.ChapterId) if conf == nil { - log.Errorf("config is nil uid:%v groupId:%v", uid, req.ChapterId) + this.moduleLinestory.Error("配置未找到", log.Fields{"uid": uid, "chapterId": req.ChapterId}) code = pb.ErrorCode_ConfigNoFound return } @@ -42,7 +43,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive //发奖 if code := this.moduleLinestory.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success { - this.moduleLinestory.Errorf("奖励发放失败 uid:%v groupId:%v reward:%v", uid, req.ChapterId, conf.Reward) + this.moduleLinestory.Error("奖励发放失败", log.Fields{"uid": uid, "chapterId": req.ChapterId, "reward": conf.Reward}) } rsp := &pb.LinestoryReceiveResp{ diff --git a/modules/linestory/model_linestory.go b/modules/linestory/model_linestory.go index 6ccb87d6e..baaa288f9 100644 --- a/modules/linestory/model_linestory.go +++ b/modules/linestory/model_linestory.go @@ -58,6 +58,7 @@ func (this *ModelLinestory) getMaintasks(uid string, groupId int32) (list []*pb. if iwt, ok := module.(comm.IWorldtask); ok { // 获取玩家世界任务 wt := iwt.GetMyWorldtask(uid) + this.moduleLinestory.Debug("获取玩家世界任务", log.Fields{"uid": uid, "groupId": groupId, "worldtask": wt}) if wt != nil { mainTasks := this.moduleLinestory.configure.getMainTaskCfgByGroup(groupId) for _, conf := range mainTasks { @@ -66,11 +67,10 @@ func (this *ModelLinestory) getMaintasks(uid string, groupId int32) (list []*pb. if conf.Id == task.TaskId { list = append(list, &pb.TaskMain{ TaskId: conf.Id, - Status: 2, + Status: 1, }) } } - } } } diff --git a/modules/linestory/module.go b/modules/linestory/module.go index dd4c5fed3..a33a1442d 100644 --- a/modules/linestory/module.go +++ b/modules/linestory/module.go @@ -58,27 +58,45 @@ func (this *ModuleLinestory) Start() (err error) { func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32) error { ls := this.modelLinestory.getLinestory(uid) - if v, ok := ls.TaskChapter[groupId]; ok { - if _, ok := utils.Findx(v.TaskIds, taskId); !ok { - v.TaskIds = append(v.TaskIds, taskId) + var isUpdate bool + if chapter, ok := ls.TaskChapter[groupId]; ok { + if _, ok := utils.Findx(chapter.TaskIds, taskId); !ok { + chapter.TaskIds = append(chapter.TaskIds, taskId) taskIds := this.configure.converArr(groupId) // 校验当前组下的任务是否全部完成 - if utils.ForContainer(taskIds, v.TaskIds) { + if utils.ForContainer(taskIds, chapter.TaskIds) { //说明组里的所有任务完成 - v.Receive = 1 - v.Status = 1 + chapter.Receive = 1 + chapter.Status = 1 } + + // 重置任务ID + if conf, ok := this.confMaintask.GetDataMap()[taskId]; ok { + if conf.Group == groupId { + var newTaskList []int32 + for _, v := range conf.Resetto { + newTaskList = utils.Deletex(chapter.TaskIds, v) + } + chapter.TaskIds = newTaskList + } + } + isUpdate = true } } else { tg := &pb.TaskChapter{} + // 设置完成的任务 tg.TaskIds = append(tg.TaskIds, taskId) if ls.TaskChapter == nil { ls.TaskChapter = make(map[int32]*pb.TaskChapter) } ls.TaskChapter[groupId] = tg + isUpdate = true } - update := map[string]interface{}{ - "taskChapter": ls.TaskChapter, + if isUpdate { + update := map[string]interface{}{ + "taskChapter": ls.TaskChapter, + } + return this.modelLinestory.Change(uid, update) } - return this.modelLinestory.Change(uid, update) + return nil } diff --git a/modules/modulebase.go b/modules/modulebase.go index e72005408..97136de46 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -391,7 +391,7 @@ func (this *ModuleBase) GetDBNodule(session comm.IUserSession, tableName string, } //跨服对象获取数据操作对象 -func (this *ModuleBase) GetDBNoduleByUid(uid, tableName string, expired time.Duration) (model *db.DBModel, err error) { +func (this *ModuleBase) GetDBModuleByUid(uid, tableName string, expired time.Duration) (model *db.DBModel, err error) { var ( stag string conn *db.DBConn diff --git a/modules/rtask/module.go b/modules/rtask/module.go index 17c0f25c6..cfb03ca44 100644 --- a/modules/rtask/module.go +++ b/modules/rtask/module.go @@ -278,13 +278,6 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T //任务完成则推送 if code := this.CheckCondi(uid, v.cfg.Id); code == pb.ErrorCode_Success { - //任务条件达成推送 - // if err := this.SendMsgToUser("taskcond", "finished", &pb.TaskcondFinishedPush{ - // CondId: v.cfg.Id, - // }, uid); err != nil { - // log.Errorf("任务条件达成推送失败 err:%v", err) - // } - // log.Errorf("任务条件达成 uid:%v condId:%v", uid, v.cfg.Id) module, err := this.service.GetModule(comm.ModuleWorldtask) if err == nil { if worldtask, ok := module.(comm.IWorldtask); ok { @@ -294,14 +287,17 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T notifyErr := &pb.NotifyErrorNotifyPush{ ReqMainType: string(comm.ModuleWorldtask), ReqSubType: "finish", - Code: pb.ErrorCode_WorldtaskLvNotEnough, Message: "", } if customErr.Code == pb.ErrorCode_WorldtaskLvNotEnough { + notifyErr.Code = pb.ErrorCode_WorldtaskLvNotEnough + session.SendMsg(string(comm.ModuleWorldtask), "finish", notifyErr) + } else if customErr.Code == pb.ErrorCode_UserSessionNobeing { + notifyErr.Code = pb.ErrorCode_UserSessionNobeing session.SendMsg(string(comm.ModuleWorldtask), "finish", notifyErr) } else { - log.Errorf("任务条件达成通知 失败 err:%v", err) + log.Error("任务条件达成通知", log.Fields{"uid": uid, "condId": v.cfg.Id, "err": err.Error()}) } } } @@ -413,7 +409,7 @@ func (this *ModuleRtask) RemoteCheckCondi(uid string, condiId int32, rsp *pb.DBR //接收区服worker发起的秘境事件 func (this *ModuleRtask) Rpc_ModuleRtaskSendTask(ctx context.Context, args *pb.RPCRTaskReq, reply *pb.EmptyResp) (err error) { - this.Debug("Rpc_ModuleRtaskSendTask", log.Fields{ "args": args.String()}) + this.Debug("Rpc_ModuleRtaskSendTask", log.Fields{"args": args.String()}) if args.Uid == "" { err = errors.New("参数异常!") return diff --git a/modules/sociaty/api_cross_accuse.go b/modules/sociaty/api_cross_accuse.go index 565d274da..3d0db2882 100644 --- a/modules/sociaty/api_cross_accuse.go +++ b/modules/sociaty/api_cross_accuse.go @@ -1,7 +1,9 @@ package sociaty import ( + "errors" "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -19,12 +21,13 @@ func (this *apiComp) Accuse(session comm.IUserSession, req *pb.SociatyAccuseReq) } uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } + // 校验权限 if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_VICEPRESIDENT, pb.SociatyJob_ADMIN, @@ -33,9 +36,15 @@ func (this *apiComp) Accuse(session comm.IUserSession, req *pb.SociatyAccuseReq) return } + // 弹劾 if err := this.module.modelSociaty.accuse(sociaty); err != nil { - code = pb.ErrorCode_SociatyAccuse - this.module.Errorf("弹劾失败 sociatyId:%s uid:%s err:%v", sociaty.Id, uid, err) + var customErr = new(comm.CustomError) + if errors.As(err, &customErr) { + code = customErr.Code + }else{ + code = pb.ErrorCode_DBError + } + this.module.Error("弹劾", log.Fields{"uid": uid, "sociatyId": sociaty.Id}) return } diff --git a/modules/sociaty/api_cross_activitylist.go b/modules/sociaty/api_cross_activitylist.go index b5a010b4a..a5c6ef17c 100644 --- a/modules/sociaty/api_cross_activitylist.go +++ b/modules/sociaty/api_cross_activitylist.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -16,20 +17,14 @@ func (this *apiComp) ActivitylistCheck(session comm.IUserSession, req *pb.Sociat func (this *apiComp) Activitylist(session comm.IUserSession, req *pb.SociatyActivityListReq) (code pb.ErrorCode, data proto.Message) { uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } rsp := &pb.SociatyActivityListResp{} - defer func() { - if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeActivityList, rsp); err != nil { - code = pb.ErrorCode_SystemError - } - }() - sociatyTask := this.module.modelSociatyTask.getUserTask(uid, sociaty.Id) if sociatyTask.SociatyId != "" { var activityList []*pb.SociatyActivity @@ -43,5 +38,9 @@ func (this *apiComp) Activitylist(session comm.IUserSession, req *pb.SociatyActi rsp.List = activityList } + if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeActivityList, rsp); err != nil { + code = pb.ErrorCode_SystemError + } + return } diff --git a/modules/sociaty/api_cross_activityreceive.go b/modules/sociaty/api_cross_activityreceive.go index 90119b52d..0660f1535 100644 --- a/modules/sociaty/api_cross_activityreceive.go +++ b/modules/sociaty/api_cross_activityreceive.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -10,6 +11,7 @@ import ( // 活跃度领取 func (this *apiComp) ActivityreceiveCheck(session comm.IUserSession, req *pb.SociatyActivityReceiveReq) (code pb.ErrorCode) { if req.Id == 0 { + this.module.Error("活跃度领取参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } return @@ -23,7 +25,7 @@ func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyA sociaty := this.module.modelSociaty.getUserSociaty(uid) if sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } @@ -39,12 +41,7 @@ func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyA } } - ggt, err := this.module.configure.getSociatyActivityCfg() - if err != nil || ggt == nil { - code = pb.ErrorCode_ConfigNoFound - return - } - conf, ok := ggt.GetDataMap()[req.Id] + conf, ok := this.module.sociatyActivityConf.GetDataMap()[req.Id] if !ok { code = pb.ErrorCode_ConfigNoFound return @@ -53,13 +50,15 @@ func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyA //是否满足领取条件 if sociaty.Activity < conf.Activity { code = pb.ErrorCode_SociatyActivityNoEnough - this.module.Errorf("活跃度不足 sociatyId:%s uid:%s activity:%d", sociaty.Id, uid, sociaty.Activity) + this.module.Debug("活跃度不足", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "confId": req.Id, + "实际活跃度": sociaty.Activity, "期望活跃度": conf.Activity}) return } // 活跃度领取 if err := this.module.modelSociatyTask.activityReceive(req.Id, sociaty.Id, uid); err != nil { - this.module.Errorf("活跃度领取失败:%v", err) + this.module.Error("活跃度领取", log.Fields{"uid": uid, "params": req}) + code = pb.ErrorCode_DBError return } diff --git a/modules/sociaty/api_cross_agree.go b/modules/sociaty/api_cross_agree.go index ea9fcd7fb..43986c7ba 100644 --- a/modules/sociaty/api_cross_agree.go +++ b/modules/sociaty/api_cross_agree.go @@ -1,17 +1,20 @@ package sociaty import ( + "errors" "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" ) -// 申请-同意 +// 公会申请-同意 func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.SociatyAgreeReq) (code pb.ErrorCode) { if req.Uid == "" { code = pb.ErrorCode_ReqParameterError + this.module.Error("公会申请-同意参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -22,12 +25,13 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) ( } uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } + // 校验权限 if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT, pb.SociatyJob_VICEPRESIDENT, @@ -37,22 +41,21 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) ( } if err := this.module.modelSociaty.agree(req.Uid, sociaty); err != nil { - code = pb.ErrorCode_SociatyAgree - this.module.Errorf("申请同意失败:%v", err) + var customError = new(comm.CustomError) + if errors.As(err, &customError) { + code = customError.Code + } else { + code = pb.ErrorCode_DBError + } + this.module.Error("公会审核-同意", log.Fields{"uid": uid, "申请人": req.Uid, "sociatyId": sociaty.Id}) return } // 发邮件 if err := this.module.modelSociaty.sendMail("GuildApproved", []string{sociaty.Name}, []string{req.Uid}); err != nil { - this.module.Errorf("发送邮件id:GuildApproved uid:%v 失败 err:%v", uid, err) + this.module.Error("发送邮件 模板ID:GuildApproved", log.Fields{"uid": uid, "申请人": req.Uid, "sociatyId": sociaty.Id}) } - //审核通过推送 - this.module.SendMsgToUser(string(this.module.GetType()), "pagree", &pb.SociatyPAgreePush{ - Uid: uid, - SociatyId: sociaty.Id, - }, req.Uid) - rsp := &pb.SociatyAgreeResp{ Uid: req.Uid, SociatyId: sociaty.Id, @@ -60,6 +63,15 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) ( if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeAgree, rsp); err != nil { code = pb.ErrorCode_SystemError + return + } + + //审核通过推送给申请人 + if err := this.module.SendMsgToUser(string(this.module.GetType()), "pagree", &pb.SociatyPAgreePush{ + Uid: uid, + SociatyId: sociaty.Id, + }, req.Uid); err != nil { + this.module.Error("审核通过推送", log.Fields{"uid": uid, "申请人": req.Uid, "sociatyId": sociaty.Id}) } return } diff --git a/modules/sociaty/api_cross_apply.go b/modules/sociaty/api_cross_apply.go index 681b7eadb..993016c16 100644 --- a/modules/sociaty/api_cross_apply.go +++ b/modules/sociaty/api_cross_apply.go @@ -1,8 +1,11 @@ package sociaty import ( + "errors" "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" + "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -12,6 +15,7 @@ import ( func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.SociatyApplyReq) (code pb.ErrorCode) { if req.SociatyId == "" { code = pb.ErrorCode_ReqParameterError + this.module.Error("公会申请参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -24,28 +28,34 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) ( uid := session.GetUserId() sociaty := this.module.modelSociaty.getSociaty(req.SociatyId) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("sociatyId: %s no found", req.SociatyId) + this.module.Error("公会未找到", log.Fields{"uid": uid, "sociatyId": req.SociatyId}) return } // userex - // userEx, err := this.module.ModuleUser.GetRemoteUserExpand(uid) - // if err != nil { - // this.module.Errorf("GetRemoteUserExpand uid: err:%v", uid, err) - // code = pb.ErrorCode_UserSessionNobeing - // return - // } + userEx, err := this.module.ModuleUser.GetRemoteUserExpand(uid) + if err != nil { + this.module.Error("GetRemoteUserExpand", log.Fields{"uid": uid, "err": err.Error()}) + code = pb.ErrorCode_UserSessionNobeing + return + } - // if utils.IsInCDHour(userEx.SociatyCd) { - // code = pb.ErrorCode_SociatyCDLimit - // return - // } + if utils.IsInCDHour(userEx.SociatyCd) { + code = pb.ErrorCode_SociatyCDLimit + return + } + + // 是否公会成员 + if this.module.modelSociaty.isMember(uid, sociaty) { + code = pb.ErrorCode_SociatyBelongTo + return + } - // 是否达到入会等级 user, err := this.module.ModuleUser.GetRemoteUser(uid) if err != nil { + code = pb.ErrorCode_DBError return } @@ -54,17 +64,12 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) ( return } + // 是否达到入会等级 if user.Lv < sociaty.ApplyLv { code = pb.ErrorCode_SociatyAppyLvNoEnough return } - // 是否公会成员 - if this.module.modelSociaty.isMember(uid, sociaty) { - code = pb.ErrorCode_SociatyBelongTo - return - } - // 是否已申请 if this.module.modelSociaty.isApplied(uid, sociaty) { code = pb.ErrorCode_SociatyApplied @@ -79,8 +84,13 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) ( // 申请 if err := this.module.modelSociaty.apply(uid, sociaty); err != nil { - code = pb.ErrorCode_SociatyApply - this.module.Errorf("公会申请失败 sociatyId:%s err:%v", req.SociatyId, err) + var customError = new(comm.CustomError) + if errors.As(err, &customError) { + code = customError.Code + } else { + code = pb.ErrorCode_DBError + } + this.module.Error("公会申请", log.Fields{"uid": uid, "sociatyId": req.SociatyId, "err": err.Error()}) return } rsp := &pb.SociatyApplyResp{ diff --git a/modules/sociaty/api_cross_applycancel.go b/modules/sociaty/api_cross_applycancel.go index b110d9788..0cecbba2f 100644 --- a/modules/sociaty/api_cross_applycancel.go +++ b/modules/sociaty/api_cross_applycancel.go @@ -2,14 +2,18 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" ) +// 取消公会申请 + func (this *apiComp) ApplyCancelCheck(session comm.IUserSession, req *pb.SociatyApplyCancelReq) (code pb.ErrorCode) { if req.SociatyId == "" { code = pb.ErrorCode_ReqParameterError + this.module.Error("公会申请取消参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -20,9 +24,16 @@ func (this *apiComp) ApplyCancel(session comm.IUserSession, req *pb.SociatyApply } uid := session.GetUserId() - if err := this.module.modelSociaty.applyCancel(uid, req.SociatyId); err != nil { - code = pb.ErrorCode_SociatyApplyCanel - this.module.Errorf("申请撤销失败:%v", err) + sociaty := this.module.modelSociaty.getSociaty(req.SociatyId) + if sociaty != nil && sociaty.Id == "" { + code = pb.ErrorCode_SociatyNoFound + this.module.Error("公会未找到", log.Fields{"uid": uid, "sociatyId": req.SociatyId}) + return + } + + if err := this.module.modelSociaty.applyCancel(uid, sociaty); err != nil { + code = pb.ErrorCode_DBError + this.module.Error("申请撤销", log.Fields{"uid": uid, "sociatyId": req.SociatyId, "err": err.Error()}) return } diff --git a/modules/sociaty/api_cross_applylist.go b/modules/sociaty/api_cross_applylist.go index c03c73a52..0b2d34839 100644 --- a/modules/sociaty/api_cross_applylist.go +++ b/modules/sociaty/api_cross_applylist.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -12,6 +13,7 @@ import ( func (this *apiComp) ApplyListCheck(session comm.IUserSession, req *pb.SociatyApplyListReq) (code pb.ErrorCode) { if req.SociatyId == "" { code = pb.ErrorCode_ReqParameterError + this.module.Error("申请列表参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -20,14 +22,15 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.SociatyApplyLi if code = this.ApplyListCheck(session, req); code != pb.ErrorCode_Success { return } + uid := session.GetUserId() sociaty := this.module.modelSociaty.getSociaty(req.SociatyId) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("sociatyId: %s no found", req.SociatyId) + this.module.Error("公会未找到", log.Fields{"uid": uid, "sociatyId": req.SociatyId}) return } - uid := session.GetUserId() + // 校验权限 if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT, pb.SociatyJob_VICEPRESIDENT, diff --git a/modules/sociaty/api_cross_assign.go b/modules/sociaty/api_cross_assign.go index 1295b13b4..97cb489c2 100644 --- a/modules/sociaty/api_cross_assign.go +++ b/modules/sociaty/api_cross_assign.go @@ -1,7 +1,9 @@ package sociaty import ( + "errors" "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -11,6 +13,7 @@ import ( func (this *apiComp) AssignCheck(session comm.IUserSession, req *pb.SociatyAssignReq) (code pb.ErrorCode) { if req.TargetId == "" { code = pb.ErrorCode_ReqParameterError + this.module.Error("公会转让参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -23,31 +26,47 @@ func (this *apiComp) Assign(session comm.IUserSession, req *pb.SociatyAssignReq) uid := session.GetUserId() if uid == req.TargetId { code = pb.ErrorCode_ReqParameterError - this.module.Errorf("不能转让给自己 uid:%s", uid) + this.module.Error("不能转让给自己", log.Fields{"uid": uid}) return } sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } + // 校验权限 if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT) { code = pb.ErrorCode_SociatyNoRight return } - if err := this.module.modelSociaty.assign(uid, req.TargetId, sociaty); err != nil { - code = pb.ErrorCode_SociatyAssign - this.module.Errorf("转让失败:%v", err) + // 校验目标是否公会成员 + if !this.module.modelSociaty.isMember(req.TargetId, sociaty) { + code = pb.ErrorCode_SociatyNoMember return } + // 公会转让 + if err := this.module.modelSociaty.assign(uid, req.TargetId, sociaty); err != nil { + code = pb.ErrorCode_DBError + this.module.Errorf("公会转让", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "targetId": req.TargetId, "err": err.Error()}) + return + } + + // 添加日志(成员职位变动) if err := this.module.modelSociatyLog.addLog(Log_Job, sociaty.Id, uid, req.TargetId, pb.SociatyJob_PRESIDENT.String()); err != nil { - this.module.Errorf("转让日志 err:%v", err) + var customErr = new(comm.CustomError) + if errors.As(err, &customErr) { + code = customErr.Code + } else { + code = pb.ErrorCode_DBError + } + this.module.Error("公会转让日志", log.Fields{"uid": uid, "sociatyId": sociaty.Id, + "targetId": req.TargetId, "日志模板": Log_Job, "err": err.Error()}) } rsp := &pb.SociatyAssignResp{ diff --git a/modules/sociaty/api_cross_cancel.go b/modules/sociaty/api_cross_cancel.go deleted file mode 100644 index f6b1da66d..000000000 --- a/modules/sociaty/api_cross_cancel.go +++ /dev/null @@ -1,18 +0,0 @@ -package sociaty - -import ( - "go_dreamfactory/comm" - "go_dreamfactory/pb" - - "google.golang.org/protobuf/proto" -) - -// 申请取消 - -func (this *apiComp) CancelCheck(session comm.IUserSession, req *pb.SociatyCancelReq) (code pb.ErrorCode) { - return -} - -func (this *apiComp) Cancel(session comm.IUserSession, req *pb.SociatyCancelReq) (code pb.ErrorCode, data proto.Message) { - return -} diff --git a/modules/sociaty/api_cross_create.go b/modules/sociaty/api_cross_create.go index f62545548..d6c5cfbd2 100644 --- a/modules/sociaty/api_cross_create.go +++ b/modules/sociaty/api_cross_create.go @@ -3,6 +3,7 @@ package sociaty import ( "errors" "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "go_dreamfactory/utils" "strings" @@ -16,6 +17,7 @@ import ( // 公会创建 func (this *apiComp) CreateCheck(session comm.IUserSession, req *pb.SociatyCreateReq) (code pb.ErrorCode) { if len(req.Notice) > 150 || strings.TrimSpace(req.Name) == "" { + this.module.Error("公会创建参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } return @@ -30,20 +32,18 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) user, err := this.module.ModuleUser.GetRemoteUser(uid) if err != nil { - this.module.Errorf("GetRmoteUser err:%v", err) code = pb.ErrorCode_DBError return } if user.Uid == "" { - this.module.Errorf("GetRmoteUser not found uid:%v", uid) + this.module.Error("GetRmoteUser not found", log.Fields{"uid": uid}) code = pb.ErrorCode_UserSessionNobeing return } userExpand, err := this.module.ModuleUser.GetRemoteUserExpand(uid) if err != nil { - this.module.Errorf("GetRemoteUserExpand err:%v", err) code = pb.ErrorCode_DBError return } @@ -64,25 +64,23 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) if err := this.module.modelSociaty.isNameExist(req.Name); err != nil { var customErr = new(comm.CustomError) if errors.As(err, &customErr) { - if customErr.Code == pb.ErrorCode_SociatyNameExist { - code = pb.ErrorCode_SociatyNameExist - return - } + code = customErr.Code + return } code = pb.ErrorCode_DBError return } //检查钻石 - if code = this.module.ConsumeRes(session, []*cfg.Gameatn{ - this.module.globalConf.GuildBuildCos}, true); code != pb.ErrorCode_Success { + if code = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.globalConf.GuildBuildCos}, true); code != pb.ErrorCode_Success { + this.module.Warn("资源不足", log.Fields{"uid": uid, "res": this.module.globalConf.GuildBuildCos}) return } //创建公会 sociaty := &pb.DBSociaty{ Creater: user.Uid, - Name: req.Name, + Name: strings.TrimSpace(req.Name), Icon: req.Icon, Notice: req.Notice, IsApplyCheck: req.IsApplyCheck, @@ -96,8 +94,15 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) Ctime: configure.Now().Unix(), }) if err := this.module.modelSociaty.create(sociaty); err != nil { - code = pb.ErrorCode_DBError - this.module.Errorf("创建公会 err:%v", err) + var customError = new(comm.CustomError) + if errors.As(err, &customError) { + if customError.Code == pb.ErrorCode_SociatyNoFound { + code = pb.ErrorCode_SociatyNoFound + } else { + code = pb.ErrorCode_DBError + } + } + this.module.Error("创建公会", log.Fields{"uid": uid, "params": req, "err": err.Error()}) return } @@ -108,13 +113,13 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) if err = this.module.ModuleUser.ChangeRemoteUserExpand(user.Uid, update); err != nil { code = pb.ErrorCode_DBError - this.module.Errorf("更新玩家公会ID err:%v", err) + this.module.Error("更新玩家公会ID", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "err": err.Error()}) return } - // 初始化任务 + // 初始化玩家公会任务 if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil { - this.module.Errorf("初始化玩家任务 err:%v", err) + this.module.Error("初始化玩家公会任务", log.Fields{"uid": uid, "err": err.Error()}) } if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeCreate, &pb.SociatyCreateResp{ diff --git a/modules/sociaty/api_cross_discharge.go b/modules/sociaty/api_cross_discharge.go index 0e20d5774..44ca08375 100644 --- a/modules/sociaty/api_cross_discharge.go +++ b/modules/sociaty/api_cross_discharge.go @@ -1,7 +1,9 @@ package sociaty import ( + "errors" "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -12,6 +14,7 @@ import ( func (this *apiComp) DischargeCheck(session comm.IUserSession, req *pb.SociatyDischargeReq) (code pb.ErrorCode) { if req.TargetId == "" { code = pb.ErrorCode_ReqParameterError + this.module.Error("踢出公会参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -22,12 +25,13 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar } uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } + // 校验权限 if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT, pb.SociatyJob_VICEPRESIDENT) { @@ -37,27 +41,37 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar // 踢人 if err := this.module.modelSociaty.discharge(req.TargetId, sociaty); err != nil { - code = pb.ErrorCode_SociatyDischarge - this.module.Errorf("踢出公会失败:%v", err) + var customError = new(comm.CustomError) + if errors.As(err, &customError) { + code = customError.Code + } else { + code = pb.ErrorCode_DBError + } + this.module.Error("踢出公会", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "被踢人": req.TargetId, "err": err.Error()}) return } // 发邮件 receiver := this.module.modelSociaty.getMemberIds(sociaty) - this.module.modelSociaty.sendMail("GuildExpel", []string{sociaty.Name}, receiver) + if err := this.module.modelSociaty.sendMail("GuildExpel", []string{sociaty.Name}, receiver); err != nil { + this.module.Error("发送邮件 模板ID:GuildExpel", log.Fields{"uid": uid, "被踢人": req.TargetId, "sociatyId": sociaty.Id}) + } //清除玩家sociatyId update := map[string]interface{}{ "sociatyId": "", //公会ID置空 } + if err := this.module.ModuleUser.ChangeRemoteUserExpand(req.TargetId, update); err != nil { code = pb.ErrorCode_DBError - this.module.Errorf("更新玩家公会ID err:%v", err) + this.module.Error("更新玩家公会ID", log.Fields{"uid": uid, "被踢人": req.TargetId, "err": err.Error()}) return } + // 添加日志 if err := this.module.modelSociatyLog.addLog(Log_Discharge, sociaty.Id, uid, req.TargetId); err != nil { - this.module.Errorf("踢出公会日志 err:%v", err) + this.module.Error("踢出公会日志", log.Fields{"uid": uid, "sociatyId": sociaty.Id, + "targetId": req.TargetId, "日志模板": Log_Discharge, "err": err.Error()}) } rsp := &pb.SociatyDischargeResp{ diff --git a/modules/sociaty/api_cross_dismiss.go b/modules/sociaty/api_cross_dismiss.go index 0048a6f5a..d29a33047 100644 --- a/modules/sociaty/api_cross_dismiss.go +++ b/modules/sociaty/api_cross_dismiss.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "go_dreamfactory/utils" @@ -11,15 +12,22 @@ import ( // 公会解散 func (this *apiComp) DismissCheck(session comm.IUserSession, req *pb.SociatyDismissReq) (code pb.ErrorCode) { + if req.Dismiss > 1 { + code = pb.ErrorCode_ReqParameterError + this.module.Error("公会解散参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) + } return } func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissReq) (code pb.ErrorCode, data proto.Message) { + if code = this.DismissCheck(session, req); code != pb.ErrorCode_Success { + return + } uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } @@ -28,16 +36,21 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe SociatyId: sociaty.Id, } + // 校验权限 if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT) { code = pb.ErrorCode_SociatyNoRight return } + + //公会解散 update := map[string]interface{}{} globalCnf := this.module.globalConf + var isUpdate bool if sociaty.DismissTime == 0 { //更新解散倒计时 update["dismissTime"] = utils.AddHour(int(globalCnf.GuildDissolutionCountDownCd)).Unix() + isUpdate = true } else { if req.Dismiss == 1 { //取消解散 if utils.IsInCDHour(int64(sociaty.DismissCD)) { @@ -49,12 +62,15 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe } //取消倒计时 update["dismissTime"] = 0 + isUpdate = true } } - if err := this.module.modelSociaty.updateSociaty(sociaty.Id, update); err != nil { - code = pb.ErrorCode_DBError - return + if isUpdate { + if err := this.module.modelSociaty.updateSociaty(sociaty.Id, update); err != nil { + code = pb.ErrorCode_DBError + return + } } if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeDismiss, rsp); err != nil { diff --git a/modules/sociaty/api_cross_list.go b/modules/sociaty/api_cross_list.go index 6e48069d6..6f1a5265e 100644 --- a/modules/sociaty/api_cross_list.go +++ b/modules/sociaty/api_cross_list.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -9,6 +10,10 @@ import ( // 公会列表 func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.SociatyListReq) (code pb.ErrorCode) { + if req.Filter > 3 { + code = pb.ErrorCode_ReqParameterError + this.module.Error("公会列表参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) + } return } diff --git a/modules/sociaty/api_cross_log.go b/modules/sociaty/api_cross_log.go index 7d8453995..4397a2feb 100644 --- a/modules/sociaty/api_cross_log.go +++ b/modules/sociaty/api_cross_log.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -16,12 +17,13 @@ func (this *apiComp) LogCheck(session comm.IUserSession, req *pb.SociatyLogReq) func (this *apiComp) Log(session comm.IUserSession, req *pb.SociatyLogReq) (code pb.ErrorCode, data proto.Message) { uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } + // 日志列表 sl := this.module.modelSociatyLog.logList(sociaty.Id) rsp := &pb.SociatyLogResp{ diff --git a/modules/sociaty/api_cross_members.go b/modules/sociaty/api_cross_members.go index 87f379ba6..5f6679586 100644 --- a/modules/sociaty/api_cross_members.go +++ b/modules/sociaty/api_cross_members.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -16,12 +17,13 @@ func (this *apiComp) MembersCheck(session comm.IUserSession, req *pb.SociatyMemb func (this *apiComp) Members(session comm.IUserSession, req *pb.SociatyMembersReq) (code pb.ErrorCode, data proto.Message) { uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } + // 成员列表 members := this.module.modelSociaty.members(sociaty) rsp := &pb.SociatyMembersResp{ List: members, diff --git a/modules/sociaty/api_cross_mine.go b/modules/sociaty/api_cross_mine.go index 04a0d8437..3b171dcfd 100644 --- a/modules/sociaty/api_cross_mine.go +++ b/modules/sociaty/api_cross_mine.go @@ -2,12 +2,15 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) +// 我的公会 + func (this *apiComp) MineCheck(session comm.IUserSession, req *pb.SociatyMineReq) (code pb.ErrorCode) { return } @@ -16,52 +19,63 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (co uid := session.GetUserId() userEx, err := this.module.ModuleUser.GetRemoteUserExpand(uid) if err != nil { - this.module.Errorf("GetRemoteUserExpand uid: err:%v", uid, err) + this.module.Error("GetRemoteUserExpand", log.Fields{"uid": uid, "err": err}) code = pb.ErrorCode_UserSessionNobeing return } rsp := &pb.SociatyMineResp{} - // 已加入公会 - if userEx.SociatyId != "" { - sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { - code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("sociatyId: %s no found", userEx.SociatyId) - return - } + // 未加入公会 + if userEx.SociatyId == "" { + code = pb.ErrorCode_SociatyNoAdded + return + } - //验证是否解散 - if this.module.modelSociaty.isDismiss(sociaty) { - code = pb.ErrorCode_SociatyDismissed - return - } + // 获取公会 + sociaty := this.module.modelSociaty.getUserSociaty(uid) + if sociaty != nil && sociaty.Id == "" { + code = pb.ErrorCode_SociatyNoFound + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) + return + } - // 初始玩家公会任务 - sociatyTask := this.module.modelSociatyTask.getUserTask(uid, sociaty.Id) - if sociatyTask.SociatyId != "" { - if utils.IsFirstTody(sociatyTask.LastUpdateTime) { - if err := this.module.modelSociatyTask.deleTask(sociaty.Id, uid); err == nil { - if err = this.module.modelSociatyTask.initSociatyTask(uid, sociaty.Id); err != nil { - this.module.Errorf("初始化玩家攻击任务失败 err:%v", err) - } + //判断公会是否解散(公会解散非立即执行) + if this.module.modelSociaty.isDismiss(sociaty) { + code = pb.ErrorCode_SociatyDismissed + return + } + + // 初始玩家公会任务 + sociatyTask := this.module.modelSociatyTask.getUserTask(uid, sociaty.Id) + if sociatyTask.SociatyId != "" { + // 今日首次进入公会 + if utils.IsFirstTody(sociatyTask.LastUpdateTime) { + // 删除任务 + if err := this.module.modelSociatyTask.deleTask(sociaty.Id, uid); err == nil { + // 初始新的公会任务 + if err = this.module.modelSociatyTask.initSociatyTask(uid, sociaty.Id); err != nil { + this.module.Error("初始化玩家公会任务", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "err": err}) } } } - - // 获取会长 - master := this.module.modelSociaty.getMasterInfo(sociaty) - if master != nil { - if err := this.module.modelSociaty.extendJob(master.Uid, sociaty); err == nil { - // 获取新的会长 - master = this.module.modelSociaty.getMasterInfo(sociaty) - } - } - rsp.Sociaty = sociaty - rsp.Master = master } + // 获取会长 + master := this.module.modelSociaty.getMasterInfo(sociaty) + if master != nil { + // 会长弹劾判断 + if err := this.module.modelSociaty.extendJob(master.Uid, sociaty); err == nil { + // 获取新的会长 + master = this.module.modelSociaty.getMasterInfo(sociaty) + } else { + code = pb.ErrorCode_DBError + this.module.Error("会长弹劾", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "master": master.Uid, "err": err}) + } + } + rsp.Sociaty = sociaty + rsp.Master = master + if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeMine, rsp); err != nil { code = pb.ErrorCode_SystemError } diff --git a/modules/sociaty/api_cross_quit.go b/modules/sociaty/api_cross_quit.go index d5e1e105c..7eaf00543 100644 --- a/modules/sociaty/api_cross_quit.go +++ b/modules/sociaty/api_cross_quit.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "go_dreamfactory/utils" @@ -17,9 +18,9 @@ func (this *apiComp) QuitCheck(session comm.IUserSession, req *pb.SociatyQuitReq func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (code pb.ErrorCode, data proto.Message) { uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } @@ -30,9 +31,10 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (co return } + // 退出公会 if err := this.module.modelSociaty.quit(uid, sociaty); err != nil { code = pb.ErrorCode_SociatyQuit - this.module.Errorf("退出公会失败:%v", err) + this.module.Errorf("退出公会", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "err": err.Error()}) return } @@ -44,12 +46,14 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (co if err := this.module.ModuleUser.ChangeRemoteUserExpand(uid, update); err != nil { code = pb.ErrorCode_DBError - this.module.Errorf("更新玩家公会ID err:%v", err) + this.module.Error("退出公会,更新玩家公会ID", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "err": err.Error()}) return } + // 添加退出公会日志 if err := this.module.modelSociatyLog.addLog(Log_Quit, sociaty.Id, uid); err != nil { - this.module.Errorf("退出公会日志 err:%v", err) + this.module.Error("踢出公会日志", log.Fields{"uid": uid, "sociatyId": sociaty.Id, + "日志模板": Log_Quit, "err": err.Error()}) } rsp := &pb.SociatyQuitResp{ diff --git a/modules/sociaty/api_cross_rank.go b/modules/sociaty/api_cross_rank.go index fd30b19b0..34e5c1d36 100644 --- a/modules/sociaty/api_cross_rank.go +++ b/modules/sociaty/api_cross_rank.go @@ -14,6 +14,7 @@ func (this *apiComp) RankCheck(session comm.IUserSession, req *pb.SociatyRankReq } func (this *apiComp) Rank(session comm.IUserSession, req *pb.SociatyRankReq) (code pb.ErrorCode, data proto.Message) { + // 排行榜 list := this.module.modelSociaty.rank() rsp := &pb.SociatyRankResp{ Rank: list, diff --git a/modules/sociaty/api_cross_receive.go b/modules/sociaty/api_cross_receive.go index 1ad85ae84..b04e96176 100644 --- a/modules/sociaty/api_cross_receive.go +++ b/modules/sociaty/api_cross_receive.go @@ -2,16 +2,18 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" ) -// 任务奖励领取 +// 公会任务奖励领取 func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.SociatyReceiveReq) (code pb.ErrorCode) { if req.TaskId == 0 { code = pb.ErrorCode_ReqParameterError + this.module.Error("公会任务奖励领取参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -22,9 +24,9 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe } uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } @@ -32,7 +34,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe sociatyTask := this.module.modelSociaty.getUserTaskList(uid, sociaty.Id) for _, v := range sociatyTask.TaskList { if v.TaskId == req.TaskId { - if v.Status == 1 {//已领取 + if v.Status == 1 { //已领取 code = pb.ErrorCode_SociatyRewardReceived return } @@ -43,40 +45,35 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe // 验证任务是否完成 if err, ok := this.module.modelSociaty.validTask(uid, req.TaskId); err != nil || !ok { code = pb.ErrorCode_SociatyTaskValidation - this.module.Errorf("任务 taskId:%v 验证未通过", req.TaskId) + this.module.Error("公会任务未通过", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "taskId": req.TaskId, "err": err.Error()}) return } - // 领取 + // 奖励领取 if err := this.module.modelSociatyTask.receive(req.TaskId, sociaty.Id, uid); err != nil { code = pb.ErrorCode_SociatyRewardReceive - this.module.Errorf("领取任务奖励 err:%v", err) + this.module.Error("领取公会任务奖励", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "taskId": req.TaskId, "err": err.Error()}) return } //获取奖励配置 - ggt, err := this.module.configure.getSociatyTaskCfg() - if err != nil || ggt == nil { - code = pb.ErrorCode_ConfigNoFound - return - } - conf, ok := ggt.GetDataMap()[req.TaskId] + conf, ok := this.module.sociatyTaskConf.GetDataMap()[req.TaskId] if ok { // 发放个人奖励 if code = this.module.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success { - this.module.Errorf("发放个人奖励失败 sociatyId:%s uid:%s taskId:%d code:%v", sociaty.Id, uid, req.TaskId, code) + this.module.Error("发放公会个人奖励失败", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "taskId": req.TaskId, "code": code}) } } // 更新公会经验和活跃度 if err := this.module.modelSociaty.updateResourceFromTask(sociaty, conf); err != nil { - this.module.Errorf("更新公会资源 sociatyId:%s uid:%s taskId:%d err:%v", sociaty.Id, uid, req.TaskId, err) + this.module.Error("更新公会资源", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "taskId": req.TaskId, "err": err.Error()}) return } // 更新成员贡献值 if err := this.module.modelSociaty.updateMemberContribution(uid, conf.Contribution, sociaty); err != nil { - this.module.Errorf("更新成员贡献值 sociatyId:%s uid:%s taskId:%d err:%v", sociaty.Id, uid, req.TaskId, err) + this.module.Error("更新公会成员贡献值", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "taskId": req.TaskId, "err": err.Error()}) return } diff --git a/modules/sociaty/api_cross_refuse.go b/modules/sociaty/api_cross_refuse.go index ff1635be5..06c6ef2e6 100644 --- a/modules/sociaty/api_cross_refuse.go +++ b/modules/sociaty/api_cross_refuse.go @@ -2,16 +2,18 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" ) -// 申请复查 +// 公会申请审核-拒绝 func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.SociatyRefuseReq) (code pb.ErrorCode) { if req.Uid == "" { code = pb.ErrorCode_ReqParameterError + this.module.Error("公会申请审核-拒绝参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -22,12 +24,13 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.SociatyRefuseReq) } uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } + // 校验权限 if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT, pb.SociatyJob_VICEPRESIDENT, @@ -36,9 +39,16 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.SociatyRefuseReq) return } + // 已是公会成员 + if this.module.modelSociaty.isMember(uid, sociaty) { + code = pb.ErrorCode_SociatyAdded + return + } + + // 拒绝公会申请 if err := this.module.modelSociaty.refuse(req.Uid, sociaty); err != nil { code = pb.ErrorCode_SociatyRefuse - this.module.Errorf("申请拒绝失败:%v", err) + this.module.Error("申请拒绝", log.Fields{"uid": uid, "拒绝目标人": req.Uid, "err": err.Error()}) return } diff --git a/modules/sociaty/api_cross_search.go b/modules/sociaty/api_cross_search.go index ef306ff15..c1ec054c9 100644 --- a/modules/sociaty/api_cross_search.go +++ b/modules/sociaty/api_cross_search.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -11,6 +12,7 @@ import ( func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.SociatySearchReq) (code pb.ErrorCode) { if req.Name == "" { code = pb.ErrorCode_ReqParameterError + this.module.Error("公会搜索参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -22,7 +24,7 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.SociatySearchReq) rsp := &pb.SociatySearchResp{} sociaty := this.module.modelSociaty.findByName(req.Name) - if sociaty.Id != "" { + if sociaty != nil && sociaty.Id != "" { rsp.List = append(rsp.List, sociaty) } diff --git a/modules/sociaty/api_cross_setting.go b/modules/sociaty/api_cross_setting.go index bb201f45e..417990236 100644 --- a/modules/sociaty/api_cross_setting.go +++ b/modules/sociaty/api_cross_setting.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -10,6 +11,10 @@ import ( // 公会设置 func (this *apiComp) SettingCheck(session comm.IUserSession, req *pb.SociatySettingReq) (code pb.ErrorCode) { + if req.ApplyLv == 0 || req.Icon == "" { + code = pb.ErrorCode_ReqParameterError + this.module.Error("公会设置参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) + } return } @@ -20,12 +25,13 @@ func (this *apiComp) Setting(session comm.IUserSession, req *pb.SociatySettingRe uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } + // 校验权限 if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT, pb.SociatyJob_VICEPRESIDENT) { code = pb.ErrorCode_SociatyNoRight @@ -37,9 +43,10 @@ func (this *apiComp) Setting(session comm.IUserSession, req *pb.SociatySettingRe sociaty.IsApplyCheck = req.IsApplyCheck sociaty.ApplyLv = req.ApplyLv + // 设置 if err := this.module.modelSociaty.setting(sociaty); err != nil { code = pb.ErrorCode_SociatySetting - this.module.Errorf("公会修改失败:%v", err) + this.module.Error("公会修改", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "params": req, "err": err.Error()}) return } diff --git a/modules/sociaty/api_cross_settingjob.go b/modules/sociaty/api_cross_settingjob.go index 528f98e88..3fa08da0f 100644 --- a/modules/sociaty/api_cross_settingjob.go +++ b/modules/sociaty/api_cross_settingjob.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -11,6 +12,7 @@ import ( func (this *apiComp) SettingJobCheck(session comm.IUserSession, req *pb.SociatySettingJobReq) (code pb.ErrorCode) { if req.TargetId == "" || req.Job == 0 { code = pb.ErrorCode_ReqParameterError + this.module.Error("公会设置职位参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -22,9 +24,9 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } @@ -35,6 +37,12 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin return } + // 不能设置自己 + if uid == req.TargetId { + code = pb.ErrorCode_SociatySelfSetting + return + } + // 判断职位人数 globalConf := this.module.globalConf jobCount := this.module.modelSociaty.getJobCount(req.Job, sociaty) @@ -44,16 +52,10 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin return } - // 不能设置自己 - if uid == req.TargetId { - code = pb.ErrorCode_SociatySelfSetting - return - } - // 设置职位 if err := this.module.modelSociaty.settingJob(req.TargetId, req.Job, sociaty); err != nil { code = pb.ErrorCode_SociatySettingJob - this.module.Errorf("设置职位失败:%v", err) + this.module.Errorf("设置公会职位", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "params": req, "err": err.Error()}) return } diff --git a/modules/sociaty/api_cross_sign.go b/modules/sociaty/api_cross_sign.go index 5c8e720c3..713b94980 100644 --- a/modules/sociaty/api_cross_sign.go +++ b/modules/sociaty/api_cross_sign.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -19,9 +20,15 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (co uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) - if sociaty.Id == "" { + if sociaty != nil && sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) + return + } + + // 不是该公会成员 + if !this.module.modelSociaty.isMember(uid, sociaty) { + code = pb.ErrorCode_SociatyNoAdded return } @@ -34,38 +41,34 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (co // 签到 if err := this.module.modelSociaty.sign(uid, sociaty); err != nil { code = pb.ErrorCode_SociatyAgree - this.module.Errorf("签到失败:%v", err) - return - } - - ggs, err := this.module.configure.getSociatySignCfg() - if err != nil { - code = pb.ErrorCode_ConfigNoFound + this.module.Error("签到失败", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "err": err.Error()}) return } // 发奖 lastSignCount := sociaty.LastSignCount var signCfgId int32 //签到配置ID - for _, v := range ggs.GetDataList() { + for _, v := range this.module.sociatySignConf.GetDataList() { if lastSignCount >= v.Down && lastSignCount <= v.Up { // 发放签到奖励 if code = this.module.DispenseRes(session, v.Reward, true); code == pb.ErrorCode_Success { signCfgId = v.Id + } else { + log.Error("发放签到奖励失败", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "code": code}) } break } } - if cfg, ok := ggs.GetDataMap()[signCfgId]; ok { + if cfg, ok := this.module.sociatySignConf.GetDataMap()[signCfgId]; ok { // 更新公会经验 if cfg.Exp.T == "guildexp" { if err := this.module.modelSociaty.updateSociatyExp(cfg.Exp.N, sociaty); err != nil { - this.module.Errorf("公会经验更新失败:%v", err) + this.module.Error("公会经验更新", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "经验": cfg.Exp.N, "err": err.Error()}) } // 更新等级 if err := this.module.modelSociaty.changeLv(sociaty); err != nil { - this.module.Errorf("公会等级更新失败:%v", err) + this.module.Error("公会等级更新", log.Fields{"uid": uid, "sociatyId": sociaty.Id, "err": err.Error()}) } } } diff --git a/modules/sociaty/api_cross_tasklist.go b/modules/sociaty/api_cross_tasklist.go index c30123028..cfde9b3cc 100644 --- a/modules/sociaty/api_cross_tasklist.go +++ b/modules/sociaty/api_cross_tasklist.go @@ -2,6 +2,7 @@ package sociaty import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -18,17 +19,11 @@ func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskList sociaty := this.module.modelSociaty.getUserSociaty(uid) if sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound - this.module.Errorf("uid:%s not in sociaty", uid) + this.module.Error("当前玩家所在的公会未找到", log.Fields{"uid": uid}) return } rsp := &pb.SociatyTaskListResp{} - defer func() { - if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeTasklist, rsp); err != nil { - code = pb.ErrorCode_SystemError - } - }() - sociatyTask := this.module.modelSociatyTask.getUserTask(uid, sociaty.Id) if sociatyTask.SociatyId != "" { var taskList []*pb.SociatyTask @@ -42,5 +37,8 @@ func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskList rsp.List = taskList } + if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeTasklist, rsp); err != nil { + code = pb.ErrorCode_SystemError + } return } diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go index b36afdc68..1b9de59fb 100644 --- a/modules/sociaty/model_sociaty.go +++ b/modules/sociaty/model_sociaty.go @@ -2,7 +2,6 @@ package sociaty import ( "context" - "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" event_v2 "go_dreamfactory/lego/sys/event/v2" @@ -60,7 +59,7 @@ func (this *ModelSociaty) Init(service core.IService, module core.IModule, comp // 创建公会 func (this *ModelSociaty) create(sociaty *pb.DBSociaty) error { if sociaty == nil { - return fmt.Errorf("sociaty is nil") + return comm.NewCustomError(pb.ErrorCode_SociatyNoFound) } _id := primitive.NewObjectID().Hex() sociaty.Id = _id @@ -99,16 +98,17 @@ func (this *ModelSociaty) list(uid string, filter pb.SociatyListFilter) (list [] return } + logFields := log.Fields{"uid": uid, "filter": filter} switch filter { case pb.SociatyListFilter_ALL: //所有 if err := this.GetList("", &list); err != nil { - log.Errorf("sociaty list err:%v", err) + log.Error("公会列表", logFields) return } case pb.SociatyListFilter_CONDI: //满足条件 //玩家等级大于等于公会的申请等级限制 if err := this.GetList("", &list); err != nil { - log.Errorf("sociaty list err:%v", err) + log.Error("公会列表", logFields) return } var newList []*pb.DBSociaty @@ -131,7 +131,7 @@ func (this *ModelSociaty) list(uid string, filter pb.SociatyListFilter) (list [] } case pb.SociatyListFilter_APPLYING: //申请中 if err := this.GetList("", &list); err != nil { - log.Errorf("sociaty list err:%v", err) + log.Error("公会列表", logFields) return } @@ -167,8 +167,8 @@ func (this *ModelSociaty) findByName(name string) *pb.DBSociaty { // 获取公会 func (this *ModelSociaty) getSociaty(sociatyId string) (sociaty *pb.DBSociaty) { sociaty = &pb.DBSociaty{} - if err := this.GetListObj("", sociatyId, sociaty); err != nil { - this.moduleSociaty.Errorf("sociaty [%s] found err:%v", sociatyId, err) + if err := this.GetListObj(comm.RDS_EMPTY, sociatyId, sociaty); err != nil { + log.Error("GetListObj", log.Fields{"sociatyId": sociatyId}) return } return @@ -198,7 +198,6 @@ func (this *ModelSociaty) getUserSociaty(uid string) (sociaty *pb.DBSociaty) { if this.moduleSociaty.IsCross() { userEx, err = this.moduleSociaty.ModuleUser.GetRemoteUserExpand(uid) if err != nil { - log.Errorf("GetUserExpand uid:%v err:%v", uid, err) return } if userEx.SociatyId != "" { @@ -213,7 +212,6 @@ func (this *ModelSociaty) getUserSociaty(uid string) (sociaty *pb.DBSociaty) { } else { userEx, err = this.moduleSociaty.ModuleUser.GetUserExpand(uid) if err != nil { - log.Errorf("GetUserExpand uid:%v err:%v", uid, err) return } if userEx.SociatyId != "" { @@ -267,12 +265,7 @@ func (this *ModelSociaty) setting(sociaty *pb.DBSociaty) error { } // 申请撤销 -func (this *ModelSociaty) applyCancel(uid, sociatyId string) error { - sociaty := this.getSociaty(sociatyId) - if sociaty.Id == "" { - return fmt.Errorf("sociatyId: %s 公会不存在", sociatyId) - } - +func (this *ModelSociaty) applyCancel(uid string, sociaty *pb.DBSociaty) error { return this.delFromApplyRecord(uid, sociaty) } @@ -360,13 +353,11 @@ func (this *ModelSociaty) dismiss(sociaty *pb.DBSociaty) error { return err } //推送 - if err := this.moduleSociaty.SendMsgToUsers( + this.moduleSociaty.SendMsgToUsers( string(this.moduleSociaty.GetType()), "pdismiss", &pb.SociatyPDismissPush{SociatyId: sociaty.Id}, - this.getMemberIds(sociaty)...); err != nil { - log.Errorf("公会解散推送 err:%v", err) - } + this.getMemberIds(sociaty)...) //发邮件 this.sendMail("GuildDissolution", []string{sociaty.Name}, this.getMemberIds(sociaty)) @@ -389,7 +380,7 @@ func (this *ModelSociaty) delFromApplyRecord(uid string, sociaty *pb.DBSociaty) //添加成员 func (this *ModelSociaty) addMember(uid string, sociaty *pb.DBSociaty) error { if int32(len(sociaty.Members)) >= this.getMemberMax(sociaty) { - return fmt.Errorf("member max") + return comm.NewCustomError(pb.ErrorCode_SociatyMemberCountLimit) } sociaty.Members = append(sociaty.Members, &pb.SociatyMember{ Uid: uid, @@ -459,7 +450,7 @@ func (this *ModelSociaty) getMemberIds(sociaty *pb.DBSociaty) (ids []string) { // 同意 func (this *ModelSociaty) agree(uid string, sociaty *pb.DBSociaty) error { if this.isMember(uid, sociaty) { - return fmt.Errorf("已是该公会成员 uid:%s sociatyId:%s", uid, sociaty.Id) + return comm.NewCustomError(pb.ErrorCode_SociatyBelongTo) } //删除申请记录 if err := this.delFromApplyRecord(uid, sociaty); err != nil { @@ -477,9 +468,6 @@ func (this *ModelSociaty) agree(uid string, sociaty *pb.DBSociaty) error { //拒绝 func (this *ModelSociaty) refuse(uid string, sociaty *pb.DBSociaty) error { - if this.isMember(uid, sociaty) { - return fmt.Errorf("已是该公会成员 uid:%s sociatyId:%s", uid, sociaty.Id) - } return this.delFromApplyRecord(uid, sociaty) } @@ -487,10 +475,6 @@ func (this *ModelSociaty) refuse(uid string, sociaty *pb.DBSociaty) error { // targetId 目标玩家ID // srcId 玩家ID 会长 func (this *ModelSociaty) assign(srcId, targetId string, sociaty *pb.DBSociaty) error { - if !this.isMember(targetId, sociaty) { - return fmt.Errorf("不是该公会成员 uid:%s sociatyId:%s", targetId, sociaty.Id) - } - for _, m := range sociaty.Members { if m.Uid == srcId { m.Uid = targetId @@ -511,7 +495,7 @@ func (this *ModelSociaty) discharge(targetId string, sociaty *pb.DBSociaty) erro for i, m := range sociaty.Members { if m.Uid == targetId { if m.Job == pb.SociatyJob_PRESIDENT { - return fmt.Errorf("会长 %s 不可以被踢出", targetId) + return comm.NewCustomError(pb.ErrorCode_SociatyMasterNoDiss) } sociaty.Members = append(sociaty.Members[:i], sociaty.Members[i+1:]...) } @@ -569,7 +553,7 @@ func (this *ModelSociaty) getMasterInfo(sociaty *pb.DBSociaty) *pb.SociatyMember func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error { master := this.getMasterInfo(sociaty) if master == nil { - return errors.New("会长不存在") + return comm.NewCustomError(pb.ErrorCode_SociatyNoMaster) } user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(master.Uid) @@ -583,7 +567,7 @@ func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error { now := configure.Now().Unix() left := now - user.Offlinetime if left < int64(globalCnf.GuildInitiateImpeachmentTime*3600) || user.Offlinetime == 0 { - return errors.New("会长很称职,无需弹劾") + return comm.NewCustomError(pb.ErrorCode_SociatyNoAccuse) } else { //更新会长的弹劾倒计时时间 update := map[string]interface{}{ @@ -594,10 +578,11 @@ func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error { } // 弹劾倒计时判断 +// 会长在截至时间前进入公会终止弹劾,否则进行新会长选举 // srcMasterId 原会长ID func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) error { if sociaty.AccuseTime != 0 { - //终止弹劾 + //会长在截至时间前进入公会终止弹劾 now := configure.Now().Unix() if now < sociaty.AccuseTime { update := map[string]interface{}{ @@ -654,7 +639,7 @@ func (this *ModelSociaty) electNewMaster(srcMasterId string, sociaty *pb.DBSocia } } if maxCount >= 1 { //有两个以上的最大值 - //比较时间 升序 + //比较时间 升序,先加入公会的人有优先候选权 sort.SliceStable(data, func(i, j int) bool { return data[i].Ctime < data[j].Ctime }) @@ -684,9 +669,6 @@ func (this *ModelSociaty) electNewMaster(srcMasterId string, sociaty *pb.DBSocia // 签到 func (this *ModelSociaty) sign(uid string, sociaty *pb.DBSociaty) error { - if !this.isMember(uid, sociaty) { - return fmt.Errorf("不是该公会成员 uid:%s sociatyId:%s", uid, sociaty.Id) - } sociaty.SignIds = append(sociaty.SignIds, uid) @@ -821,7 +803,7 @@ func (this *ModelSociaty) rankDataChanged(event interface{}, next func(event int func (this *ModelSociaty) rank() (rank []*pb.DBSociatyRank) { var list []*pb.DBSociaty if err := this.GetList("", &list); err != nil { - log.Errorf("sociaty list err:%v", err) + log.Error("公会列表", log.Fields{"err": err.Error()}) return nil } @@ -836,6 +818,7 @@ func (this *ModelSociaty) rank() (rank []*pb.DBSociatyRank) { rank = this.sort(rank) + // 只取前20条数据 if len(rank) > 20 { rank = append(rank[:0], rank[19:]...) } @@ -901,18 +884,10 @@ func (this *ModelSociaty) validTask(uid string, taskId int32) (err error, ok boo return } - grc, err := this.moduleSociaty.configure.getRtaskCondiCfg() - if err != nil { - return - } - if grc == nil { - return errors.New("RtaskCondiCfg is nil"), false - } - // 遍历玩家任务数据 if data, ok := rsp.Vals[taskId]; ok { //查找表配置 - conf, ok := grc.GetDataMap()[taskId] + conf, ok := this.moduleSociaty.rtaskCondConf.GetDataMap()[taskId] if ok { if data.Rtype == conf.Type && data.Data[0] >= conf.Data1 { return nil, true diff --git a/modules/sociaty/model_sociatylog.go b/modules/sociaty/model_sociatylog.go index ead6d4d53..55164e545 100644 --- a/modules/sociaty/model_sociatylog.go +++ b/modules/sociaty/model_sociatylog.go @@ -1,9 +1,9 @@ package sociaty import ( - "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" @@ -37,7 +37,7 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string) content = string(Log_Add) count := strings.Count(content, "%s") if count != len(params) { - return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params)) + return comm.NewCustomError(pb.ErrorCode_SociatyLogParams) } for i := 0; i < len(params); i++ { user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(params[i]) @@ -49,7 +49,7 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string) content = string(Log_Quit) count := strings.Count(content, "%s") if count != len(params) { - return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params)) + return comm.NewCustomError(pb.ErrorCode_SociatyLogParams) } for i := 0; i < len(params); i++ { user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(params[i]) @@ -61,7 +61,7 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string) content = string(Log_Job) count := strings.Count(content, "%s") if count != len(params) { - return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params)) + return comm.NewCustomError(pb.ErrorCode_SociatyLogParams) } for i := 0; i < len(params); i++ { if i == 2 { @@ -88,7 +88,7 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string) content = string(Log_Job) count := strings.Count(content, "%s") if count != len(params) { - return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params)) + return comm.NewCustomError(pb.ErrorCode_SociatyLogParams) } for i := 0; i < len(params); i++ { user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(params[i]) @@ -100,7 +100,7 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string) content = string(Log_Job) count := strings.Count(content, "%s") if count != len(params) { - return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params)) + return comm.NewCustomError(pb.ErrorCode_SociatyLogParams) } for i := 0; i < len(params); i++ { content = strings.Replace(content, "%s", params[i], 1) @@ -160,17 +160,19 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string) // 查询日志 func (this *ModelSociatyLog) logList(sociatyId string) (slist []*pb.SociatyLog) { - log := &pb.DBSociatyLog{} - if err := this.Get(sociatyId, log); err != nil { + sociatyLog := &pb.DBSociatyLog{} + if err := this.Get(sociatyId, sociatyLog); err != nil { + log.Error("公会日志列表", log.Fields{"sociatyId": sociatyId}) return nil } - for _, l := range log.List { + for _, l := range sociatyLog.List { slist = append(slist, &pb.SociatyLog{ Content: l.Content, Ctime: l.Ctime, }) } + // 创建时间排序 降序 sort.SliceStable(slist, func(i, j int) bool { return slist[i].Ctime > slist[j].Ctime }) diff --git a/modules/sociaty/model_sociatytask.go b/modules/sociaty/model_sociatytask.go index b9aebdaf2..45b5bce06 100644 --- a/modules/sociaty/model_sociatytask.go +++ b/modules/sociaty/model_sociatytask.go @@ -1,7 +1,6 @@ package sociaty import ( - "errors" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" @@ -26,29 +25,25 @@ func (this *ModelSociatyTask) Init(service core.IService, module core.IModule, c // 初始化公会任务 加入成员时初始化 func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error { - ggt, err := this.moduleSociaty.configure.getSociatyTaskCfg() - if err != nil || ggt == nil { - return errors.New("SociatyTaskCfg not found") - } sociatyTask := &pb.DBSociatyTask{ SociatyId: sociatyId, Uid: uid, } var taskList []*pb.SociatyTask - list := ggt.GetDataList() + taskListConf := this.moduleSociaty.sociatyTaskConf.GetDataList() globalConf := this.moduleSociaty.globalConf // 大于4条配置 - if len(list) > int(globalConf.GuildTaskNum) { + if len(taskListConf) > int(globalConf.GuildTaskNum) { //随机4条任务 - randInts := utils.RandomNumbers(0, len(list)-1, int(globalConf.GuildTaskNum)) + randInts := utils.RandomNumbers(0, len(taskListConf)-1, int(globalConf.GuildTaskNum)) for _, v := range randInts { taskList = append(taskList, &pb.SociatyTask{ - TaskId: list[v].TypeId, + TaskId: taskListConf[v].TypeId, }) } } else { - for _, v := range list { + for _, v := range taskListConf { taskList = append(taskList, &pb.SociatyTask{ TaskId: v.TypeId, }) @@ -59,7 +54,7 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error { return this.moduleSociaty.modelSociatyTask.AddList(sociatyId, uid, sociatyTask) } -//任务列表 +//公会任务列表 func (this *ModelSociatyTask) getUserTask(uid, sociatyId string) (task *pb.DBSociatyTask) { task = &pb.DBSociatyTask{} this.GetListObj(sociatyId, uid, task) @@ -91,14 +86,19 @@ func (this *ModelSociatyTask) receive(taskId int32, sociatyId, uid string) error func (this *ModelSociatyTask) activityReceive(id int32, sociatyId, uid string) error { sociatyTask := &pb.DBSociatyTask{} this.GetListObj(sociatyId, uid, sociatyTask) + var isUpdate bool for _, t := range sociatyTask.ActivityList { if t.Id == id { t.Status = 1 //领取 + isUpdate = true break } } - update := map[string]interface{}{ - "activityList": sociatyTask.ActivityList, + if isUpdate { + update := map[string]interface{}{ + "activityList": sociatyTask.ActivityList, + } + return this.ChangeList(sociatyId, uid, update) } - return this.ChangeList(sociatyId, uid, update) + return nil } diff --git a/modules/sociaty/module.go b/modules/sociaty/module.go index 412cccbed..8cbe7d194 100644 --- a/modules/sociaty/module.go +++ b/modules/sociaty/module.go @@ -20,13 +20,17 @@ var _ comm.ISociaty = (*Sociaty)(nil) type Sociaty struct { modules.ModuleBase - api *apiComp - service base.IRPCXService - modelSociaty *ModelSociaty - modelSociatyTask *ModelSociatyTask - modelSociatyLog *ModelSociatyLog - configure *configureComp - globalConf *cfg.GameGlobalData + api *apiComp + service base.IRPCXService + modelSociaty *ModelSociaty + modelSociatyTask *ModelSociatyTask + modelSociatyLog *ModelSociatyLog + configure *configureComp + globalConf *cfg.GameGlobalData + sociatyActivityConf *cfg.GameGuildActivity + sociatyTaskConf *cfg.GameGuildTask + sociatySignConf *cfg.GameGuildSign + rtaskCondConf *cfg.GameRdtaskCondi } func NewModule() core.IModule { @@ -59,6 +63,10 @@ func (this *Sociaty) Start() (err error) { if this.globalConf == nil { err = errors.New("global config not found") } + this.sociatyActivityConf, err = this.configure.getSociatyActivityCfg() + this.sociatyTaskConf, err = this.configure.getSociatyTaskCfg() + this.rtaskCondConf, err = this.configure.getRtaskCondiCfg() + this.sociatySignConf, err = this.configure.getSociatySignCfg() return } diff --git a/modules/user/model_expand.go b/modules/user/model_expand.go index f2a74014c..bc51df2fa 100644 --- a/modules/user/model_expand.go +++ b/modules/user/model_expand.go @@ -3,6 +3,7 @@ package user import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" "go_dreamfactory/sys/db" @@ -28,20 +29,21 @@ func (this *ModelExpand) Init(service core.IService, module core.IModule, comp c func (this *ModelExpand) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) { result = &pb.DBUserExpand{} if db.IsCross() { - if model, err := this.module.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil { - this.module.Errorln(err) + if model, err := this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { + this.module.Error("Cross GetDBModuleByUid", log.Fields{"uid": uid}) + return result, err } else { if err = model.Get(uid, result); err != nil && mongo.ErrNoDocuments != err { - this.module.Errorf("err:%v", err) + this.module.Error("Cross Get", log.Fields{"uid": uid}) + return result,err } } } else { if err = this.Get(uid, result); err != nil && mongo.ErrNoDocuments != err { - this.module.Errorf("err:%v", err) + this.module.Error("Get", log.Fields{"uid": uid}) } } - err = nil - return result, err + return } //修改用户扩展数据 @@ -53,7 +55,7 @@ func (this *ModelExpand) ChangeUserExpand(uid string, value map[string]interface model *db.DBModel ) if db.IsCross() { - if model, err = this.module.GetDBNoduleByUid(uid, this.TableName, this.Expired); err == nil { + if model, err = this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err == nil { return model.Change(uid, value) } else { this.module.Errorln(err) diff --git a/modules/user/model_user.go b/modules/user/model_user.go index 1073ab24d..3d79cdeee 100644 --- a/modules/user/model_user.go +++ b/modules/user/model_user.go @@ -78,7 +78,7 @@ func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) { // return // } if this.module.IsCross() { - if model, err := this.module.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err := this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.Get(uid, user); err != nil { @@ -96,7 +96,7 @@ func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) { //设置属性 func (this *ModelUser) updateUserAttr(uid string, data map[string]interface{}) error { if this.module.IsCross() { - if model, err := this.module.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err := this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.Change(uid, data); err != nil { diff --git a/modules/user/module.go b/modules/user/module.go index 5de6bf409..9e88111c2 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -164,7 +164,6 @@ func (this *User) CrossUserOnlineList() ([]*pb.CacheUser, error) { err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(), comm.Service_Worker, Rpc_GetAllOnlineUser, nil, reply) if err != nil { - log.Errorf("Rpc_GetAllOnlineUser err:%v", err) return nil, err } return reply.Users, err @@ -176,7 +175,6 @@ func (this *User) CrossUserSession(uid string) *pb.CacheUser { err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(), comm.Service_Worker, Rpc_GetCrossUserSession, &pb.UIdReq{Uid: uid}, cacheUser) if err != nil { - log.Errorf("Rpc_GetCrossUserSession err:%v", err) return nil } return cacheUser @@ -192,7 +190,6 @@ func (this *User) CrossSearchUser(nickName string) ([]*pb.DBUser, error) { err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(), comm.Service_Worker, Rpc_QueryUser, &pb.NameReq{Name: name}, reply) if err != nil { - log.Errorf("Rpc_QueryUser err:%v", err) return nil, err } @@ -243,7 +240,7 @@ func (this *User) QueryAttributeValue(uid string, attr string) (value int64) { func (this *User) change(session comm.IUserSession, attr string, add int32) (change *pb.UserResChangedPush, code pb.ErrorCode) { if add == 0 { - log.Errorf("attr no changed,uid: %s attr: %s add: %d", session.GetUserId(), attr, add) + log.Error("attr no changed", log.Fields{"uid": session.GetUserId(), "attr": attr, "add": add}) // code = pb.ErrorCode_ReqParameterError return } @@ -435,7 +432,6 @@ func (this *User) EventUserChanged(session comm.IUserSession) { } func (this *User) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) { - return this.modelExpand.GetUserExpand(uid) } diff --git a/modules/worldtask/api_battlefinish.go b/modules/worldtask/api_battlefinish.go index 3a7ad1849..b9b5e4631 100644 --- a/modules/worldtask/api_battlefinish.go +++ b/modules/worldtask/api_battlefinish.go @@ -2,6 +2,7 @@ package worldtask import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -10,6 +11,7 @@ import ( // 战斗结束的请求 func (this *apiComp) BattlefinishCheck(session comm.IUserSession, req *pb.WorldtaskBattleFinishReq) (code pb.ErrorCode) { if req.BattleConfId == 0 || req.TaskId == 0 || req.Report == nil { + this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } return @@ -20,9 +22,6 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa return } - defer func() { - this.module.Errorf("战斗结束 taskId:%v", req.TaskId) - }() taskConf, err := this.module.configure.getWorldtaskById(req.TaskId) if err != nil || taskConf == nil { code = pb.ErrorCode_ConfigNoFound @@ -40,11 +39,12 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa } if ibattle, ok := battleModule.(comm.IBattle); ok { - // var isWin bool - if code, _ = ibattle.CheckBattleReport(session, req.Report); code == pb.ErrorCode_Success { + var isWin bool + if code, isWin = ibattle.CheckBattleReport(session, req.Report); code == pb.ErrorCode_Success { //触发任务 this.module.ModuleRtask.SendToRtask(session, comm.Rtype70, 1, req.BattleConfId) } + this.module.Debug("校验战报", log.Fields{"uid": session.GetUserId(), "taskId": req.TaskId, "战斗结果": isWin}) } if err := session.SendMsg(string(this.module.GetType()), WorldtaskBattleFinish, rsp); err != nil { diff --git a/modules/worldtask/api_battlestart.go b/modules/worldtask/api_battlestart.go index d84718ecf..3e173070d 100644 --- a/modules/worldtask/api_battlestart.go +++ b/modules/worldtask/api_battlestart.go @@ -10,6 +10,10 @@ import ( // 战斗开始 func (this *apiComp) BattlestartCheck(session comm.IUserSession, req *pb.WorldtaskBattleStartReq) (code pb.ErrorCode) { + if req.BattleConfId == 0 || len(req.Teamids) == 0 || req.Leadpos == 0 { + this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) + code = pb.ErrorCode_ReqParameterError + } return } diff --git a/modules/worldtask/api_finish.go b/modules/worldtask/api_finish.go index 9c0b965fb..aa7c34643 100644 --- a/modules/worldtask/api_finish.go +++ b/modules/worldtask/api_finish.go @@ -2,6 +2,7 @@ package worldtask import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -11,6 +12,7 @@ import ( func (this *apiComp) FinishCheck(session comm.IUserSession, req *pb.WorldtaskFinishReq) (code pb.ErrorCode) { if req.GroupId == 0 || req.TaskId == 0 { + this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } return @@ -60,7 +62,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe // 前置任务ID if !this.module.modelWorldtask.IsPreFinished(userTask, curTaskConf) { - this.module.Warnf("前置任务未完成 uid:%v preTaskId:%v taskId:", uid, curTaskConf.Ontxe, curTaskConf.Key) + this.module.Debug("前置任务未完成", log.Fields{"uid": uid, "preTaskId": curTaskConf.Ontxe, "taskId": curTaskConf.Key}) code = pb.ErrorCode_WorldtaskLastUnFinished return } @@ -80,12 +82,12 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe // 完成任务 if err := this.module.modelWorldtask.finishTask(req.GroupId, req.TaskId, userTask); err != nil { code = pb.ErrorCode_WorldtaskFinish - this.module.Errorf("finishTask err:%v", err) + this.module.Error("finishTask", log.Fields{"uid": uid, "groupId": req.GroupId, "taskId": req.TaskId, "err": err.Error()}) return } // 发奖 if code = this.module.DispenseRes(session, curTaskConf.Reword, true); code != pb.ErrorCode_Success { - this.module.Errorf("资源发放失败 err:%v", err) + this.module.Error("资源发放", log.Fields{"uid": uid, "groupId": req.GroupId, "taskId": req.TaskId, "reword": curTaskConf.Reword, "code": code}) } } diff --git a/modules/worldtask/api_mine.go b/modules/worldtask/api_mine.go index afa2d4bce..abb3f96a1 100644 --- a/modules/worldtask/api_mine.go +++ b/modules/worldtask/api_mine.go @@ -2,6 +2,7 @@ package worldtask import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -16,6 +17,7 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) ( uid := session.GetUserId() myWorldtask, err := this.module.modelWorldtask.getWorldtask(uid) if err != nil { + this.module.Error("获取玩家世界任务失败", log.Fields{"uid": uid, "err": err.Error()}) code = pb.ErrorCode_DBError return } diff --git a/modules/worldtask/model_worldtask.go b/modules/worldtask/model_worldtask.go index ebf2535e6..e0056befa 100644 --- a/modules/worldtask/model_worldtask.go +++ b/modules/worldtask/model_worldtask.go @@ -31,6 +31,7 @@ func (this *ModelWorldtask) getWorldtask(uid string) (*pb.DBWorldtask, error) { d := &pb.DBWorldtask{} if err := this.Get(uid, d); err != nil { if err != mongo.ErrNoDocuments { + log.Error("getWorldtask", log.Fields{"uid": uid}) return d, err } } @@ -38,6 +39,7 @@ func (this *ModelWorldtask) getWorldtask(uid string) (*pb.DBWorldtask, error) { } //判断前置任务是否完成 +// true 已完成 false未完成 func (this *ModelWorldtask) IsPreFinished(userTask *pb.DBWorldtask, curTaskConf *cfg.GameWorldTaskData) bool { var ( lastTaskId int32 @@ -94,7 +96,7 @@ func (this *ModelWorldtask) finishTask(groupId, taskId int32, task *pb.DBWorldta if module, err := this.service.GetModule(comm.ModuleLinestory); err == nil { if iLinestory, ok := module.(comm.ILinestory); ok { if err := iLinestory.TaskFinishNotify(task.Uid, taskId, groupId); err != nil { - log.Errorf("任务完成通知失败 groupId:%v taskId:%v err:%v", groupId, taskId, err) + log.Error("任务完成通知", log.Fields{"uid": task.Uid, "groupId": groupId, "taskId": taskId, "err": err.Error()}) } } } diff --git a/modules/worldtask/module.go b/modules/worldtask/module.go index dbf86ea85..159efe0ab 100644 --- a/modules/worldtask/module.go +++ b/modules/worldtask/module.go @@ -1,7 +1,6 @@ package worldtask import ( - "errors" "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/base" @@ -9,6 +8,7 @@ import ( "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" ) var _ comm.IWorldtask = (*Worldtask)(nil) @@ -19,6 +19,7 @@ type Worldtask struct { service base.IRPCXService configure *configureComp modelWorldtask *ModelWorldtask + worldtaskConf *cfg.GameWorldTask } func NewModule() core.IModule { @@ -35,29 +36,33 @@ func (this *Worldtask) OnInstallComp() { this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.modelWorldtask = this.RegisterComp(new(ModelWorldtask)).(*ModelWorldtask) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) - } + func (this *Worldtask) GetType() core.M_Modules { return comm.ModuleWorldtask } +func (this *Worldtask) Start() (err error) { + err = this.ModuleBase.Start() + if this.worldtaskConf, err = this.configure.getWorldtaskCfg(); err != nil { + return err + } + return +} + // 任务条件达成通知 func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) error { uid := session.GetUserId() - conf, err := this.configure.getWorldtaskCfg() - if err != nil || conf == nil { - return err - } - finishedTaskIds := make(map[int32]int32) //达成的任务条件 - for _, c := range conf.GetDataList() { + for _, c := range this.worldtaskConf.GetDataList() { if c.Completetask == condId && c.Completetask != 0 { finishedTaskIds[c.Group] = c.Key } } if len(finishedTaskIds) == 0 { + this.Debug("没有匹配到任务世界任务", log.Fields{"uid": uid, "condId": condId}) return nil } @@ -66,20 +71,23 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e // 获取用户信息 user := this.ModuleUser.GetUser(uid) if user == nil { - return fmt.Errorf("玩家uid:%v not found", uid) + return comm.NewCustomError(pb.ErrorCode_UserSessionNobeing) } // 玩家世界任务 userTask, err := this.modelWorldtask.getWorldtask(uid) if err != nil { + this.Error("获取玩家世界任务", log.Fields{"uid": uid, "condId": condId}) return err } if userTask.Uid != "" { //查找任务ID根据condId 可能会找出不同的任务 for k, id := range finishedTaskIds { + logFields := log.Fields{"uid": uid, "group": k, "taskId": id, "condId": condId} // 判断任务是否已完成 if this.modelWorldtask.isFinished(id, userTask.TaskList) { + this.Debug("任务已完成", logFields) continue } taskConf, err := this.configure.getWorldtaskById(id) @@ -88,7 +96,7 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e } if taskConf != nil { if !this.modelWorldtask.IsPreFinished(userTask, taskConf) { - this.Errorf("世界任务已完成 uid:%v 要求taskid:%v", uid, id) + this.Debug("世界任务前置任务未完成", logFields) continue } @@ -96,29 +104,35 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e // 判断玩家等级要求 if user.Lv < taskConf.Lock { - this.Errorf("等级不满足 uid:%v 要求lv:%v", uid, taskConf.Lock) + logFields["当前lv"] = user.Lv + logFields["期望等级"] = taskConf.Lock + this.Debug("等级不满足", logFields) return comm.NewCustomError(pb.ErrorCode_WorldtaskLvNotEnough) } //完成任务 if err := this.modelWorldtask.finishTask(k, id, userTask); err != nil { - this.Errorf("世界任务完成失败 err:%v", err) + logFields["err"] = err.Error() + this.Error("世界任务完成", logFields) return err } - this.Debugf("任务条件达成完成 condId:%v group:%v taskId:%d", condId, k, id) + this.Debug("任务条件达成完成", logFields) //发奖 if code := this.DispenseRes(session, taskConf.Reword, true); code != pb.ErrorCode_Success { - this.Errorf("资源发放失败 err:%v", err) + logFields["reward"] = taskConf.Reword + logFields["code"] = code + this.Error("资源发放", logFields) } if nextTaskId != 0 { if err := session.SendMsg(string(this.GetType()), "nexttask", &pb.WorldtaskNexttaskPush{ NextTaskId: nextTaskId, }); err != nil { - log.Errorf("任务条件达成推送失败 err:%v", err) + logFields["err"] = err.Error() + log.Error("任务条件达成推送", logFields) } } else { - this.Debugf("已经是最后一个任务了 taskId:%v", taskConf.Key) + this.Debug("已经是最后一个任务了", logFields) } } @@ -133,7 +147,8 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e func (this *Worldtask) GetMyWorldtask(uid string) *pb.DBWorldtask { wt, err := this.modelWorldtask.getWorldtask(uid) if err != nil { - log.Errorf("GetMyWorldtask err:%v", err) + log.Errorln(err.Error()) + return nil } return wt } @@ -148,13 +163,8 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId // 更新数据 update := map[string]interface{}{} - conf, err := this.configure.getWorldtaskCfg() - if err != nil || conf == nil { - return errors.New("config is nil") - } - - taskConf, err := this.configure.getWorldtaskById(taskId) - if err != nil || taskConf == nil { + taskConf := this.worldtaskConf.GetDataMap()[taskId] + if taskConf == nil { return fmt.Errorf("taskId: %v config is nil", taskId) } @@ -166,7 +176,7 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId //遍历 if taskConf.Ontxe != 0 && taskConf.IdAfter != 0 { - for _, v := range conf.GetDataList() { + for _, v := range this.worldtaskConf.GetDataList() { if v.Group == groupId && v.Key <= taskId { mytask.LastTaskIds[groupId] = v.Key mytask.TaskList = append(mytask.TaskList, &pb.Worldtask{ @@ -188,12 +198,13 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId "taskList": mytask.TaskList, } - this.modelWorldtask.Change(uid, update) + if err := this.modelWorldtask.Change(uid, update); err != nil { + return err + } rsp := &pb.WorldtaskFinishIdsPush{ TaskList: mytask.TaskList, } - session.SendMsg(string(this.GetType()), "finishIds", rsp) - return nil + return session.SendMsg(string(this.GetType()), "finishIds", rsp) } diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index b39da82c3..ba2353600 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -203,18 +203,18 @@ const ( ErrorCode_SociatyNoFound ErrorCode = 3000 //公会不存在 ErrorCode_SociatyAdded ErrorCode = 3001 //已在公会里 ErrorCode_SociatyDiamondNoEnough ErrorCode = 3002 //钻石不足 - ErrorCode_SociatyApply ErrorCode = 3003 //申请失败 + ErrorCode_SociatyNoMember ErrorCode = 3003 //不是公会成员 ErrorCode_SociatyNoRight ErrorCode = 3004 //无权限 ErrorCode_SociatyNoAdded ErrorCode = 3005 //未加入公会 ErrorCode_SociatyDismiss ErrorCode = 3006 //解散失败 ErrorCode_SociatyQuit ErrorCode = 3007 //退会失败 ErrorCode_SociatyAgree ErrorCode = 3008 //申请-同意失败 ErrorCode_SociatyRefuse ErrorCode = 3009 //申请-拒绝失败 - ErrorCode_SociatyAssign ErrorCode = 30010 //公会转让失败 - ErrorCode_SociatyDischarge ErrorCode = 30011 //踢出失败 + ErrorCode_SociatyLogParams ErrorCode = 30010 //公会日志参数错误 + ErrorCode_SociatyMasterNoDiss ErrorCode = 30011 //会长不能被踢出 ErrorCode_SociatySettingJob ErrorCode = 30012 //设置职位失败 ErrorCode_SociatySetting ErrorCode = 30013 //公会修改失败 - ErrorCode_SociatyAccuse ErrorCode = 30014 //弹劾失败 + ErrorCode_SociatyNoAccuse ErrorCode = 30014 //无需弹劾 ErrorCode_SociatySign ErrorCode = 30015 //签到失败 ErrorCode_SociatySigned ErrorCode = 30016 //已签到 ErrorCode_SociatyCDLimit ErrorCode = 30017 // CD时间限制 @@ -224,7 +224,6 @@ const ( ErrorCode_SociatyRewardReceived ErrorCode = 30021 //奖励已领取 ErrorCode_SociatyRewardReceive ErrorCode = 30022 //奖励领取失败 ErrorCode_SociatyResource ErrorCode = 30023 //更新公会资源失败 - ErrorCode_SociatyApplyCanel ErrorCode = 30024 //申请撤销失败 ErrorCode_SociatyBelongTo ErrorCode = 30025 //已是公会成员 ErrorCode_SociatyApplied ErrorCode = 30026 //已申请 ErrorCode_SociatyAppyLvNoEnough ErrorCode = 30027 //申请等级不满足 @@ -234,6 +233,7 @@ const ( ErrorCode_SociatyDismissed ErrorCode = 30031 //公会已解散 ErrorCode_SociatyNameExist ErrorCode = 30032 //公会名存在 ErrorCode_SociatyQuitNoAllowed ErrorCode = 30033 //会长不允许退公会 + ErrorCode_SociatyNoMaster ErrorCode = 30034 //无会长 // arena ErrorCode_ArenaTicketBuyUp ErrorCode = 3101 //票据上限 ErrorCode_ArenaTicketNotEnough ErrorCode = 3102 //票据不足 @@ -435,18 +435,18 @@ var ( 3000: "SociatyNoFound", 3001: "SociatyAdded", 3002: "SociatyDiamondNoEnough", - 3003: "SociatyApply", + 3003: "SociatyNoMember", 3004: "SociatyNoRight", 3005: "SociatyNoAdded", 3006: "SociatyDismiss", 3007: "SociatyQuit", 3008: "SociatyAgree", 3009: "SociatyRefuse", - 30010: "SociatyAssign", - 30011: "SociatyDischarge", + 30010: "SociatyLogParams", + 30011: "SociatyMasterNoDiss", 30012: "SociatySettingJob", 30013: "SociatySetting", - 30014: "SociatyAccuse", + 30014: "SociatyNoAccuse", 30015: "SociatySign", 30016: "SociatySigned", 30017: "SociatyCDLimit", @@ -456,7 +456,6 @@ var ( 30021: "SociatyRewardReceived", 30022: "SociatyRewardReceive", 30023: "SociatyResource", - 30024: "SociatyApplyCanel", 30025: "SociatyBelongTo", 30026: "SociatyApplied", 30027: "SociatyAppyLvNoEnough", @@ -466,6 +465,7 @@ var ( 30031: "SociatyDismissed", 30032: "SociatyNameExist", 30033: "SociatyQuitNoAllowed", + 30034: "SociatyNoMaster", 3101: "ArenaTicketBuyUp", 3102: "ArenaTicketNotEnough", 3103: "ArenaTicketNpcInCd", @@ -655,18 +655,18 @@ var ( "SociatyNoFound": 3000, "SociatyAdded": 3001, "SociatyDiamondNoEnough": 3002, - "SociatyApply": 3003, + "SociatyNoMember": 3003, "SociatyNoRight": 3004, "SociatyNoAdded": 3005, "SociatyDismiss": 3006, "SociatyQuit": 3007, "SociatyAgree": 3008, "SociatyRefuse": 3009, - "SociatyAssign": 30010, - "SociatyDischarge": 30011, + "SociatyLogParams": 30010, + "SociatyMasterNoDiss": 30011, "SociatySettingJob": 30012, "SociatySetting": 30013, - "SociatyAccuse": 30014, + "SociatyNoAccuse": 30014, "SociatySign": 30015, "SociatySigned": 30016, "SociatyCDLimit": 30017, @@ -676,7 +676,6 @@ var ( "SociatyRewardReceived": 30021, "SociatyRewardReceive": 30022, "SociatyResource": 30023, - "SociatyApplyCanel": 30024, "SociatyBelongTo": 30025, "SociatyApplied": 30026, "SociatyAppyLvNoEnough": 30027, @@ -686,6 +685,7 @@ var ( "SociatyDismissed": 30031, "SociatyNameExist": 30032, "SociatyQuitNoAllowed": 30033, + "SociatyNoMaster": 30034, "ArenaTicketBuyUp": 3101, "ArenaTicketNotEnough": 3102, "ArenaTicketNpcInCd": 3103, @@ -747,7 +747,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xe7, 0x26, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xf0, 0x26, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -970,95 +970,96 @@ var file_errorcode_proto_rawDesc = []byte{ 0x10, 0xb8, 0x17, 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x64, 0x64, 0x65, 0x64, 0x10, 0xb9, 0x17, 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, - 0x10, 0xba, 0x17, 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, - 0x70, 0x6c, 0x79, 0x10, 0xbb, 0x17, 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, - 0x79, 0x4e, 0x6f, 0x52, 0x69, 0x67, 0x68, 0x74, 0x10, 0xbc, 0x17, 0x12, 0x13, 0x0a, 0x0e, 0x53, - 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x41, 0x64, 0x64, 0x65, 0x64, 0x10, 0xbd, 0x17, - 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, 0x73, 0x6d, 0x69, - 0x73, 0x73, 0x10, 0xbe, 0x17, 0x12, 0x10, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, - 0x51, 0x75, 0x69, 0x74, 0x10, 0xbf, 0x17, 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x6f, 0x63, 0x69, 0x61, - 0x74, 0x79, 0x41, 0x67, 0x72, 0x65, 0x65, 0x10, 0xc0, 0x17, 0x12, 0x12, 0x0a, 0x0d, 0x53, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x66, 0x75, 0x73, 0x65, 0x10, 0xc1, 0x17, 0x12, 0x13, - 0x0a, 0x0d, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x10, - 0xba, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, - 0x73, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x10, 0xbb, 0xea, 0x01, 0x12, 0x17, 0x0a, 0x11, 0x53, - 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4a, 0x6f, 0x62, - 0x10, 0xbc, 0xea, 0x01, 0x12, 0x14, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x10, 0xbd, 0xea, 0x01, 0x12, 0x13, 0x0a, 0x0d, 0x53, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x63, 0x75, 0x73, 0x65, 0x10, 0xbe, 0xea, 0x01, 0x12, - 0x11, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x10, 0xbf, - 0xea, 0x01, 0x12, 0x13, 0x0a, 0x0d, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x69, 0x67, - 0x6e, 0x65, 0x64, 0x10, 0xc0, 0xea, 0x01, 0x12, 0x14, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, - 0x74, 0x79, 0x43, 0x44, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x10, 0xc1, 0xea, 0x01, 0x12, 0x15, 0x0a, - 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x78, - 0x10, 0xc2, 0xea, 0x01, 0x12, 0x18, 0x0a, 0x12, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, - 0x65, 0x6c, 0x66, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x10, 0xc3, 0xea, 0x01, 0x12, 0x1d, - 0x0a, 0x17, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x10, 0xc4, 0xea, 0x01, 0x12, 0x1b, 0x0a, - 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, - 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x10, 0xc5, 0xea, 0x01, 0x12, 0x1a, 0x0a, 0x14, 0x53, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x10, 0xc6, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, - 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0xc7, 0xea, 0x01, 0x12, 0x17, 0x0a, - 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x61, 0x6e, - 0x65, 0x6c, 0x10, 0xc8, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, - 0x79, 0x42, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x54, 0x6f, 0x10, 0xc9, 0xea, 0x01, 0x12, 0x14, 0x0a, - 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x10, - 0xca, 0xea, 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, - 0x70, 0x79, 0x4c, 0x76, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xcb, 0xea, 0x01, - 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0xcc, 0xea, 0x01, 0x12, 0x1d, 0x0a, - 0x17, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, - 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xcd, 0xea, 0x01, 0x12, 0x1c, 0x0a, 0x16, - 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x69, 0x74, 0x76, 0x69, 0x74, 0x79, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0xce, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x10, 0xcf, - 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x61, 0x6d, - 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0xd0, 0xea, 0x01, 0x12, 0x1a, 0x0a, 0x14, 0x53, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x79, 0x51, 0x75, 0x69, 0x74, 0x4e, 0x6f, 0x41, 0x6c, 0x6c, 0x6f, 0x77, - 0x65, 0x64, 0x10, 0xd1, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x10, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, - 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, 0x79, 0x55, 0x70, 0x10, 0x9d, 0x18, 0x12, 0x19, 0x0a, - 0x14, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x45, - 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x9e, 0x18, 0x12, 0x17, 0x0a, 0x12, 0x41, 0x72, 0x65, 0x6e, - 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x70, 0x63, 0x49, 0x6e, 0x43, 0x64, 0x10, 0x9f, - 0x18, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, - 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x10, 0x81, 0x19, 0x12, 0x12, 0x0a, 0x0d, 0x54, 0x61, 0x6c, - 0x65, 0x6e, 0x74, 0x45, 0x72, 0x72, 0x44, 0x61, 0x74, 0x61, 0x10, 0x82, 0x19, 0x12, 0x19, 0x0a, - 0x14, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, - 0x65, 0x66, 0x6f, 0x72, 0x65, 0x10, 0x83, 0x19, 0x12, 0x15, 0x0a, 0x10, 0x54, 0x61, 0x6c, 0x65, - 0x6e, 0x74, 0x52, 0x65, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0x84, 0x19, 0x12, - 0x10, 0x0a, 0x0b, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x10, 0xe5, - 0x19, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4d, 0x61, - 0x78, 0x10, 0xe6, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, - 0x53, 0x65, 0x6c, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xe7, 0x19, 0x12, 0x16, 0x0a, 0x11, - 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x10, 0xe8, 0x19, 0x12, 0x18, 0x0a, 0x13, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x70, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe9, 0x19, 0x12, 0x19, - 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x4e, 0x6f, 0x74, 0x54, 0x75, - 0x72, 0x6e, 0x65, 0x64, 0x4f, 0x6e, 0x10, 0xc9, 0x1a, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, - 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x52, 0x65, 0x73, 0x74, 0x43, 0x44, 0x4e, 0x6f, 0x45, 0x6e, - 0x64, 0x10, 0xca, 0x1a, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, - 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xad, 0x1b, 0x12, 0x17, 0x0a, 0x12, - 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, - 0x6d, 0x65, 0x10, 0xae, 0x1b, 0x12, 0x14, 0x0a, 0x0f, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, - 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x91, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x47, - 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, - 0x65, 0x10, 0x92, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, - 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, - 0x0f, 0x50, 0x61, 0x79, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x72, 0x72, - 0x10, 0xf6, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, - 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0xd9, 0x1d, 0x12, 0x19, 0x0a, 0x14, 0x57, 0x6f, 0x72, - 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x76, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, - 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, - 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x10, 0xdb, 0x1d, 0x12, 0x18, 0x0a, 0x13, - 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, - 0x65, 0x74, 0x65, 0x10, 0xdc, 0x1d, 0x12, 0x15, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, - 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x68, 0x65, 0x64, 0x10, 0xdd, 0x1d, 0x12, 0x1c, 0x0a, - 0x17, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x6e, - 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xde, 0x1d, 0x12, 0x1e, 0x0a, 0x19, 0x41, - 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, - 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x10, 0xbd, 0x1e, 0x42, 0x06, 0x5a, 0x04, 0x2e, - 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x10, 0xba, 0x17, 0x12, 0x14, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, + 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0xbb, 0x17, 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6f, 0x63, + 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x52, 0x69, 0x67, 0x68, 0x74, 0x10, 0xbc, 0x17, 0x12, 0x13, + 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x41, 0x64, 0x64, 0x65, 0x64, + 0x10, 0xbd, 0x17, 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, + 0x73, 0x6d, 0x69, 0x73, 0x73, 0x10, 0xbe, 0x17, 0x12, 0x10, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x79, 0x51, 0x75, 0x69, 0x74, 0x10, 0xbf, 0x17, 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x67, 0x72, 0x65, 0x65, 0x10, 0xc0, 0x17, 0x12, 0x12, 0x0a, + 0x0d, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x66, 0x75, 0x73, 0x65, 0x10, 0xc1, + 0x17, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4c, 0x6f, 0x67, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x10, 0xba, 0xea, 0x01, 0x12, 0x19, 0x0a, 0x13, 0x53, 0x6f, 0x63, + 0x69, 0x61, 0x74, 0x79, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x44, 0x69, 0x73, 0x73, + 0x10, 0xbb, 0xea, 0x01, 0x12, 0x17, 0x0a, 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4a, 0x6f, 0x62, 0x10, 0xbc, 0xea, 0x01, 0x12, 0x14, 0x0a, + 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x10, + 0xbd, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, + 0x41, 0x63, 0x63, 0x75, 0x73, 0x65, 0x10, 0xbe, 0xea, 0x01, 0x12, 0x11, 0x0a, 0x0b, 0x53, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x10, 0xbf, 0xea, 0x01, 0x12, 0x13, 0x0a, + 0x0d, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x10, 0xc0, + 0xea, 0x01, 0x12, 0x14, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x43, 0x44, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x10, 0xc1, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x78, 0x10, 0xc2, 0xea, 0x01, 0x12, + 0x18, 0x0a, 0x12, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x65, 0x6c, 0x66, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x10, 0xc3, 0xea, 0x01, 0x12, 0x1d, 0x0a, 0x17, 0x53, 0x6f, 0x63, + 0x69, 0x61, 0x74, 0x79, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x10, 0xc4, 0xea, 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x79, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x64, 0x10, 0xc5, 0xea, 0x01, 0x12, 0x1a, 0x0a, 0x14, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, + 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0xc6, 0xea, + 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x10, 0xc7, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x79, 0x42, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x54, 0x6f, 0x10, 0xc9, 0xea, 0x01, 0x12, + 0x14, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x64, 0x10, 0xca, 0xea, 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, + 0x41, 0x70, 0x70, 0x79, 0x4c, 0x76, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xcb, + 0xea, 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x61, 0x73, + 0x6b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0xcc, 0xea, 0x01, 0x12, + 0x1d, 0x0a, 0x17, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, + 0x74, 0x79, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xcd, 0xea, 0x01, 0x12, 0x1c, + 0x0a, 0x16, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x69, 0x74, 0x76, 0x69, 0x74, + 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0xce, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, + 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, + 0x10, 0xcf, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0xd0, 0xea, 0x01, 0x12, 0x1a, 0x0a, 0x14, + 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x51, 0x75, 0x69, 0x74, 0x4e, 0x6f, 0x41, 0x6c, 0x6c, + 0x6f, 0x77, 0x65, 0x64, 0x10, 0xd1, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x10, 0xd2, 0xea, 0x01, 0x12, + 0x15, 0x0a, 0x10, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, + 0x79, 0x55, 0x70, 0x10, 0x9d, 0x18, 0x12, 0x19, 0x0a, 0x14, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, + 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x9e, + 0x18, 0x12, 0x17, 0x0a, 0x12, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, + 0x4e, 0x70, 0x63, 0x49, 0x6e, 0x43, 0x64, 0x10, 0x9f, 0x18, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, + 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x10, + 0x81, 0x19, 0x12, 0x12, 0x0a, 0x0d, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x45, 0x72, 0x72, 0x44, + 0x61, 0x74, 0x61, 0x10, 0x82, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, + 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x10, 0x83, + 0x19, 0x12, 0x15, 0x0a, 0x10, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x65, 0x74, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0x84, 0x19, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x72, 0x6f, 0x6c, + 0x6c, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x10, 0xe5, 0x19, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x72, + 0x6f, 0x6c, 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x10, 0xe6, 0x19, 0x12, 0x16, 0x0a, + 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x6c, 0x6c, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x10, 0xe7, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, + 0x78, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xe8, 0x19, 0x12, 0x18, 0x0a, + 0x13, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, + 0x77, 0x61, 0x72, 0x64, 0x10, 0xe9, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x4e, 0x6f, 0x74, 0x54, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x4f, 0x6e, 0x10, + 0xc9, 0x1a, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x52, + 0x65, 0x73, 0x74, 0x43, 0x44, 0x4e, 0x6f, 0x45, 0x6e, 0x64, 0x10, 0xca, 0x1a, 0x12, 0x16, 0x0a, + 0x11, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, + 0x6e, 0x64, 0x10, 0xad, 0x1b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, + 0x67, 0x65, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x10, 0xae, 0x1b, 0x12, 0x14, + 0x0a, 0x0f, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, + 0x65, 0x10, 0x91, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, + 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x92, 0x1c, 0x12, 0x17, 0x0a, + 0x12, 0x50, 0x61, 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, + 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x50, 0x61, 0x79, 0x52, 0x65, 0x6e, + 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x72, 0x72, 0x10, 0xf6, 0x1c, 0x12, 0x14, 0x0a, 0x0f, + 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, + 0xd9, 0x1d, 0x12, 0x19, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, + 0x76, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16, 0x0a, + 0x11, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63, 0x65, + 0x70, 0x74, 0x10, 0xdb, 0x1d, 0x12, 0x18, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, + 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x10, 0xdc, 0x1d, 0x12, + 0x15, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, + 0x68, 0x65, 0x64, 0x10, 0xdd, 0x1d, 0x12, 0x1c, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, + 0x61, 0x73, 0x6b, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, + 0x64, 0x10, 0xde, 0x1d, 0x12, 0x1e, 0x0a, 0x19, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x54, + 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, + 0x6b, 0x10, 0xbd, 0x1e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/utils/strings.go b/utils/strings.go index ba75ad482..631a913ff 100644 --- a/utils/strings.go +++ b/utils/strings.go @@ -39,6 +39,17 @@ func Find(slice []string, val string) (int, bool) { return -1, false } +func Deletex[T string | int32](slice []T, val T) []T { + result := make([]T, 0) + for _, v := range slice { + if v != val { + result = append(result, v) + } + } + return result +} + +// Deprecated: Use Deletex instead func DeleteString(list []string, ele string) []string { result := make([]string, 0) for _, v := range list { diff --git a/utils/utils_test.go b/utils/utils_test.go index 42a04bd06..0bff6a796 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -81,4 +81,10 @@ func TestCompre(t *testing.T){ a:=[]int32{1,2,4,5} b:=[]int32{1,2,4} fmt.Println(utils.ForContainer(a,b)) +} + +func TestDeletex(t *testing.T){ + a:=[]int32{1,2,3,4} + c:=utils.Deletex(a, 2) + fmt.Println(c) } \ No newline at end of file From 9757796ba3750f072c5893191a64c5dd6f351ea9 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Wed, 16 Nov 2022 19:23:44 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=96=E7=95=8C?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/worldtask/api_battlestart.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worldtask/api_battlestart.go b/modules/worldtask/api_battlestart.go index 3e173070d..c46af82cf 100644 --- a/modules/worldtask/api_battlestart.go +++ b/modules/worldtask/api_battlestart.go @@ -10,7 +10,7 @@ import ( // 战斗开始 func (this *apiComp) BattlestartCheck(session comm.IUserSession, req *pb.WorldtaskBattleStartReq) (code pb.ErrorCode) { - if req.BattleConfId == 0 || len(req.Teamids) == 0 || req.Leadpos == 0 { + if req.BattleConfId == 0 || req.Battle != nil { this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } From af3ce8f4e8e3995ba0148a3c82f7cc5a6259eb8f Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 17 Nov 2022 14:38:04 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A5=BD=E5=8F=8B?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/friend/api.go | 3 +- modules/friend/api_cross_addblack.go | 39 ++++++++++++++------------ modules/friend/api_cross_agree.go | 30 ++++++++++---------- modules/friend/api_cross_apply.go | 39 ++++++++++++-------------- modules/friend/api_cross_applylist.go | 23 +++++++-------- modules/friend/api_cross_assisthero.go | 11 ++++---- modules/friend/api_cross_assistlist.go | 2 ++ modules/friend/api_cross_blacklist.go | 24 +++++++--------- modules/friend/api_cross_del.go | 12 ++++---- 9 files changed, 91 insertions(+), 92 deletions(-) diff --git a/modules/friend/api.go b/modules/friend/api.go index ab453d18c..c144c9f53 100644 --- a/modules/friend/api.go +++ b/modules/friend/api.go @@ -2,6 +2,7 @@ package friend import ( "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" ) @@ -40,7 +41,7 @@ func (this *apiComp) Init(service core.IService, module core.IModule, comp core. func (this *apiComp) setDefaultFriendUserBaseInfo(userId string) *pb.FriendBase { if user, err := this.moduleFriend.ModuleUser.GetRemoteUser(userId); err != nil { - this.moduleFriend.Errorf("GetRmoteUser err:%v", err) + this.moduleFriend.Error("GetRmoteUser", log.Fields{"err": err.Error()}) return nil } else { if user != nil { diff --git a/modules/friend/api_cross_addblack.go b/modules/friend/api_cross_addblack.go index eb7b2b4a6..6bef8c607 100644 --- a/modules/friend/api_cross_addblack.go +++ b/modules/friend/api_cross_addblack.go @@ -2,20 +2,23 @@ package friend import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) +//加入黑名单 + func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.FriendAddBlackReq) (code pb.ErrorCode) { if req.FriendId == "" { code = pb.ErrorCode_ReqParameterError + this.moduleFriend.Error("加入黑名单参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } -//加入黑名单 func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackReq) (code pb.ErrorCode, data proto.Message) { if code = this.AddblackCheck(session, req); code != pb.ErrorCode_Success { return @@ -28,18 +31,8 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR Resp *pb.FriendAddBlackResp ) - defer func() { - Resp = &pb.FriendAddBlackResp{ - FriendId: req.FriendId, - UserId: session.GetUserId(), - } - if err = session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAddBlack, Resp); err != nil { - code = pb.ErrorCode_SystemError - return - } - }() - - self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId()) + uid := session.GetUserId() + self = this.moduleFriend.modelFriend.GetFriend(uid) if self == nil { code = pb.ErrorCode_FriendSelfNoData return @@ -51,20 +44,20 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR return } - //判断目标是否在好友列表里面 - // if _, ok := utils.Find(self.FriendIds, req.FriendId); ok { + //判断目标是否在好友列表里面(目标不在好友列表中也可加入黑名单) + // if _, ok := utils.Findx(self.FriendIds, req.FriendId); ok { // code = pb.ErrorCode_FriendYet // return // } //判断目标是否已经在黑名单中 - if _, ok := utils.Find(self.BlackIds, req.FriendId); ok { + if _, ok := utils.Findx(self.BlackIds, req.FriendId); ok { code = pb.ErrorCode_FriendSelfBlackYet return } // 判断自己是否在对方的黑名单中 - if _, ok := utils.Find(target.BlackIds, self.Uid); ok { + if _, ok := utils.Findx(target.BlackIds, self.Uid); ok { code = pb.ErrorCode_FriendTargetBlackYet return } @@ -79,7 +72,7 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR self.BlackIds = append(self.BlackIds, req.FriendId) // 将目标从好友列表中移除 - friendIds := utils.DeleteString(self.FriendIds, req.FriendId) + friendIds := utils.Deletex(self.FriendIds, req.FriendId) //更新 err = this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{ @@ -88,6 +81,16 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR }) if err != nil { code = pb.ErrorCode_DBError + this.moduleFriend.Error("加入黑名单", log.Fields{"uid": uid, "目标人": req.FriendId, "err": err.Error()}) + return + } + + Resp = &pb.FriendAddBlackResp{ + FriendId: req.FriendId, + UserId: session.GetUserId(), + } + if err = session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAddBlack, Resp); err != nil { + code = pb.ErrorCode_SystemError return } diff --git a/modules/friend/api_cross_agree.go b/modules/friend/api_cross_agree.go index ef288bc34..740f1ea4a 100644 --- a/modules/friend/api_cross_agree.go +++ b/modules/friend/api_cross_agree.go @@ -2,21 +2,24 @@ package friend import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) +//单个/批量同意 + func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.FriendAgreeReq) (code pb.ErrorCode) { if len(req.FriendIds) == 0 { code = pb.ErrorCode_ReqParameterError + this.moduleFriend.Error("好友审批同意参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } -//单个/批量同意 func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (code pb.ErrorCode, data proto.Message) { if code = this.AgreeCheck(session, req); code != pb.ErrorCode_Success { return @@ -25,23 +28,11 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c err error self *pb.DBFriend target *pb.DBFriend - Resp *pb.FriendAgreeResp optNum int32 ) - - defer func() { - Resp = &pb.FriendAgreeResp{ - Num: optNum, - } - err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAgree, Resp) - if err != nil { - code = pb.ErrorCode_SystemError - return - } - }() - + uid := session.GetUserId() //获取玩家自己好友数据 - self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId()) + self = this.moduleFriend.modelFriend.GetFriend(uid) if self == nil { code = pb.ErrorCode_FriendSelfNoData return @@ -90,6 +81,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c }) if err != nil { code = pb.ErrorCode_DBError + this.moduleFriend.Error("好友审批同意", log.Fields{"uid": uid, "params": req.FriendIds, "err": err.Error()}) return } @@ -110,5 +102,13 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c // 拥有xx个好友 this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype10, int32(len(agreeIds))) + + resp := &pb.FriendAgreeResp{ + Num: optNum, + } + if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAgree, resp); err != nil { + code = pb.ErrorCode_SystemError + return + } return } diff --git a/modules/friend/api_cross_apply.go b/modules/friend/api_cross_apply.go index 540c733a3..f78905e19 100644 --- a/modules/friend/api_cross_apply.go +++ b/modules/friend/api_cross_apply.go @@ -9,14 +9,16 @@ import ( "google.golang.org/protobuf/proto" ) +//好友申请 + func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.FriendApplyReq) (code pb.ErrorCode) { if req.FriendId == "" { code = pb.ErrorCode_ReqParameterError + this.moduleFriend.Error("好友申请参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } -//好友申请 func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (code pb.ErrorCode, data proto.Message) { if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success { return @@ -26,24 +28,11 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c err error self *pb.DBFriend target *pb.DBFriend - Resp *pb.FriendApplyResp ) - defer func() { - if code == pb.ErrorCode_Success { - Resp = &pb.FriendApplyResp{ - UserId: session.GetUserId(), - FriendId: req.FriendId, - } - } - if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeApply, Resp); err != nil { - code = pb.ErrorCode_SystemError - return - } - }() - + uid := session.GetUserId() //获取玩家自己好友数据 - self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId()) + self = this.moduleFriend.modelFriend.GetFriend(uid) if self == nil { code = pb.ErrorCode_FriendSelfNoData return @@ -57,7 +46,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c } //判断是否是自己 - if req.FriendId == session.GetUserId() { + if req.FriendId == uid { code = pb.ErrorCode_FriendNotSelf return } @@ -104,14 +93,22 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c } target.ApplyIds = append(target.ApplyIds, session.GetUserId()) - err = this.moduleFriend.modelFriend.Change(req.FriendId, map[string]interface{}{ + if err = this.moduleFriend.modelFriend.Change(req.FriendId, map[string]interface{}{ "applyIds": target.ApplyIds, - }) - if err != nil { - log.Errorf("firend Apply err:%v", err) + }); err != nil { code = pb.ErrorCode_FriendApplyError + this.moduleFriend.Error("好友申请", log.Fields{"uid": uid, "params": req.FriendId, "err": err.Error()}) return } + resp := &pb.FriendApplyResp{ + UserId: session.GetUserId(), + FriendId: req.FriendId, + } + + if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeApply, resp); err != nil { + code = pb.ErrorCode_SystemError + return + } return } diff --git a/modules/friend/api_cross_applylist.go b/modules/friend/api_cross_applylist.go index 4dd95cc34..fd35e6244 100644 --- a/modules/friend/api_cross_applylist.go +++ b/modules/friend/api_cross_applylist.go @@ -7,29 +7,18 @@ import ( "google.golang.org/protobuf/proto" ) +//申请列表 + func (this *apiComp) ApplyListCheck(session comm.IUserSession, req *pb.FriendApplyListReq) (code pb.ErrorCode) { return } -//申请列表 func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyListReq) (code pb.ErrorCode, data proto.Message) { var ( self *pb.DBFriend - Resp *pb.FriendApplyListResp list []*pb.FriendBase ) - defer func() { - if code == pb.ErrorCode_Success { - Resp = &pb.FriendApplyListResp{ - List: list, - } - } - if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeApplyList, Resp); err != nil { - code = pb.ErrorCode_SystemError - } - }() - self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId()) if self == nil { code = pb.ErrorCode_FriendSelfNoData @@ -43,5 +32,13 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis } } + resp := &pb.FriendApplyListResp{ + List: list, + } + + if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeApplyList, resp); err != nil { + code = pb.ErrorCode_SystemError + } + return } diff --git a/modules/friend/api_cross_assisthero.go b/modules/friend/api_cross_assisthero.go index ddbc5b04b..5c339cb75 100644 --- a/modules/friend/api_cross_assisthero.go +++ b/modules/friend/api_cross_assisthero.go @@ -14,6 +14,7 @@ import ( func (this *apiComp) AssistheroCheck(session comm.IUserSession, req *pb.FriendAssistheroReq) (code pb.ErrorCode) { if req.HeroObjId == "" { code = pb.ErrorCode_ReqParameterError + this.moduleFriend.Error("设置助战英雄参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } @@ -22,12 +23,12 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth if code = this.AssistheroCheck(session, req); code != pb.ErrorCode_Success { return } - + uid := session.GetUserId() // 获取英雄 hero, err := this.moduleFriend.ModuleHero.QueryCrossHeroinfo(req.HeroObjId) if err != nil { code = pb.ErrorCode_DBError - this.moduleFriend.Errorf("query hero by cross err:%v", err) + this.moduleFriend.Error("查询英雄数据 QueryCrossHeroinfo", log.Fields{"uid": uid, "param": req.HeroObjId, "err": err.Error()}) return } @@ -37,7 +38,7 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth } //获取玩家自己好友数据 - self := this.moduleFriend.modelFriend.GetFriend(session.GetUserId()) + self := this.moduleFriend.modelFriend.GetFriend(uid) if self == nil { code = pb.ErrorCode_FriendSelfNoData return @@ -54,8 +55,8 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth } if err := this.moduleFriend.modelFriend.Change(self.Uid, update); err != nil { - log.Errorf("Assisthero err:%v", err) code = pb.ErrorCode_FriendApplyError + this.moduleFriend.Error("设置助战英雄", log.Fields{"uid": uid, "param": req.HeroObjId, "err": err.Error()}) return } @@ -76,7 +77,7 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth } if err := this.moduleFriend.SendMsgToUsers(string(this.moduleFriend.GetType()), "assistheroupdate", push, self.FriendIds...); err != nil { - this.moduleFriend.Errorf("push AssistHeroList err:", err) + this.moduleFriend.Error("推送助战英雄列表", log.Fields{"uid": uid, "friends": self.FriendIds, "err": err.Error()}) } } diff --git a/modules/friend/api_cross_assistlist.go b/modules/friend/api_cross_assistlist.go index e04427f1f..f5c8117b1 100644 --- a/modules/friend/api_cross_assistlist.go +++ b/modules/friend/api_cross_assistlist.go @@ -9,6 +9,8 @@ import ( "google.golang.org/protobuf/proto" ) +// 助战列表 + func (this *apiComp) AssistlistCheck(session comm.IUserSession, req *pb.FriendAssistlistReq) (code pb.ErrorCode) { return } diff --git a/modules/friend/api_cross_blacklist.go b/modules/friend/api_cross_blacklist.go index 453be5dfa..3fcb18539 100644 --- a/modules/friend/api_cross_blacklist.go +++ b/modules/friend/api_cross_blacklist.go @@ -7,30 +7,17 @@ import ( "google.golang.org/protobuf/proto" ) +//黑名单列表 func (this *apiComp) BlacklistCheck(session comm.IUserSession, req *pb.FriendBlackListReq) (code pb.ErrorCode) { return } -//黑名单 func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackListReq) (code pb.ErrorCode, data proto.Message) { var ( self *pb.DBFriend - Resp *pb.FriendBlackListResp list []*pb.FriendBase ) - defer func() { - Resp = &pb.FriendBlackListResp{ - Friends: list, - } - - err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeBlacklist, Resp) - if err != nil { - code = pb.ErrorCode_SystemError - return - } - }() - self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId()) if self == nil { code = pb.ErrorCode_FriendSelfNoData @@ -43,6 +30,15 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis list = append(list, base) } } + + resp := &pb.FriendBlackListResp{ + Friends: list, + } + err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeBlacklist, resp) + if err != nil { + code = pb.ErrorCode_SystemError + return + } return } diff --git a/modules/friend/api_cross_del.go b/modules/friend/api_cross_del.go index f1bcbad0e..279186340 100644 --- a/modules/friend/api_cross_del.go +++ b/modules/friend/api_cross_del.go @@ -9,27 +9,29 @@ import ( "google.golang.org/protobuf/proto" ) +//删除好友 func (this *apiComp) DelCheck(session comm.IUserSession, req *pb.FriendDelReq) (code pb.ErrorCode) { if req.FriendId == "" { code = pb.ErrorCode_ReqParameterError + this.moduleFriend.Error("删除好友参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) } return } -//删除好友 func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code pb.ErrorCode, data proto.Message) { if code = this.DelCheck(session, req); code != pb.ErrorCode_Success { return } - self := this.moduleFriend.modelFriend.GetFriend(session.GetUserId()) + uid := session.GetUserId() + self := this.moduleFriend.modelFriend.GetFriend(uid) if self == nil { code = pb.ErrorCode_FriendSelfNoData return } // 从好友列表中删除 - selfFriendIds := utils.DeleteString(self.FriendIds, req.FriendId) + selfFriendIds := utils.Deletex(self.FriendIds, req.FriendId) if err := this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{ "friendIds": selfFriendIds, @@ -46,13 +48,13 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code } // 将自己从对方好友列表中移除 - targetFriendIds := utils.DeleteString(target.FriendIds, session.GetUserId()) + targetFriendIds := utils.DeleteString(target.FriendIds, uid) if err := this.moduleFriend.modelFriend.Change(req.FriendId, map[string]interface{}{ "friendIds": targetFriendIds, }); err != nil { - log.Errorf("Del friend err:%v", err) code = pb.ErrorCode_FriendApplyError + this.moduleFriend.Error("删除好友", log.Fields{"uid": uid, "param": req.FriendId, "err": err.Error()}) return } From 77e57cbd47407caadd98c59ba1289c1755a5e0dd Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 17 Nov 2022 14:38:51 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=94=AF=E7=BA=BF=E5=89=A7=E6=83=85?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/linestory/model_linestory.go | 1 + modules/linestory/module.go | 23 ++++++++++++++++++----- modules/worldtask/api_battlefinish.go | 2 +- modules/worldtask/api_battlestart.go | 2 +- modules/worldtask/api_finish.go | 4 ++-- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/modules/linestory/model_linestory.go b/modules/linestory/model_linestory.go index baaa288f9..470f4c1b3 100644 --- a/modules/linestory/model_linestory.go +++ b/modules/linestory/model_linestory.go @@ -32,6 +32,7 @@ func (this *ModelLinestory) getLinestory(uid string) *pb.DBLinestory { if err := this.Get(uid, ls); err != nil { if err == mongo.ErrNoDocuments { ls.Id = primitive.NewObjectID().Hex() + if err := this.Add(uid, ls); err != nil { log.Errorf("save linestory err:%v", err) return ls diff --git a/modules/linestory/module.go b/modules/linestory/module.go index a33a1442d..d5b551d35 100644 --- a/modules/linestory/module.go +++ b/modules/linestory/module.go @@ -6,6 +6,7 @@ package linestory import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -57,7 +58,7 @@ func (this *ModuleLinestory) Start() (err error) { // 世界任务完成通知 func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32) error { ls := this.modelLinestory.getLinestory(uid) - + log.Debug("支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId}) var isUpdate bool if chapter, ok := ls.TaskChapter[groupId]; ok { if _, ok := utils.Findx(chapter.TaskIds, taskId); !ok { @@ -73,16 +74,28 @@ func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32) // 重置任务ID if conf, ok := this.confMaintask.GetDataMap()[taskId]; ok { if conf.Group == groupId { - var newTaskList []int32 - for _, v := range conf.Resetto { - newTaskList = utils.Deletex(chapter.TaskIds, v) + if len(conf.Resetto) > 0 { + var newTaskList []int32 + for _, v := range conf.Resetto { + newTaskList = utils.Deletex(chapter.TaskIds, v) + } + chapter.TaskIds = newTaskList } - chapter.TaskIds = newTaskList } } isUpdate = true } } else { + // 校验groupId 或taskId是否合法 + if _, ok := this.confTimeline.GetDataMap()[groupId]; !ok { + this.Debug("非支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId}) + return comm.NewCustomError(pb.ErrorCode_ReqParameterError) + } + if _, ok := this.confMaintask.GetDataMap()[taskId]; !ok { + this.Debug("非支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId}) + return comm.NewCustomError(pb.ErrorCode_ReqParameterError) + } + tg := &pb.TaskChapter{} // 设置完成的任务 tg.TaskIds = append(tg.TaskIds, taskId) diff --git a/modules/worldtask/api_battlefinish.go b/modules/worldtask/api_battlefinish.go index b9b5e4631..12ba9bf12 100644 --- a/modules/worldtask/api_battlefinish.go +++ b/modules/worldtask/api_battlefinish.go @@ -11,7 +11,7 @@ import ( // 战斗结束的请求 func (this *apiComp) BattlefinishCheck(session comm.IUserSession, req *pb.WorldtaskBattleFinishReq) (code pb.ErrorCode) { if req.BattleConfId == 0 || req.TaskId == 0 || req.Report == nil { - this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) + this.module.Error("世界任务战斗结束参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } return diff --git a/modules/worldtask/api_battlestart.go b/modules/worldtask/api_battlestart.go index c46af82cf..adca6d478 100644 --- a/modules/worldtask/api_battlestart.go +++ b/modules/worldtask/api_battlestart.go @@ -11,7 +11,7 @@ import ( // 战斗开始 func (this *apiComp) BattlestartCheck(session comm.IUserSession, req *pb.WorldtaskBattleStartReq) (code pb.ErrorCode) { if req.BattleConfId == 0 || req.Battle != nil { - this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) + this.module.Error("世界任务战斗开始参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } return diff --git a/modules/worldtask/api_finish.go b/modules/worldtask/api_finish.go index aa7c34643..d1851c065 100644 --- a/modules/worldtask/api_finish.go +++ b/modules/worldtask/api_finish.go @@ -8,11 +8,11 @@ import ( "google.golang.org/protobuf/proto" ) -// 任务完成 +// 世界任务完成 func (this *apiComp) FinishCheck(session comm.IUserSession, req *pb.WorldtaskFinishReq) (code pb.ErrorCode) { if req.GroupId == 0 || req.TaskId == 0 { - this.module.Error("参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) + this.module.Error("世界任务完成参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } return From 4953b4e5453afb7e2ba058cd33127348dac237a2 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 17 Nov 2022 20:32:28 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=94=AF=E7=BA=BF=E5=89=A7=E6=83=85?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_linestorymaintask.json | 80 ++- bin/json/game_linestorytimeline.json | 8 + bin/json/game_worldtask.json | 616 ++++-------------- modules/linestory/model_linestory.go | 21 +- modules/linestory/module.go | 48 +- modules/sociaty/module.go | 17 +- modules/worldtask/api_battlestart.go | 6 +- modules/worldtask/api_finish.go | 25 +- modules/worldtask/model_worldtask.go | 2 +- modules/worldtask/module.go | 27 +- pb/errorcode.pb.go | 225 +++---- .../structs/Game.LinestoryMainTaskData.go | 10 +- .../structs/Game.LinestoryTimeLineData.go | 2 + 13 files changed, 430 insertions(+), 657 deletions(-) diff --git a/bin/json/game_linestorymaintask.json b/bin/json/game_linestorymaintask.json index 2773db391..dbc2e50cd 100644 --- a/bin/json/game_linestorymaintask.json +++ b/bin/json/game_linestorymaintask.json @@ -1,120 +1,180 @@ [ { "id": 20001, - "group": 10001, "subTask": 0, + "nodeIndex": 0, + "order": "1", + "group": 10001, "name": { "key": "SubplotMainTask_20001", "text": "让阿宝变强1" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强1" + }, "img": "", "ending": 0, "resetto": [] }, { "id": 20002, - "group": 10001, "subTask": 20001, + "nodeIndex": 1, + "order": "2", + "group": 10001, "name": { "key": "SubplotMainTask_20002", "text": "让阿宝变强2" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强2" + }, "img": "", "ending": 0, "resetto": [] }, { "id": 20003, + "subTask": 20001, + "nodeIndex": 1, + "order": "3", "group": 10001, - "subTask": 20002, "name": { "key": "SubplotMainTask_20003", "text": "让阿宝变强3" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强3" + }, "img": "", "ending": 0, "resetto": [] }, { "id": 20004, - "group": 10001, "subTask": 20003, + "nodeIndex": 2, + "order": "4", + "group": 10001, "name": { "key": "SubplotMainTask_20004", "text": "让阿宝变强4" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强4" + }, "img": "", "ending": 0, "resetto": [] }, { "id": 20005, + "subTask": 20002, + "nodeIndex": 2, + "order": "5", "group": 10001, - "subTask": 20004, "name": { "key": "SubplotMainTask_20005", "text": "让阿宝变强5" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强5" + }, "img": "", "ending": 0, "resetto": [] }, { "id": 20006, - "group": 10001, "subTask": 20005, + "nodeIndex": 3, + "order": "6", + "group": 10001, "name": { "key": "SubplotMainTask_20006", "text": "让阿宝变强6" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强6" + }, "img": "", "ending": 0, "resetto": [] }, { "id": 20007, - "group": 10001, "subTask": 20006, + "nodeIndex": 4, + "order": "7", + "group": 10001, "name": { "key": "SubplotMainTask_20007", "text": "让阿宝变强7" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强7" + }, "img": "", "ending": 0, "resetto": [] }, { "id": 20008, - "group": 10001, "subTask": 20007, + "nodeIndex": 5, + "order": "8", + "group": 10001, "name": { "key": "SubplotMainTask_20008", "text": "让阿宝变强8" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强8" + }, "img": "", "ending": 0, "resetto": [] }, { "id": 20009, - "group": 10001, "subTask": 20008, + "nodeIndex": 6, + "order": "9", + "group": 10001, "name": { "key": "SubplotMainTask_20009", "text": "让阿宝变强9" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强9" + }, "img": "", "ending": 0, "resetto": [] }, { "id": 20010, - "group": 10001, "subTask": 20009, + "nodeIndex": 7, + "order": "10", + "group": 10001, "name": { "key": "SubplotMainTask_20010", "text": "让阿宝变强10" }, + "describe": { + "key": "SubplotMainTask_10001", + "text": "让阿宝变强10" + }, "img": "", "ending": 1, "resetto": [] diff --git a/bin/json/game_linestorytimeline.json b/bin/json/game_linestorytimeline.json index 9217cc998..33ce6cf80 100644 --- a/bin/json/game_linestorytimeline.json +++ b/bin/json/game_linestorytimeline.json @@ -1,6 +1,7 @@ [ { "group": 10001, + "order": "1", "nodeIndex": 0, "cond": [], "name": { @@ -23,6 +24,7 @@ }, { "group": 10002, + "order": "2", "nodeIndex": 1, "cond": [ 10001 @@ -47,6 +49,7 @@ }, { "group": 10003, + "order": "3", "nodeIndex": 1, "cond": [ 10001 @@ -71,6 +74,7 @@ }, { "group": 10004, + "order": "4", "nodeIndex": 2, "cond": [ 10003 @@ -95,6 +99,7 @@ }, { "group": 10005, + "order": "5", "nodeIndex": 2, "cond": [ 10003 @@ -119,6 +124,7 @@ }, { "group": 10006, + "order": "6", "nodeIndex": 3, "cond": [ 10005 @@ -143,6 +149,7 @@ }, { "group": 10007, + "order": "7", "nodeIndex": 4, "cond": [ 10006 @@ -167,6 +174,7 @@ }, { "group": 10008, + "order": "8", "nodeIndex": 5, "cond": [ 10007 diff --git a/bin/json/game_worldtask.json b/bin/json/game_worldtask.json index 36e69a8b6..1ce883390 100644 --- a/bin/json/game_worldtask.json +++ b/bin/json/game_worldtask.json @@ -19,7 +19,7 @@ 100001 ], "completetask": 0, - "auto_accept": 1, + "auto_accept": 0, "overtips": 1, "reword": [ { @@ -33,8 +33,8 @@ "n": 1 } ], - "day": "night", - "weather": 2 + "day": "", + "weather": 0 }, { "key": 10101, @@ -191,13 +191,7 @@ "completetask": 118, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -223,15 +217,9 @@ "completetask": 174, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", - "weather": 2 + "reword": [], + "day": "", + "weather": 0 }, { "key": 10107, @@ -255,15 +243,9 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", - "weather": 2 + "reword": [], + "day": "", + "weather": 0 }, { "key": 10108, @@ -287,14 +269,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "", "weather": 0 }, { @@ -319,14 +295,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "", "weather": 0 }, { @@ -351,14 +321,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "", "weather": 0 }, { @@ -383,14 +347,8 @@ "completetask": 175, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "", "weather": 0 }, { @@ -415,14 +373,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "", "weather": 0 }, { @@ -447,14 +399,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "", "weather": 0 }, { @@ -479,14 +425,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "", "weather": 0 }, { @@ -501,7 +441,7 @@ "task_display": "新剧情文本10115", "npc": [ "scenes_boundary_02night", - "阿宝组件名", + "阿宝夜晚组件名", "153" ], "getafter_event": [ @@ -511,15 +451,9 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "night", - "weather": 0 + "weather": 2 }, { "key": 10116, @@ -543,13 +477,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "night", "weather": 0 }, @@ -575,14 +503,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "day", "weather": 0 }, { @@ -607,14 +529,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "day", "weather": 0 }, { @@ -639,14 +555,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "day", "weather": 0 }, { @@ -671,14 +581,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "day", "weather": 0 }, { @@ -703,14 +607,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "day", "weather": 0 }, { @@ -735,14 +633,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "night", + "reword": [], + "day": "day", "weather": 0 }, { @@ -767,14 +659,8 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "day": "", + "reword": [], + "day": "day", "weather": 0 }, { @@ -789,8 +675,8 @@ "task_display": "新剧情文本10124", "npc": [ "WuGuanScene", - "阿宝组件名", - "624" + "武馆阿宝", + "137" ], "getafter_event": [ 2, @@ -799,13 +685,7 @@ "completetask": 176, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -821,8 +701,8 @@ "task_display": "新剧情文本10125", "npc": [ "WuGuanScene", - "阿宝组件名", - "625" + "武馆阿宝", + "137" ], "getafter_event": [ 2, @@ -831,13 +711,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -853,8 +727,8 @@ "task_display": "新剧情文本10126", "npc": [ "WuGuanScene", - "阿宝组件名", - "626" + "武馆阿宝", + "137" ], "getafter_event": [ 2, @@ -863,13 +737,7 @@ "completetask": 177, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -885,8 +753,8 @@ "task_display": "新剧情文本10127", "npc": [ "WuGuanScene", - "阿宝组件名", - "627" + "武馆阿宝", + "137" ], "getafter_event": [ 2, @@ -895,13 +763,7 @@ "completetask": 178, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -917,8 +779,8 @@ "task_display": "新剧情文本10128", "npc": [ "WuGuanScene", - "阿宝组件名", - "628" + "武馆阿宝", + "137" ], "getafter_event": [ 2, @@ -927,13 +789,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -949,8 +805,8 @@ "task_display": "新剧情文本10129", "npc": [ "WuGuanScene", - "阿宝组件名", - "629" + "武馆阿宝", + "137" ], "getafter_event": [ 2, @@ -959,13 +815,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -981,8 +831,8 @@ "task_display": "新剧情文本10130", "npc": [ "WuGuanScene", - "阿宝组件名", - "630" + "武馆阿宝", + "137" ], "getafter_event": [ 2, @@ -991,13 +841,7 @@ "completetask": 158, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1023,13 +867,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1055,13 +893,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1087,13 +919,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1119,13 +945,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1151,13 +971,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1183,13 +997,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1215,13 +1023,7 @@ "completetask": 179, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1247,13 +1049,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1279,13 +1075,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1311,13 +1101,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1343,13 +1127,7 @@ "completetask": 180, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1375,13 +1153,7 @@ "completetask": 181, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1407,13 +1179,7 @@ "completetask": 182, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1439,13 +1205,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1471,13 +1231,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1503,13 +1257,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1535,13 +1283,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1567,13 +1309,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1599,13 +1335,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1631,13 +1361,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1663,13 +1387,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1694,13 +1412,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1725,13 +1437,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1756,13 +1462,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1787,13 +1487,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1818,13 +1512,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1849,13 +1537,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1880,13 +1562,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1911,13 +1587,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1942,13 +1612,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -1973,13 +1637,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -2004,13 +1662,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -2035,13 +1687,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -2066,13 +1712,7 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, @@ -2097,23 +1737,17 @@ "completetask": 0, "auto_accept": 1, "overtips": 1, - "reword": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], + "reword": [], "day": "", "weather": 0 }, { "key": 20001, "lock": 1, - "ontxe": 0, + "ontxe": 10165, "id_after": 20002, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10100", "task_display": "新剧情文本10100", @@ -2150,7 +1784,7 @@ "ontxe": 20001, "id_after": 20003, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10101", "task_display": "新剧情文本10101", @@ -2182,7 +1816,7 @@ "ontxe": 20002, "id_after": 20004, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10102", "task_display": "新剧情文本10102", @@ -2195,7 +1829,7 @@ 2, 100003 ], - "completetask": 171, + "completetask": 176, "auto_accept": 1, "overtips": 1, "reword": [ @@ -2214,7 +1848,7 @@ "ontxe": 20003, "id_after": 20005, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10103", "task_display": "新剧情文本10103", @@ -2246,7 +1880,7 @@ "ontxe": 20004, "id_after": 20006, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10104", "task_display": "新剧情文本10104", @@ -2283,7 +1917,7 @@ "ontxe": 20005, "id_after": 20007, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10105", "task_display": "新剧情文本10105", @@ -2315,7 +1949,7 @@ "ontxe": 20006, "id_after": 20008, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10106", "task_display": "新剧情文本10106", @@ -2328,7 +1962,7 @@ 2, 100007 ], - "completetask": 174, + "completetask": 175, "auto_accept": 1, "overtips": 1, "reword": [ @@ -2347,7 +1981,7 @@ "ontxe": 20007, "id_after": 20009, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10107", "task_display": "新剧情文本10107", @@ -2379,7 +2013,7 @@ "ontxe": 20008, "id_after": 20010, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10108", "task_display": "新剧情文本10108", @@ -2411,7 +2045,7 @@ "ontxe": 20009, "id_after": 20011, "group": 10001, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10109", "task_display": "新剧情文本10109", @@ -2440,10 +2074,10 @@ { "key": 20011, "lock": 1, - "ontxe": 0, + "ontxe": 20010, "id_after": 20012, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10100", "task_display": "新剧情文本10100", @@ -2480,7 +2114,7 @@ "ontxe": 20011, "id_after": 20013, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10101", "task_display": "新剧情文本10101", @@ -2512,7 +2146,7 @@ "ontxe": 20012, "id_after": 20014, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10102", "task_display": "新剧情文本10102", @@ -2544,7 +2178,7 @@ "ontxe": 20013, "id_after": 20015, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10103", "task_display": "新剧情文本10103", @@ -2576,7 +2210,7 @@ "ontxe": 20014, "id_after": 20016, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10104", "task_display": "新剧情文本10104", @@ -2613,7 +2247,7 @@ "ontxe": 20015, "id_after": 20017, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10105", "task_display": "新剧情文本10105", @@ -2626,7 +2260,7 @@ 2, 100006 ], - "completetask": 118, + "completetask": 172, "auto_accept": 1, "overtips": 1, "reword": [ @@ -2645,7 +2279,7 @@ "ontxe": 20016, "id_after": 20018, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10106", "task_display": "新剧情文本10106", @@ -2677,7 +2311,7 @@ "ontxe": 20017, "id_after": 20019, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10107", "task_display": "新剧情文本10107", @@ -2709,7 +2343,7 @@ "ontxe": 20018, "id_after": 20020, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10108", "task_display": "新剧情文本10108", @@ -2741,7 +2375,7 @@ "ontxe": 20019, "id_after": 20100, "group": 10002, - "des": 2, + "des": 3, "icon": "", "task_name": "新剧情10109", "task_display": "新剧情文本10109", @@ -2770,7 +2404,7 @@ { "key": 20100, "lock": 1, - "ontxe": 0, + "ontxe": 20020, "id_after": 20101, "group": 1, "des": 2, @@ -2787,7 +2421,7 @@ 200001 ], "completetask": 0, - "auto_accept": 1, + "auto_accept": 0, "overtips": 1, "reword": [ { diff --git a/modules/linestory/model_linestory.go b/modules/linestory/model_linestory.go index 470f4c1b3..ecd7dffeb 100644 --- a/modules/linestory/model_linestory.go +++ b/modules/linestory/model_linestory.go @@ -6,6 +6,7 @@ import ( "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" + "go_dreamfactory/utils" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" @@ -52,6 +53,24 @@ func (this *ModelLinestory) getChapters(uid string) map[int32]*pb.TaskChapter { return ls.TaskChapter } +// 校验前置任务是否完成 +// true完成 false未完成 +func (this *ModelLinestory) isPreFinished(finishTasks []int32, taskId int32) bool { + maintaskConf, ok := this.moduleLinestory.confMaintask.GetDataMap()[taskId] + if !ok { + return false + } + if maintaskConf.SubTask == 0 { + return true + } + + if _, ok := utils.Findx(finishTasks, maintaskConf.SubTask); ok { + return true + } + + return false +} + // 获取玩家支线剧情-主线任务 func (this *ModelLinestory) getMaintasks(uid string, groupId int32) (list []*pb.TaskMain) { // 调用世界任务接口groupId & taskId @@ -86,7 +105,7 @@ func (this *ModelLinestory) receive(uid string, groupId int32) (err error) { if v.Receive == 1 { v.Receive = 2 update := map[string]interface{}{ - "receive": v.Receive, + "taskChapter": ls.TaskChapter, } return this.Change(uid, update) } else { diff --git a/modules/linestory/module.go b/modules/linestory/module.go index d5b551d35..3a69c4df8 100644 --- a/modules/linestory/module.go +++ b/modules/linestory/module.go @@ -55,17 +55,47 @@ func (this *ModuleLinestory) Start() (err error) { return } +// 检查真实结局路径是否完成 +func (this *ModuleLinestory) isOverRealline(finishTasks []int32) bool { + //真实结局节点ID + var realEndingTaskId int32 + for _, v := range this.confMaintask.GetDataList() { + if v.Ending == 1 { + realEndingTaskId = v.Id + break + } + } + log.Debugln(realEndingTaskId) + // 存在真实结局节点 + if _, ok := utils.Findx(finishTasks, realEndingTaskId); ok { + return true + } + return false +} + // 世界任务完成通知 func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32) error { ls := this.modelLinestory.getLinestory(uid) log.Debug("支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId}) + + // 校验groupId 或taskId是否合法 + if _, ok := this.confTimeline.GetDataMap()[groupId]; !ok { + this.Debug("非支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId}) + return comm.NewCustomError(pb.ErrorCode_ReqParameterError) + } + if _, ok := this.confMaintask.GetDataMap()[taskId]; !ok { + this.Debug("非支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId}) + return comm.NewCustomError(pb.ErrorCode_ReqParameterError) + } + var isUpdate bool if chapter, ok := ls.TaskChapter[groupId]; ok { + if !this.modelLinestory.isPreFinished(chapter.TaskIds, taskId) { + return comm.NewCustomError(pb.ErrorCode_LinestoryPreNoComplete) + } if _, ok := utils.Findx(chapter.TaskIds, taskId); !ok { chapter.TaskIds = append(chapter.TaskIds, taskId) - taskIds := this.configure.converArr(groupId) - // 校验当前组下的任务是否全部完成 - if utils.ForContainer(taskIds, chapter.TaskIds) { + if this.isOverRealline(chapter.TaskIds) { //说明组里的所有任务完成 chapter.Receive = 1 chapter.Status = 1 @@ -75,7 +105,7 @@ func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32) if conf, ok := this.confMaintask.GetDataMap()[taskId]; ok { if conf.Group == groupId { if len(conf.Resetto) > 0 { - var newTaskList []int32 + newTaskList := []int32{} for _, v := range conf.Resetto { newTaskList = utils.Deletex(chapter.TaskIds, v) } @@ -86,16 +116,6 @@ func (this *ModuleLinestory) TaskFinishNotify(uid string, taskId, groupId int32) isUpdate = true } } else { - // 校验groupId 或taskId是否合法 - if _, ok := this.confTimeline.GetDataMap()[groupId]; !ok { - this.Debug("非支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId}) - return comm.NewCustomError(pb.ErrorCode_ReqParameterError) - } - if _, ok := this.confMaintask.GetDataMap()[taskId]; !ok { - this.Debug("非支线剧情任务", log.Fields{"uid": uid, "groupId": groupId, "taskId": taskId}) - return comm.NewCustomError(pb.ErrorCode_ReqParameterError) - } - tg := &pb.TaskChapter{} // 设置完成的任务 tg.TaskIds = append(tg.TaskIds, taskId) diff --git a/modules/sociaty/module.go b/modules/sociaty/module.go index 8cbe7d194..c8883588c 100644 --- a/modules/sociaty/module.go +++ b/modules/sociaty/module.go @@ -62,11 +62,20 @@ func (this *Sociaty) Start() (err error) { this.globalConf = this.configure.GetGlobalConf() if this.globalConf == nil { err = errors.New("global config not found") + return + } + if this.sociatyActivityConf, err = this.configure.getSociatyActivityCfg(); err != nil { + return err + } + if this.sociatyTaskConf, err = this.configure.getSociatyTaskCfg(); err != nil { + return err + } + if this.rtaskCondConf, err = this.configure.getRtaskCondiCfg(); err != nil { + return err + } + if this.sociatySignConf, err = this.configure.getSociatySignCfg(); err != nil { + return err } - this.sociatyActivityConf, err = this.configure.getSociatyActivityCfg() - this.sociatyTaskConf, err = this.configure.getSociatyTaskCfg() - this.rtaskCondConf, err = this.configure.getRtaskCondiCfg() - this.sociatySignConf, err = this.configure.getSociatySignCfg() return } diff --git a/modules/worldtask/api_battlestart.go b/modules/worldtask/api_battlestart.go index adca6d478..5824e5726 100644 --- a/modules/worldtask/api_battlestart.go +++ b/modules/worldtask/api_battlestart.go @@ -10,7 +10,7 @@ import ( // 战斗开始 func (this *apiComp) BattlestartCheck(session comm.IUserSession, req *pb.WorldtaskBattleStartReq) (code pb.ErrorCode) { - if req.BattleConfId == 0 || req.Battle != nil { + if req.BattleConfId == 0 || req.Battle == nil { this.module.Error("世界任务战斗开始参数错误", log.Fields{"uid": session.GetUserId(), "params": req}) code = pb.ErrorCode_ReqParameterError } @@ -21,11 +21,11 @@ func (this *apiComp) Battlestart(session comm.IUserSession, req *pb.WorldtaskBat if code = this.BattlestartCheck(session, req); code != pb.ErrorCode_Success { return } - + uid := session.GetUserId() battleConf, err := this.module.configure.getWorldtaskBattleById(req.BattleConfId) if err != nil || battleConf == nil { code = pb.ErrorCode_ConfigNoFound - log.Errorf("world_battle %v no found", req.BattleConfId) + log.Error("战斗配置未找到", log.Fields{"uid": uid, "battleConfId": req.BattleConfId}) return } diff --git a/modules/worldtask/api_finish.go b/modules/worldtask/api_finish.go index d1851c065..336e2a0d8 100644 --- a/modules/worldtask/api_finish.go +++ b/modules/worldtask/api_finish.go @@ -60,11 +60,13 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe userTask.Uid = uid } - // 前置任务ID - if !this.module.modelWorldtask.IsPreFinished(userTask, curTaskConf) { - this.module.Debug("前置任务未完成", log.Fields{"uid": uid, "preTaskId": curTaskConf.Ontxe, "taskId": curTaskConf.Key}) - code = pb.ErrorCode_WorldtaskLastUnFinished - return + // 前置任务ID 只有世界任务才校验前置 + if curTaskConf.Des == 2 { + if !this.module.modelWorldtask.IsPreFinished(userTask, curTaskConf) { + this.module.Debug("前置任务未完成", log.Fields{"uid": uid, "preTaskId": curTaskConf.Ontxe, "taskId": curTaskConf.Key}) + code = pb.ErrorCode_WorldtaskLastUnFinished + return + } } //判断任务是否已完成 @@ -78,6 +80,9 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe var nextTaskId int32 finishCall := func() { + defer func() { + this.module.Debug("世界任务完成", log.Fields{"uid": uid, "params": req}) + }() nextTaskId = curTaskConf.IdAfter // 完成任务 if err := this.module.modelWorldtask.finishTask(req.GroupId, req.TaskId, userTask); err != nil { @@ -109,10 +114,12 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe } // 任务完成推送 - if err := session.SendMsg(string(this.module.GetType()), WorldtaskNexttaskPush, &pb.WorldtaskNexttaskPush{ - NextTaskId: nextTaskId, - }); err != nil { - code = pb.ErrorCode_SystemError + if curTaskConf.Des == 2 { + if err := session.SendMsg(string(this.module.GetType()), WorldtaskNexttaskPush, &pb.WorldtaskNexttaskPush{ + NextTaskId: nextTaskId, + }); err != nil { + code = pb.ErrorCode_SystemError + } } return diff --git a/modules/worldtask/model_worldtask.go b/modules/worldtask/model_worldtask.go index e0056befa..d7a884d63 100644 --- a/modules/worldtask/model_worldtask.go +++ b/modules/worldtask/model_worldtask.go @@ -96,7 +96,7 @@ func (this *ModelWorldtask) finishTask(groupId, taskId int32, task *pb.DBWorldta if module, err := this.service.GetModule(comm.ModuleLinestory); err == nil { if iLinestory, ok := module.(comm.ILinestory); ok { if err := iLinestory.TaskFinishNotify(task.Uid, taskId, groupId); err != nil { - log.Error("任务完成通知", log.Fields{"uid": task.Uid, "groupId": groupId, "taskId": taskId, "err": err.Error()}) + log.Error("世界任务完成通知支线剧情任务", log.Fields{"uid": task.Uid, "groupId": groupId, "taskId": taskId, "err": err.Error()}) } } } diff --git a/modules/worldtask/module.go b/modules/worldtask/module.go index 159efe0ab..6c206c1ee 100644 --- a/modules/worldtask/module.go +++ b/modules/worldtask/module.go @@ -56,7 +56,7 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e finishedTaskIds := make(map[int32]int32) //达成的任务条件 for _, c := range this.worldtaskConf.GetDataList() { - if c.Completetask == condId && c.Completetask != 0 { + if c.Completetask != 0 && c.Completetask == condId { finishedTaskIds[c.Group] = c.Key } } @@ -66,6 +66,8 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e return nil } + log.Debug("世界任务完成通知-查找到世界任务", log.Fields{"uid": uid, "condId": condId, "params": finishedTaskIds}) + //下一个任务ID var nextTaskId int32 // 获取用户信息 @@ -83,23 +85,24 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e if userTask.Uid != "" { //查找任务ID根据condId 可能会找出不同的任务 - for k, id := range finishedTaskIds { - logFields := log.Fields{"uid": uid, "group": k, "taskId": id, "condId": condId} + for groupId, taskId := range finishedTaskIds { + logFields := log.Fields{"uid": uid, "group": groupId, "taskId": taskId, "condId": condId} // 判断任务是否已完成 - if this.modelWorldtask.isFinished(id, userTask.TaskList) { - this.Debug("任务已完成", logFields) + if this.modelWorldtask.isFinished(taskId, userTask.TaskList) { + this.Debug("世界任务已完成", logFields) continue } - taskConf, err := this.configure.getWorldtaskById(id) + taskConf, err := this.configure.getWorldtaskById(taskId) if err != nil { return err } if taskConf != nil { - if !this.modelWorldtask.IsPreFinished(userTask, taskConf) { - this.Debug("世界任务前置任务未完成", logFields) - continue + if taskConf.Des == 2 { //只有世界任务才校验前置 + if !this.modelWorldtask.IsPreFinished(userTask, taskConf) { + this.Debug("世界任务前置任务未完成", logFields) + continue + } } - nextTaskId = taskConf.IdAfter // 判断玩家等级要求 @@ -111,7 +114,7 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e } //完成任务 - if err := this.modelWorldtask.finishTask(k, id, userTask); err != nil { + if err := this.modelWorldtask.finishTask(groupId, taskId, userTask); err != nil { logFields["err"] = err.Error() this.Error("世界任务完成", logFields) return err @@ -124,7 +127,7 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e this.Error("资源发放", logFields) } - if nextTaskId != 0 { + if nextTaskId != 0 && taskConf.Des == 2 { if err := session.SendMsg(string(this.GetType()), "nexttask", &pb.WorldtaskNexttaskPush{ NextTaskId: nextTaskId, }); err != nil { diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index ba2353600..84193011b 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -186,6 +186,7 @@ const ( ErrorCode_LinestoryNoReceive ErrorCode = 2602 //章节奖励不能领取 ErrorCode_LinestoryTaskDisabledEnter ErrorCode = 2603 //禁止进入 ErrorCode_LinestoryChapterNoOpen ErrorCode = 2604 //章节未开启 + ErrorCode_LinestoryPreNoComplete ErrorCode = 2605 //前置任务未完成 // hunting ErrorCode_HuntingLvErr ErrorCode = 2701 // 关卡难度不匹配 ErrorCode_HuntingBoosType ErrorCode = 2702 // BOSS 类型不对 @@ -422,6 +423,7 @@ var ( 2602: "LinestoryNoReceive", 2603: "LinestoryTaskDisabledEnter", 2604: "LinestoryChapterNoOpen", + 2605: "LinestoryPreNoComplete", 2701: "HuntingLvErr", 2702: "HuntingBoosType", 2703: "HuntingBuyMaxCount", @@ -642,6 +644,7 @@ var ( "LinestoryNoReceive": 2602, "LinestoryTaskDisabledEnter": 2603, "LinestoryChapterNoOpen": 2604, + "LinestoryPreNoComplete": 2605, "HuntingLvErr": 2701, "HuntingBoosType": 2702, "HuntingBuyMaxCount": 2703, @@ -747,7 +750,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xf0, 0x26, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0x8d, 0x27, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -951,115 +954,117 @@ var file_errorcode_proto_rawDesc = []byte{ 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xab, 0x14, 0x12, 0x1b, 0x0a, 0x16, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x4e, 0x6f, - 0x4f, 0x70, 0x65, 0x6e, 0x10, 0xac, 0x14, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x75, 0x6e, 0x74, 0x69, - 0x6e, 0x67, 0x4c, 0x76, 0x45, 0x72, 0x72, 0x10, 0x8d, 0x15, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x75, - 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x10, 0x8e, 0x15, - 0x12, 0x17, 0x0a, 0x12, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x79, 0x4d, 0x61, - 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x8f, 0x15, 0x12, 0x1d, 0x0a, 0x18, 0x48, 0x75, 0x6e, - 0x74, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0x90, 0x15, 0x12, 0x11, 0x0a, 0x0c, 0x4c, 0x69, 0x62, 0x72, - 0x61, 0x72, 0x79, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0xf1, 0x15, 0x12, 0x12, 0x0a, 0x0d, 0x4c, - 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x10, 0xf2, 0x15, 0x12, - 0x16, 0x0a, 0x11, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x10, 0xf3, 0x15, 0x12, 0x12, 0x0a, 0x0d, 0x4c, 0x69, 0x62, 0x72, 0x61, - 0x72, 0x79, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xf4, 0x15, 0x12, 0x14, 0x0a, 0x0f, 0x4c, - 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x4c, 0x76, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xf5, - 0x15, 0x12, 0x1b, 0x0a, 0x16, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xd5, 0x16, 0x12, 0x13, - 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x46, 0x6f, 0x75, 0x6e, 0x64, - 0x10, 0xb8, 0x17, 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x64, - 0x64, 0x65, 0x64, 0x10, 0xb9, 0x17, 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, - 0x79, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, - 0x10, 0xba, 0x17, 0x12, 0x14, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, - 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0xbb, 0x17, 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6f, 0x63, - 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x52, 0x69, 0x67, 0x68, 0x74, 0x10, 0xbc, 0x17, 0x12, 0x13, - 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x41, 0x64, 0x64, 0x65, 0x64, - 0x10, 0xbd, 0x17, 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, - 0x73, 0x6d, 0x69, 0x73, 0x73, 0x10, 0xbe, 0x17, 0x12, 0x10, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x69, - 0x61, 0x74, 0x79, 0x51, 0x75, 0x69, 0x74, 0x10, 0xbf, 0x17, 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x67, 0x72, 0x65, 0x65, 0x10, 0xc0, 0x17, 0x12, 0x12, 0x0a, - 0x0d, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x66, 0x75, 0x73, 0x65, 0x10, 0xc1, - 0x17, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4c, 0x6f, 0x67, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x10, 0xba, 0xea, 0x01, 0x12, 0x19, 0x0a, 0x13, 0x53, 0x6f, 0x63, - 0x69, 0x61, 0x74, 0x79, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x44, 0x69, 0x73, 0x73, - 0x10, 0xbb, 0xea, 0x01, 0x12, 0x17, 0x0a, 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4a, 0x6f, 0x62, 0x10, 0xbc, 0xea, 0x01, 0x12, 0x14, 0x0a, - 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x10, - 0xbd, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, - 0x41, 0x63, 0x63, 0x75, 0x73, 0x65, 0x10, 0xbe, 0xea, 0x01, 0x12, 0x11, 0x0a, 0x0b, 0x53, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x10, 0xbf, 0xea, 0x01, 0x12, 0x13, 0x0a, - 0x0d, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x10, 0xc0, - 0xea, 0x01, 0x12, 0x14, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x43, 0x44, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x10, 0xc1, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, - 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x78, 0x10, 0xc2, 0xea, 0x01, 0x12, - 0x18, 0x0a, 0x12, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x65, 0x6c, 0x66, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x10, 0xc3, 0xea, 0x01, 0x12, 0x1d, 0x0a, 0x17, 0x53, 0x6f, 0x63, - 0x69, 0x61, 0x74, 0x79, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x10, 0xc4, 0xea, 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, - 0x61, 0x74, 0x79, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x64, 0x10, 0xc5, 0xea, 0x01, 0x12, 0x1a, 0x0a, 0x14, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, - 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0xc6, 0xea, - 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x10, 0xc7, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, - 0x61, 0x74, 0x79, 0x42, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x54, 0x6f, 0x10, 0xc9, 0xea, 0x01, 0x12, - 0x14, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x64, 0x10, 0xca, 0xea, 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, - 0x41, 0x70, 0x70, 0x79, 0x4c, 0x76, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xcb, - 0xea, 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x61, 0x73, - 0x6b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0xcc, 0xea, 0x01, 0x12, - 0x1d, 0x0a, 0x17, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, - 0x74, 0x79, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xcd, 0xea, 0x01, 0x12, 0x1c, - 0x0a, 0x16, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x69, 0x74, 0x76, 0x69, 0x74, - 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0xce, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, - 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, - 0x10, 0xcf, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, - 0x61, 0x6d, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0xd0, 0xea, 0x01, 0x12, 0x1a, 0x0a, 0x14, - 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x51, 0x75, 0x69, 0x74, 0x4e, 0x6f, 0x41, 0x6c, 0x6c, - 0x6f, 0x77, 0x65, 0x64, 0x10, 0xd1, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, - 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x10, 0xd2, 0xea, 0x01, 0x12, - 0x15, 0x0a, 0x10, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, - 0x79, 0x55, 0x70, 0x10, 0x9d, 0x18, 0x12, 0x19, 0x0a, 0x14, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, - 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x9e, - 0x18, 0x12, 0x17, 0x0a, 0x12, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, - 0x4e, 0x70, 0x63, 0x49, 0x6e, 0x43, 0x64, 0x10, 0x9f, 0x18, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, - 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x10, - 0x81, 0x19, 0x12, 0x12, 0x0a, 0x0d, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x45, 0x72, 0x72, 0x44, - 0x61, 0x74, 0x61, 0x10, 0x82, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, - 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x10, 0x83, - 0x19, 0x12, 0x15, 0x0a, 0x10, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x65, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0x84, 0x19, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x72, 0x6f, 0x6c, - 0x6c, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x10, 0xe5, 0x19, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x72, - 0x6f, 0x6c, 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x10, 0xe6, 0x19, 0x12, 0x16, 0x0a, - 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x6c, 0x6c, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x10, 0xe7, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, - 0x78, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xe8, 0x19, 0x12, 0x18, 0x0a, - 0x13, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x10, 0xe9, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x4e, 0x6f, 0x74, 0x54, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x4f, 0x6e, 0x10, - 0xc9, 0x1a, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x52, - 0x65, 0x73, 0x74, 0x43, 0x44, 0x4e, 0x6f, 0x45, 0x6e, 0x64, 0x10, 0xca, 0x1a, 0x12, 0x16, 0x0a, - 0x11, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, - 0x6e, 0x64, 0x10, 0xad, 0x1b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, - 0x67, 0x65, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x10, 0xae, 0x1b, 0x12, 0x14, - 0x0a, 0x0f, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, - 0x65, 0x10, 0x91, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, - 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x92, 0x1c, 0x12, 0x17, 0x0a, - 0x12, 0x50, 0x61, 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, - 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x50, 0x61, 0x79, 0x52, 0x65, 0x6e, - 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x72, 0x72, 0x10, 0xf6, 0x1c, 0x12, 0x14, 0x0a, 0x0f, - 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, - 0xd9, 0x1d, 0x12, 0x19, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, - 0x76, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16, 0x0a, - 0x11, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63, 0x65, - 0x70, 0x74, 0x10, 0xdb, 0x1d, 0x12, 0x18, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, - 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x10, 0xdc, 0x1d, 0x12, - 0x15, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, - 0x68, 0x65, 0x64, 0x10, 0xdd, 0x1d, 0x12, 0x1c, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, - 0x61, 0x73, 0x6b, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, - 0x64, 0x10, 0xde, 0x1d, 0x12, 0x1e, 0x0a, 0x19, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x54, - 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, - 0x6b, 0x10, 0xbd, 0x1e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x4f, 0x70, 0x65, 0x6e, 0x10, 0xac, 0x14, 0x12, 0x1b, 0x0a, 0x16, 0x4c, 0x69, 0x6e, 0x65, 0x73, + 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x65, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x65, 0x10, 0xad, 0x14, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x4c, + 0x76, 0x45, 0x72, 0x72, 0x10, 0x8d, 0x15, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x75, 0x6e, 0x74, 0x69, + 0x6e, 0x67, 0x42, 0x6f, 0x6f, 0x73, 0x54, 0x79, 0x70, 0x65, 0x10, 0x8e, 0x15, 0x12, 0x17, 0x0a, + 0x12, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x10, 0x8f, 0x15, 0x12, 0x1d, 0x0a, 0x18, 0x48, 0x75, 0x6e, 0x74, 0x69, 0x6e, + 0x67, 0x4d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x10, 0x90, 0x15, 0x12, 0x11, 0x0a, 0x0c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0xf1, 0x15, 0x12, 0x12, 0x0a, 0x0d, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x10, 0xf2, 0x15, 0x12, 0x16, 0x0a, 0x11, + 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x10, 0xf3, 0x15, 0x12, 0x12, 0x0a, 0x0d, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, + 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xf4, 0x15, 0x12, 0x14, 0x0a, 0x0f, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x4c, 0x76, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xf5, 0x15, 0x12, 0x1b, + 0x0a, 0x16, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xd5, 0x16, 0x12, 0x13, 0x0a, 0x0e, 0x53, + 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xb8, 0x17, + 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x64, 0x64, 0x65, 0x64, + 0x10, 0xb9, 0x17, 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, + 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xba, 0x17, + 0x12, 0x14, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x10, 0xbb, 0x17, 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, + 0x79, 0x4e, 0x6f, 0x52, 0x69, 0x67, 0x68, 0x74, 0x10, 0xbc, 0x17, 0x12, 0x13, 0x0a, 0x0e, 0x53, + 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x41, 0x64, 0x64, 0x65, 0x64, 0x10, 0xbd, 0x17, + 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, 0x73, 0x6d, 0x69, + 0x73, 0x73, 0x10, 0xbe, 0x17, 0x12, 0x10, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, + 0x51, 0x75, 0x69, 0x74, 0x10, 0xbf, 0x17, 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x6f, 0x63, 0x69, 0x61, + 0x74, 0x79, 0x41, 0x67, 0x72, 0x65, 0x65, 0x10, 0xc0, 0x17, 0x12, 0x12, 0x0a, 0x0d, 0x53, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x66, 0x75, 0x73, 0x65, 0x10, 0xc1, 0x17, 0x12, 0x16, + 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4c, 0x6f, 0x67, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x10, 0xba, 0xea, 0x01, 0x12, 0x19, 0x0a, 0x13, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, + 0x79, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x44, 0x69, 0x73, 0x73, 0x10, 0xbb, 0xea, + 0x01, 0x12, 0x17, 0x0a, 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x4a, 0x6f, 0x62, 0x10, 0xbc, 0xea, 0x01, 0x12, 0x14, 0x0a, 0x0e, 0x53, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x10, 0xbd, 0xea, 0x01, + 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x41, 0x63, 0x63, + 0x75, 0x73, 0x65, 0x10, 0xbe, 0xea, 0x01, 0x12, 0x11, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x69, 0x61, + 0x74, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x10, 0xbf, 0xea, 0x01, 0x12, 0x13, 0x0a, 0x0d, 0x53, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x10, 0xc0, 0xea, 0x01, 0x12, + 0x14, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x43, 0x44, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x10, 0xc1, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, + 0x41, 0x70, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x78, 0x10, 0xc2, 0xea, 0x01, 0x12, 0x18, 0x0a, 0x12, + 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x53, 0x65, 0x6c, 0x66, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x10, 0xc3, 0xea, 0x01, 0x12, 0x1d, 0x0a, 0x17, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, + 0x79, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x10, 0xc4, 0xea, 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, + 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x10, 0xc5, + 0xea, 0x01, 0x12, 0x1a, 0x0a, 0x14, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0xc6, 0xea, 0x01, 0x12, 0x15, + 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x10, 0xc7, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, + 0x42, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x54, 0x6f, 0x10, 0xc9, 0xea, 0x01, 0x12, 0x14, 0x0a, 0x0e, + 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x10, 0xca, + 0xea, 0x01, 0x12, 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, + 0x79, 0x4c, 0x76, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xcb, 0xea, 0x01, 0x12, + 0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0xcc, 0xea, 0x01, 0x12, 0x1d, 0x0a, 0x17, + 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x4e, + 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xcd, 0xea, 0x01, 0x12, 0x1c, 0x0a, 0x16, 0x53, + 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x63, 0x69, 0x74, 0x76, 0x69, 0x74, 0x79, 0x52, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0xce, 0xea, 0x01, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, + 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x10, 0xcf, 0xea, + 0x01, 0x12, 0x16, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0xd0, 0xea, 0x01, 0x12, 0x1a, 0x0a, 0x14, 0x53, 0x6f, 0x63, + 0x69, 0x61, 0x74, 0x79, 0x51, 0x75, 0x69, 0x74, 0x4e, 0x6f, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, + 0x64, 0x10, 0xd1, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, + 0x4e, 0x6f, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x10, 0xd2, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x10, + 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, 0x79, 0x55, 0x70, + 0x10, 0x9d, 0x18, 0x12, 0x19, 0x0a, 0x14, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, + 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x9e, 0x18, 0x12, 0x17, + 0x0a, 0x12, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x70, 0x63, + 0x49, 0x6e, 0x43, 0x64, 0x10, 0x9f, 0x18, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, 0x6c, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x10, 0x81, 0x19, 0x12, + 0x12, 0x0a, 0x0d, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x45, 0x72, 0x72, 0x44, 0x61, 0x74, 0x61, + 0x10, 0x82, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x4c, + 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x10, 0x83, 0x19, 0x12, 0x15, + 0x0a, 0x10, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x10, 0x84, 0x19, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x42, 0x75, + 0x79, 0x4d, 0x61, 0x78, 0x10, 0xe5, 0x19, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x72, 0x6f, 0x6c, 0x6c, + 0x53, 0x65, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x10, 0xe6, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, + 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x6c, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, + 0xe7, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x49, 0x74, + 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xe8, 0x19, 0x12, 0x18, 0x0a, 0x13, 0x54, 0x72, + 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x77, 0x61, 0x72, + 0x64, 0x10, 0xe9, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x4e, 0x6f, 0x74, 0x54, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x4f, 0x6e, 0x10, 0xc9, 0x1a, 0x12, + 0x19, 0x0a, 0x14, 0x48, 0x6f, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x52, 0x65, 0x73, 0x74, + 0x43, 0x44, 0x4e, 0x6f, 0x45, 0x6e, 0x64, 0x10, 0xca, 0x1a, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x72, + 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, + 0xad, 0x1b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x52, + 0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x10, 0xae, 0x1b, 0x12, 0x14, 0x0a, 0x0f, 0x47, + 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x91, + 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x64, 0x76, + 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x92, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, + 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, + 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x50, 0x61, 0x79, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x54, + 0x69, 0x6d, 0x65, 0x45, 0x72, 0x72, 0x10, 0xf6, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x57, 0x6f, 0x72, + 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0xd9, 0x1d, 0x12, + 0x19, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x76, 0x4e, 0x6f, + 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16, 0x0a, 0x11, 0x57, 0x6f, + 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x10, + 0xdb, 0x1d, 0x12, 0x18, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, + 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x10, 0xdc, 0x1d, 0x12, 0x15, 0x0a, 0x10, + 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x68, 0x65, 0x64, + 0x10, 0xdd, 0x1d, 0x12, 0x1c, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, + 0x4c, 0x61, 0x73, 0x74, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xde, + 0x1d, 0x12, 0x1e, 0x0a, 0x19, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x54, 0x61, 0x73, 0x6b, + 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x10, 0xbd, + 0x1e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/sys/configure/structs/Game.LinestoryMainTaskData.go b/sys/configure/structs/Game.LinestoryMainTaskData.go index e18cc30ca..d9cbd1990 100644 --- a/sys/configure/structs/Game.LinestoryMainTaskData.go +++ b/sys/configure/structs/Game.LinestoryMainTaskData.go @@ -12,9 +12,12 @@ import "errors" type GameLinestoryMainTaskData struct { Id int32 - Group int32 SubTask int32 + NodeIndex int32 + Order string + Group int32 Name string + Describe string Img string Ending int32 Resetto []int32 @@ -28,9 +31,12 @@ func (*GameLinestoryMainTaskData) GetTypeId() int32 { func (_v *GameLinestoryMainTaskData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["group"].(float64); !_ok_ { err = errors.New("group error"); return }; _v.Group = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["subTask"].(float64); !_ok_ { err = errors.New("subTask error"); return }; _v.SubTask = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["nodeIndex"].(float64); !_ok_ { err = errors.New("nodeIndex error"); return }; _v.NodeIndex = int32(_tempNum_) } + { var _ok_ bool; if _v.Order, _ok_ = _buf["order"].(string); !_ok_ { err = errors.New("order error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["group"].(float64); !_ok_ { err = errors.New("group error"); return }; _v.Group = int32(_tempNum_) } {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } + {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["describe"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Describe error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Describe, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } { var _ok_ bool; if _v.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ending"].(float64); !_ok_ { err = errors.New("ending error"); return }; _v.Ending = int32(_tempNum_) } { diff --git a/sys/configure/structs/Game.LinestoryTimeLineData.go b/sys/configure/structs/Game.LinestoryTimeLineData.go index 1d90940cf..f79bfe64e 100644 --- a/sys/configure/structs/Game.LinestoryTimeLineData.go +++ b/sys/configure/structs/Game.LinestoryTimeLineData.go @@ -12,6 +12,7 @@ import "errors" type GameLinestoryTimeLineData struct { Group int32 + Order string NodeIndex int32 Cond []int32 Name string @@ -27,6 +28,7 @@ func (*GameLinestoryTimeLineData) GetTypeId() int32 { func (_v *GameLinestoryTimeLineData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["group"].(float64); !_ok_ { err = errors.New("group error"); return }; _v.Group = int32(_tempNum_) } + { var _ok_ bool; if _v.Order, _ok_ = _buf["order"].(string); !_ok_ { err = errors.New("order error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["nodeIndex"].(float64); !_ok_ { err = errors.New("nodeIndex error"); return }; _v.NodeIndex = int32(_tempNum_) } { var _arr_ []interface{} From 4333089c6a387408d503651ad68fa00ea834b782 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 17 Nov 2022 20:32:59 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=A5=96=E5=8A=B1=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/linestory/api_receive.go | 7 ++- pb/linestory_msg.pb.go | 87 +++++++++++++++++++------------- utils/trans.go | 17 +++++++ 3 files changed, 73 insertions(+), 38 deletions(-) create mode 100644 utils/trans.go diff --git a/modules/linestory/api_receive.go b/modules/linestory/api_receive.go index c86c5d12e..5ecf8d97a 100644 --- a/modules/linestory/api_receive.go +++ b/modules/linestory/api_receive.go @@ -5,6 +5,7 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" + "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -42,12 +43,14 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive } //发奖 - if code := this.moduleLinestory.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success { + if code = this.moduleLinestory.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success { this.moduleLinestory.Error("奖励发放失败", log.Fields{"uid": uid, "chapterId": req.ChapterId, "reward": conf.Reward}) + return } rsp := &pb.LinestoryReceiveResp{ - ChapterId: req.ChapterId, + ChapterId: req.ChapterId, + UserAssets: utils.ConvertReward(conf.Reward...), } if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeReceive, rsp); err != nil { code = pb.ErrorCode_SystemError diff --git a/pb/linestory_msg.pb.go b/pb/linestory_msg.pb.go index 604b3d776..b45903168 100644 --- a/pb/linestory_msg.pb.go +++ b/pb/linestory_msg.pb.go @@ -254,7 +254,8 @@ type LinestoryReceiveResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"` + ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"` + UserAssets []*UserAssets `protobuf:"bytes,2,rep,name=userAssets,proto3" json:"userAssets"` } func (x *LinestoryReceiveResp) Reset() { @@ -296,40 +297,51 @@ func (x *LinestoryReceiveResp) GetChapterId() int32 { return 0 } +func (x *LinestoryReceiveResp) GetUserAssets() []*UserAssets { + if x != nil { + return x.UserAssets + } + return nil +} + var File_linestory_linestory_msg_proto protoreflect.FileDescriptor var file_linestory_linestory_msg_proto_rawDesc = []byte{ 0x0a, 0x1d, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x73, - 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, 0x0a, - 0x13, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x22, 0xae, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, - 0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x48, 0x0a, - 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, - 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68, - 0x61, 0x70, 0x74, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b, - 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x1a, 0x4c, 0x0a, 0x10, 0x54, 0x61, 0x73, 0x6b, 0x43, - 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x54, - 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x34, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, - 0x72, 0x79, 0x4d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, - 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x15, 0x4c, - 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4d, 0x61, 0x69, 0x6e, 0x52, 0x04, 0x6c, - 0x69, 0x73, 0x74, 0x22, 0x33, 0x0a, 0x13, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, - 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, - 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, - 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x34, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, - 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, + 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, 0x0a, 0x13, 0x4c, 0x69, 0x6e, + 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x22, 0xae, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, + 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x48, 0x0a, 0x0b, 0x74, 0x61, 0x73, + 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, + 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, + 0x74, 0x65, 0x72, 0x1a, 0x4c, 0x0a, 0x10, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, + 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0x34, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, + 0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, + 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, + 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x15, 0x4c, 0x69, 0x6e, 0x65, 0x73, + 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x1d, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, + 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4d, 0x61, 0x69, 0x6e, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, + 0x33, 0x0a, 0x13, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, + 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x49, 0x64, 0x22, 0x61, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, + 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, + 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x0a, 0x75, 0x73, + 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, + 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x0a, 0x75, 0x73, 0x65, + 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -354,17 +366,19 @@ var file_linestory_linestory_msg_proto_goTypes = []interface{}{ (*LinestoryReceiveResp)(nil), // 5: LinestoryReceiveResp nil, // 6: LinestoryChapterResp.TaskChapterEntry (*TaskMain)(nil), // 7: TaskMain - (*TaskChapter)(nil), // 8: TaskChapter + (*UserAssets)(nil), // 8: UserAssets + (*TaskChapter)(nil), // 9: TaskChapter } var file_linestory_linestory_msg_proto_depIdxs = []int32{ 6, // 0: LinestoryChapterResp.taskChapter:type_name -> LinestoryChapterResp.TaskChapterEntry 7, // 1: LinestoryMaintaskResp.list:type_name -> TaskMain - 8, // 2: LinestoryChapterResp.TaskChapterEntry.value:type_name -> TaskChapter - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 8, // 2: LinestoryReceiveResp.userAssets:type_name -> UserAssets + 9, // 3: LinestoryChapterResp.TaskChapterEntry.value:type_name -> TaskChapter + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_linestory_linestory_msg_proto_init() } @@ -373,6 +387,7 @@ func file_linestory_linestory_msg_proto_init() { return } file_linestory_linestory_db_proto_init() + file_comm_proto_init() if !protoimpl.UnsafeEnabled { file_linestory_linestory_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LinestoryChapterReq); i { diff --git a/utils/trans.go b/utils/trans.go new file mode 100644 index 000000000..ada5e9fa6 --- /dev/null +++ b/utils/trans.go @@ -0,0 +1,17 @@ +package utils + +import ( + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" +) + +func ConvertReward(data ...*cfg.Gameatn) (res []*pb.UserAssets) { + for _, v := range data { + res = append(res, &pb.UserAssets{ + A: v.A, + T: v.T, + N: v.N, + }) + } + return +} From 29e40b3e80c155e41735bad8fa26833ce3ce881b Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 18 Nov 2022 09:32:20 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E7=88=AC=E5=A1=94=E5=A5=96=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/api_challengeover.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/pagoda/api_challengeover.go b/modules/pagoda/api_challengeover.go index 8902afa99..a68799aa7 100644 --- a/modules/pagoda/api_challengeover.go +++ b/modules/pagoda/api_challengeover.go @@ -84,11 +84,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal mapData["pagodaId"] = conf.LayerNum mapData["type"] = pagoda.Type - // 通关奖励 - code = this.module.DispenseRes(session, conf.Reward, true) - if code != pb.ErrorCode_Success { - return - } pagoda.PagodaId = conf.LayerNum // 更新层数 code = this.module.ModifyPagodaData(session.GetUserId(), mapData) session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda}) @@ -168,7 +163,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda}) } - + // 通关奖励 + code = this.module.DispenseRes(session, conf.Reward, true) + if code != pb.ErrorCode_Success { + return + } // 任务相关 if req.PagodaType == comm.PagodaType { this.module.ModuleRtask.SendToRtask(session, comm.Rtype58, 1)