成长任务

This commit is contained in:
wh_zcy 2022-11-04 23:02:19 +08:00
parent 1fed642354
commit 0a384e53c8
18 changed files with 1509 additions and 17 deletions

View File

@ -6,8 +6,17 @@
"a": "attr",
"t": "gold",
"n": 9999
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
],
"title": {
"key": "Primary_Reward_Progress",
"text": "初级-奖励进度"
}
},
{
"type": 2,
@ -16,8 +25,17 @@
"a": "attr",
"t": "gold",
"n": 9999
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
],
"title": {
"key": "Middle_Reward_Progress",
"text": "中级-奖励进度"
}
},
{
"type": 3,
@ -26,7 +44,16 @@
"a": "attr",
"t": "gold",
"n": 9999
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
],
"title": {
"key": "High_Reward_Progress",
"text": "高级-奖励进度"
}
}
]

View File

@ -3,6 +3,7 @@
"id": 1,
"type": 1,
"title": "通关1-1",
"onetask": 0,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31253",
"fstask": 101,
@ -12,6 +13,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -19,6 +25,7 @@
"id": 2,
"type": 1,
"title": "通关1-2",
"onetask": 1,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31254",
"fstask": 101,
@ -28,6 +35,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -35,6 +47,7 @@
"id": 3,
"type": 1,
"title": "通关1-3",
"onetask": 2,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31255",
"fstask": 101,
@ -44,6 +57,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -51,6 +69,7 @@
"id": 4,
"type": 1,
"title": "通关1-4",
"onetask": 3,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31256",
"fstask": 101,
@ -60,6 +79,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -67,6 +91,7 @@
"id": 5,
"type": 1,
"title": "通关1-5",
"onetask": 4,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31257",
"fstask": 101,
@ -76,6 +101,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -83,6 +113,7 @@
"id": 6,
"type": 1,
"title": "通关1-6",
"onetask": 5,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31258",
"fstask": 101,
@ -92,6 +123,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -99,6 +135,7 @@
"id": 7,
"type": 1,
"title": "通关1-7",
"onetask": 6,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31259",
"fstask": 101,
@ -108,6 +145,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -115,6 +157,7 @@
"id": 8,
"type": 1,
"title": "通关1-8",
"onetask": 7,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31260",
"fstask": 101,
@ -124,6 +167,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -131,6 +179,7 @@
"id": 9,
"type": 1,
"title": "通关1-9",
"onetask": 8,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31261",
"fstask": 101,
@ -140,6 +189,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -147,6 +201,7 @@
"id": 10,
"type": 1,
"title": "通关1-10",
"onetask": 9,
"txt": "位置的丛林充满了危险,赶快带上你的小伙伴去探索一番吧~",
"portrait": "N6_0002_图层-31262",
"fstask": 101,
@ -156,6 +211,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -163,6 +223,7 @@
"id": 11,
"type": 2,
"title": "阿宝升1级",
"onetask": 10,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31263",
"fstask": 101,
@ -172,6 +233,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -179,6 +245,7 @@
"id": 12,
"type": 2,
"title": "阿宝升2级",
"onetask": 11,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31264",
"fstask": 101,
@ -188,6 +255,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -195,6 +267,7 @@
"id": 13,
"type": 2,
"title": "阿宝升3级",
"onetask": 12,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31265",
"fstask": 101,
@ -204,6 +277,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -211,6 +289,7 @@
"id": 14,
"type": 2,
"title": "阿宝升4级",
"onetask": 13,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31266",
"fstask": 101,
@ -220,6 +299,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -227,6 +311,7 @@
"id": 15,
"type": 2,
"title": "阿宝升5级",
"onetask": 14,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31267",
"fstask": 101,
@ -236,6 +321,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -243,6 +333,7 @@
"id": 16,
"type": 2,
"title": "阿宝升6级",
"onetask": 15,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31268",
"fstask": 101,
@ -252,6 +343,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -259,6 +355,7 @@
"id": 17,
"type": 2,
"title": "阿宝升7级",
"onetask": 16,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31269",
"fstask": 101,
@ -268,6 +365,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -275,6 +377,7 @@
"id": 18,
"type": 2,
"title": "阿宝升8级",
"onetask": 17,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31270",
"fstask": 101,
@ -284,6 +387,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -291,6 +399,7 @@
"id": 19,
"type": 2,
"title": "阿宝升9级",
"onetask": 18,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31271",
"fstask": 101,
@ -300,6 +409,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -307,6 +421,7 @@
"id": 20,
"type": 2,
"title": "阿宝升10级",
"onetask": 19,
"txt": "阿宝需要变强,快去帮助他把~",
"portrait": "N6_0002_图层-31272",
"fstask": 101,
@ -316,6 +431,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -323,6 +443,7 @@
"id": 21,
"type": 3,
"title": "波比升1级",
"onetask": 20,
"txt": "你们都变强了,我也需要变强,请助我一臂之力~",
"portrait": "N6_0002_图层-31273",
"fstask": 101,
@ -332,6 +453,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -339,6 +465,7 @@
"id": 22,
"type": 3,
"title": "波比升2级",
"onetask": 21,
"txt": "你们都变强了,我也需要变强,请助我一臂之力~",
"portrait": "N6_0002_图层-31274",
"fstask": 101,
@ -348,6 +475,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -355,6 +487,7 @@
"id": 23,
"type": 3,
"title": "波比升3级",
"onetask": 22,
"txt": "你们都变强了,我也需要变强,请助我一臂之力~",
"portrait": "N6_0002_图层-31275",
"fstask": 101,
@ -364,6 +497,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -371,6 +509,7 @@
"id": 24,
"type": 3,
"title": "波比升4级",
"onetask": 23,
"txt": "你们都变强了,我也需要变强,请助我一臂之力~",
"portrait": "N6_0002_图层-31276",
"fstask": 101,
@ -380,6 +519,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -387,6 +531,7 @@
"id": 25,
"type": 3,
"title": "波比升5级",
"onetask": 24,
"txt": "你们都变强了,我也需要变强,请助我一臂之力~",
"portrait": "N6_0002_图层-31277",
"fstask": 101,
@ -396,6 +541,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -403,6 +553,7 @@
"id": 26,
"type": 3,
"title": "波比升6级",
"onetask": 25,
"txt": "你们都变强了,我也需要变强,请助我一臂之力~",
"portrait": "N6_0002_图层-31278",
"fstask": 101,
@ -412,6 +563,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -419,6 +575,7 @@
"id": 27,
"type": 3,
"title": "波比升7级",
"onetask": 26,
"txt": "你们都变强了,我也需要变强,请助我一臂之力~",
"portrait": "N6_0002_图层-31279",
"fstask": 101,
@ -428,6 +585,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -435,6 +597,7 @@
"id": 28,
"type": 3,
"title": "波比升8级",
"onetask": 27,
"txt": "你们都变强了,我也需要变强,请助我一臂之力~",
"portrait": "N6_0002_图层-31280",
"fstask": 101,
@ -444,6 +607,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
},
@ -451,6 +619,7 @@
"id": 29,
"type": 3,
"title": "波比升9级",
"onetask": 28,
"txt": "你们都变强了,我也需要变强,请助我一臂之力~",
"portrait": "N6_0002_图层-31281",
"fstask": 101,
@ -460,6 +629,11 @@
"a": "attr",
"t": "gold",
"n": 1000
},
{
"a": "attr",
"t": "diamond",
"n": 1000
}
]
}

View File

@ -10,6 +10,7 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules/friend"
"go_dreamfactory/modules/growtask"
"go_dreamfactory/modules/hero"
"go_dreamfactory/modules/linestory"
"go_dreamfactory/modules/mainline"
@ -118,8 +119,8 @@ var (
ff(comm.ModuleSociaty, sociaty.SociatySubTypeRank): &formview.SociatyRankView{},
// troll
ff(comm.ModuleTroll, "getlist"): &formview.TrollGetlistView{},
// alliance
// ff(comm.ModuleAlliance,"")
// growtask
ff(comm.ModuleGrowtask, growtask.GrowtaskSubTypeList): &formview.GrowtaskListView{},
}
)
@ -144,7 +145,7 @@ var (
string(comm.ModuleGourmet),
string(comm.ModuleSociaty),
string(comm.ModuleTroll),
string(comm.ModuleAlliance),
string(comm.ModuleGrowtask),
},
"gm": {ff(comm.ModuleGM, "cmd")},
"sys": {
@ -242,6 +243,9 @@ var (
"troll": {
ff(comm.ModuleTroll, "getlist"),
},
"growtask": {
ff(comm.ModuleGrowtask, growtask.GrowtaskSubTypeList),
},
}
)
@ -879,10 +883,17 @@ var (
SubType: "getlist",
Enabled: true,
},
// alliance
string(comm.ModuleAlliance): {
NavLabel: "联盟学院",
MainType: string(comm.ModuleAlliance),
// growtask
string(comm.ModuleGrowtask): {
NavLabel: "成长任务",
MainType: string(comm.ModuleGrowtask),
Enabled: true,
},
ff(comm.ModuleGrowtask, growtask.GrowtaskSubTypeList): {
NavLabel: "列表",
Desc: "成长任务列表",
MainType: string(comm.ModuleGrowtask),
SubType: growtask.GrowtaskSubTypeList,
Enabled: true,
},
}

View File

@ -65,13 +65,13 @@ func (this *toyUserInfo) Init(obs observer.Observer) error {
// 注销用户
this.logoutBtn = widget.NewButtonWithIcon("", theme.AccountIcon(), func() {
if err := service.GetPttService().SendToClient(
string(comm.ModuleUser),
user.UserSubTypeInfo,
&pb.UserInfoReq{}); err != nil {
logrus.Error(err)
return
}
// if err := service.GetPttService().SendToClient(
// string(comm.ModuleUser),
// user.UserSubTypeInfo,
// &pb.UserInfoReq{}); err != nil {
// logrus.Error(err)
// return
// }
})
// list

View File

@ -0,0 +1,83 @@
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/modules/growtask"
"go_dreamfactory/pb"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
)
type GrowtaskListView struct {
BaseformView
taskList func()
itemList *common.ItemList
flag bool
}
func (this *GrowtaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
this.itemList = common.NewItemList()
this.itemList.ItemList = this.itemList.CreateList()
this.taskList = func() {
if err := service.GetPttService().SendToClient(
string(comm.ModuleGrowtask),
growtask.GrowtaskSubTypeList,
&pb.GrowtaskListReq{}); err != nil {
logrus.Error(err)
}
}
defer this.taskList()
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
this.itemList.Reset()
this.taskList()
})
buttonBar := container.NewHBox(refreshBtn)
c := container.NewBorder(buttonBar, nil, nil, nil, this.itemList.ItemList)
this.dataListener()
return c
}
func (this *GrowtaskListView) dataListener() {
if this.flag {
return
}
this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
OnNotify: func(d interface{}, args ...interface{}) {
data := d.(*pb.UserMessage)
if !(data.MainType == string(comm.ModuleGrowtask) &&
data.SubType == growtask.GrowtaskSubTypeList) {
return
}
rsp := &pb.GrowtaskListResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
for _, v := range rsp.TaskList {
item := common.Item{
Id: cast.ToString(v.Id),
Text: fmt.Sprintf("taskId:%v status:%v", v.Id, v.Status),
}
this.itemList.AddItem(item)
}
},
})
this.flag = true
}

View File

@ -72,6 +72,7 @@ const (
ModulePay core.M_Modules = "pay" //支付
ModuleAlliance core.M_Modules = "alliance" //联盟学院
ModulePrivilege core.M_Modules = "privilege" //特权
ModuleGrowtask core.M_Modules = "growtask" //成长任务
)
//数据表名定义处
@ -193,6 +194,8 @@ const (
// 签到
TableSign = "sign"
// 成长任务
TableGrowtask = "growtask"
)
//RPC服务接口定义处

25
modules/growtask/api.go Normal file
View File

@ -0,0 +1,25 @@
package growtask
import (
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
const (
GrowtaskSubTypeList = "list" //任务列表
GrowtaskSubTypeReceive = "receive" //子任务奖励领取
GrowtaskSubTypeAdvreceive = "advreceive" //进阶奖励领取
)
type apiComp struct {
modules.MCompGate
service base.IRPCXService
module *Growtask
}
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
_ = this.MCompGate.Init(service, module, comp, options)
this.module = module.(*Growtask)
return
}

View File

@ -0,0 +1,53 @@
package growtask
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//进阶奖励领取
func (this *apiComp) AdvreceiveCheck(session comm.IUserSession, req *pb.GrowtaskAdvReceiveReq) (code pb.ErrorCode) {
if req.TaskType == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Advreceive(session comm.IUserSession, req *pb.GrowtaskAdvReceiveReq) (code pb.ErrorCode, data proto.Message) {
if code = this.AdvreceiveCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
if err := this.module.modelGrowtask.advReceive(uid, req.TaskType); err != nil {
code = pb.ErrorCode_GrowtaskAdvReceive
return
}
//发奖
ggt, err := this.module.configure.getGrowrewardCfg()
if err != nil {
code = pb.ErrorCode_ConfigNoFound
return
}
if ggt == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
if conf, ok := ggt.GetDataMap()[req.TaskType]; ok {
if code := this.module.DispenseRes(session, conf.Allreward, true); code != pb.ErrorCode_Success {
this.module.Errorf("进阶奖励发放失败 taskType:%v uid:%v", req.TaskType, uid)
}
}
rsp := &pb.GrowtaskAdvReceiveResp{}
if err := session.SendMsg(string(this.module.GetType()), GrowtaskSubTypeAdvreceive, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,57 @@
package growtask
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 子任务奖励领取
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.GrowtaskReceiveReq) (code pb.ErrorCode) {
if req.TaskId == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Receive(session comm.IUserSession, req *pb.GrowtaskReceiveReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ReceiveCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
// 领取
if err := this.module.modelGrowtask.receive(uid, req.TaskId); err != nil {
code = pb.ErrorCode_GrowtaskReceive
return
}
//发奖
ggt, err := this.module.configure.getGrowtaskCfg()
if err != nil {
code = pb.ErrorCode_ConfigNoFound
return
}
if ggt == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
if conf, ok := ggt.GetDataMap()[req.TaskId]; ok {
if code := this.module.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success {
this.module.Errorf("子任务奖励发放失败 taskId:%v uid:%v", req.TaskId, uid)
}
}
rsp := &pb.GrowtaskReceiveResp{
TaskId: req.TaskId,
}
if err := session.SendMsg(string(this.module.GetType()), GrowtaskSubTypeReceive, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,26 @@
package growtask
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 成长任务列表
func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.GrowtaskListReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) List(session comm.IUserSession, req *pb.GrowtaskListReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
g := this.module.modelGrowtask.list(uid)
rsp := &pb.GrowtaskListResp{
TaskList: g,
}
session.SendMsg(string(this.module.GetType()), GrowtaskSubTypeList, rsp)
return
}

View File

@ -0,0 +1,60 @@
package growtask
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
gameGrowreward = "game_growreward.json"
gameGrowTask = "game_growtask.json"
)
type configureComp struct {
modules.MCompConfigure
}
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompConfigure.Init(service, module, comp, options)
err = this.LoadMultiConfigure(map[string]interface{}{
gameGrowreward: cfg.NewGameGrowReward,
gameGrowTask: cfg.NewGameGrowTask,
})
return
}
// 成长任务配置
func (this *configureComp) getGrowtaskCfg() (data *cfg.GameGrowTask, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameGrowTask); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGrowTask); !ok {
err = fmt.Errorf("%T no is *cfg.GameGrowTask", v)
return
}
}
return
}
// 奖励配置
func (this *configureComp) getGrowrewardCfg() (data *cfg.GameGrowReward, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameGrowreward); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGrowReward); !ok {
err = fmt.Errorf("%T no is *cfg.GameGrowReward", v)
return
}
}
return
}

View File

@ -0,0 +1,162 @@
package growtask
import (
"errors"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/mongo"
)
type ModelGrowtask struct {
modules.MCompModel
moduleGrowtask *Growtask
}
func (this *ModelGrowtask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompModel.Init(service, module, comp, options)
this.TableName = comm.TableGrowtask
this.moduleGrowtask = module.(*Growtask)
return
}
// 初始化成长任务
func (this *ModelGrowtask) initGrowtask(uid string) (*pb.DBGrowtask, error) {
ggt, err := this.moduleGrowtask.configure.getGrowtaskCfg()
if err != nil {
return nil, err
}
if ggt == nil {
return nil, errors.New("growtask config is nil")
}
data := &pb.DBGrowtask{
Uid: uid,
}
for _, v := range ggt.GetDataList() {
if v.Type == 1 { //初级任务 默认状态:锁定
task := &pb.Growtask{
Id: v.Id,
TaskType: v.Type,
Fstask: v.Fstask,
PreTask: v.Onetask,
}
data.TaskList = append(data.TaskList, task)
}
}
if err = this.Add(uid, data); err != nil {
return nil, err
}
return data, nil
}
// 获取玩家成长任务
func (this *ModelGrowtask) getUserGrowtask(uid string) (*pb.DBGrowtask, error) {
gt := &pb.DBGrowtask{}
if err := this.Get(uid, gt); err != nil {
if err == mongo.ErrNoDocuments {
return this.initGrowtask(uid)
}
return nil, err
}
return gt, nil
}
// 任务列表
func (this *ModelGrowtask) list(uid string) []*pb.Growtask {
gt, err := this.getUserGrowtask(uid)
if err != nil {
return nil
}
if gt.Uid != "" {
taskStatusMap := make(map[int32]pb.GrowtaskStatus) //任务状态
for _, v := range gt.TaskList {
//已完成
if v.Status == pb.GrowtaskStatus_Finish {
continue
}
taskStatusMap[v.Id] = v.Status
//任务完成
if code := this.moduleGrowtask.ModuleRtask.CheckCondi(uid, v.Fstask); code == pb.ErrorCode_Success {
if v.PreTask == 0 {
v.Status = pb.GrowtaskStatus_Wait //待领奖状态
} else {
if s, ok := taskStatusMap[v.PreTask]; ok {
// 上个任务是领取状态
if s == pb.GrowtaskStatus_Wait {
continue
}
}
}
} else {
if v.PreTask == 0 {
v.Status = pb.GrowtaskStatus_Ongoing //进行中
} else {
if s, ok := taskStatusMap[v.PreTask]; ok {
// 上个任务是领取状态
if s == pb.GrowtaskStatus_Ongoing {
v.Status = pb.GrowtaskStatus_Lock
continue
}
}
}
}
}
}
//更新
update := map[string]interface{}{
"taskList": gt.TaskList,
}
if err := this.Change(uid, update); err != nil {
log.Errorf("更新任务列表 err:%v", err)
return nil
}
return gt.TaskList
}
// 领取子任务奖励
func (this *ModelGrowtask) receive(uid string, taskId int32) error {
gt, err := this.getUserGrowtask(uid)
if err != nil {
return err
}
for _, v := range gt.TaskList {
if v.Id == taskId {
if v.Status == pb.GrowtaskStatus_Wait {
v.Status = pb.GrowtaskStatus_Finish
} else {
return errors.New("不能领取")
}
break
}
}
//更新
update := map[string]interface{}{
"taskList": gt.TaskList,
}
if err := this.Change(uid, update); err != nil {
log.Errorf("更新任务列表 err:%v", err)
return err
}
return nil
}
// 进阶奖励领取
func (this *ModelGrowtask) advReceive(uid string, taskType int32) error {
gt, err := this.getUserGrowtask(uid)
if err != nil {
return err
}
//判断当前等级的任务是否都完成
for _, v := range gt.TaskList {
if v.Status != pb.GrowtaskStatus_Finish {
return errors.New("任务未全部完成")
}
}
return nil
}

View File

@ -0,0 +1,35 @@
package growtask
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
type Growtask struct {
modules.ModuleBase
api *apiComp
service base.IRPCXService
configure *configureComp
modelGrowtask *ModelGrowtask
}
func NewModule() core.IModule {
return &Growtask{}
}
func (this *Growtask) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
func (this *Growtask) GetType() core.M_Modules {
return comm.ModuleGrowtask
}
func (this *Growtask) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelGrowtask = this.RegisterComp(new(ModelGrowtask)).(*ModelGrowtask)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}

315
pb/growtask_db.pb.go Normal file
View File

@ -0,0 +1,315 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: growtask/growtask_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
//任务状态
type GrowtaskStatus int32
const (
GrowtaskStatus_Lock GrowtaskStatus = 0 //锁定
GrowtaskStatus_Ongoing GrowtaskStatus = 1 //进行中
GrowtaskStatus_Wait GrowtaskStatus = 2 //待领奖
GrowtaskStatus_Finish GrowtaskStatus = 3 //完成
)
// Enum value maps for GrowtaskStatus.
var (
GrowtaskStatus_name = map[int32]string{
0: "Lock",
1: "Ongoing",
2: "Wait",
3: "Finish",
}
GrowtaskStatus_value = map[string]int32{
"Lock": 0,
"Ongoing": 1,
"Wait": 2,
"Finish": 3,
}
)
func (x GrowtaskStatus) Enum() *GrowtaskStatus {
p := new(GrowtaskStatus)
*p = x
return p
}
func (x GrowtaskStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (GrowtaskStatus) Descriptor() protoreflect.EnumDescriptor {
return file_growtask_growtask_db_proto_enumTypes[0].Descriptor()
}
func (GrowtaskStatus) Type() protoreflect.EnumType {
return &file_growtask_growtask_db_proto_enumTypes[0]
}
func (x GrowtaskStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use GrowtaskStatus.Descriptor instead.
func (GrowtaskStatus) EnumDescriptor() ([]byte, []int) {
return file_growtask_growtask_db_proto_rawDescGZIP(), []int{0}
}
type DBGrowtask struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
TaskList []*Growtask `protobuf:"bytes,2,rep,name=taskList,proto3" json:"taskList" bson:"taskList"` //任务列表
}
func (x *DBGrowtask) Reset() {
*x = DBGrowtask{}
if protoimpl.UnsafeEnabled {
mi := &file_growtask_growtask_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBGrowtask) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBGrowtask) ProtoMessage() {}
func (x *DBGrowtask) ProtoReflect() protoreflect.Message {
mi := &file_growtask_growtask_db_proto_msgTypes[0]
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 DBGrowtask.ProtoReflect.Descriptor instead.
func (*DBGrowtask) Descriptor() ([]byte, []int) {
return file_growtask_growtask_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBGrowtask) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBGrowtask) GetTaskList() []*Growtask {
if x != nil {
return x.TaskList
}
return nil
}
type Growtask struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id" bson:"id"` //配置ID
TaskType int32 `protobuf:"varint,2,opt,name=taskType,proto3" json:"taskType" bson:"taskType"` //任务类型
Status GrowtaskStatus `protobuf:"varint,3,opt,name=status,proto3,enum=GrowtaskStatus" json:"status" bson:"status"` //任务状态
Fstask int32 `protobuf:"varint,4,opt,name=fstask,proto3" json:"fstask" bson:"fstask"` //任务条件
PreTask int32 `protobuf:"varint,5,opt,name=preTask,proto3" json:"preTask" bson:"preTask"` //前置任务ID
}
func (x *Growtask) Reset() {
*x = Growtask{}
if protoimpl.UnsafeEnabled {
mi := &file_growtask_growtask_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Growtask) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Growtask) ProtoMessage() {}
func (x *Growtask) ProtoReflect() protoreflect.Message {
mi := &file_growtask_growtask_db_proto_msgTypes[1]
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 Growtask.ProtoReflect.Descriptor instead.
func (*Growtask) Descriptor() ([]byte, []int) {
return file_growtask_growtask_db_proto_rawDescGZIP(), []int{1}
}
func (x *Growtask) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *Growtask) GetTaskType() int32 {
if x != nil {
return x.TaskType
}
return 0
}
func (x *Growtask) GetStatus() GrowtaskStatus {
if x != nil {
return x.Status
}
return GrowtaskStatus_Lock
}
func (x *Growtask) GetFstask() int32 {
if x != nil {
return x.Fstask
}
return 0
}
func (x *Growtask) GetPreTask() int32 {
if x != nil {
return x.PreTask
}
return 0
}
var File_growtask_growtask_db_proto protoreflect.FileDescriptor
var file_growtask_growtask_db_proto_rawDesc = []byte{
0x0a, 0x1a, 0x67, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x67, 0x72, 0x6f, 0x77, 0x74,
0x61, 0x73, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x45, 0x0a, 0x0a,
0x44, 0x42, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x08,
0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09,
0x2e, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c,
0x69, 0x73, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x08, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64,
0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x27, 0x0a, 0x06,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x47,
0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x73, 0x74, 0x61, 0x73, 0x6b, 0x18,
0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x66, 0x73, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x18, 0x0a,
0x07, 0x70, 0x72, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
0x70, 0x72, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x2a, 0x3d, 0x0a, 0x0e, 0x47, 0x72, 0x6f, 0x77, 0x74,
0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x6f, 0x63,
0x6b, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x6e, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x10, 0x01,
0x12, 0x08, 0x0a, 0x04, 0x57, 0x61, 0x69, 0x74, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x69,
0x6e, 0x69, 0x73, 0x68, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_growtask_growtask_db_proto_rawDescOnce sync.Once
file_growtask_growtask_db_proto_rawDescData = file_growtask_growtask_db_proto_rawDesc
)
func file_growtask_growtask_db_proto_rawDescGZIP() []byte {
file_growtask_growtask_db_proto_rawDescOnce.Do(func() {
file_growtask_growtask_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_growtask_growtask_db_proto_rawDescData)
})
return file_growtask_growtask_db_proto_rawDescData
}
var file_growtask_growtask_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_growtask_growtask_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_growtask_growtask_db_proto_goTypes = []interface{}{
(GrowtaskStatus)(0), // 0: GrowtaskStatus
(*DBGrowtask)(nil), // 1: DBGrowtask
(*Growtask)(nil), // 2: Growtask
}
var file_growtask_growtask_db_proto_depIdxs = []int32{
2, // 0: DBGrowtask.taskList:type_name -> Growtask
0, // 1: Growtask.status:type_name -> GrowtaskStatus
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_growtask_growtask_db_proto_init() }
func file_growtask_growtask_db_proto_init() {
if File_growtask_growtask_db_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_growtask_growtask_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBGrowtask); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_growtask_growtask_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Growtask); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_growtask_growtask_db_proto_rawDesc,
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_growtask_growtask_db_proto_goTypes,
DependencyIndexes: file_growtask_growtask_db_proto_depIdxs,
EnumInfos: file_growtask_growtask_db_proto_enumTypes,
MessageInfos: file_growtask_growtask_db_proto_msgTypes,
}.Build()
File_growtask_growtask_db_proto = out.File
file_growtask_growtask_db_proto_rawDesc = nil
file_growtask_growtask_db_proto_goTypes = nil
file_growtask_growtask_db_proto_depIdxs = nil
}

455
pb/growtask_msg.pb.go Normal file
View File

@ -0,0 +1,455 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: growtask/growtask_msg.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// 成长任务列表
type GrowtaskListReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *GrowtaskListReq) Reset() {
*x = GrowtaskListReq{}
if protoimpl.UnsafeEnabled {
mi := &file_growtask_growtask_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GrowtaskListReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GrowtaskListReq) ProtoMessage() {}
func (x *GrowtaskListReq) ProtoReflect() protoreflect.Message {
mi := &file_growtask_growtask_msg_proto_msgTypes[0]
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 GrowtaskListReq.ProtoReflect.Descriptor instead.
func (*GrowtaskListReq) Descriptor() ([]byte, []int) {
return file_growtask_growtask_msg_proto_rawDescGZIP(), []int{0}
}
type GrowtaskListResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskList []*Growtask `protobuf:"bytes,1,rep,name=taskList,proto3" json:"taskList"`
}
func (x *GrowtaskListResp) Reset() {
*x = GrowtaskListResp{}
if protoimpl.UnsafeEnabled {
mi := &file_growtask_growtask_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GrowtaskListResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GrowtaskListResp) ProtoMessage() {}
func (x *GrowtaskListResp) ProtoReflect() protoreflect.Message {
mi := &file_growtask_growtask_msg_proto_msgTypes[1]
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 GrowtaskListResp.ProtoReflect.Descriptor instead.
func (*GrowtaskListResp) Descriptor() ([]byte, []int) {
return file_growtask_growtask_msg_proto_rawDescGZIP(), []int{1}
}
func (x *GrowtaskListResp) GetTaskList() []*Growtask {
if x != nil {
return x.TaskList
}
return nil
}
//子任务奖励领取
type GrowtaskReceiveReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` //子任务ID
}
func (x *GrowtaskReceiveReq) Reset() {
*x = GrowtaskReceiveReq{}
if protoimpl.UnsafeEnabled {
mi := &file_growtask_growtask_msg_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GrowtaskReceiveReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GrowtaskReceiveReq) ProtoMessage() {}
func (x *GrowtaskReceiveReq) ProtoReflect() protoreflect.Message {
mi := &file_growtask_growtask_msg_proto_msgTypes[2]
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 GrowtaskReceiveReq.ProtoReflect.Descriptor instead.
func (*GrowtaskReceiveReq) Descriptor() ([]byte, []int) {
return file_growtask_growtask_msg_proto_rawDescGZIP(), []int{2}
}
func (x *GrowtaskReceiveReq) GetTaskId() int32 {
if x != nil {
return x.TaskId
}
return 0
}
type GrowtaskReceiveResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"`
}
func (x *GrowtaskReceiveResp) Reset() {
*x = GrowtaskReceiveResp{}
if protoimpl.UnsafeEnabled {
mi := &file_growtask_growtask_msg_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GrowtaskReceiveResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GrowtaskReceiveResp) ProtoMessage() {}
func (x *GrowtaskReceiveResp) ProtoReflect() protoreflect.Message {
mi := &file_growtask_growtask_msg_proto_msgTypes[3]
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 GrowtaskReceiveResp.ProtoReflect.Descriptor instead.
func (*GrowtaskReceiveResp) Descriptor() ([]byte, []int) {
return file_growtask_growtask_msg_proto_rawDescGZIP(), []int{3}
}
func (x *GrowtaskReceiveResp) GetTaskId() int32 {
if x != nil {
return x.TaskId
}
return 0
}
//进阶奖励领取
type GrowtaskAdvReceiveReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskType int32 `protobuf:"varint,1,opt,name=taskType,proto3" json:"taskType"` //任务类型
}
func (x *GrowtaskAdvReceiveReq) Reset() {
*x = GrowtaskAdvReceiveReq{}
if protoimpl.UnsafeEnabled {
mi := &file_growtask_growtask_msg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GrowtaskAdvReceiveReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GrowtaskAdvReceiveReq) ProtoMessage() {}
func (x *GrowtaskAdvReceiveReq) ProtoReflect() protoreflect.Message {
mi := &file_growtask_growtask_msg_proto_msgTypes[4]
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 GrowtaskAdvReceiveReq.ProtoReflect.Descriptor instead.
func (*GrowtaskAdvReceiveReq) Descriptor() ([]byte, []int) {
return file_growtask_growtask_msg_proto_rawDescGZIP(), []int{4}
}
func (x *GrowtaskAdvReceiveReq) GetTaskType() int32 {
if x != nil {
return x.TaskType
}
return 0
}
type GrowtaskAdvReceiveResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskType int32 `protobuf:"varint,1,opt,name=taskType,proto3" json:"taskType"`
}
func (x *GrowtaskAdvReceiveResp) Reset() {
*x = GrowtaskAdvReceiveResp{}
if protoimpl.UnsafeEnabled {
mi := &file_growtask_growtask_msg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GrowtaskAdvReceiveResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GrowtaskAdvReceiveResp) ProtoMessage() {}
func (x *GrowtaskAdvReceiveResp) ProtoReflect() protoreflect.Message {
mi := &file_growtask_growtask_msg_proto_msgTypes[5]
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 GrowtaskAdvReceiveResp.ProtoReflect.Descriptor instead.
func (*GrowtaskAdvReceiveResp) Descriptor() ([]byte, []int) {
return file_growtask_growtask_msg_proto_rawDescGZIP(), []int{5}
}
func (x *GrowtaskAdvReceiveResp) GetTaskType() int32 {
if x != nil {
return x.TaskType
}
return 0
}
var File_growtask_growtask_msg_proto protoreflect.FileDescriptor
var file_growtask_growtask_msg_proto_rawDesc = []byte{
0x0a, 0x1b, 0x67, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x67, 0x72, 0x6f, 0x77, 0x74,
0x61, 0x73, 0x6b, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x67,
0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x67, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b,
0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x11, 0x0a, 0x0f, 0x47, 0x72, 0x6f,
0x77, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x39, 0x0a, 0x10,
0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
0x12, 0x25, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74,
0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x2c, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74,
0x61, 0x73, 0x6b, 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, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73,
0x6b, 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, 0x33, 0x0a, 0x15, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b,
0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a,
0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x34, 0x0a, 0x16, 0x47, 0x72, 0x6f,
0x77, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52,
0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_growtask_growtask_msg_proto_rawDescOnce sync.Once
file_growtask_growtask_msg_proto_rawDescData = file_growtask_growtask_msg_proto_rawDesc
)
func file_growtask_growtask_msg_proto_rawDescGZIP() []byte {
file_growtask_growtask_msg_proto_rawDescOnce.Do(func() {
file_growtask_growtask_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_growtask_growtask_msg_proto_rawDescData)
})
return file_growtask_growtask_msg_proto_rawDescData
}
var file_growtask_growtask_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_growtask_growtask_msg_proto_goTypes = []interface{}{
(*GrowtaskListReq)(nil), // 0: GrowtaskListReq
(*GrowtaskListResp)(nil), // 1: GrowtaskListResp
(*GrowtaskReceiveReq)(nil), // 2: GrowtaskReceiveReq
(*GrowtaskReceiveResp)(nil), // 3: GrowtaskReceiveResp
(*GrowtaskAdvReceiveReq)(nil), // 4: GrowtaskAdvReceiveReq
(*GrowtaskAdvReceiveResp)(nil), // 5: GrowtaskAdvReceiveResp
(*Growtask)(nil), // 6: Growtask
}
var file_growtask_growtask_msg_proto_depIdxs = []int32{
6, // 0: GrowtaskListResp.taskList:type_name -> Growtask
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_growtask_growtask_msg_proto_init() }
func file_growtask_growtask_msg_proto_init() {
if File_growtask_growtask_msg_proto != nil {
return
}
file_growtask_growtask_db_proto_init()
if !protoimpl.UnsafeEnabled {
file_growtask_growtask_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GrowtaskListReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_growtask_growtask_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GrowtaskListResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_growtask_growtask_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GrowtaskReceiveReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_growtask_growtask_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GrowtaskReceiveResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_growtask_growtask_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GrowtaskAdvReceiveReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_growtask_growtask_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GrowtaskAdvReceiveResp); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_growtask_growtask_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_growtask_growtask_msg_proto_goTypes,
DependencyIndexes: file_growtask_growtask_msg_proto_depIdxs,
MessageInfos: file_growtask_growtask_msg_proto_msgTypes,
}.Build()
File_growtask_growtask_msg_proto = out.File
file_growtask_growtask_msg_proto_rawDesc = nil
file_growtask_growtask_msg_proto_goTypes = nil
file_growtask_growtask_msg_proto_depIdxs = nil
}

View File

@ -12,6 +12,7 @@ import (
"go_dreamfactory/modules/friend"
"go_dreamfactory/modules/gm"
"go_dreamfactory/modules/gourmet"
"go_dreamfactory/modules/growtask"
"go_dreamfactory/modules/hero"
"go_dreamfactory/modules/horoscope"
"go_dreamfactory/modules/hunting"
@ -99,6 +100,7 @@ func main() {
horoscope.NewModule(),
pay.NewModule(),
//privilege.NewModule(),
growtask.NewModule(),
)
}

View File

@ -13,6 +13,7 @@ import "errors"
type GameGrowRewardData struct {
Type int32
Allreward []*Gameatn
Title string
}
const TypeId_GameGrowRewardData = 1151266152
@ -37,6 +38,7 @@ func (_v *GameGrowRewardData)Deserialize(_buf map[string]interface{}) (err error
}
}
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["title"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Title error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Title, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
return
}

View File

@ -14,6 +14,7 @@ type GameGrowTaskData struct {
Id int32
Type int32
Title string
Onetask int32
Txt string
Portrait string
Fstask int32
@ -31,6 +32,7 @@ func (_v *GameGrowTaskData)Deserialize(_buf map[string]interface{}) (err error)
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; if _v.Title, _ok_ = _buf["title"].(string); !_ok_ { err = errors.New("title error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["onetask"].(float64); !_ok_ { err = errors.New("onetask error"); return }; _v.Onetask = int32(_tempNum_) }
{ var _ok_ bool; if _v.Txt, _ok_ = _buf["txt"].(string); !_ok_ { err = errors.New("txt error"); return } }
{ var _ok_ bool; if _v.Portrait, _ok_ = _buf["portrait"].(string); !_ok_ { err = errors.New("portrait error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["fstask"].(float64); !_ok_ { err = errors.New("fstask error"); return }; _v.Fstask = int32(_tempNum_) }