From 9fa28554351e9ff8ea8a42364cfcf8cf63956e3a Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 2 Mar 2023 15:03:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BE=E9=81=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_dispatch_task.json | 539 +++++++++++++++++----------- cmd/v2/ui/protocol.go | 19 + cmd/v2/ui/views/dispatch.go | 188 ++++++++++ modules/dispatch/api_autoreceive.go | 34 ++ modules/dispatch/api_do.go | 27 +- modules/dispatch/api_notice.go | 13 +- modules/dispatch/api_receive.go | 38 +- modules/dispatch/api_refresh.go | 54 ++- modules/dispatch/api_week.go | 20 ++ modules/dispatch/model_dispatch.go | 401 ++++++++++++++++----- modules/smithy/api_receive.go | 18 +- modules/smithy/api_tasklist.go | 31 ++ modules/smithy/model_task.go | 51 +-- modules/smithy/module.go | 2 + modules/worldtask/api_check.go | 2 + pb/dispatch_db.pb.go | 126 +++++-- pb/dispatch_msg.pb.go | 386 +++++++++++++++++--- pb/errorcode.pb.go | 11 +- pb/smithy_msg.pb.go | 84 ++--- 19 files changed, 1589 insertions(+), 455 deletions(-) create mode 100644 cmd/v2/ui/views/dispatch.go create mode 100644 modules/dispatch/api_autoreceive.go create mode 100644 modules/dispatch/api_week.go create mode 100644 modules/smithy/api_tasklist.go create mode 100644 modules/worldtask/api_check.go diff --git a/bin/json/game_dispatch_task.json b/bin/json/game_dispatch_task.json index eeeb6157e..5f3acb66b 100644 --- a/bin/json/game_dispatch_task.json +++ b/bin/json/game_dispatch_task.json @@ -1,13 +1,14 @@ [ { "id": 1, - "type": 0, + "type": 1, "taskname": { "key": "story_80", - "text": "特殊任务1" + "text": "普通任务1" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 20, "tasktxt": { "key": "story_80", "text": "普通任务文本1" @@ -19,12 +20,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -45,13 +52,14 @@ "type": 1, "taskname": { "key": "story_80", - "text": "普通任务1" + "text": "普通任务2" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 30, "tasktxt": { "key": "story_80", - "text": "普通任务文本1" + "text": "普通任务文本2" }, "taskneed": 2, "taskreq": [ @@ -60,12 +68,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -86,13 +100,14 @@ "type": 1, "taskname": { "key": "story_80", - "text": "普通任务2" + "text": "普通任务3" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 40, "tasktxt": { "key": "story_80", - "text": "普通任务文本2" + "text": "普通任务文本3" }, "taskneed": 2, "taskreq": [ @@ -101,12 +116,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -127,13 +148,14 @@ "type": 1, "taskname": { "key": "story_80", - "text": "普通任务3" + "text": "普通任务4" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 10, "tasktxt": { "key": "story_80", - "text": "普通任务文本3" + "text": "普通任务文本4" }, "taskneed": 2, "taskreq": [ @@ -142,12 +164,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -168,13 +196,14 @@ "type": 1, "taskname": { "key": "story_80", - "text": "普通任务4" + "text": "普通任务5" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 20, "tasktxt": { "key": "story_80", - "text": "普通任务文本4" + "text": "普通任务文本5" }, "taskneed": 2, "taskreq": [ @@ -183,12 +212,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -209,13 +244,14 @@ "type": 1, "taskname": { "key": "story_80", - "text": "普通任务5" + "text": "普通任务6" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 30, "tasktxt": { "key": "story_80", - "text": "普通任务文本5" + "text": "普通任务文本6" }, "taskneed": 2, "taskreq": [ @@ -224,12 +260,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -250,13 +292,14 @@ "type": 1, "taskname": { "key": "story_80", - "text": "普通任务6" + "text": "普通任务7" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 40, "tasktxt": { "key": "story_80", - "text": "普通任务文本6" + "text": "普通任务文本7" }, "taskneed": 2, "taskreq": [ @@ -265,12 +308,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -289,53 +338,13 @@ { "id": 8, "type": 1, - "taskname": { - "key": "story_80", - "text": "普通任务7" - }, - "taskcd": 168, - "tasktime": 2, - "tasktxt": { - "key": "story_80", - "text": "普通任务文本7" - }, - "taskneed": 2, - "taskreq": [ - { - "key": 1, - "param": 1 - } - ], - "taskreqex": [ - { - "key": 2, - "param": 5 - } - ], - "reward": [ - { - "a": "attr", - "t": "gold", - "n": 10000 - } - ], - "rewardex": [ - { - "a": "attr", - "t": "gold", - "n": 20000 - } - ] - }, - { - "id": 9, - "type": 1, "taskname": { "key": "story_80", "text": "普通任务8" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 10, "tasktxt": { "key": "story_80", "text": "普通任务文本8" @@ -347,12 +356,66 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], + "reward": [ + { + "a": "attr", + "t": "gold", + "n": 20000 + } + ], + "rewardex": [ + { + "a": "attr", + "t": "gold", + "n": 40000 + } + ] + }, + { + "id": 9, + "type": 2, + "taskname": { + "key": "story_80", + "text": "稀有任务1" + }, + "icon": "", + "taskcd": 168, + "tasktime": 20, + "tasktxt": { + "key": "story_80", + "text": "稀有任务文本1" + }, + "taskneed": 2, + "taskreq": [ + { + "key": 1, + "param": 1 + } + ], + "reqtxt": [ + "DispatchCond1" + ], + "taskreqex": [ + { + "key": 2, + "param": 5 + } + ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -373,13 +436,14 @@ "type": 2, "taskname": { "key": "story_80", - "text": "稀有任务1" + "text": "稀有任务2" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 30, "tasktxt": { "key": "story_80", - "text": "稀有任务文本1" + "text": "稀有任务文本2" }, "taskneed": 2, "taskreq": [ @@ -388,12 +452,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -414,13 +484,14 @@ "type": 2, "taskname": { "key": "story_80", - "text": "稀有任务2" + "text": "稀有任务3" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 40, "tasktxt": { "key": "story_80", - "text": "稀有任务文本2" + "text": "稀有任务文本3" }, "taskneed": 2, "taskreq": [ @@ -429,12 +500,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -455,13 +532,14 @@ "type": 2, "taskname": { "key": "story_80", - "text": "稀有任务3" + "text": "稀有任务4" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 10, "tasktxt": { "key": "story_80", - "text": "稀有任务文本3" + "text": "稀有任务文本4" }, "taskneed": 2, "taskreq": [ @@ -470,12 +548,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -496,13 +580,14 @@ "type": 2, "taskname": { "key": "story_80", - "text": "稀有任务4" + "text": "稀有任务5" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 20, "tasktxt": { "key": "story_80", - "text": "稀有任务文本4" + "text": "稀有任务文本5" }, "taskneed": 2, "taskreq": [ @@ -511,12 +596,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -534,54 +625,14 @@ }, { "id": 14, - "type": 2, - "taskname": { - "key": "story_80", - "text": "稀有任务5" - }, - "taskcd": 168, - "tasktime": 2, - "tasktxt": { - "key": "story_80", - "text": "稀有任务文本5" - }, - "taskneed": 2, - "taskreq": [ - { - "key": 1, - "param": 1 - } - ], - "taskreqex": [ - { - "key": 2, - "param": 5 - } - ], - "reward": [ - { - "a": "attr", - "t": "gold", - "n": 20000 - } - ], - "rewardex": [ - { - "a": "attr", - "t": "gold", - "n": 40000 - } - ] - }, - { - "id": 15, "type": 3, "taskname": { "key": "story_80", "text": "史诗任务1" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 30, "tasktxt": { "key": "story_80", "text": "史诗任务文本1" @@ -593,12 +644,66 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], + "reward": [ + { + "a": "attr", + "t": "gold", + "n": 30000 + } + ], + "rewardex": [ + { + "a": "attr", + "t": "gold", + "n": 50000 + } + ] + }, + { + "id": 15, + "type": 3, + "taskname": { + "key": "story_80", + "text": "史诗任务2" + }, + "icon": "", + "taskcd": 168, + "tasktime": 40, + "tasktxt": { + "key": "story_80", + "text": "史诗任务文本2" + }, + "taskneed": 2, + "taskreq": [ + { + "key": 1, + "param": 1 + } + ], + "reqtxt": [ + "DispatchCond1" + ], + "taskreqex": [ + { + "key": 2, + "param": 5 + } + ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -619,13 +724,14 @@ "type": 3, "taskname": { "key": "story_80", - "text": "史诗任务2" + "text": "史诗任务3" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 10, "tasktxt": { "key": "story_80", - "text": "史诗任务文本2" + "text": "史诗任务文本3" }, "taskneed": 2, "taskreq": [ @@ -634,12 +740,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -660,13 +772,14 @@ "type": 3, "taskname": { "key": "story_80", - "text": "史诗任务3" + "text": "史诗任务4" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 20, "tasktxt": { "key": "story_80", - "text": "史诗任务文本3" + "text": "史诗任务文本4" }, "taskneed": 2, "taskreq": [ @@ -675,12 +788,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -701,13 +820,14 @@ "type": 3, "taskname": { "key": "story_80", - "text": "史诗任务4" + "text": "史诗任务5" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 30, "tasktxt": { "key": "story_80", - "text": "史诗任务文本4" + "text": "史诗任务文本5" }, "taskneed": 2, "taskreq": [ @@ -716,12 +836,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -742,13 +868,14 @@ "type": 3, "taskname": { "key": "story_80", - "text": "史诗任务5" + "text": "史诗任务6" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 40, "tasktxt": { "key": "story_80", - "text": "史诗任务文本5" + "text": "史诗任务文本6" }, "taskneed": 2, "taskreq": [ @@ -757,12 +884,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -780,54 +913,14 @@ }, { "id": 20, - "type": 3, - "taskname": { - "key": "story_80", - "text": "史诗任务6" - }, - "taskcd": 168, - "tasktime": 2, - "tasktxt": { - "key": "story_80", - "text": "史诗任务文本6" - }, - "taskneed": 2, - "taskreq": [ - { - "key": 1, - "param": 1 - } - ], - "taskreqex": [ - { - "key": 2, - "param": 5 - } - ], - "reward": [ - { - "a": "attr", - "t": "gold", - "n": 30000 - } - ], - "rewardex": [ - { - "a": "attr", - "t": "gold", - "n": 50000 - } - ] - }, - { - "id": 21, "type": 4, "taskname": { "key": "story_80", "text": "传说任务1" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 10, "tasktxt": { "key": "story_80", "text": "传说任务文本1" @@ -839,12 +932,66 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], + "reward": [ + { + "a": "attr", + "t": "gold", + "n": 40000 + } + ], + "rewardex": [ + { + "a": "attr", + "t": "gold", + "n": 510000 + } + ] + }, + { + "id": 21, + "type": 4, + "taskname": { + "key": "story_80", + "text": "传说任务2" + }, + "icon": "", + "taskcd": 168, + "tasktime": 20, + "tasktxt": { + "key": "story_80", + "text": "传说任务文本2" + }, + "taskneed": 2, + "taskreq": [ + { + "key": 1, + "param": 1 + } + ], + "reqtxt": [ + "DispatchCond1" + ], + "taskreqex": [ + { + "key": 2, + "param": 5 + } + ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", @@ -863,53 +1010,13 @@ { "id": 22, "type": 4, - "taskname": { - "key": "story_80", - "text": "传说任务2" - }, - "taskcd": 168, - "tasktime": 2, - "tasktxt": { - "key": "story_80", - "text": "传说任务文本2" - }, - "taskneed": 2, - "taskreq": [ - { - "key": 1, - "param": 1 - } - ], - "taskreqex": [ - { - "key": 2, - "param": 5 - } - ], - "reward": [ - { - "a": "attr", - "t": "gold", - "n": 40000 - } - ], - "rewardex": [ - { - "a": "attr", - "t": "gold", - "n": 510000 - } - ] - }, - { - "id": 23, - "type": 4, "taskname": { "key": "story_80", "text": "传说任务3" }, + "icon": "", "taskcd": 168, - "tasktime": 2, + "tasktime": 30, "tasktxt": { "key": "story_80", "text": "传说任务文本3" @@ -921,12 +1028,18 @@ "param": 1 } ], + "reqtxt": [ + "DispatchCond1" + ], "taskreqex": [ { "key": 2, "param": 5 } ], + "reqextxt": [ + "DispatchCond2" + ], "reward": [ { "a": "attr", diff --git a/cmd/v2/ui/protocol.go b/cmd/v2/ui/protocol.go index 36cb77d70..405a7b1e3 100644 --- a/cmd/v2/ui/protocol.go +++ b/cmd/v2/ui/protocol.go @@ -122,6 +122,8 @@ var ( ff(comm.ModuleWorldtask, worldtask.WorldtaskSubtypeMine): &formview.WorldtaskMineView{}, //smithy ff(comm.ModuleSmithy, "customer"): &formview.SmithyView{}, + //武馆派遣 + ff(comm.ModuleDispatch, "dispatch"): &formview.DispatchView{}, } ) @@ -150,6 +152,7 @@ var ( string(comm.ModuleWorldtask), string(comm.ModuleReddot), string(comm.ModuleSmithy), + string(comm.ModuleDispatch), }, "gm": {ff(comm.ModuleGM, "cmd")}, "sys": { @@ -251,6 +254,9 @@ var ( "smithy": { ff(comm.ModuleSmithy, "customer"), }, + "dispatch": { + ff(comm.ModuleDispatch, "dispatch"), + }, } ) @@ -896,6 +902,19 @@ var ( SubType: "customer", Enabled: true, }, + // dispatch + string(comm.ModuleDispatch): { + NavLabel: "武馆派遣", + MainType: string(comm.ModuleDispatch), + Enabled: true, + }, + ff(comm.ModuleDispatch, "dispatch"): { + NavLabel: "派遣", + Desc: "派遣", + MainType: string(comm.ModuleDispatch), + SubType: "dispatch", + Enabled: true, + }, } ) diff --git a/cmd/v2/ui/views/dispatch.go b/cmd/v2/ui/views/dispatch.go new file mode 100644 index 000000000..025e9e7ad --- /dev/null +++ b/cmd/v2/ui/views/dispatch.go @@ -0,0 +1,188 @@ +package formview + +import ( + "fmt" + "go_dreamfactory/cmd/v2/lib/common" + "go_dreamfactory/cmd/v2/model" + "go_dreamfactory/cmd/v2/service" + "go_dreamfactory/cmd/v2/service/observer" + "go_dreamfactory/comm" + "go_dreamfactory/pb" + "time" + + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/container" + "fyne.io/fyne/v2/dialog" + "fyne.io/fyne/v2/widget" + "github.com/sirupsen/logrus" + "github.com/spf13/cast" +) + +type DispatchView struct { + BaseformView + itemList *common.ItemList + flag bool +} + +func (d *DispatchView) CreateView(t *model.TestCase) fyne.CanvasObject { + d.itemList = common.NewItemList() + + d.itemList.ItemList = d.itemList.CreateList() + + //选择任务 + d.itemList.ItemList.OnSelected = func(id widget.ListItemID) { + item := d.itemList.CachedList.Items[id] + d.itemList.SelItemId = item.Id + logrus.Debug(item) + + } + + //玩家公告 + + noticeBtn := widget.NewButton("玩家公告", func() { + d.itemList.Reset() + if err := service.GetPttService().SendToClient( + t.MainType, + "notice", + &pb.DispatchNoticeReq{}, + ); err != nil { + logrus.Error(err) + return + } + + }) + //刷新公告 + refreshBtn := widget.NewButton("刷新公告", func() { + if err := service.GetPttService().SendToClient( + t.MainType, + "refresh", + &pb.DispatchRefreshReq{}, + ); err != nil { + logrus.Error(err) + return + } + }) + + //领取奖励 + receiveBtn := widget.NewButton("领取奖励", func() { + if d.itemList.SelItemId == "" { + logrus.Debug("参数是空") + return + } + if err := service.GetPttService().SendToClient( + t.MainType, + "receive", + &pb.DispatchReceiveReq{ + TaskId: cast.ToInt32(d.itemList.SelItemId), + }, + ); err != nil { + logrus.Error(err) + return + } + }) + //一键领取奖励 + autoReceiveBtn := widget.NewButton("一键领取", func() { + if err := service.GetPttService().SendToClient( + t.MainType, + "autoreceive", + &pb.DispatchAutoReceiveReq{}, + ); err != nil { + logrus.Error(err) + return + } + }) + //派遣 + hero1 := widget.NewEntry() + hero2 := widget.NewEntry() + form := widget.NewForm( + widget.NewFormItem("英雄1", hero1), + widget.NewFormItem("英雄2", hero2), + ) + + paiqianBtn := widget.NewButton("派遣", func() { + //弹窗 + form.OnSubmit = func() { + logrus.Debug(hero1.Text, hero2.Text) + if hero1.Text == "" && hero2.Text == "" { + logrus.Debug("heroId参数不能为空") + return + } + heroIds := []string{} + if hero1.Text != "" { + heroIds = append(heroIds, hero1.Text) + } else if hero2.Text != "" { + heroIds = append(heroIds, hero2.Text) + } + if err := service.GetPttService().SendToClient( + t.MainType, + "do", + &pb.DispatchDoReq{ + TaskId: cast.ToInt32(d.itemList.SelItemId), + HeroIds: heroIds, + }, + ); err != nil { + logrus.Error(err) + return + } + } + form.SubmitText = "派遣" + paiWin := dialog.NewCustom("派遣", "关闭", form, d.w) + paiWin.Resize(fyne.NewSize(600, 300)) + paiWin.Show() + + }) + //周奖励领取 + weekReceiveBtn := widget.NewButton("周奖励", func() { + if err := service.GetPttService().SendToClient( + t.MainType, + "weekreceive", + &pb.DispatchWeekReciveReq{}, + ); err != nil { + logrus.Error(err) + return + } + + }) + + btns := container.NewHBox(noticeBtn, refreshBtn, receiveBtn, + autoReceiveBtn, paiqianBtn, weekReceiveBtn) + c := container.NewBorder(btns, nil, nil, nil, d.itemList.ItemList) + d.noticeList() + return c +} + +func (a *DispatchView) noticeList() { + if a.flag { + return + } + + a.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{ + OnNotify: func(d interface{}, args ...interface{}) { + data := d.(*pb.UserMessage) + if data.MainType == string(comm.ModuleDispatch) && + data.SubType == "notice" { + + rsp := &pb.DispatchNoticeResp{} + + if !comm.ProtoUnmarshal(data, rsp) { + logrus.Error("unmarshal err") + return + } + + for _, v := range rsp.Dispatch.Tasks { + t1 := time.Unix(v.Duration, 0) + lt1 := t1.Format("15:04:05") + t2 := time.Unix(v.LeftTime, 0) + lt2 := t2.Format("15:04:05") + item := common.Item{ + Id: cast.ToString(v.TaskId), + Text: fmt.Sprintf("ID:%v 状态:%v 任务截至:%v 派遣截至:%v", v.TaskId, v.Status, lt1, lt2), + Data: v, + } + a.itemList.AddItem(item) + } + } + }, + }) + a.flag = true +} diff --git a/modules/dispatch/api_autoreceive.go b/modules/dispatch/api_autoreceive.go new file mode 100644 index 000000000..474dc6087 --- /dev/null +++ b/modules/dispatch/api_autoreceive.go @@ -0,0 +1,34 @@ +package dispatch + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +func (a *apiComp) AutoreceiveCheck(session comm.IUserSession, req *pb.DispatchAutoReceiveReq) (code pb.ErrorCode) { + return +} + +func (a *apiComp) Autoreceive(session comm.IUserSession, req *pb.DispatchAutoReceiveReq) (code pb.ErrorCode, data proto.Message) { + + rsp := &pb.DispatchAutoReceiveResp{} + d := a.module.modelDispatch.getDBDispatch(session.GetUserId()) + if d == nil { + code = pb.ErrorCode_DataNotFound + return + } + + tasks := a.module.modelDispatch.replaceFinishedTask(session.GetUserId(), d) + + //更新公告任务 + if err := a.module.modelDispatch.updateTasks(session.GetUserId(), d.Nb, tasks); err != nil { + a.module.Debug("更新公告失败", log.Field{Key: "uid", Value: session.GetUserId()}) + return + } + + session.SendMsg(string(a.module.GetType()), "autoreceive", rsp) + return +} diff --git a/modules/dispatch/api_do.go b/modules/dispatch/api_do.go index 6b0cb4f8d..2c4522b4f 100644 --- a/modules/dispatch/api_do.go +++ b/modules/dispatch/api_do.go @@ -1,6 +1,7 @@ package dispatch import ( + "errors" "go_dreamfactory/comm" "go_dreamfactory/pb" @@ -10,7 +11,8 @@ import ( // 派遣 func (a *apiComp) DoCheck(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.ErrorCode) { - if len(req.HeroId) == 0 || req.TaskId == 0 { + if len(req.HeroIds) == 0 || req.TaskId == 0 { + code = pb.ErrorCode_ReqParameterError return } return @@ -21,12 +23,31 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb. return } - if err := a.module.modelDispatch.dispatch(session.GetUserId(), req.TaskId, req.HeroId); err != nil { - code = pb.ErrorCode_DBError + d := a.module.modelDispatch.getDBDispatch(session.GetUserId()) + if d == nil && d.Nb == nil { + code = pb.ErrorCode_DataNotFound return } + + //校验门票 + if d.Ticket <= 0 { + code = pb.ErrorCode_DispatchTicketNoEnough + return + } + rsp := &pb.DispatchDoResp{} + if err := a.module.modelDispatch.dispatch(session.GetUserId(), req.TaskId, req.HeroIds, d); err != nil { + var errCustom = new(comm.CustomError) + if errors.As(err, &errCustom) { + code = errCustom.Code + } else { + code = pb.ErrorCode_DBError + } + return + } + + rsp.IsSucc = true session.SendMsg(string(a.module.GetType()), "do", rsp) return } diff --git a/modules/dispatch/api_notice.go b/modules/dispatch/api_notice.go index fa94e54bf..cdcb234a4 100644 --- a/modules/dispatch/api_notice.go +++ b/modules/dispatch/api_notice.go @@ -16,12 +16,13 @@ func (a *apiComp) NoticeCheck(session comm.IUserSession, req *pb.DispatchNoticeR func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (code pb.ErrorCode, data proto.Message) { d := a.module.modelDispatch.getDBDispatch(session.GetUserId()) - if d == nil { - d = a.module.modelDispatch.initDispatch(session.GetUserId()) - return - } - rsp := &pb.DispatchNoticeResp{ - Dispatch: d, + rsp := &pb.DispatchNoticeResp{} + + if len(d.Nb.Tasks) == 0 { + rsp.Dispatch = a.module.modelDispatch.initDispatch(session.GetUserId(), d) + } else { + a.module.modelDispatch.updateNotice(session.GetUserId(),d) + rsp.Dispatch = d.Nb } session.SendMsg(string(a.module.GetType()), "notice", rsp) diff --git a/modules/dispatch/api_receive.go b/modules/dispatch/api_receive.go index a66ca3e7a..5ac134f3b 100644 --- a/modules/dispatch/api_receive.go +++ b/modules/dispatch/api_receive.go @@ -2,6 +2,7 @@ package dispatch import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -10,20 +11,49 @@ import ( // 领取派遣奖励 func (a *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.DispatchReceiveReq) (code pb.ErrorCode) { + if req.TaskId == 0 { + code = pb.ErrorCode_ReqParameterError + } return } func (a *apiComp) Receive(session comm.IUserSession, req *pb.DispatchReceiveReq) (code pb.ErrorCode, data proto.Message) { - + if code = a.ReceiveCheck(session, req); code != pb.ErrorCode_Success { + return + } d := a.module.modelDispatch.getDBDispatch(session.GetUserId()) if d == nil { code = pb.ErrorCode_DBError return } - a.module.modelDispatch.taskRandom(session.GetUserId(), d.Nb.Lv) - - rsp := &pb.DispatchReceiveResp{} + tasks := a.module.modelDispatch.replaceTask(session.GetUserId(), req.TaskId, d) + + //更新公告任务 + if err := a.module.modelDispatch.updateTasks(session.GetUserId(), d.Nb, tasks); err != nil { + a.module.Debug("更新公告失败", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "taskId", Value: req.TaskId}) + return + } + + //奖励 + for _, t := range d.Nb.Tasks { + if t.TaskId == req.TaskId { + gd, err := a.module.configure.getDispatchTaskConf(t.TaskId) + if err != nil { + break + } + a.module.DispenseRes(session, gd.Reward, true) + + if t.Exaward { + a.module.DispenseRes(session, gd.Rewardex, true) + } + break + } + } + + rsp := &pb.DispatchReceiveResp{ + TaskId: req.TaskId, + } session.SendMsg(string(a.module.GetType()), "receive", rsp) return diff --git a/modules/dispatch/api_refresh.go b/modules/dispatch/api_refresh.go index 3c38c2583..91b45306d 100644 --- a/modules/dispatch/api_refresh.go +++ b/modules/dispatch/api_refresh.go @@ -1,8 +1,11 @@ package dispatch import ( + "errors" "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" "google.golang.org/protobuf/proto" ) @@ -14,7 +17,56 @@ func (a *apiComp) RefreshCheck(session comm.IUserSession, req *pb.DispatchRefres func (a *apiComp) Refresh(session comm.IUserSession, req *pb.DispatchRefreshReq) (code pb.ErrorCode, data proto.Message) { - rsp := &pb.DispatchRefreshResp{} + d := a.module.modelDispatch.getDBDispatch(session.GetUserId()) + if d == nil { + code = pb.ErrorCode_DataNotFound + return + } + + if d.GetNb() != nil { + if d.GetNb().FreeCount > 0 { + //更新刷新次数 + if err := a.module.modelDispatch.updateFreeCount(session.GetUserId(), d.Nb); err != nil { + var customer = new(comm.CustomError) + if errors.As(err, &customer) { + code = customer.Code + } else { + code = pb.ErrorCode_DBError + } + return + } + } else { + //消耗金币 + money := a.module.configure.GetGlobalConf().DispatchCheckmoney + if code = a.module.CheckRes(session, []*cfg.Gameatn{money}); code != pb.ErrorCode_Success { + return + } + if code = a.module.DispenseRes(session, []*cfg.Gameatn{money}, true); code != pb.ErrorCode_Success { + return + } + if err := a.module.modelDispatch.updateRefreshCount(session.GetUserId(), d.Nb); err != nil { + code = pb.ErrorCode_DBError + return + } + } + } + + //刷新公告(随机新的任务 包括未领取和正在进行的任务) + taskIds, err := a.module.modelDispatch.taskRandom(session.GetUserId(), d) + if err != nil { + return + } + + //更新公告任务 + if err := a.module.modelDispatch.updateTasks(session.GetUserId(), d.Nb, taskIds); err != nil { + a.module.Debug("更新公告失败", log.Field{Key: ""}) + return + } + + rsp := &pb.DispatchRefreshResp{ + FreeCount: d.Nb.FreeCount, + RefreshCount: d.Nb.FreeCount, + } session.SendMsg(string(a.module.GetType()), "refresh", rsp) return diff --git a/modules/dispatch/api_week.go b/modules/dispatch/api_week.go new file mode 100644 index 000000000..df0392281 --- /dev/null +++ b/modules/dispatch/api_week.go @@ -0,0 +1,20 @@ +package dispatch + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +func (a *apiComp) WeekreceiveCheck(session comm.IUserSession, req *pb.DispatchWeekReciveReq) (code pb.ErrorCode) { + return +} + +func (a *apiComp) Weekreceive(session comm.IUserSession, req *pb.DispatchWeekReciveReq) (code pb.ErrorCode, data proto.Message) { + + rsp := &pb.DispatchWeekReciveResp{} + + session.SendMsg(string(a.module.GetType()), "weekreceive", rsp) + return +} diff --git a/modules/dispatch/model_dispatch.go b/modules/dispatch/model_dispatch.go index a92f66cf8..1f600c5af 100644 --- a/modules/dispatch/model_dispatch.go +++ b/modules/dispatch/model_dispatch.go @@ -1,7 +1,6 @@ package dispatch import ( - "errors" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" @@ -31,64 +30,107 @@ func (this *modelDispatch) Init(service core.IService, module core.IModule, comp return } -func (this *modelDispatch) initDispatch(uid string) (dis *pb.DBDispatch) { - taskIds, err := this.taskRandom(uid, 1) +// 初始玩家公告 +func (this *modelDispatch) initDispatch(uid string, dispatch *pb.DBDispatch) *pb.Noticeboard { + tasks, err := this.taskRandom(uid, dispatch) if err != nil { - return + return nil } - if len(taskIds) == 0 { - return + if len(tasks) == 0 { + return nil } - dis = &pb.DBDispatch{ + freeCount := this.module.configure.GetGlobalConf().DispatchFreecheck + ticketCount := this.module.configure.GetGlobalConf().DispatchNumoftimes + dis := &pb.DBDispatch{ Uid: uid, - Ticket: 6, + Ticket: ticketCount, Nb: &pb.Noticeboard{ - Lv: 1, + Lv: 1, //公告初始升级 + FreeCount: freeCount, + Tasks: tasks, }, } - for _, v := range taskIds { - taskConf, err := this.module.configure.getDispatchTaskConf(v) - if err != nil { - continue - } - //接续截至时间 - duration := configure.Now().Unix() + int64(taskConf.Taskcd) - dis.Nb.Tasks = append(dis.Nb.Tasks, &pb.DispatchTask{ - TaskId: v, - Duration: duration, - }) - } - if err := this.Add(uid, dis); err != nil { - return + return nil } - return + return dis.Nb } // 获取派遣数据 -func (this *modelDispatch) getDBDispatch(uid string) *pb.DBDispatch { - dis := &pb.DBDispatch{} +func (this *modelDispatch) getDBDispatch(uid string) (dis *pb.DBDispatch) { + dis = &pb.DBDispatch{} if err := this.Get(uid, dis); err != nil { - return nil + if err == mongo.ErrNoDocuments { + dis.Uid = uid + dis.Nb = &pb.Noticeboard{ + Lv: 1, + } + if err := this.Add(uid, dis); err != nil { + return + } + } + return } - return nil + return } -// 随机任务 -func (this *modelDispatch) taskRandom(uid string, noticeLv int32) (taskIds []int32, err error) { - d := this.getDBDispatch(uid) - if d == nil { - return nil, errors.New("no data") +// 获取任务权重数据 +func (this *modelDispatch) getTasksWeight(uid string, noticeLv int32) []int32 { + dispatch := this.getDBDispatch(uid) + if dispatch == nil { + return []int32{} } - if d.Nb == nil { - return nil, errors.New("notice is nil") + if dispatch.Nb == nil { + return []int32{} } conf, err := this.module.configure.getDispatchLvConf(noticeLv) + if err != nil { + return []int32{} + } + + var items []*comm.WeightItem + for i, v := range conf.Probability { + items = append(items, &comm.WeightItem{Id: (i + 1), Weight: int(v)}) + } + + wr := comm.NewWeightedRandom(items) + //任务类型 + var taskType int + if c := wr.Pick(); c != nil { + taskType = c.Id.(int) + } + + confList := this.module.configure.getDispatchListConf() + var tIds []int32 + for _, v := range confList { + if int(v.Type) == taskType { + tIds = append(tIds, v.Id) + } + } + + return tIds +} + +// 随机任务 +func (this *modelDispatch) taskRandom(uid string, dispatch *pb.DBDispatch) (tasks []*pb.DispatchTask, err error) { + // dispatch := this.getDBDispatch(uid) + // if dispatch == nil { + // return nil, errors.New("no data") + // } + + // if dispatch.Nb == nil { + // return nil, errors.New("notice is nil") + // } + if dispatch.Nb.Lv == 0 { + dispatch.Nb.Lv = 1 + } + + conf, err := this.module.configure.getDispatchLvConf(dispatch.Nb.Lv) if err != nil { return nil, err } @@ -115,46 +157,143 @@ func (this *modelDispatch) taskRandom(uid string, noticeLv int32) (taskIds []int //判断随机数量 var n int - n = len(d.Nb.Tasks) + n = len(dispatch.Nb.Tasks) - if len(taskIds) > 0 { - ids := utils.RandomNumbers(0, len(tIds), n) - for i := 0; i < len(ids); i++ { - taskIds = append(taskIds, tIds[i]) + if n == 0 { + //随机6个任务 + ids := utils.RandomNumbers(1, len(tIds), 6) + for _, id := range ids { + taskConf, err := this.module.configure.getDispatchTaskConf(int32(id)) + if err != nil { + continue + } + //公告持续截至时间 + duration := configure.Now().Unix() + int64(taskConf.Taskcd) + tasks = append(tasks, &pb.DispatchTask{ + TaskId: int32(id), + Duration: duration, + }) + } + } else { + tasks = dispatch.Nb.Tasks + for i, v := range tasks{ + //只随机未接取的任务 + if v.Status == 0 { + //删除 + tasks = append(tasks[:i], tasks[i+1:]...) + + //追加一条随机任务 + ids := utils.RandomNumbers(1, len(tIds), 1) + if len(ids) <= 0 { + continue + } + taskId := ids[0] + taskConf, err := this.module.configure.getDispatchTaskConf(v.TaskId) + if err != nil { + continue + } + + //公告持续截至时间 + duration := configure.Now().Unix() + int64(taskConf.Taskcd) + tasks = append(tasks, &pb.DispatchTask{ + TaskId: int32(taskId), + Duration: duration, + }) + } else { + tasks = append(tasks, v) + } + i-- + } + } + + return +} + +// 替换指定的任务 +func (this *modelDispatch) replaceTask(uid string, taskId int32, dispatch *pb.DBDispatch) (tasks []*pb.DispatchTask) { + randomTaskIds := this.getTasksWeight(uid, dispatch.Nb.Lv) + + for i, v := range dispatch.Nb.Tasks { + //替换状态是完成的任务 + if v.Status == 2 { + if taskId != v.TaskId { + continue + } + //删除 + dispatch.Nb.Tasks = append(dispatch.Nb.Tasks[:i], dispatch.Nb.Tasks[i+1:]...) + i-- + + //追加一条随机任务 + ids := utils.RandomNumbers(1, len(randomTaskIds), 1) + if len(ids) <= 0 { + continue + } + taskId := ids[0] + taskConf, err := this.module.configure.getDispatchTaskConf(v.TaskId) + if err != nil { + continue + } + + //公告持续截至时间 + duration := configure.Now().Unix() + int64(taskConf.Taskcd) + // 任务截至时间 + leftTime := configure.Now().Unix() + int64(taskConf.Tasktime) + + tasks = append(tasks, &pb.DispatchTask{ + TaskId: int32(taskId), + Duration: duration, + LeftTime: leftTime, + }) + } else { + tasks = append(tasks, v) + } + } + + return +} + +// 替换所有完成的任务 +func (this *modelDispatch) replaceFinishedTask(uid string, dispatch *pb.DBDispatch) (tasks []*pb.DispatchTask) { + + randomTaskIds := this.getTasksWeight(uid, dispatch.Nb.Lv) + + for i, v := range dispatch.Nb.Tasks { + //替换状态是完成的任务 + if v.Status == 2 { + //删除 + dispatch.Nb.Tasks = append(dispatch.Nb.Tasks[:i], dispatch.Nb.Tasks[i+1:]...) + i-- + + //追加一条随机任务 + ids := utils.RandomNumbers(1, len(randomTaskIds), 1) + if len(ids) <= 0 { + continue + } + taskId := ids[0] + taskConf, err := this.module.configure.getDispatchTaskConf(v.TaskId) + if err != nil { + continue + } + + //公告持续截至时间 + duration := configure.Now().Unix() + int64(taskConf.Taskcd) + // 任务截至时间 + leftTime := configure.Now().Unix() + int64(taskConf.Tasktime) + + tasks = append(tasks, &pb.DispatchTask{ + TaskId: int32(taskId), + Duration: duration, + LeftTime: leftTime, + }) + } else { + tasks = append(tasks, v) } } return } // 验证英雄的条件 -func (this *modelDispatch) validHeroCond(uid string, taskId int32, heroId string) (ok bool, err error) { - //taskConf - gd, err := this.module.configure.getDispatchTaskConf(taskId) - if err != nil { - return - } - - //获取英雄信息 - hero, code := this.module.ModuleHero.GetHeroByObjID(uid, heroId) - - //校验英雄的条件 - if code == pb.ErrorCode_Success && hero != nil { - for _, v := range gd.Taskreq { - switch v.Key { - case 1: //lv - if hero.Lv >= v.Param { - ok = true - return - } - case 2: //star - if hero.Star >= v.Param { - ok = true - return - } - } - } - } - +func (this *modelDispatch) validHeroCond(uid string, taskId int32, heroId string) (ok1, ok2 bool, err error) { //校验英雄是否已被派遣 dispatch := this.getDBDispatch(uid) if dispatch == nil { @@ -164,43 +303,145 @@ func (this *modelDispatch) validHeroCond(uid string, taskId int32, heroId string for _, v := range dispatch.Nb.Tasks { for _, h := range v.HeroIds { if h == heroId { - ok = false + err = comm.NewCustomError(pb.ErrorCode_DispatchHeroAssigned) return } } } + //taskConf + gd, err := this.module.configure.getDispatchTaskConf(taskId) + if err != nil { + return + } + + //获取英雄信息 + hero, code := this.module.ModuleHero.GetHeroByObjID(uid, heroId) + + if code == pb.ErrorCode_Success && hero != nil { + for _, v := range gd.Taskreq { + switch v.Key { + case 1: //校验英雄的基础条件 + if hero.Lv >= v.Param { + ok1 = true + return + } + case 2: //校验英雄的额外要求 + if hero.Star >= v.Param { + ok2 = true + return + } + } + } + } + return } // 派遣 -func (this *modelDispatch) dispatch(uid string, taskId int32, heroIds []string) error { +func (this *modelDispatch) dispatch(uid string, taskId int32, heroIds []string, disp *pb.DBDispatch) error { + var flag bool //额外条件是否满足 for _, heroId := range heroIds { - if ok, err := this.validHeroCond(uid, taskId, heroId); err == nil { - if !ok { - return comm.NewCustomError(pb.ErrorCode_DispatchHeroNoReached) + if ok1, ok2, err := this.validHeroCond(uid, taskId, heroId); err == nil { + if !ok1 { + return comm.NewCustomError(pb.ErrorCode_DispatchHeroNoReached) //基础条件未满足 + } + if ok2 { + flag = true } } else { return err } } - d := this.getDBDispatch(uid) - if d == nil { - return errors.New("no data") - } - - for _, v := range d.Nb.Tasks { + for _, v := range disp.Nb.Tasks { if v.TaskId == taskId && v.Status == 0 { v.HeroIds = heroIds + if v.Duration >= configure.Now().Unix() { + return comm.NewCustomError(pb.ErrorCode_DispatchTaskExpired) + } else { + if v.LeftTime >= configure.Now().Unix() { + v.Status = 2 //任务结束 + v.Exaward = flag + } else { + v.Status = 1 //任务进行中 + leftTime := configure.Now().Unix() + v.LeftTime = leftTime + } + } + } } + //周任务数累加 + disp.Nb.WeekCount++ + + //升级 + conf, err := this.module.configure.getDispatchLvConf(disp.Nb.Lv) + if err != nil { + return err + } + if disp.Nb.WeekCount >= conf.Upgrade { + disp.Nb.Lv++ + } + update := map[string]interface{}{ - "nb": d.Nb.Tasks, + "nb": disp.Nb, + "ticket": disp.Ticket - 1, } if err := this.Change(uid, update); err != nil { return err } return nil } + +// 更新免费刷新次数 +func (this *modelDispatch) updateFreeCount(uid string, noticeboard *pb.Noticeboard) error { + if noticeboard.FreeCount <= 0 { + return comm.NewCustomError(pb.ErrorCode_DispatchNoFree) + } + update := map[string]interface{}{ + "freeCount": noticeboard.FreeCount - 1, + } + return this.Change(uid, update) +} + +// 更新刷新次数 +func (this *modelDispatch) updateRefreshCount(uid string, noticeboard *pb.Noticeboard) error { + noticeboard.RefreshCount++ + update := map[string]interface{}{ + "refreshCount": noticeboard.RefreshCount, + } + return this.Change(uid, update) +} + +// 更新公告任务 +func (this *modelDispatch) updateTasks(uid string, noticeboard *pb.Noticeboard, tasks []*pb.DispatchTask) error { + noticeboard.Tasks = tasks + update := map[string]interface{}{ + "nb": noticeboard, + } + return this.Change(uid, update) +} + +// 更新公告栏任务 +func (this *modelDispatch) updateNotice(uid string, dispatch *pb.DBDispatch) error { + for _, v := range dispatch.Nb.Tasks { + if v.Status == 0 { + //判断到期时间 + if v.Duration >= configure.Now().Unix() { + //替换任务 + this.replaceTask(uid, v.TaskId, dispatch) + } + } + + if v.Status == 1 { + if v.LeftTime >= configure.Now().Unix() { + //更改次任务状态为 + v.Status = 2 //任务结束 + } + } + } + + return this.updateTasks(uid, dispatch.Nb, dispatch.Nb.Tasks) +} diff --git a/modules/smithy/api_receive.go b/modules/smithy/api_receive.go index 222afe047..9b5b81907 100644 --- a/modules/smithy/api_receive.go +++ b/modules/smithy/api_receive.go @@ -1,6 +1,7 @@ package smithy import ( + "errors" "go_dreamfactory/comm" "go_dreamfactory/pb" @@ -16,12 +17,23 @@ func (this *apiComp) TaskAwardCheck(session comm.IUserSession, req *pb.SmithyTas } func (this *apiComp) TaskAward(session comm.IUserSession, req *pb.SmithyTaskAwardReq) (code pb.ErrorCode, data proto.Message) { - if code = this.TaskAwardCheck(session, req); code != pb.ErrorCode_Success { + if code = this.TaskAwardCheck(session, req); code != pb.ErrorCode_Success { return } - resp:= &pb.SmithyTaskAwardResp{} + if err := this.module.modelTask.updateTaskRecord(session.GetUserId(), req.TaskId); err != nil { + var errCustom = new(comm.CustomError) + if errors.As(err, &errCustom) { + code = errCustom.Code + }else{ + code = pb.ErrorCode_DBError + } + return + } + resp := &pb.SmithyTaskAwardResp{ + TaskId: req.TaskId, + } - session.SendMsg(string(this.module.GetType()),"taskaward", resp) + session.SendMsg(string(this.module.GetType()), "taskaward", resp) return } diff --git a/modules/smithy/api_tasklist.go b/modules/smithy/api_tasklist.go new file mode 100644 index 000000000..3a87b3301 --- /dev/null +++ b/modules/smithy/api_tasklist.go @@ -0,0 +1,31 @@ +package smithy + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +func (a *apiComp) TasklistCheck(session comm.IUserSession, req *pb.SmithyTasklistReq) (code pb.ErrorCode) { + return +} + +func (a *apiComp) Tasklist(session comm.IUserSession, req *pb.SmithyTasklistReq) (code pb.ErrorCode, data proto.Message) { + if code = a.TasklistCheck(session, req); code != pb.ErrorCode_Success { + return + } + + dt, err := a.module.modelTask.getTaskRecord(session.GetUserId()) + if err != nil { + code = pb.ErrorCode_DBError + return + } + + resp := &pb.SmithyTasklistResp{ + Tasks: dt, + } + + session.SendMsg(string(a.module.GetType()), "tasklist", resp) + return +} diff --git a/modules/smithy/model_task.go b/modules/smithy/model_task.go index e7a1786cf..b07a0f502 100644 --- a/modules/smithy/model_task.go +++ b/modules/smithy/model_task.go @@ -34,29 +34,36 @@ func (this *modelTask) getTaskRecord(uid string) (*pb.DBTujianTask, error) { } func (this *modelTask) updateTaskRecord(uid string, taskId int32) error { - // if !this.CheckTaskStatus(uid, taskId) { - // return comm.NewCustomError(pb.ErrorCode_SmithyTaskNoFinished) - // } - // dt, err := this.getTaskRecord(uid) - // if err != nil { - // return err - // } + if !this.CheckTaskStatus(uid, taskId) { + return comm.NewCustomError(pb.ErrorCode_SmithyTaskNoFinished) + } + dt, err := this.getTaskRecord(uid) + if err != nil { + return err + } - // if dt.Uid == "" { - // this.Add(uid, &pb.DBTujianTask{Uid: uid, TaskId: taskId, Received: 2}) - // } else { - // // 已存在 重复领取 - // if dt.Received == 2 { - // return comm.NewCustomError(pb.ErrorCode_SmithyTaskReceived) - // } else { - // update := map[string]interface{}{ - // "received": 2, - // } - // if err := this.Change(uid, update); err != nil { - // return err - // } - // } - // } + if dt.Uid == "" { + tj := &pb.DBTujianTask{} + tj.Tasks = append(tj.Tasks, &pb.TujianTask{TaskId: taskId, Received: 2}) + return this.Add(uid, tj) + } else { + for _, v := range dt.Tasks { + if v.TaskId == taskId { + // 已存在 重复领取 + if v.Received == 2 { + return comm.NewCustomError(pb.ErrorCode_SmithyTaskReceived) + } else { + update := map[string]interface{}{ + "received": 2, + } + if err := this.Change(uid, update); err != nil { + return err + } + } + } + } + + } return nil } diff --git a/modules/smithy/module.go b/modules/smithy/module.go index da09c93e3..2ef3bb97a 100644 --- a/modules/smithy/module.go +++ b/modules/smithy/module.go @@ -21,6 +21,7 @@ type Smithy struct { configure *configureComp modelStove *modelStove modelAtlas *modelAtlas + modelTask *modelTask } func NewModule() core.IModule { @@ -45,6 +46,7 @@ func (this *Smithy) OnInstallComp() { this.modelTrade = this.RegisterComp(new(modelTrade)).(*modelTrade) this.modelStove = this.RegisterComp(new(modelStove)).(*modelStove) this.modelAtlas = this.RegisterComp(new(modelAtlas)).(*modelAtlas) + this.modelTask = this.RegisterComp(new(modelTask)).(*modelTask) } // 接口信息 diff --git a/modules/worldtask/api_check.go b/modules/worldtask/api_check.go new file mode 100644 index 000000000..5b158b61e --- /dev/null +++ b/modules/worldtask/api_check.go @@ -0,0 +1,2 @@ +package worldtask + diff --git a/pb/dispatch_db.pb.go b/pb/dispatch_db.pb.go index 4b536cae1..404de8824 100644 --- a/pb/dispatch_db.pb.go +++ b/pb/dispatch_db.pb.go @@ -27,8 +27,8 @@ type DBDispatch struct { unknownFields protoimpl.UnknownFields Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` // - Ticket int32 `protobuf:"varint,2,opt,name=ticket,proto3" json:"ticket" bson:"ticket"` //门票 - Nb *Noticeboard `protobuf:"bytes,3,opt,name=nb,proto3" json:"nb" bson:"nb"` //公告栏 + Nb *Noticeboard `protobuf:"bytes,2,opt,name=nb,proto3" json:"nb" bson:"nb"` //公告栏 + Ticket int32 `protobuf:"varint,3,opt,name=ticket,proto3" json:"ticket" bson:"ticket"` //派遣门票 } func (x *DBDispatch) Reset() { @@ -70,13 +70,6 @@ func (x *DBDispatch) GetUid() string { return "" } -func (x *DBDispatch) GetTicket() int32 { - if x != nil { - return x.Ticket - } - return 0 -} - func (x *DBDispatch) GetNb() *Noticeboard { if x != nil { return x.Nb @@ -84,15 +77,27 @@ func (x *DBDispatch) GetNb() *Noticeboard { return nil } +func (x *DBDispatch) GetTicket() int32 { + if x != nil { + return x.Ticket + } + return 0 +} + // 公告栏 type Noticeboard struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Lv int32 `protobuf:"varint,1,opt,name=lv,proto3" json:"lv" bson:"lv"` // 公告栏等级 - NoticeType int32 `protobuf:"varint,2,opt,name=noticeType,proto3" json:"noticeType" bson:"noticeType"` // 公告栏类型 - Tasks []*DispatchTask `protobuf:"bytes,3,rep,name=tasks,proto3" json:"tasks" bson:"tasks"` //当前公告任务 + Lv int32 `protobuf:"varint,1,opt,name=lv,proto3" json:"lv" bson:"lv"` // 公告栏等级 + NoticeType int32 `protobuf:"varint,2,opt,name=noticeType,proto3" json:"noticeType" bson:"noticeType"` // 公告栏类型 + Tasks []*DispatchTask `protobuf:"bytes,3,rep,name=tasks,proto3" json:"tasks" bson:"tasks"` //当前公告任务 + FreeCount int32 `protobuf:"varint,4,opt,name=freeCount,proto3" json:"freeCount" bson:"freeCount"` //已使用的免费次数 + RefreshCount int32 `protobuf:"varint,5,opt,name=refreshCount,proto3" json:"refreshCount" bson:"refreshCount"` //已刷新次数 + WeekCount int32 `protobuf:"varint,6,opt,name=weekCount,proto3" json:"weekCount" bson:"weekCount"` //周任务数 + TaskCount int32 `protobuf:"varint,7,opt,name=taskCount,proto3" json:"taskCount" bson:"taskCount"` //任务数 + WeekReceived []int32 `protobuf:"varint,8,rep,packed,name=weekReceived,proto3" json:"weekReceived" bson:"weekReceived"` ////已领取的周任务索引ID } func (x *Noticeboard) Reset() { @@ -148,6 +153,41 @@ func (x *Noticeboard) GetTasks() []*DispatchTask { return nil } +func (x *Noticeboard) GetFreeCount() int32 { + if x != nil { + return x.FreeCount + } + return 0 +} + +func (x *Noticeboard) GetRefreshCount() int32 { + if x != nil { + return x.RefreshCount + } + return 0 +} + +func (x *Noticeboard) GetWeekCount() int32 { + if x != nil { + return x.WeekCount + } + return 0 +} + +func (x *Noticeboard) GetTaskCount() int32 { + if x != nil { + return x.TaskCount + } + return 0 +} + +func (x *Noticeboard) GetWeekReceived() []int32 { + if x != nil { + return x.WeekReceived + } + return nil +} + // 派遣任务 type DispatchTask struct { state protoimpl.MessageState @@ -159,6 +199,7 @@ type DispatchTask struct { Duration int64 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration" bson:"duration"` //持续截至时间 LeftTime int64 `protobuf:"varint,4,opt,name=leftTime,proto3" json:"leftTime" bson:"leftTime"` //任务截至时间 HeroIds []string `protobuf:"bytes,5,rep,name=heroIds,proto3" json:"heroIds"` //go_tags(`bson:"heroIds"`) 派遣的英雄 + Exaward bool `protobuf:"varint,6,opt,name=exaward,proto3" json:"exaward" bson:"exaward"` //是否获取额外奖励 } func (x *DispatchTask) Reset() { @@ -228,33 +269,52 @@ func (x *DispatchTask) GetHeroIds() []string { return nil } +func (x *DispatchTask) GetExaward() bool { + if x != nil { + return x.Exaward + } + return false +} + var File_dispatch_dispatch_db_proto protoreflect.FileDescriptor var file_dispatch_dispatch_db_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x54, 0x0a, 0x0a, 0x44, 0x42, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, - 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x69, - 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x02, 0x6e, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0c, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x02, - 0x6e, 0x62, 0x22, 0x62, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x62, 0x6f, 0x61, 0x72, - 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, - 0x76, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x52, - 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0c, 0x44, 0x69, 0x73, 0x70, 0x61, - 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x65, 0x66, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x65, 0x66, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x02, + 0x6e, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x63, + 0x65, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x02, 0x6e, 0x62, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x69, + 0x63, 0x6b, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x69, 0x63, 0x6b, + 0x65, 0x74, 0x22, 0x84, 0x02, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x62, 0x6f, 0x61, + 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, + 0x6c, 0x76, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, + 0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x72, 0x65, 0x65, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x66, 0x72, 0x65, 0x65, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x72, 0x65, 0x66, + 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x77, 0x65, 0x65, + 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x77, 0x65, + 0x65, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x61, 0x73, 0x6b, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x77, 0x65, 0x65, 0x6b, 0x52, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x08, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x77, 0x65, 0x65, + 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x22, 0xaa, 0x01, 0x0a, 0x0c, 0x44, 0x69, + 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, + 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, + 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x65, 0x66, 0x74, 0x54, 0x69, + 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x65, 0x66, 0x74, 0x54, 0x69, + 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, + 0x65, 0x78, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, + 0x78, 0x61, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/dispatch_msg.pb.go b/pb/dispatch_msg.pb.go index 7be098a6b..f4eda7512 100644 --- a/pb/dispatch_msg.pb.go +++ b/pb/dispatch_msg.pb.go @@ -64,7 +64,7 @@ type DispatchNoticeResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Dispatch *DBDispatch `protobuf:"bytes,1,opt,name=dispatch,proto3" json:"dispatch"` + Dispatch *Noticeboard `protobuf:"bytes,1,opt,name=dispatch,proto3" json:"dispatch"` } func (x *DispatchNoticeResp) Reset() { @@ -99,7 +99,7 @@ func (*DispatchNoticeResp) Descriptor() ([]byte, []int) { return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{1} } -func (x *DispatchNoticeResp) GetDispatch() *DBDispatch { +func (x *DispatchNoticeResp) GetDispatch() *Noticeboard { if x != nil { return x.Dispatch } @@ -149,6 +149,9 @@ type DispatchRefreshResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + FreeCount int32 `protobuf:"varint,1,opt,name=freeCount,proto3" json:"freeCount"` //已使用的免费次数 + RefreshCount int32 `protobuf:"varint,2,opt,name=refreshCount,proto3" json:"refreshCount"` //已刷新次数 } func (x *DispatchRefreshResp) Reset() { @@ -183,11 +186,27 @@ func (*DispatchRefreshResp) Descriptor() ([]byte, []int) { return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{3} } -//一键领取奖励 +func (x *DispatchRefreshResp) GetFreeCount() int32 { + if x != nil { + return x.FreeCount + } + return 0 +} + +func (x *DispatchRefreshResp) GetRefreshCount() int32 { + if x != nil { + return x.RefreshCount + } + return 0 +} + +// 领取任务奖励 type DispatchReceiveReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` //任务ID } func (x *DispatchReceiveReq) Reset() { @@ -222,10 +241,19 @@ func (*DispatchReceiveReq) Descriptor() ([]byte, []int) { return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{4} } +func (x *DispatchReceiveReq) GetTaskId() int32 { + if x != nil { + return x.TaskId + } + return 0 +} + type DispatchReceiveResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` } func (x *DispatchReceiveResp) Reset() { @@ -260,20 +288,113 @@ func (*DispatchReceiveResp) Descriptor() ([]byte, []int) { return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{5} } +func (x *DispatchReceiveResp) GetTaskId() int32 { + if x != nil { + return x.TaskId + } + return 0 +} + +//一键领取任务奖励 +type DispatchAutoReceiveReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DispatchAutoReceiveReq) Reset() { + *x = DispatchAutoReceiveReq{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchAutoReceiveReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchAutoReceiveReq) ProtoMessage() {} + +func (x *DispatchAutoReceiveReq) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DispatchAutoReceiveReq.ProtoReflect.Descriptor instead. +func (*DispatchAutoReceiveReq) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{6} +} + +type DispatchAutoReceiveResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId []int32 `protobuf:"varint,1,rep,packed,name=taskId,proto3" json:"taskId"` //领取奖励的任务ID +} + +func (x *DispatchAutoReceiveResp) Reset() { + *x = DispatchAutoReceiveResp{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchAutoReceiveResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchAutoReceiveResp) ProtoMessage() {} + +func (x *DispatchAutoReceiveResp) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DispatchAutoReceiveResp.ProtoReflect.Descriptor instead. +func (*DispatchAutoReceiveResp) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{7} +} + +func (x *DispatchAutoReceiveResp) GetTaskId() []int32 { + if x != nil { + return x.TaskId + } + return nil +} + // 派遣 type DispatchDoReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` - HeroId []string `protobuf:"bytes,2,rep,name=heroId,proto3" json:"heroId"` + TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` + HeroIds []string `protobuf:"bytes,2,rep,name=heroIds,proto3" json:"heroIds"` } func (x *DispatchDoReq) Reset() { *x = DispatchDoReq{} if protoimpl.UnsafeEnabled { - mi := &file_dispatch_dispatch_msg_proto_msgTypes[6] + mi := &file_dispatch_dispatch_msg_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -286,7 +407,7 @@ func (x *DispatchDoReq) String() string { func (*DispatchDoReq) ProtoMessage() {} func (x *DispatchDoReq) ProtoReflect() protoreflect.Message { - mi := &file_dispatch_dispatch_msg_proto_msgTypes[6] + mi := &file_dispatch_dispatch_msg_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -299,7 +420,7 @@ func (x *DispatchDoReq) ProtoReflect() protoreflect.Message { // Deprecated: Use DispatchDoReq.ProtoReflect.Descriptor instead. func (*DispatchDoReq) Descriptor() ([]byte, []int) { - return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{6} + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{8} } func (x *DispatchDoReq) GetTaskId() int32 { @@ -309,9 +430,9 @@ func (x *DispatchDoReq) GetTaskId() int32 { return 0 } -func (x *DispatchDoReq) GetHeroId() []string { +func (x *DispatchDoReq) GetHeroIds() []string { if x != nil { - return x.HeroId + return x.HeroIds } return nil } @@ -320,12 +441,14 @@ type DispatchDoResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + IsSucc bool `protobuf:"varint,1,opt,name=isSucc,proto3" json:"isSucc"` //派遣是否成功 } func (x *DispatchDoResp) Reset() { *x = DispatchDoResp{} if protoimpl.UnsafeEnabled { - mi := &file_dispatch_dispatch_msg_proto_msgTypes[7] + mi := &file_dispatch_dispatch_msg_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -338,7 +461,7 @@ func (x *DispatchDoResp) String() string { func (*DispatchDoResp) ProtoMessage() {} func (x *DispatchDoResp) ProtoReflect() protoreflect.Message { - mi := &file_dispatch_dispatch_msg_proto_msgTypes[7] + mi := &file_dispatch_dispatch_msg_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -351,7 +474,109 @@ func (x *DispatchDoResp) ProtoReflect() protoreflect.Message { // Deprecated: Use DispatchDoResp.ProtoReflect.Descriptor instead. func (*DispatchDoResp) Descriptor() ([]byte, []int) { - return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{7} + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{9} +} + +func (x *DispatchDoResp) GetIsSucc() bool { + if x != nil { + return x.IsSucc + } + return false +} + +// 周奖励领取 +type DispatchWeekReciveReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Idx int32 `protobuf:"varint,1,opt,name=idx,proto3" json:"idx"` // 奖励节点索引号从0开始 +} + +func (x *DispatchWeekReciveReq) Reset() { + *x = DispatchWeekReciveReq{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchWeekReciveReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchWeekReciveReq) ProtoMessage() {} + +func (x *DispatchWeekReciveReq) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DispatchWeekReciveReq.ProtoReflect.Descriptor instead. +func (*DispatchWeekReciveReq) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{10} +} + +func (x *DispatchWeekReciveReq) GetIdx() int32 { + if x != nil { + return x.Idx + } + return 0 +} + +type DispatchWeekReciveResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Idx int32 `protobuf:"varint,1,opt,name=idx,proto3" json:"idx"` +} + +func (x *DispatchWeekReciveResp) Reset() { + *x = DispatchWeekReciveResp{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchWeekReciveResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchWeekReciveResp) ProtoMessage() {} + +func (x *DispatchWeekReciveResp) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DispatchWeekReciveResp.ProtoReflect.Descriptor instead. +func (*DispatchWeekReciveResp) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{11} +} + +func (x *DispatchWeekReciveResp) GetIdx() int32 { + if x != nil { + return x.Idx + } + return 0 } var File_dispatch_dispatch_msg_proto protoreflect.FileDescriptor @@ -361,23 +586,42 @@ var file_dispatch_dispatch_msg_proto_rawDesc = []byte{ 0x74, 0x63, 0x68, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x44, 0x69, 0x73, - 0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x3d, + 0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x3e, 0x0a, 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x44, 0x69, 0x73, 0x70, 0x61, - 0x74, 0x63, 0x68, 0x52, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x22, 0x14, 0x0a, - 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, - 0x52, 0x65, 0x71, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, - 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x69, - 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, - 0x22, 0x15, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65, - 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x3f, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x61, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x28, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x62, + 0x6f, 0x61, 0x72, 0x64, 0x52, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x22, 0x14, + 0x0a, 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, + 0x68, 0x52, 0x65, 0x71, 0x22, 0x57, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x66, + 0x72, 0x65, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, + 0x66, 0x72, 0x65, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x66, + 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2c, 0x0a, + 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x13, 0x44, + 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x69, + 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, + 0x65, 0x52, 0x65, 0x71, 0x22, 0x31, 0x0a, 0x17, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, + 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, + 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x41, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, - 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x44, 0x69, 0x73, 0x70, - 0x61, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x22, 0x28, 0x0a, 0x0e, 0x44, 0x69, + 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, + 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, + 0x53, 0x75, 0x63, 0x63, 0x22, 0x29, 0x0a, 0x15, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, + 0x57, 0x65, 0x65, 0x6b, 0x52, 0x65, 0x63, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, + 0x03, 0x69, 0x64, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x69, 0x64, 0x78, 0x22, + 0x2a, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x57, 0x65, 0x65, 0x6b, 0x52, + 0x65, 0x63, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x78, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x69, 0x64, 0x78, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -392,25 +636,29 @@ func file_dispatch_dispatch_msg_proto_rawDescGZIP() []byte { return file_dispatch_dispatch_msg_proto_rawDescData } -var file_dispatch_dispatch_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_dispatch_dispatch_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_dispatch_dispatch_msg_proto_goTypes = []interface{}{ - (*DispatchNoticeReq)(nil), // 0: DispatchNoticeReq - (*DispatchNoticeResp)(nil), // 1: DispatchNoticeResp - (*DispatchRefreshReq)(nil), // 2: DispatchRefreshReq - (*DispatchRefreshResp)(nil), // 3: DispatchRefreshResp - (*DispatchReceiveReq)(nil), // 4: DispatchReceiveReq - (*DispatchReceiveResp)(nil), // 5: DispatchReceiveResp - (*DispatchDoReq)(nil), // 6: DispatchDoReq - (*DispatchDoResp)(nil), // 7: DispatchDoResp - (*DBDispatch)(nil), // 8: DBDispatch + (*DispatchNoticeReq)(nil), // 0: DispatchNoticeReq + (*DispatchNoticeResp)(nil), // 1: DispatchNoticeResp + (*DispatchRefreshReq)(nil), // 2: DispatchRefreshReq + (*DispatchRefreshResp)(nil), // 3: DispatchRefreshResp + (*DispatchReceiveReq)(nil), // 4: DispatchReceiveReq + (*DispatchReceiveResp)(nil), // 5: DispatchReceiveResp + (*DispatchAutoReceiveReq)(nil), // 6: DispatchAutoReceiveReq + (*DispatchAutoReceiveResp)(nil), // 7: DispatchAutoReceiveResp + (*DispatchDoReq)(nil), // 8: DispatchDoReq + (*DispatchDoResp)(nil), // 9: DispatchDoResp + (*DispatchWeekReciveReq)(nil), // 10: DispatchWeekReciveReq + (*DispatchWeekReciveResp)(nil), // 11: DispatchWeekReciveResp + (*Noticeboard)(nil), // 12: Noticeboard } var file_dispatch_dispatch_msg_proto_depIdxs = []int32{ - 8, // 0: DispatchNoticeResp.dispatch:type_name -> DBDispatch - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 12, // 0: DispatchNoticeResp.dispatch:type_name -> Noticeboard + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_dispatch_dispatch_msg_proto_init() } @@ -493,7 +741,7 @@ func file_dispatch_dispatch_msg_proto_init() { } } file_dispatch_dispatch_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DispatchDoReq); i { + switch v := v.(*DispatchAutoReceiveReq); i { case 0: return &v.state case 1: @@ -505,6 +753,30 @@ func file_dispatch_dispatch_msg_proto_init() { } } file_dispatch_dispatch_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchAutoReceiveResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchDoReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DispatchDoResp); i { case 0: return &v.state @@ -516,6 +788,30 @@ func file_dispatch_dispatch_msg_proto_init() { return nil } } + file_dispatch_dispatch_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchWeekReciveReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchWeekReciveResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -523,7 +819,7 @@ func file_dispatch_dispatch_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_dispatch_dispatch_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 12, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index fb5ecbf5c..e4c0add70 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -341,6 +341,7 @@ const ( ErrorCode_DispatchNoFree ErrorCode = 4202 //免费次数用尽 ErrorCode_DispatchTicketNoEnough ErrorCode = 4203 //门票不足 ErrorCode_DispatchHeroAssigned ErrorCode = 4204 //英雄已派遣 + ErrorCode_DispatchTaskExpired ErrorCode = 4205 //任务已过期 ) // Enum value maps for ErrorCode. @@ -631,6 +632,7 @@ var ( 4202: "DispatchNoFree", 4203: "DispatchTicketNoEnough", 4204: "DispatchHeroAssigned", + 4205: "DispatchTaskExpired", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -918,6 +920,7 @@ var ( "DispatchNoFree": 4202, "DispatchTicketNoEnough": 4203, "DispatchHeroAssigned": 4204, + "DispatchTaskExpired": 4205, } ) @@ -952,7 +955,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, 0xf3, 0x33, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0x8d, 0x34, 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, @@ -1367,8 +1370,10 @@ var file_errorcode_proto_rawDesc = []byte{ 0x1b, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xeb, 0x20, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x73, 0x73, 0x69, - 0x67, 0x6e, 0x65, 0x64, 0x10, 0xec, 0x20, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x6e, 0x65, 0x64, 0x10, 0xec, 0x20, 0x12, 0x18, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, + 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x10, 0xed, + 0x20, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/pb/smithy_msg.pb.go b/pb/smithy_msg.pb.go index 2d5d10110..e488705d0 100644 --- a/pb/smithy_msg.pb.go +++ b/pb/smithy_msg.pb.go @@ -1231,7 +1231,7 @@ type SmithyTasklistResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tasks *DBTujianTask `protobuf:"bytes,1,opt,name=tasks,proto3" json:"tasks"` //任务列表 + Tasks []*TujianTask `protobuf:"bytes,1,rep,name=tasks,proto3" json:"tasks"` //任务列表 } func (x *SmithyTasklistResp) Reset() { @@ -1266,7 +1266,7 @@ func (*SmithyTasklistResp) Descriptor() ([]byte, []int) { return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{25} } -func (x *SmithyTasklistResp) GetTasks() *DBTujianTask { +func (x *SmithyTasklistResp) GetTasks() []*TujianTask { if x != nil { return x.Tasks } @@ -1910,46 +1910,46 @@ var file_smithy_smithy_msg_proto_rawDesc = []byte{ 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x13, 0x0a, 0x11, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x22, 0x39, 0x0a, 0x12, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x6c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x54, 0x75, 0x6a, 0x69, 0x61, - 0x6e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x22, 0x39, 0x0a, 0x14, - 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x12, 0x21, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x6e, 0x67, - 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x36, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, - 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, - 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, - 0x14, 0x0a, 0x12, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, - 0x72, 0x64, 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x13, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, - 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, - 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x32, 0x0a, 0x14, 0x53, - 0x6d, 0x69, 0x74, 0x68, 0x79, 0x44, 0x65, 0x73, 0x6b, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, - 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, - 0x36, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x44, 0x65, 0x73, 0x6b, 0x53, 0x6b, 0x69, + 0x71, 0x22, 0x37, 0x0a, 0x12, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x6c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x54, + 0x61, 0x73, 0x6b, 0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x22, 0x39, 0x0a, 0x14, 0x53, 0x6d, + 0x69, 0x74, 0x68, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x12, 0x21, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0b, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x6e, 0x67, 0x52, 0x05, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x36, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, + 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, + 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x14, 0x0a, + 0x12, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, + 0x52, 0x65, 0x71, 0x22, 0x34, 0x0a, 0x13, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, + 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x32, 0x0a, 0x14, 0x53, 0x6d, 0x69, + 0x74, 0x68, 0x79, 0x44, 0x65, 0x73, 0x6b, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, + 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x36, 0x0a, + 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x44, 0x65, 0x73, 0x6b, 0x53, 0x6b, 0x69, 0x6c, 0x6c, + 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, + 0x74, 0x6f, 0x76, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x71, 0x22, 0x37, + 0x0a, 0x16, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, 0x74, 0x6f, 0x76, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, - 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, - 0x79, 0x53, 0x74, 0x6f, 0x76, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x71, - 0x22, 0x37, 0x0a, 0x16, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, 0x74, 0x6f, 0x76, 0x65, 0x53, - 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, - 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2e, 0x0a, 0x14, 0x53, 0x6d, 0x69, - 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x65, 0x6f, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x70, 0x65, 0x6f, 0x70, 0x6c, 0x65, 0x22, 0x34, 0x0a, 0x15, 0x53, 0x6d, 0x69, - 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x07, 0x2e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, - 0x12, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, - 0x52, 0x65, 0x71, 0x22, 0x32, 0x0a, 0x11, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, - 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, - 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2e, 0x0a, 0x14, 0x53, 0x6d, 0x69, 0x74, 0x68, + 0x79, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, + 0x16, 0x0a, 0x06, 0x70, 0x65, 0x6f, 0x70, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x70, 0x65, 0x6f, 0x70, 0x6c, 0x65, 0x22, 0x34, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, + 0x79, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x1b, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, + 0x2e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x12, 0x0a, + 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x22, 0x32, 0x0a, 0x11, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2008,7 +2008,7 @@ var file_smithy_smithy_msg_proto_goTypes = []interface{}{ (*DB_Equipment)(nil), // 39: DB_Equipment (*CustomerInfo)(nil), // 40: CustomerInfo (*DBAtlas)(nil), // 41: DBAtlas - (*DBTujianTask)(nil), // 42: DBTujianTask + (*TujianTask)(nil), // 42: TujianTask (*OrderClang)(nil), // 43: OrderClang (*DBSmithy)(nil), // 44: DBSmithy (*DBUser)(nil), // 45: DBUser @@ -2026,7 +2026,7 @@ var file_smithy_smithy_msg_proto_depIdxs = []int32{ 41, // 9: SmithyAtlasListResp.data:type_name -> DBAtlas 41, // 10: SmithyAtlasActivateResp.data:type_name -> DBAtlas 41, // 11: SmithyAtlasAwardResp.data:type_name -> DBAtlas - 42, // 12: SmithyTasklistResp.tasks:type_name -> DBTujianTask + 42, // 12: SmithyTasklistResp.tasks:type_name -> TujianTask 43, // 13: SmithyCreateOrderReq.order:type_name -> OrderClang 44, // 14: SmithyCreateOrderResp.data:type_name -> DBSmithy 44, // 15: SmithyGetRewardResp.data:type_name -> DBSmithy