diff --git a/bin/json/game_pandamasjx.json b/bin/json/game_pandamasjx.json index 203b662fd..deda0ad0b 100644 --- a/bin/json/game_pandamasjx.json +++ b/bin/json/game_pandamasjx.json @@ -1,6 +1,7 @@ [ { "id": "10001", + "job": 1, "race": 1, "type": 1, "name": { @@ -35,6 +36,7 @@ }, { "id": "10002", + "job": 2, "race": 2, "type": 1, "name": { @@ -69,6 +71,7 @@ }, { "id": "10003", + "job": 3, "race": 3, "type": 1, "name": { @@ -103,6 +106,7 @@ }, { "id": "10004", + "job": 4, "race": 4, "type": 1, "name": { @@ -148,6 +152,7 @@ }, { "id": "10005", + "job": 1, "race": 1, "type": 1, "name": { @@ -182,6 +187,7 @@ }, { "id": "10006", + "job": 2, "race": 2, "type": 1, "name": { @@ -216,6 +222,7 @@ }, { "id": "10007", + "job": 3, "race": 3, "type": 1, "name": { @@ -250,6 +257,7 @@ }, { "id": "10008", + "job": 4, "race": 4, "type": 1, "name": { @@ -284,6 +292,7 @@ }, { "id": "10009", + "job": 1, "race": 1, "type": 1, "name": { @@ -329,6 +338,7 @@ }, { "id": "10010", + "job": 2, "race": 2, "type": 1, "name": { @@ -374,6 +384,7 @@ }, { "id": "10011", + "job": 3, "race": 1, "type": 1, "name": { @@ -419,6 +430,7 @@ }, { "id": "10012", + "job": 4, "race": 2, "type": 1, "name": { @@ -464,6 +476,7 @@ }, { "id": "20001", + "job": 1, "race": 0, "type": 2, "name": { @@ -509,6 +522,7 @@ }, { "id": "20002", + "job": 2, "race": 0, "type": 2, "name": { @@ -543,6 +557,7 @@ }, { "id": "20003", + "job": 3, "race": 0, "type": 2, "name": { @@ -577,6 +592,7 @@ }, { "id": "20004", + "job": 4, "race": 0, "type": 2, "name": { @@ -611,6 +627,7 @@ }, { "id": "20005", + "job": 1, "race": 0, "type": 2, "name": { @@ -645,6 +662,7 @@ }, { "id": "20006", + "job": 2, "race": 0, "type": 2, "name": { @@ -679,6 +697,7 @@ }, { "id": "20007", + "job": 3, "race": 0, "type": 2, "name": { @@ -713,6 +732,7 @@ }, { "id": "20008", + "job": 4, "race": 0, "type": 2, "name": { @@ -747,6 +767,7 @@ }, { "id": "20009", + "job": 1, "race": 0, "type": 2, "name": { @@ -792,6 +813,7 @@ }, { "id": "20010", + "job": 2, "race": 0, "type": 2, "name": { @@ -837,6 +859,7 @@ }, { "id": "20011", + "job": 3, "race": 0, "type": 2, "name": { @@ -882,6 +905,7 @@ }, { "id": "20012", + "job": 4, "race": 0, "type": 2, "name": { @@ -927,6 +951,7 @@ }, { "id": "20013", + "job": 1, "race": 0, "type": 2, "name": { @@ -972,6 +997,7 @@ }, { "id": "20014", + "job": 2, "race": 0, "type": 2, "name": { @@ -1006,6 +1032,7 @@ }, { "id": "20015", + "job": 3, "race": 0, "type": 2, "name": { @@ -1040,6 +1067,7 @@ }, { "id": "20016", + "job": 4, "race": 0, "type": 2, "name": { @@ -1074,6 +1102,7 @@ }, { "id": "20017", + "job": 1, "race": 0, "type": 2, "name": { @@ -1117,6 +1146,7 @@ }, { "id": "20018", + "job": 2, "race": 0, "type": 2, "name": { @@ -1160,6 +1190,7 @@ }, { "id": "20019", + "job": 3, "race": 0, "type": 2, "name": { @@ -1203,6 +1234,7 @@ }, { "id": "20020", + "job": 4, "race": 0, "type": 2, "name": { diff --git a/bin/json/game_rdtasknpc.json b/bin/json/game_rdtasknpc.json index d09d860ce..fdaebdcfb 100644 --- a/bin/json/game_rdtasknpc.json +++ b/bin/json/game_rdtasknpc.json @@ -322,7 +322,7 @@ "goto": 0 }, { - "id": 10020, + "id": 100101, "heroid": 25001, "datas": [ "GameMain", @@ -335,6 +335,44 @@ ], "goto": 0 }, + { + "id": 100104, + "heroid": 25001, + "datas": [ + "GameMain", + "901" + ], + "event": [ + 0 + ], + "goto": 0 + }, + { + "id": 100108, + "heroid": 25001, + "datas": [ + "GameMain", + "901" + ], + "event": [ + 0 + ], + "goto": 0 + }, + { + "id": 10020, + "heroid": 25001, + "datas": [ + "GameMain", + "20020_小怪_船甲板", + "901" + ], + "event": [ + 2, + 10042 + ], + "goto": 0 + }, { "id": 10024, "heroid": 51004, diff --git a/bin/json/game_skillafteratk.json b/bin/json/game_skillafteratk.json index 49fee7d03..4d21b40db 100644 --- a/bin/json/game_skillafteratk.json +++ b/bin/json/game_skillafteratk.json @@ -20436,7 +20436,7 @@ "From": 2, "Where": [], "Order": "", - "Limit": 1, + "Limit": 10, "ExecuteCnt": 1, "Type": 1, "Argu": [ diff --git a/bin/梦工厂后台AIP文档.md b/bin/梦工厂后台AIP文档.md index 5b87d1fc2..bf9c5d64b 100644 --- a/bin/梦工厂后台AIP文档.md +++ b/bin/梦工厂后台AIP文档.md @@ -98,7 +98,7 @@ ### 支付发货API - 接口名:paydelivery -- 接口说明:web 服务器给玩家发送邮件 +- 接口说明:web 服务器给玩家发送支付获得商品 - 请求地址:{IP}:{port}/paydelivery - 请求参数:uid(用户id|签名),productid(商品id|签名),orderid(订单号|签名),price(总金额|签名),sign(签名) - 请求样例 diff --git a/comm/const.go b/comm/const.go index a5788349d..269af9297 100644 --- a/comm/const.go +++ b/comm/const.go @@ -402,34 +402,49 @@ const ( Diamond int32 = 2 //钻石 ) -// 门票 +//定时通知类型 +type NotifyType int32 + const ( -// ArenaTicket string = "100004" //竞技场入场券 -// MoonFantasyTicket string = "100003" //梦境场入场券 -// PhysicalMedicament string = "10017" //体力药剂 -// UnifiedTicket string = "100100" //统一门票 + Notify1001 NotifyType = 1001 //铁匠铺炉温达到满值 ) // 红点枚举 type ReddotType int32 const ( - Reddot1 ReddotType = 10001 //任务----日常任务奖励红点 - Reddot2 ReddotType = 10002 //任务----周常任务奖励红点 - Reddot3 ReddotType = 10003 //公会----签到红点 - Reddot4 ReddotType = 10004 //任务----成就任务奖励红点 - Reddot5 ReddotType = 10005 //主线关卡----可挑战红点 + //任务 + Reddot10101 ReddotType = 10101 //任务----日常活跃宝箱红点 + Reddot10102 ReddotType = 10102 //任务----周活跃宝箱红点 + Reddot10103 ReddotType = 10103 //任务----成就任务奖励红点 + Reddot10201 ReddotType = 10201 //任务----日常活跃奖励红点 + Reddot10301 ReddotType = 10301 //任务----周常活跃奖励红点 + + //邮件 + Reddot12101 ReddotType = 12101 //邮件-----附件红点 + Reddot12102 ReddotType = 12102 //邮件-----未读邮件红点 + //维京 + Reddot13102 ReddotType = 13102 //维京远征 有挑战次数 + //狩猎 + Reddot14102 ReddotType = 14102 //狩猎 有挑战次数 + + //英雄 + Reddot20102 ReddotType = 20102 //英雄----升级红点 前端处理 + Reddot20201 ReddotType = 20201 //英雄----觉醒红点 前端处理 + Reddot10 ReddotType = 10010 //英雄----共鸣红点 前端处理 + Reddot20301 ReddotType = 20301 //英雄----升星红点 前端处理 + //公会 + Reddot15102 ReddotType = 15102 //公会----签到红点 + Reddot15201 ReddotType = 15201 //公会----申请红点 + //主线关卡 + Reddot11100 ReddotType = 11100 //主线关卡----可挑战红点 + // 铁匠铺 + Reddot17102 ReddotType = 17102 // 铁匠铺手册台 + Reddot17106 ReddotType = 17106 // 铁匠铺手册台收藏家奖励上 + Reddot17107 ReddotType = 17107 // 铁匠铺手册台收藏家奖励按钮上 + Reddot6 ReddotType = 10006 //爬塔----可挑战红点 Reddot7 ReddotType = 10007 //爬塔----奖励红点 - Reddot8 ReddotType = 10008 //英雄----升级红点 前端处理 - Reddot9 ReddotType = 10009 //英雄----觉醒红点 前端处理 - Reddot10 ReddotType = 10010 //英雄----共鸣红点 前端处理 - Reddot11 ReddotType = 10011 //英雄----升星红点 前端处理 - Reddot12 ReddotType = 10012 //装备----可穿戴红点 前端处理 - Reddot13 ReddotType = 10013 //装备----可替换红点 前端处理 - Reddot14 ReddotType = 10014 //装备----可强化红点 前端处理 - Reddot15 ReddotType = 10015 //装备----可附魔红点 前端处理 - Reddot16 ReddotType = 10016 //装备----可洗炼红点 前端处理 Reddot17 ReddotType = 10017 //星座图----红点 Reddot18 ReddotType = 10018 //英雄招募----红点 // 前端处理 Reddot19 ReddotType = 10019 //竞技场----挑战红点 @@ -439,14 +454,8 @@ const ( Reddot23 ReddotType = 10023 //熊猫武馆----可挂机红点 Reddot24 ReddotType = 10024 //熊猫武馆----可升级红点 Reddot25 ReddotType = 10025 //熊猫武馆----可领取奖励红点 - Reddot26 ReddotType = 10026 //邮件-----附件红点 - Reddot27 ReddotType = 10027 //任务----日常活跃奖励红点 - Reddot28 ReddotType = 10028 //任务----周常活跃奖励红点 - Reddot29 ReddotType = 10029 //公会----申请红点 - Reddot30 ReddotType = 10030 //邮件-----未读邮件红点 - Reddot31 ReddotType = 10031 //维京远征 有挑战次数 - Reddot32 ReddotType = 10032 //狩猎 有挑战次数 Reddot33 ReddotType = 10033 //附魔副本 有挑战次数 + ) type TaskType int32 diff --git a/comm/imodule.go b/comm/imodule.go index 969eb1c49..d1b49bfc8 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -234,23 +234,7 @@ type ( IReddot } - // 随机任务 - IRtask interface { - // 条件校验 - CheckCondi(uid string, condiId int32, p ...int32) (errdata *pb.ErrorData) - // 多条件校验 - CheckCondis(uid string, condiIds ...int32) (condIds []int32) - // 远程任务条件校验 - RemoteCheckCondi(uid string, condiId int32, rsp *pb.DBRtaskRecord) error - // 删除任务条件数据 - RemoveCondi(uid string, condiId int32) error - // 更新任务条件数据 - ChangeCondi(uid string, data map[int32]*pb.RtaskData) error - //任务批量触发 - TriggerTask(uid string, taskParams ...*TaskParam) - // 获取任务条件记录 - GetCondiData(uid string) *pb.DBRtaskRecord - } + //好友 IFriend interface { @@ -467,6 +451,7 @@ type ( ISmithy interface { CheckActivateAtlasCollect(uid string, id string) + IReddot // 铁匠铺红点 } IPandaAtlas interface { diff --git a/comm/pool.go b/comm/pool.go index 0d514f6e7..f14642792 100644 --- a/comm/pool.go +++ b/comm/pool.go @@ -5,25 +5,6 @@ import ( "sync" ) -var taskParamPool = &sync.Pool{ - New: func() interface{} { - return &TaskParam{} - }, -} - -//GetBuriedParam -func GetTaskParam(t TaskType, p ...int32) *TaskParam { - task := taskParamPool.Get().(*TaskParam) - task.TT = t - task.Params = append(task.Params, p...) - return task -} - -func PuttaskParam(r *TaskParam) { - r.Params = r.Params[:0] - taskParamPool.Put(r) -} - var buriedParamPool = &sync.Pool{ New: func() interface{} { return &pb.BuriedParam{ diff --git a/lego/sys/timewheel/timewheel.go b/lego/sys/timewheel/timewheel.go index ff0bda215..4dd421394 100644 --- a/lego/sys/timewheel/timewheel.go +++ b/lego/sys/timewheel/timewheel.go @@ -2,6 +2,8 @@ package timewheel import ( "context" + "go_dreamfactory/lego/sys/log" + "runtime" "sync" "sync/atomic" "time" @@ -117,8 +119,7 @@ func (this *TimeWheel) Stop() { this.stopC <- struct{}{} } - -//此处写法 为监控时间轮是否正常执行 +//此处写法 为监控时间轮是否正常执行 func (this *TimeWheel) tickGenerator() { if this.tickQueue == nil { return @@ -184,10 +185,10 @@ func (this *TimeWheel) handleTick() { } if task.async { - go task.callback(task, task.args...) + go this.calltask(task, task.args...) } else { // optimize gopool - task.callback(task, task.args...) + this.calltask(task, task.args...) } // circle @@ -209,6 +210,18 @@ func (this *TimeWheel) handleTick() { this.currentIndex++ } +//执行时间轮事件 捕捉异常错误 防止程序崩溃 +func (this *TimeWheel) calltask(task *Task, args ...interface{}) { + defer func() { //程序异常 收集异常信息传递给前端显示 + if r := recover(); r != nil { + buf := make([]byte, 4096) + l := runtime.Stack(buf, false) + log.Errorf("timewheel err:%s", string(buf[0:l])) + } + }() + task.callback(task, task.args...) +} + func (this *TimeWheel) addAny(delay time.Duration, circle, async bool, callback func(*Task, ...interface{}), agr ...interface{}) *Task { if delay <= 0 { delay = this.tick diff --git a/modules/hunting/module.go b/modules/hunting/module.go index 8216ba121..d29081b5d 100644 --- a/modules/hunting/module.go +++ b/modules/hunting/module.go @@ -172,8 +172,8 @@ func (this *Hunting) Reddot(session comm.IUserSession, rid ...comm.ReddotType) ( reddot = make(map[comm.ReddotType]bool) for _, v := range rid { switch v { - case comm.Reddot32: - reddot[comm.Reddot32] = this.modelHunting.checkReddot32(session) + case comm.Reddot14102: + reddot[comm.Reddot14102] = this.modelHunting.checkReddot32(session) break } } diff --git a/modules/mail/module.go b/modules/mail/module.go index acfedc136..58d9d527c 100644 --- a/modules/mail/module.go +++ b/modules/mail/module.go @@ -106,18 +106,18 @@ func (this *Mail) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (red reddot = make(map[comm.ReddotType]bool) for _, v := range rid { switch v { - case comm.Reddot26: + case comm.Reddot12101: if isredot := this.modelMail.checkReddot26(session.GetUserId()); isredot { - reddot[comm.Reddot26] = true + reddot[comm.Reddot12101] = true } else { - reddot[comm.Reddot26] = false + reddot[comm.Reddot12101] = false } break - case comm.Reddot30: + case comm.Reddot12102: if isredot := this.modelMail.checkReddot30(session.GetUserId()); isredot { - reddot[comm.Reddot30] = true + reddot[comm.Reddot12102] = true } else { - reddot[comm.Reddot30] = false + reddot[comm.Reddot12102] = false } break } diff --git a/modules/mline/module.go b/modules/mline/module.go index f01d80d1d..701beedda 100644 --- a/modules/mline/module.go +++ b/modules/mline/module.go @@ -53,8 +53,8 @@ func (this *Mline) Start() (err error) { func (this *Mline) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { reddot = make(map[comm.ReddotType]bool) for _, v := range rid { - if v == comm.Reddot5 { - reddot[comm.Reddot5] = this.CheckPoint(session.GetUserId()) + if v == comm.Reddot11100 { + reddot[comm.Reddot11100] = this.CheckPoint(session.GetUserId()) break } } diff --git a/modules/notify/core.go b/modules/notify/core.go index a3131f139..8df44855e 100644 --- a/modules/notify/core.go +++ b/modules/notify/core.go @@ -1 +1,8 @@ package notify + +import "go_dreamfactory/lego/sys/timewheel" + +//定时通知 +type timernotify struct { + rtask *timewheel.Task +} diff --git a/modules/notify/module.go b/modules/notify/module.go index 9368783d1..6a61a2a45 100644 --- a/modules/notify/module.go +++ b/modules/notify/module.go @@ -4,6 +4,8 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" + "go_dreamfactory/pb" + "time" ) /* @@ -40,3 +42,9 @@ func (this *Notify) OnInstallComp() { this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp) this.modelNotify = this.RegisterComp(new(modelNotifyComp)).(*modelNotifyComp) } + +//添加定时通知消息 +func (this *Notify) AddTimerNotify(uid string, ntype comm.NotifyType, delay time.Duration) (errdata *pb.ErrorData) { + + return +} diff --git a/modules/notify/notify_timer.go b/modules/notify/notify_timer.go new file mode 100644 index 000000000..145947161 --- /dev/null +++ b/modules/notify/notify_timer.go @@ -0,0 +1,73 @@ +package notify + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/core/cbase" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/lego/sys/timewheel" + "go_dreamfactory/pb" + "time" +) + +///定时通知组件 +type notifyTimer struct { + cbase.ModuleCompBase + module *Notify + timers map[string]map[comm.NotifyType]*timernotify +} + +//组件初始化接口 +func (this *notifyTimer) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { + this.ModuleCompBase.Init(service, module, comp, opt) + this.timers = make(map[string]map[comm.NotifyType]*timernotify) + return +} + +func (this *notifyTimer) addTimerNotify(uid string, ntype comm.NotifyType, delay time.Duration) (errdata *pb.ErrorData) { + var ( + utimers map[comm.NotifyType]*timernotify + timer *timernotify + ok bool + ) + if utimers, ok = this.timers[uid]; !ok { + this.timers[uid] = make(map[comm.NotifyType]*timernotify) + utimers = this.timers[uid] + } + if timer, ok = utimers[ntype]; !ok { //还没有定时任务 + utimers[ntype] = &timernotify{} + utimers[ntype].rtask = timewheel.Add(delay, this.timerNotify, uid, ntype) + } else { + timewheel.Remove(utimers[ntype].rtask) + timer.rtask = timewheel.Add(delay, this.timerNotify, uid, ntype) + } + return +} + +func (this *notifyTimer) timerNotify(task *timewheel.Task, args ...interface{}) { + if len(args) != 2 { + this.module.Error("异常定时通知消息", log.Field{Key: "args", Value: args}) + return + } + var ( + uid string + ntype comm.NotifyType + utimers map[comm.NotifyType]*timernotify + ok bool + ) + uid = args[0].(string) + ntype = args[1].(comm.NotifyType) + if utimers, ok = this.timers[uid]; !ok { + return + } + if _, ok = utimers[ntype]; !ok { //还没有定时任务 + return + } + delete(utimers, ntype) + + switch ntype { + case comm.Notify1001: + break + } + +} diff --git a/modules/reddot/api_get.go b/modules/reddot/api_get.go index 17c898325..b7fa1b12a 100644 --- a/modules/reddot/api_get.go +++ b/modules/reddot/api_get.go @@ -23,19 +23,19 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (errda // reddot[v] = false _rid := comm.ReddotType(rid) switch _rid { - case comm.Reddot1: + case comm.Reddot10101: for k, v := range this.module.ModuleTask.Reddot(session, _rid) { reddot[int32(k)] = v } - case comm.Reddot2: + case comm.Reddot10102: for k, v := range this.module.ModuleTask.Reddot(session, _rid) { reddot[int32(k)] = v } - case comm.Reddot3: + case comm.Reddot15102: for k, v := range this.module.ModuleSociaty.Reddot(session, _rid) { reddot[int32(k)] = v } - case comm.Reddot4: + case comm.Reddot10103: for k, v := range this.module.ModuleTask.Reddot(session, _rid) { reddot[int32(k)] = v } @@ -55,16 +55,16 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (errda for k, v := range this.module.gourmet.Reddot(session, _rid) { reddot[int32(k)] = v } - case comm.Reddot26, comm.Reddot30: + case comm.Reddot12101, comm.Reddot12102: for k, v := range this.module.mail.Reddot(session, _rid) { reddot[int32(k)] = v } - case comm.Reddot31: + case comm.Reddot13102: for k, v := range this.module.viking.Reddot(session, _rid) { reddot[int32(k)] = v } - case comm.Reddot32: + case comm.Reddot14102: for k, v := range this.module.hunting.Reddot(session, _rid) { reddot[int32(k)] = v } diff --git a/modules/reddot/api_getall.go b/modules/reddot/api_getall.go index 64afa81f2..209cda992 100644 --- a/modules/reddot/api_getall.go +++ b/modules/reddot/api_getall.go @@ -19,11 +19,11 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) if errdata = this.GetAllCheck(session, req); errdata != nil { return } - for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot1, comm.Reddot2, comm.Reddot4, comm.Reddot27, - comm.Reddot28) { + for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot10101, comm.Reddot10102, comm.Reddot10103, comm.Reddot10201, + comm.Reddot10301) { reddot[int32(k)] = v } - for k, v := range this.module.mline.Reddot(session, comm.Reddot5) { + for k, v := range this.module.mline.Reddot(session, comm.Reddot11100) { reddot[int32(k)] = v } for k, v := range this.module.pagoda.Reddot(session, comm.Reddot6) { @@ -42,17 +42,17 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) reddot[int32(k)] = v } - for k, v := range this.module.sociaty.Reddot(session, comm.Reddot3, comm.Reddot29) { + for k, v := range this.module.sociaty.Reddot(session, comm.Reddot15102, comm.Reddot15201) { reddot[int32(k)] = v } - for k, v := range this.module.mail.Reddot(session, comm.Reddot26, comm.Reddot30) { + for k, v := range this.module.mail.Reddot(session, comm.Reddot12101, comm.Reddot12102) { reddot[int32(k)] = v } - for k, v := range this.module.viking.Reddot(session, comm.Reddot31) { + for k, v := range this.module.viking.Reddot(session, comm.Reddot13102) { reddot[int32(k)] = v } - for k, v := range this.module.hunting.Reddot(session, comm.Reddot32) { + for k, v := range this.module.hunting.Reddot(session, comm.Reddot14102) { reddot[int32(k)] = v } diff --git a/modules/smithy/model_atlas.go b/modules/smithy/model_atlas.go index dae756f3b..768d6a838 100644 --- a/modules/smithy/model_atlas.go +++ b/modules/smithy/model_atlas.go @@ -143,3 +143,19 @@ func (this *modelAtlas) CheckActivateEquipAtlas(uid string, Equip []*pb.DB_Equip } return true } + +// 红点检测 +func (this *modelAtlas) checkReddot17102(uid string) bool { + list, _ := this.module.modelAtlas.getSmithyAtlasList(uid) + for _, v := range list.Atlas { + if v.Activate == false { + return true + } else { + if v.Data2 != nil { + return true + } + } + } + + return false +} diff --git a/modules/smithy/model_task.go b/modules/smithy/model_task.go index ecf08bf93..4d3b988e0 100644 --- a/modules/smithy/model_task.go +++ b/modules/smithy/model_task.go @@ -170,6 +170,20 @@ func (this *modelTask) updateTaskRecord(uid string, taskId int32) error { return nil } +// 红点检测 +func (this *modelTask) checkReddot17107(uid string) bool { + dt, err := this.getTaskRecord(uid) + if err != nil { + return false + } + for _, v := range dt.Tasks { + if v.Received == 1 { + return true + } + } + return false +} + // 检查任务状态 // func (this *modelTask) checkTaskStatus(uid string, taskId int32) bool { // conf, _ := this.module.configure.GetSmithyTask(taskId) diff --git a/modules/smithy/module.go b/modules/smithy/module.go index d4a53720c..d399b6f8a 100644 --- a/modules/smithy/module.go +++ b/modules/smithy/module.go @@ -119,3 +119,19 @@ func (this *Smithy) CheckActivateAtlasCollect(uid string, id string) { } return } + +func (this *Smithy) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { + reddot = make(map[comm.ReddotType]bool) + for _, v := range rid { + switch v { + case comm.Reddot17102: // 铁匠铺手册台 + reddot[comm.Reddot17102] = this.modelAtlas.checkReddot17102(session.GetUserId()) + break + case comm.Reddot17107: // 铁匠铺手册台收藏家奖励按钮上 + reddot[comm.Reddot17107] = this.modelTask.checkReddot17107(session.GetUserId()) + break + } + + } + return +} diff --git a/modules/sociaty/module.go b/modules/sociaty/module.go index 560db1f5a..ba2493ae5 100644 --- a/modules/sociaty/module.go +++ b/modules/sociaty/module.go @@ -154,11 +154,11 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) ( } for _, v := range rid { switch v { - case comm.Reddot3: + case comm.Reddot15102: tf := this.modelSociaty.IsSign(session.GetUserId(), sociaty) - reddot[comm.Reddot3] = !tf - case comm.Reddot29: - reddot[comm.Reddot29] = applyReddot + reddot[comm.Reddot15102] = !tf + case comm.Reddot15201: + reddot[comm.Reddot15201] = applyReddot } } } diff --git a/modules/task/module.go b/modules/task/module.go index c305084da..001ebd43d 100644 --- a/modules/task/module.go +++ b/modules/task/module.go @@ -143,22 +143,22 @@ func (this *ModuleTask) Reddot(session comm.IUserSession, rid ...comm.ReddotType for _, v := range rid { switch v { - case comm.Reddot1: + case comm.Reddot10101: tf, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_DAILY) - reddot[comm.Reddot1] = tf - case comm.Reddot2: + reddot[comm.Reddot10101] = tf + case comm.Reddot10102: tf, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_WEEKLY) - reddot[comm.Reddot2] = tf + reddot[comm.Reddot10102] = tf - case comm.Reddot4: + case comm.Reddot10103: tf, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_ACHIEVE) - reddot[comm.Reddot4] = tf - case comm.Reddot27: + reddot[comm.Reddot10103] = tf + case comm.Reddot10201: tf, _ := this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_DAILY) - reddot[comm.Reddot27] = tf - case comm.Reddot28: + reddot[comm.Reddot10201] = tf + case comm.Reddot10301: tf, _ := this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_WEEKLY) - reddot[comm.Reddot28] = tf + reddot[comm.Reddot10301] = tf } } return diff --git a/modules/viking/module.go b/modules/viking/module.go index 7b65a55a9..d16ee5938 100644 --- a/modules/viking/module.go +++ b/modules/viking/module.go @@ -180,8 +180,8 @@ func (this *Viking) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (r reddot = make(map[comm.ReddotType]bool) for _, v := range rid { switch v { - case comm.Reddot31: - reddot[comm.Reddot31] = this.modelViking.checkReddot31(session) + case comm.Reddot13102: + reddot[comm.Reddot13102] = this.modelViking.checkReddot31(session) break } diff --git a/modules/web/api_paydelivery.go b/modules/web/api_paydelivery.go index a9fb56271..dd69dfa62 100644 --- a/modules/web/api_paydelivery.go +++ b/modules/web/api_paydelivery.go @@ -8,6 +8,7 @@ import ( "go_dreamfactory/lego/utils/crypto/md5" "go_dreamfactory/pb" "net/http" + "time" ) type PayDeliveryResults struct { @@ -53,8 +54,9 @@ func (this *Api_Comp) PayDelivery(c *engine.Context) { payresp.Code = pb.ErrorCode_SignError payresp.Msg = pb.GetErrorCodeMsg(pb.ErrorCode_SignError) } + ctx, _ := context.WithTimeout(context.TODO(), time.Second*5) if err = this.module.service.RpcCall( - context.Background(), + ctx, comm.Service_Worker, string(comm.Rpc_ModulePayDelivery), payreq, diff --git a/modules/web/api_synccross.go b/modules/web/api_synccross.go index 9b8e92e17..1b1c1cd5f 100644 --- a/modules/web/api_synccross.go +++ b/modules/web/api_synccross.go @@ -8,6 +8,7 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/db" "net/http" + "time" ) type SyncCrossReq struct { @@ -51,8 +52,9 @@ func (this *Api_Comp) SyncCross(c *engine.Context) { resp.Message = err.Error() return } + ctx, _ := context.WithTimeout(context.TODO(), time.Second*5) if err = this.module.service.RpcBroadcast( - context.Background(), + ctx, comm.Service_Worker, string(comm.Rpc_DBSyncCross), pb.EmptyReq{}, diff --git a/modules/web/api_upload.go b/modules/web/api_upload.go index 215d6b1ae..fad22ee80 100644 --- a/modules/web/api_upload.go +++ b/modules/web/api_upload.go @@ -9,6 +9,7 @@ import ( "go_dreamfactory/sys/configure" "net/http" "strconv" + "time" ) //上传配置文件 @@ -52,8 +53,9 @@ func (this *Api_Comp) Upload(c *engine.Context) { } } } + ctx, _ := context.WithTimeout(context.TODO(), time.Second*5) if err := this.module.service.RpcBroadcast( - context.Background(), + ctx, comm.Service_Worker, string(comm.Rpc_ConfigureUpDate), &pb.EmptyReq{}, diff --git a/sys/configure/structs/Game.PandamasJxData.go b/sys/configure/structs/Game.PandamasJxData.go index a177ca5d8..ac71b9884 100644 --- a/sys/configure/structs/Game.PandamasJxData.go +++ b/sys/configure/structs/Game.PandamasJxData.go @@ -12,6 +12,7 @@ import "errors" type GamePandamasJxData struct { Id string + Job int32 Race int32 Type int32 Name string @@ -41,6 +42,7 @@ func (*GamePandamasJxData) GetTypeId() int32 { func (_v *GamePandamasJxData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["job"].(float64); !_ok_ { err = errors.New("job error"); return }; _v.Job = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["race"].(float64); !_ok_ { err = errors.New("race error"); return }; _v.Race = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = 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 } } }