Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
44002c8052
2018
bin/json/game_enchantboss.json
Normal file
2018
bin/json/game_enchantboss.json
Normal file
File diff suppressed because it is too large
Load Diff
102
bin/json/game_enchantshop.json
Normal file
102
bin/json/game_enchantshop.json
Normal file
@ -0,0 +1,102 @@
|
||||
[
|
||||
{
|
||||
"buynum": 1,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"buynum": 2,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 20
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"buynum": 3,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 30
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"buynum": 4,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 40
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"buynum": 5,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 50
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"buynum": 6,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 60
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"buynum": 7,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 70
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"buynum": 8,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"buynum": 9,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 90
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"buynum": 10,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 100
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -57,7 +57,7 @@ func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject
|
||||
}
|
||||
if err := service.GetPttService().SendToClient(
|
||||
t.MainType, "activereceive",
|
||||
&pb.TaskActiveReceiveReq{Id: selItemId, TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
||||
&pb.TaskActiveReceiveReq{Id: cast.ToInt32(selItemId), TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
@ -94,8 +94,8 @@ func (this *TaskActiveListView) dataListener() {
|
||||
|
||||
for _, v := range rsp.List {
|
||||
item := common.Item{
|
||||
Id: cast.ToString(v.Id),
|
||||
Text: fmt.Sprintf("任务ID:%s 领取状态:%d", cast.ToString(v.RId), v.Received),
|
||||
Id: cast.ToString(v.TaskId),
|
||||
Text: fmt.Sprintf("任务ID:%s 领取状态:%d", cast.ToString(v.TaskId), v.Received),
|
||||
}
|
||||
this.itemList.AddItem(item)
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ func (this *TaskActiveReceiveView) CreateView(t *model.TestCase) fyne.CanvasObje
|
||||
|
||||
this.form.OnSubmit = func() {
|
||||
if err := service.GetPttService().SendToClient(t.MainType, t.SubType, &pb.TaskActiveReceiveReq{
|
||||
Id: id.Text,
|
||||
Id: cast.ToInt32(id.Text),
|
||||
TaskTag: cast.ToInt32(tagSelect.Selected),
|
||||
}); err != nil {
|
||||
logrus.Error(err)
|
||||
|
@ -54,7 +54,7 @@ func (this *TaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
}
|
||||
if err := service.GetPttService().SendToClient(
|
||||
t.MainType, "receive",
|
||||
&pb.TaskReceiveReq{Id: selId, TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
||||
&pb.TaskReceiveReq{Id: cast.ToInt32(selId), TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
@ -90,7 +90,7 @@ func (this *TaskListView) dataListener() {
|
||||
|
||||
for _, v := range rsp.List {
|
||||
item := common.Item{
|
||||
Id: cast.ToString(v.Id),
|
||||
Id: cast.ToString(v.TaskId),
|
||||
Text: fmt.Sprintf("%s 是否完成:%d 是否领奖:%d 进度:%d", cast.ToString(v.TaskId), v.Status, v.Received, v.Progress),
|
||||
}
|
||||
this.itemList.AddItem(item)
|
||||
|
@ -155,9 +155,9 @@ type (
|
||||
// 清理玩家任务数据
|
||||
CleanData(uid string)
|
||||
// 获取当前任务
|
||||
GetTaskById(uid string, taskId int32) *pb.DBTask
|
||||
// 获取已完成的任务列表
|
||||
GetTaskFinished(uid string, taskType TaskTag) []*pb.DBTask
|
||||
GetTaskById(uid string, taskTag, taskId int32) *pb.TaskData
|
||||
// 获取已完成的日任务列表
|
||||
GetTaskDayFinished(uid string) []*pb.TaskData
|
||||
///红点
|
||||
IReddot
|
||||
}
|
||||
|
49
modules/enchant/api.go
Normal file
49
modules/enchant/api.go
Normal file
@ -0,0 +1,49 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
)
|
||||
|
||||
const (
|
||||
HuntingGetListResp = "getlist"
|
||||
HuntingChallengeResp = "challenge"
|
||||
HuntingChallengeOverResp = "challengeover"
|
||||
HuntingSkillLvResp = "skilllv"
|
||||
HuntingGetRewardResp = "getreward"
|
||||
HuntingBuyResp = "buy"
|
||||
HuntingRankListResp = "ranklist"
|
||||
)
|
||||
|
||||
type apiComp struct {
|
||||
modules.MCompGate
|
||||
service core.IService
|
||||
configure *configureComp
|
||||
module *Hunting
|
||||
friend comm.IFriend
|
||||
chat comm.IChat
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.MCompGate.Init(service, module, comp, options)
|
||||
this.module = module.(*Hunting)
|
||||
|
||||
this.service = service
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Start() (err error) {
|
||||
err = this.MCompGate.Start()
|
||||
var module core.IModule
|
||||
if module, err = this.service.GetModule(comm.ModuleFriend); err != nil {
|
||||
return
|
||||
}
|
||||
this.friend = module.(comm.IFriend)
|
||||
if module, err = this.service.GetModule(comm.ModuleChat); err != nil {
|
||||
return
|
||||
}
|
||||
this.chat = module.(comm.IChat)
|
||||
return
|
||||
}
|
137
modules/enchant/api_buy.go
Normal file
137
modules/enchant/api_buy.go
Normal file
@ -0,0 +1,137 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.HuntingBuyReq) (code pb.ErrorCode) {
|
||||
if req.Count <= 0 {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
curByCount int32
|
||||
costRes *cfg.Gameatn // 门票atn 类型 只取T
|
||||
mapData map[string]interface{}
|
||||
szCostRes []*cfg.Gameatn // 购买累计消耗
|
||||
curCount int32 // 当前门票数量
|
||||
addCount int32 //获得数量
|
||||
)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
code = this.BuyCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
list, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
// 校验是不是今天
|
||||
if !utils.IsToday(list.CTime) {
|
||||
list.CTime = configure.Now().Unix()
|
||||
list.BuyCount = 0
|
||||
mapData["cTime"] = list.CTime
|
||||
mapData["buyCount"] = list.BuyCount
|
||||
} else {
|
||||
curByCount = list.BuyCount
|
||||
}
|
||||
curByCount += req.Count // 当前需要购买的数量
|
||||
if this.configure.GetMaxBuyChallengeCount() < curByCount {
|
||||
code = pb.ErrorCode_HuntingBuyMaxCount
|
||||
return
|
||||
}
|
||||
conf := this.module.configure.GetGlobalConf()
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
costRes = conf.HuntingCos
|
||||
if costRes == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
amount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), costRes.T)) // 获取当前数量
|
||||
curCount = amount
|
||||
if amount < conf.HuntingNum {
|
||||
if list.RecoveryTime == 0 {
|
||||
list.RecoveryTime = configure.Now().Unix()
|
||||
}
|
||||
for { // 计算恢复时间
|
||||
if list.RecoveryTime+int64(conf.HuntingRecovery*60) <= configure.Now().Unix() {
|
||||
curCount++
|
||||
list.RecoveryTime += int64(conf.HuntingRecovery * 60)
|
||||
if curCount >= conf.HuntingNum {
|
||||
list.RecoveryTime = 0
|
||||
break
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
if curCount-amount > 0 {
|
||||
addCount = curCount - amount
|
||||
}
|
||||
} else {
|
||||
list.RecoveryTime = 0
|
||||
}
|
||||
addCount += req.Count
|
||||
if amount+addCount > conf.VikingNum {
|
||||
code = pb.ErrorCode_VikingBuyMaxCount
|
||||
return
|
||||
}
|
||||
mapData["recoveryTime"] = list.RecoveryTime
|
||||
|
||||
for i := list.BuyCount + 1; i <= curByCount; i++ {
|
||||
_cfg := this.configure.GetBuyChallengeCount(i)
|
||||
if _cfg == nil {
|
||||
code = pb.ErrorCode_HuntingBuyMaxCount
|
||||
return
|
||||
}
|
||||
szCostRes = append(szCostRes, _cfg.Need...)
|
||||
}
|
||||
sz := make([]*cfg.Gameatn, 0)
|
||||
for _, v := range szCostRes {
|
||||
bFound := false
|
||||
for _, v1 := range sz {
|
||||
if v.A == v1.A && v.T == v1.T {
|
||||
v1.N += v.N
|
||||
bFound = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !bFound {
|
||||
sz = append(sz, v)
|
||||
}
|
||||
}
|
||||
//消耗
|
||||
if code = this.module.ConsumeRes(session, sz, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
res := &cfg.Gameatn{
|
||||
A: "item",
|
||||
T: costRes.T,
|
||||
N: addCount,
|
||||
}
|
||||
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
list.BuyCount = curByCount
|
||||
mapData["buyCount"] = curByCount
|
||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), HuntingBuyResp, &pb.HuntingBuyResp{Data: list})
|
||||
return
|
||||
}
|
90
modules/enchant/api_challenge.go
Normal file
90
modules/enchant/api_challenge.go
Normal file
@ -0,0 +1,90 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.HuntingChallengeReq) (code pb.ErrorCode) {
|
||||
if req.BossType <= 0 && req.Difficulty > 0 {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
///挑战主线关卡
|
||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallengeReq) (code pb.ErrorCode, data proto.Message) {
|
||||
|
||||
code = this.ChallengeCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
return
|
||||
}
|
||||
conf := this.module.configure.GetGlobalConf()
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
costRes := conf.HuntingCos
|
||||
if costRes == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
if code = this.module.CheckRes(session, []*cfg.Gameatn{costRes}); code != pb.ErrorCode_Success {
|
||||
code = pb.ErrorCode_HuntingNoChallengeCount
|
||||
return
|
||||
}
|
||||
// if hunting.ChallengeCount > this.module.configure.GetGlobalConf().HuntingNum+hunting.BuyCount {
|
||||
// code = pb.ErrorCode_HuntingMaxChallengeCount
|
||||
// return
|
||||
// }
|
||||
cfgData := this.module.configure.GetHuntingBossConfigData(req.BossType, req.Difficulty)
|
||||
if cfgData == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
value, ok := hunting.Boss[req.BossType]
|
||||
if !ok { // 类型校验
|
||||
hunting.Boss[req.BossType] = 0
|
||||
}
|
||||
if value < req.Difficulty {
|
||||
if value+1 != req.Difficulty {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Ptype: pb.PlayType_hunting,
|
||||
Title: "",
|
||||
Format: &pb.BattleFormation{
|
||||
Leadpos: req.Leadpos,
|
||||
Format: req.Teamids,
|
||||
},
|
||||
Mformat: cfgData.Boss,
|
||||
})
|
||||
if code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), HuntingChallengeResp, &pb.HuntingChallengeResp{
|
||||
Info: &pb.BattleInfo{Id: record.Id, Title: record.Title, Btype: record.Btype, Ptype: record.Ptype, RedCompId: record.RedCompId, Redflist: record.Redflist, BlueCompId: record.BlueCompId, Buleflist: record.Buleflist},
|
||||
BossType: req.BossType,
|
||||
Difficulty: req.Difficulty,
|
||||
})
|
||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem15, nil, req.BossType, req.Difficulty, user.Name)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
return
|
||||
}
|
119
modules/enchant/api_challengeover.go
Normal file
119
modules/enchant/api_challengeover.go
Normal file
@ -0,0 +1,119 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.HuntingChallengeOverReq) (code pb.ErrorCode) {
|
||||
if req.BossType <= 0 && req.Difficulty > 0 {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
///挑战主线关卡
|
||||
func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingChallengeOverReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
mapData map[string]interface{}
|
||||
newChallenge bool // 新的关卡
|
||||
reward []*cfg.Gameatn
|
||||
bWin bool // 战斗是否胜利
|
||||
)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
reward = make([]*cfg.Gameatn, 0)
|
||||
code = this.ChallengeOverCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
hunting, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
return
|
||||
}
|
||||
conf := this.module.configure.GetGlobalConf()
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
costRes := conf.HuntingCos
|
||||
if costRes == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
|
||||
if code = this.module.CheckRes(session, []*cfg.Gameatn{costRes}); code != pb.ErrorCode_Success {
|
||||
code = pb.ErrorCode_HuntingNoChallengeCount
|
||||
return
|
||||
}
|
||||
|
||||
cfgHunting := this.module.configure.GetHuntingBossConfigData(req.BossType, req.Difficulty)
|
||||
if cfgHunting == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
value, ok := hunting.Boss[req.BossType]
|
||||
if !ok { // 类型校验
|
||||
hunting.Boss[req.BossType] = 0
|
||||
}
|
||||
if value < req.Difficulty {
|
||||
if value+1 != req.Difficulty {
|
||||
code = pb.ErrorCode_HuntingLvErr
|
||||
return
|
||||
}
|
||||
newChallenge = true
|
||||
}
|
||||
// 校验门票数量够不够
|
||||
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{costRes}, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
// check
|
||||
code, bWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
amount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), costRes.T)) // 获取当前数量
|
||||
|
||||
if amount < conf.HuntingNum {
|
||||
hunting.RecoveryTime = configure.Now().Unix()
|
||||
mapData["recoveryTime"] = hunting.RecoveryTime
|
||||
}
|
||||
if bWin {
|
||||
this.module.CheckRank(session.GetUserId(), req.BossType, req.Difficulty, hunting, req.Report)
|
||||
}
|
||||
// 耗时校验 当前战斗胜利时间消耗小于之前刷新数据
|
||||
|
||||
// 发放通关随机奖励
|
||||
reward = this.module.configure.GetDropReward(cfgHunting.Drop) // 获取掉落奖励
|
||||
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励
|
||||
if code = this.module.DispenseRes(session, cfgHunting.Firstprize, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
hunting.Boss[req.BossType] += 1
|
||||
mapData["boss"] = hunting.Boss
|
||||
|
||||
}
|
||||
for k := range hunting.Boss {
|
||||
hunting.Boss[k] += 1
|
||||
}
|
||||
mapData["challengeTime"] = hunting.BossTime
|
||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting})
|
||||
|
||||
// 随机任务统计
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype81, req.Difficulty, req.BossType)
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype82, req.BossType)
|
||||
|
||||
return
|
||||
}
|
95
modules/enchant/api_getlist.go
Normal file
95
modules/enchant/api_getlist.go
Normal file
@ -0,0 +1,95 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.HuntingGetListReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) GetList(session comm.IUserSession, req *pb.HuntingGetListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
mapData map[string]interface{}
|
||||
curCount int32
|
||||
)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
code = this.GetListCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
list, err := this.module.modelHunting.getHuntingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
// 校验 是不是当天
|
||||
if !utils.IsToday(list.CTime) {
|
||||
list.CTime = configure.Now().Unix()
|
||||
list.BuyCount = 0
|
||||
mapData["cTime"] = list.CTime
|
||||
mapData["buyCount"] = list.BuyCount
|
||||
|
||||
}
|
||||
// 检查恢复时间
|
||||
conf := this.module.configure.GetGlobalConf()
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
costRes := conf.HuntingCos
|
||||
if costRes == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
amount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), costRes.T)) // 获取当前数量
|
||||
curCount = amount
|
||||
if amount < conf.HuntingNum {
|
||||
if list.RecoveryTime == 0 {
|
||||
list.RecoveryTime = configure.Now().Unix()
|
||||
}
|
||||
for { // 计算恢复时间
|
||||
if list.RecoveryTime+int64(conf.HuntingRecovery*60) <= configure.Now().Unix() {
|
||||
curCount++
|
||||
list.RecoveryTime += int64(conf.HuntingRecovery * 60)
|
||||
if curCount >= conf.HuntingNum {
|
||||
list.RecoveryTime = 0
|
||||
break
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
addCount := curCount - amount
|
||||
if addCount > 0 {
|
||||
res := &cfg.Gameatn{
|
||||
A: "item",
|
||||
T: costRes.T,
|
||||
N: addCount,
|
||||
}
|
||||
if code = this.module.DispenseRes(session, []*cfg.Gameatn{res}, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list.RecoveryTime = 0
|
||||
}
|
||||
mapData["recoveryTime"] = list.RecoveryTime
|
||||
code = this.module.ModifyHuntingData(session.GetUserId(), mapData) //修改内存信息
|
||||
// 发送难度
|
||||
for k := range list.Boss {
|
||||
list.Boss[k] += 1
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list})
|
||||
return
|
||||
}
|
59
modules/enchant/api_ranklist.go
Normal file
59
modules/enchant/api_ranklist.go
Normal file
@ -0,0 +1,59 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/redis/pipe"
|
||||
"go_dreamfactory/pb"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.HuntingRankListReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) RankList(session comm.IUserSession, req *pb.HuntingRankListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
szRank []*pb.DBHuntingRank
|
||||
rd *redis.StringSliceCmd
|
||||
)
|
||||
code = this.RankListCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
if !req.Friend {
|
||||
var (
|
||||
pipe *pipe.RedisPipe = this.module.modelHunting.Redis.RedisPipe(context.TODO())
|
||||
)
|
||||
rd = pipe.ZRange("huntingRank"+strconv.Itoa(int(req.BoosType)), 0, -1)
|
||||
|
||||
if _, err := pipe.Exec(); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
_dataList := rd.Val()
|
||||
for _, v := range _dataList {
|
||||
result := &pb.DBHuntingRank{}
|
||||
if err := this.module.modulerank.GetListObj(session.GetUserId(), v, result); err == nil {
|
||||
szRank = append(szRank, result)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
uids := this.friend.GetFriendList(session.GetUserId())
|
||||
for _, id := range uids {
|
||||
rankData := this.module.modulerank.getHuntingRankListByBossType(id, req.BoosType)
|
||||
if rankData != nil {
|
||||
szRank = append(szRank, rankData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), HuntingRankListResp, &pb.HuntingRankListResp{Ranks: szRank})
|
||||
return
|
||||
}
|
112
modules/enchant/comp_configure.go
Normal file
112
modules/enchant/comp_configure.go
Normal file
@ -0,0 +1,112 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"sync"
|
||||
)
|
||||
|
||||
const (
|
||||
game_huntingboss = "game_huntingboss.json"
|
||||
game_challenge = "game_huntingchallenge.json"
|
||||
)
|
||||
|
||||
///配置管理基础组件
|
||||
type configureComp struct {
|
||||
hlock sync.RWMutex
|
||||
modules.MCompConfigure
|
||||
_huntingMap map[int64]*cfg.GameHuntingBossData
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
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)
|
||||
|
||||
this._huntingMap = make(map[int64]*cfg.GameHuntingBossData, 0)
|
||||
configure.RegisterConfigure(game_huntingboss, cfg.NewGameHuntingBoss, func() {
|
||||
if v, err := this.GetConfigure(game_huntingboss); err == nil {
|
||||
if configure, ok := v.(*cfg.GameHuntingBoss); ok {
|
||||
this.hlock.Lock()
|
||||
defer this.hlock.Unlock()
|
||||
for _, value := range configure.GetDataList() {
|
||||
this._huntingMap[int64(value.Type<<16)+int64(value.Difficulty)] = value
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get game_huntingboss conf err:%v", err)
|
||||
}
|
||||
return
|
||||
})
|
||||
err = this.LoadConfigure(game_challenge, cfg.NewGameHuntingChallenge)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数: boss类型 难度
|
||||
func (this *configureComp) GetHuntingBossConfigData(bossType int32, difficulty int32) (data *cfg.GameHuntingBossData) {
|
||||
|
||||
return this._huntingMap[int64(bossType<<16)+int64(difficulty)]
|
||||
}
|
||||
|
||||
//加载多个配置文件
|
||||
func (this *configureComp) LoadMultiConfigure(confs map[string]interface{}) (err error) {
|
||||
for k, v := range confs {
|
||||
err = configure.RegisterConfigure(k, v, nil)
|
||||
if err != nil {
|
||||
log.Errorf("配置文件:%s解析失败!", k)
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//读取配置数据
|
||||
func (this *configureComp) GetConfigure(name string) (v interface{}, err error) {
|
||||
return configure.GetConfigure(name)
|
||||
}
|
||||
|
||||
// get boss Type
|
||||
func (this *configureComp) GetHuntingBossTypeConfigData() (mapType map[int32]struct{}) {
|
||||
|
||||
mapType = make(map[int32]struct{}, 0)
|
||||
if v, err := this.GetConfigure(game_huntingboss); err == nil {
|
||||
if configure, ok := v.(*cfg.GameHuntingBoss); ok {
|
||||
this.hlock.Lock()
|
||||
defer this.hlock.Unlock()
|
||||
for _, value := range configure.GetDataList() {
|
||||
if _, ok := mapType[value.Type]; !ok {
|
||||
mapType[value.Type] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetBuyChallengeCount(index int32) (data *cfg.GameHuntingChallengeData) {
|
||||
if v, err := this.GetConfigure(game_challenge); err == nil {
|
||||
if configure, ok := v.(*cfg.GameHuntingChallenge); ok {
|
||||
data = configure.Get(index)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get game_challenge conf err:%v", err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
func (this *configureComp) GetMaxBuyChallengeCount() int32 {
|
||||
if v, err := this.GetConfigure(game_challenge); err == nil {
|
||||
if configure, ok := v.(*cfg.GameHuntingChallenge); ok {
|
||||
return int32(len(configure.GetDataList()))
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get game_challenge conf err:%v", err)
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
79
modules/enchant/model_hunting.go
Normal file
79
modules/enchant/model_hunting.go
Normal file
@ -0,0 +1,79 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"strconv"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type modelHunting struct {
|
||||
modules.MCompModel
|
||||
module *Hunting
|
||||
}
|
||||
|
||||
func (this *modelHunting) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.TableName = string(comm.TableHunting)
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.module = module.(*Hunting)
|
||||
// uid 创建索引
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (this *modelHunting) modifyHuntingDataByObjId(uid string, data map[string]interface{}) error {
|
||||
return this.Change(uid, data)
|
||||
}
|
||||
|
||||
// 获取列表信息
|
||||
func (this *modelHunting) getHuntingList(uid string) (result *pb.DBHunting, err error) {
|
||||
result = &pb.DBHunting{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: uid,
|
||||
Boss: make(map[int32]int32),
|
||||
BossTime: make(map[string]int32),
|
||||
}
|
||||
if err = this.Get(uid, result); err != nil && mgo.MongodbNil != err {
|
||||
|
||||
return
|
||||
}
|
||||
if mgo.MongodbNil == err {
|
||||
if len(result.Boss) == 0 {
|
||||
_cfg := this.module.configure.GetHuntingBossTypeConfigData()
|
||||
for k := range _cfg {
|
||||
result.Boss[k] = 0
|
||||
str := strconv.Itoa(int(k)) + "_1"
|
||||
result.BossTime[str] = 0
|
||||
}
|
||||
}
|
||||
this.Add(uid, result)
|
||||
}
|
||||
err = nil
|
||||
return result, err
|
||||
}
|
||||
|
||||
// 红点检测
|
||||
func (this *modelHunting) checkReddot32(uid string) bool {
|
||||
|
||||
conf := this.module.configure.GetGlobalConf()
|
||||
if conf == nil {
|
||||
return false
|
||||
}
|
||||
costRes := conf.HuntingCos
|
||||
if costRes == nil {
|
||||
return false
|
||||
}
|
||||
amount := int32(this.module.ModuleItems.QueryItemAmount(uid, costRes.T)) // 获取当前数量
|
||||
if amount > 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
82
modules/enchant/model_rank.go
Normal file
82
modules/enchant/model_rank.go
Normal file
@ -0,0 +1,82 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/redis/pipe"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/db"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
)
|
||||
|
||||
type ModelRank struct {
|
||||
modules.MCompModel
|
||||
moduleHunting *Hunting
|
||||
}
|
||||
|
||||
func (this *ModelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.TableName = comm.TableHuntingRecord // 挑战记录
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.moduleHunting = module.(*Hunting)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *ModelRank) AddRankList(uId string, objId string, data *pb.DBHuntingRank) (err error) {
|
||||
|
||||
if err = this.AddList(uId, objId, data); err != nil {
|
||||
return
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *ModelRank) getHuntingRankList(uid string) []*pb.DBHuntingRank {
|
||||
ranks := make([]*pb.DBHuntingRank, 0)
|
||||
err := this.GetList(uid, &ranks)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return ranks
|
||||
}
|
||||
|
||||
func (this *ModelRank) getHuntingRankListByBossType(uid string, bossType int32) *pb.DBHuntingRank {
|
||||
ranks := make([]*pb.DBHuntingRank, 0)
|
||||
err := this.GetList(uid, &ranks)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
for _, v := range ranks {
|
||||
if v.Bosstype == bossType {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 排行数据写跨服
|
||||
func (this *ModelRank) SetRankListData(tableName string, score int32, uid string) {
|
||||
if !db.IsCross() {
|
||||
if conn, err := db.Cross(); err == nil {
|
||||
var (
|
||||
pipe *pipe.RedisPipe = conn.Redis.RedisPipe(context.TODO())
|
||||
menbers *redis.Z
|
||||
)
|
||||
|
||||
menbers = &redis.Z{Score: float64(score), Member: uid}
|
||||
|
||||
if cmd := pipe.ZAdd(tableName, menbers); cmd != nil {
|
||||
|
||||
dock, err1 := cmd.Result()
|
||||
if err1 != nil {
|
||||
this.moduleHunting.Errorln(dock, err1)
|
||||
}
|
||||
}
|
||||
if _, err := pipe.Exec(); err != nil {
|
||||
this.moduleHunting.Errorln(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
181
modules/enchant/module.go
Normal file
181
modules/enchant/module.go
Normal file
@ -0,0 +1,181 @@
|
||||
package enchant
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/db"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type Hunting struct {
|
||||
modules.ModuleBase
|
||||
modelHunting *modelHunting
|
||||
api *apiComp
|
||||
configure *configureComp
|
||||
modulerank *ModelRank
|
||||
battle comm.IBattle
|
||||
service core.IService
|
||||
}
|
||||
|
||||
func NewModule() core.IModule {
|
||||
return &Hunting{}
|
||||
}
|
||||
|
||||
func (this *Hunting) GetType() core.M_Modules {
|
||||
return comm.ModuleHunting
|
||||
}
|
||||
|
||||
func (this *Hunting) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
this.service = service
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Hunting) Start() (err error) {
|
||||
err = this.ModuleBase.Start()
|
||||
var module core.IModule
|
||||
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
this.battle = module.(comm.IBattle)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Hunting) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.modelHunting = this.RegisterComp(new(modelHunting)).(*modelHunting)
|
||||
this.modulerank = this.RegisterComp(new(ModelRank)).(*ModelRank)
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
}
|
||||
|
||||
// 接口信息
|
||||
func (this *Hunting) ModifyHuntingData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
|
||||
err := this.modelHunting.modifyHuntingDataByObjId(uid, data)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Hunting) CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) {
|
||||
list, err := this.modelHunting.getHuntingList(uid)
|
||||
if err != nil {
|
||||
for k := range list.Boss {
|
||||
_d := this.modulerank.getHuntingRankListByBossType(uid, k)
|
||||
if _d != nil {
|
||||
data = append(data, _d)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, hunting *pb.DBHunting, report *pb.BattleReport) {
|
||||
costTime := report.Costtime
|
||||
key := strconv.Itoa(int(boosID)) + "_" + strconv.Itoa(int(difficulty))
|
||||
|
||||
if hunting.BossTime[key] > costTime || hunting.BossTime[key] == 0 && difficulty >= hunting.Boss[boosID] { // 刷新记录
|
||||
hunting.BossTime[key] = costTime
|
||||
szLine := make([]*pb.LineUp, 5)
|
||||
Leadpos := 0
|
||||
if report != nil && report.Info != nil && len(report.Info.Redflist) > 0 {
|
||||
costTime = report.Costtime
|
||||
Leadpos = int(report.Info.Redflist[0].Leadpos)
|
||||
for i, v := range report.Info.Redflist[0].Team {
|
||||
if v != nil {
|
||||
szLine[i] = &pb.LineUp{
|
||||
Cid: v.HeroID,
|
||||
Star: v.Star,
|
||||
Lv: v.Lv,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 写入排行榜
|
||||
objID := ""
|
||||
bFind := false
|
||||
ranks := this.modulerank.getHuntingRankList(uid)
|
||||
for _, v := range ranks {
|
||||
if v.Bosstype == boosID {
|
||||
mapRankData := make(map[string]interface{}, 0)
|
||||
mapRankData["difficulty"] = difficulty
|
||||
mapRankData["bosstype"] = boosID
|
||||
mapRankData["Leadpos"] = Leadpos
|
||||
mapRankData["line"] = szLine
|
||||
mapRankData["costTime"] = costTime
|
||||
conn_, _ := db.Cross()
|
||||
dbModel := db.NewDBModel(comm.TableHuntingRank, time.Hour, conn_)
|
||||
dbModel.ChangeList(uid, v.Id, mapRankData)
|
||||
objID = v.Id
|
||||
bFind = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !bFind {
|
||||
userinfo := this.ModuleUser.GetUser(uid)
|
||||
new := &pb.DBHuntingRank{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: uid,
|
||||
Difficulty: difficulty,
|
||||
Bosstype: boosID,
|
||||
Nickname: userinfo.Name,
|
||||
Icon: "",
|
||||
Lv: userinfo.Lv,
|
||||
Leadpos: int32(Leadpos),
|
||||
Line: szLine,
|
||||
CostTime: costTime,
|
||||
}
|
||||
objID = new.Id
|
||||
conn_, _ := db.Cross()
|
||||
dbModel := db.NewDBModel(comm.TableHuntingRank, time.Hour, conn_)
|
||||
dbModel.AddList(uid, new.Id, new)
|
||||
}
|
||||
this.modulerank.SetRankListData("huntingRank"+strconv.Itoa(int(boosID)), difficulty<<16+costTime, objID)
|
||||
}
|
||||
}
|
||||
|
||||
//红点查询
|
||||
func (this *Hunting) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
|
||||
reddot = make(map[comm.ReddotType]bool)
|
||||
for _, v := range rid {
|
||||
switch v {
|
||||
case comm.Reddot32:
|
||||
reddot[comm.Reddot32] = this.modelHunting.checkReddot32(session.GetUserId())
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 解锁远征所有难度
|
||||
func (this *Hunting) CompleteAllLevel(session comm.IUserSession) (code pb.ErrorCode) {
|
||||
list, err := this.modelHunting.getHuntingList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
// 查配置获取每个Boss的最大难度
|
||||
for k := range list.Boss {
|
||||
for i := 1; ; i++ {
|
||||
conf := this.configure.GetHuntingBossConfigData(k, int32(i))
|
||||
if conf == nil {
|
||||
list.Boss[k] = int32(i - 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
mapData["boss"] = list.Boss
|
||||
code = this.ModifyHuntingData(session.GetUserId(), mapData)
|
||||
for k := range list.Boss {
|
||||
list.Boss[k] += 1
|
||||
}
|
||||
session.SendMsg(string(this.GetType()), HuntingGetListResp, &pb.HuntingGetListResp{Data: list})
|
||||
return
|
||||
}
|
@ -132,7 +132,7 @@ func hasUpdateData(len int, data *pb.RtaskData, vals ...int32) map[int32]int32 {
|
||||
}
|
||||
|
||||
func printCondiLog(uid string, cfg *cfg.GameRdtaskCondiData) {
|
||||
log.Infof("uid:%v condiId:%v rtype:%v", uid, cfg.Id, cfg.Type)
|
||||
log.Debugf("uid:%v condiId:%v rtype:%v", uid, cfg.Id, cfg.Type)
|
||||
}
|
||||
|
||||
type Num interface {
|
||||
|
@ -142,7 +142,7 @@ func (this *ModelRtask) verifyRtype3(uid string, cfg *cfg.GameRdtaskCondiData) (
|
||||
}
|
||||
|
||||
if ml, y := m.(comm.ITask); y {
|
||||
for _, task := range ml.GetTaskFinished(uid, comm.TASK_DAILY) {
|
||||
for _, task := range ml.GetTaskDayFinished(uid) {
|
||||
if task.TaskId >= cfg.Data1 {
|
||||
ok = true
|
||||
break
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
//活跃度领取
|
||||
func (this *apiComp) ActiveReceiveCheck(session comm.IUserSession, req *pb.TaskActiveReceiveReq) (code pb.ErrorCode) {
|
||||
if req.Id == "" {
|
||||
if req.Id == 0 {
|
||||
code = pb.ErrorCode_TaskIdEmpty
|
||||
} else if req.TaskTag <= 0 || req.TaskTag > 2 {
|
||||
code = pb.ErrorCode_TaskTagEmpty
|
||||
@ -25,17 +25,6 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
||||
}
|
||||
uid := session.GetUserId()
|
||||
|
||||
// ua := this.moduleTask.modelTaskActive.getUserActive(uid, req.Id, comm.TaskTag(req.TaskTag))
|
||||
// if ua == nil {
|
||||
// code = pb.ErrorCode_TaskActiveNofound
|
||||
// return
|
||||
// }
|
||||
|
||||
//判断是否已领取
|
||||
// if ua.Received == 1 {
|
||||
// code = pb.ErrorCode_TaskReceived
|
||||
// return
|
||||
// }
|
||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(uid)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
@ -49,39 +38,47 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
||||
var rewards []*cfg.Gameatn
|
||||
// 玩家的
|
||||
activeList := this.moduleTask.modelTaskActive.getActiveListByTag(uid, comm.TaskTag(req.TaskTag))
|
||||
var activityData *pb.ActivityData
|
||||
for _, v := range activeList {
|
||||
if v.Received != 1 { //未领取
|
||||
conf := this.moduleTask.configure.getTaskActiveById(v.RId)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
if v.TaskId == req.Id {
|
||||
activityData = v
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if activityData == nil {
|
||||
code = pb.ErrorCode_TaskNotFound
|
||||
return
|
||||
}
|
||||
|
||||
if activityData.Received != 1 { //未领取
|
||||
conf := this.moduleTask.configure.getTaskActiveById(activityData.TaskId)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
|
||||
update := make(map[string]interface{})
|
||||
if req.TaskTag == int32(comm.TASK_DAILY) {
|
||||
if ue.Activeday < conf.Active {
|
||||
code = pb.ErrorCode_TaskActiveNoenough
|
||||
return
|
||||
}
|
||||
|
||||
// get user expand
|
||||
|
||||
update := make(map[string]interface{})
|
||||
if req.TaskTag == int32(comm.TASK_DAILY) {
|
||||
if ue.Activeday < conf.Active {
|
||||
continue
|
||||
}
|
||||
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
||||
if ue.Activeweek < conf.Active {
|
||||
continue
|
||||
}
|
||||
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
||||
if ue.Activeweek < conf.Active {
|
||||
code = pb.ErrorCode_TaskActiveNoenough
|
||||
return
|
||||
}
|
||||
update["received"] = 1
|
||||
if len(update) > 0 {
|
||||
if err := this.moduleTask.modelTaskActive.updateReceive(session.GetUserId(),
|
||||
v.Id,
|
||||
comm.TaskTag(req.TaskTag),
|
||||
update); err != nil {
|
||||
this.moduleTask.Errorf("updateReceive err %v", err)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
}
|
||||
rewards = append(rewards, conf.Reword...)
|
||||
}
|
||||
update["received"] = 1
|
||||
if len(update) > 0 {
|
||||
if err := this.moduleTask.modelTaskActive.updateReceive(session.GetUserId(), update); err != nil {
|
||||
this.moduleTask.Errorf("updateReceive err %v", err)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
}
|
||||
rewards = append(rewards, conf.Reword...)
|
||||
}
|
||||
|
||||
if len(rewards) > 0 {
|
||||
|
@ -30,7 +30,19 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.TaskListReq) (code
|
||||
}
|
||||
}()
|
||||
|
||||
rsp.List = this.moduleTask.modelTask.getTaskListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
|
||||
task := this.moduleTask.modelTask.getTaskListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
|
||||
if task == nil {
|
||||
code = pb.ErrorCode_TaskNotFound
|
||||
return
|
||||
}
|
||||
|
||||
switch req.TaskTag {
|
||||
case int32(comm.TASK_DAILY):
|
||||
rsp.List = task.DayList
|
||||
case int32(comm.TASK_WEEKLY):
|
||||
rsp.List = task.WeekList
|
||||
case int32(comm.TASK_ACHIEVE):
|
||||
rsp.List = task.AchieveList
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
//任务奖励领取
|
||||
|
||||
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.TaskReceiveReq) (code pb.ErrorCode) {
|
||||
if req.Id == "" {
|
||||
if req.Id == 0 {
|
||||
code = pb.ErrorCode_TaskIdEmpty
|
||||
} else if req.TaskTag == 0 {
|
||||
code = pb.ErrorCode_TaskTagEmpty
|
||||
@ -32,19 +32,38 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
||||
return
|
||||
}
|
||||
|
||||
var taskDataList []*pb.TaskData
|
||||
|
||||
switch req.TaskTag {
|
||||
case int32(comm.TASK_DAILY):
|
||||
taskDataList = userTask.DayList
|
||||
case int32(comm.TASK_WEEKLY):
|
||||
taskDataList = userTask.WeekList
|
||||
case int32(comm.TASK_ACHIEVE):
|
||||
taskDataList = userTask.AchieveList
|
||||
}
|
||||
|
||||
resp := &pb.TaskReceiveResp{}
|
||||
var taskData *pb.TaskData
|
||||
for _, v := range taskDataList {
|
||||
if v.TaskId == req.Id {
|
||||
taskData = v
|
||||
}
|
||||
}
|
||||
|
||||
//判断是否完成
|
||||
if userTask.Status == 0 {
|
||||
if taskData.Status == 0 {
|
||||
code = pb.ErrorCode_TaskNoFinished
|
||||
return
|
||||
}
|
||||
//判断任务是否领取
|
||||
if userTask.Received == 1 {
|
||||
if taskData.Received == 1 {
|
||||
code = pb.ErrorCode_TaskReceived
|
||||
return
|
||||
}
|
||||
|
||||
// 待领取的任务配置
|
||||
conf := this.moduleTask.configure.getTaskById(userTask.TaskId)
|
||||
conf := this.moduleTask.configure.getTaskById(taskData.TaskId)
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
@ -88,14 +107,11 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
||||
update := map[string]interface{}{
|
||||
"received": 1,
|
||||
}
|
||||
if err := this.moduleTask.modelTask.modifyUserTask(session.GetUserId(), userTask.Id, update); err != nil {
|
||||
if err := this.moduleTask.modelTask.modifyUserTask(session.GetUserId(), taskData.TaskId, update); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
resp := &pb.TaskReceiveResp{
|
||||
TaskId: userTask.TaskId,
|
||||
}
|
||||
resp.TaskId = taskData.TaskId
|
||||
|
||||
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeReceive, resp)
|
||||
if err != nil {
|
||||
|
@ -1,39 +0,0 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//卡牌攻略
|
||||
func (this *apiComp) StrategyCheck(session comm.IUserSession, req *pb.TaskDoStrategyReq) (code pb.ErrorCode) {
|
||||
if req.HeroCfgId == 0 {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//进入卡牌攻略
|
||||
func (this *apiComp) Strategy(session comm.IUserSession, req *pb.TaskDoStrategyReq) (code pb.ErrorCode, data proto.Message) {
|
||||
if code = this.StrategyCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
resp := &pb.TaskDoStrategyResp{}
|
||||
|
||||
taskIds, err := this.moduleTask.modelTask.inStrategy(session.GetUserId(), req.HeroCfgId)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
|
||||
resp.TaskIds = taskIds
|
||||
|
||||
err = session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeStrategy, resp)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
}
|
||||
return
|
||||
}
|
@ -29,32 +29,48 @@ func (this *ModelTaskActive) Init(service core.IService, module core.IModule, co
|
||||
|
||||
//初始化活跃度
|
||||
func (this *ModelTaskActive) initActiveReward(uid string, taskTag comm.TaskTag) {
|
||||
task := &pb.DBActivity{}
|
||||
if err := this.Get(uid, task); err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
objId := primitive.NewObjectID().Hex()
|
||||
task = &pb.DBActivity{
|
||||
Uid: uid,
|
||||
Id: objId,
|
||||
}
|
||||
this.moduleTask.modelTaskActive.Add(uid, task)
|
||||
} else {
|
||||
this.moduleTask.Errorf("getTaskList err %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
data := this.moduleTask.configure.getTaskActiveByTag(int32(taskTag))
|
||||
|
||||
for _, conf := range data {
|
||||
objId := primitive.NewObjectID().Hex()
|
||||
ta := &pb.DBTaskActive{
|
||||
Id: objId,
|
||||
Uid: uid,
|
||||
Tag: int32(taskTag),
|
||||
RId: conf.Key,
|
||||
}
|
||||
if err := this.moduleTask.modelTaskActive.AddList(uid, ta.Id, ta); err != nil {
|
||||
this.moduleTask.Errorf("uid:%v tag:%v initActiv add err %v", uid, err)
|
||||
return
|
||||
ta := &pb.ActivityData{
|
||||
Tag: int32(taskTag),
|
||||
TaskId: conf.Key,
|
||||
}
|
||||
task.ActivityList = append(task.ActivityList, ta)
|
||||
}
|
||||
update := map[string]interface{}{
|
||||
"activityList": task.ActivityList,
|
||||
}
|
||||
if err := this.moduleTask.modelTaskActive.Change(uid, update); err != nil {
|
||||
this.moduleTask.Errorf("uid:%v tag:%v initActivity err %v", uid, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
//获取玩家活跃度列表
|
||||
func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag) (list []*pb.DBTaskActive) {
|
||||
al := []*pb.DBTaskActive{}
|
||||
if err := this.GetList(uid, &al); err != nil {
|
||||
this.moduleTask.Errorf("getUserActiveList err:%v", err)
|
||||
return al
|
||||
func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag) (list []*pb.ActivityData) {
|
||||
task := &pb.DBActivity{}
|
||||
if err := this.Get(uid, task); err != nil {
|
||||
this.moduleTask.Errorf("getTaskList err %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range al {
|
||||
for _, v := range task.ActivityList {
|
||||
if v.Tag == int32(taskTag) {
|
||||
list = append(list, v)
|
||||
}
|
||||
@ -65,12 +81,13 @@ func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag
|
||||
|
||||
// 查询完成的且未领取的任务 发现未领取返回true
|
||||
func (this *ModelTaskActive) noReceiveTaskActive(uid string, taskTag comm.TaskTag) (bool, error) {
|
||||
list := []*pb.DBTaskActive{}
|
||||
if err := this.GetList(uid, &list); err != nil {
|
||||
this.moduleTask.Errorf("getUserActiveList err:%v", err)
|
||||
task := &pb.DBActivity{}
|
||||
if err := this.Get(uid, task); err != nil {
|
||||
this.moduleTask.Errorf("getTaskActivityList err %v", err)
|
||||
return false, err
|
||||
}
|
||||
for _, v := range list {
|
||||
|
||||
for _, v := range task.ActivityList {
|
||||
if v.Tag == int32(taskTag) && v.Received == 0 {
|
||||
return true, nil
|
||||
}
|
||||
@ -79,21 +96,21 @@ func (this *ModelTaskActive) noReceiveTaskActive(uid string, taskTag comm.TaskTa
|
||||
}
|
||||
|
||||
//获取玩家活跃记录 id 唯一ID
|
||||
func (this *ModelTaskActive) getUserActive(uid, id string, taskTag comm.TaskTag) *pb.DBTaskActive {
|
||||
func (this *ModelTaskActive) getUserActive(uid string, taskId int32, taskTag comm.TaskTag) *pb.ActivityData {
|
||||
record := this.getActiveListByTag(uid, taskTag)
|
||||
for _, v := range record {
|
||||
if v.Id == id {
|
||||
if v.TaskId == taskId {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *ModelTaskActive) updateReceive(uid, id string, taskTag comm.TaskTag, data map[string]interface{}) (err error) {
|
||||
func (this *ModelTaskActive) updateReceive(uid string, data map[string]interface{}) (err error) {
|
||||
if len(data) == 0 {
|
||||
return
|
||||
}
|
||||
return this.moduleTask.modelTaskActive.ChangeList(uid, id, data)
|
||||
return this.moduleTask.modelTaskActive.Change(uid, data)
|
||||
}
|
||||
|
||||
//清空活跃度任务
|
||||
@ -103,10 +120,17 @@ func (this *ModelTaskActive) clearTask(uid string, taskTag ...comm.TaskTag) {
|
||||
return
|
||||
}
|
||||
data := this.getActiveListByTag(uid, taskTag[0])
|
||||
for _, v := range data {
|
||||
if err := this.moduleTask.modelTaskActive.DelListlds(uid, v.Id); err != nil {
|
||||
this.moduleTask.Errorf("uid: %v err:%v", uid, err)
|
||||
return
|
||||
for i, v := range data {
|
||||
if v.Tag == int32(taskTag[0]) {
|
||||
data = append(data[:i], data[i+1:]...)
|
||||
}
|
||||
}
|
||||
update := map[string]interface{}{
|
||||
"activityList": data,
|
||||
}
|
||||
if err := this.moduleTask.modelTaskActive.Change(uid, update); err != nil {
|
||||
this.moduleTask.Errorf("uid: %v err:%v", uid, err)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,53 +36,74 @@ func (this *ModelTask) Init(service core.IService, module core.IModule, comp cor
|
||||
|
||||
// 查询完成的且未领取的任务 发现未领取返回true
|
||||
func (this *ModelTask) noReceiveTask(uid string, taskTag comm.TaskTag) (bool, error) {
|
||||
list := []*pb.DBTask{}
|
||||
if err := this.GetList(uid, &list); err != nil {
|
||||
task := &pb.DBTask{}
|
||||
if err := this.Get(uid, task); err != nil {
|
||||
this.moduleTask.Errorf("getTaskList err %v", err)
|
||||
return false, err
|
||||
}
|
||||
for _, v := range list {
|
||||
if v.Tag == int32(taskTag) && v.Status == 1 && v.Received == 0 {
|
||||
return true, nil
|
||||
if taskTag == comm.TASK_DAILY {
|
||||
for _, v := range task.DayList {
|
||||
if v.Status == 1 && v.Received == 0 {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
} else if taskTag == comm.TASK_WEEKLY {
|
||||
for _, v := range task.WeekList {
|
||||
if v.Status == 1 && v.Received == 0 {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
//获取玩家任务列表
|
||||
func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) (newlist []*pb.DBTask) {
|
||||
list := []*pb.DBTask{}
|
||||
if err := this.GetList(uid, &list); err != nil {
|
||||
func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) *pb.DBTask {
|
||||
task := &pb.DBTask{}
|
||||
if err := this.Get(uid, task); err != nil {
|
||||
this.moduleTask.Errorf("getTaskList err %v", err)
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
if task == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 排序
|
||||
sort.SliceStable(list, func(i, j int) bool {
|
||||
return list[i].Sort < list[j].Sort
|
||||
sort.SliceStable(task.DayList, func(i, j int) bool {
|
||||
return task.DayList[i].Sort < task.DayList[j].Sort
|
||||
})
|
||||
sort.SliceStable(task.WeekList, func(i, j int) bool {
|
||||
return task.WeekList[i].Sort < task.WeekList[j].Sort
|
||||
})
|
||||
|
||||
dr := this.moduleTask.ModuleRtask.GetCondiData(uid)
|
||||
if dr == nil {
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
// 筛选出指定tag的任务
|
||||
var taskList []*pb.DBTask
|
||||
for _, v := range list {
|
||||
if v.Tag == int32(taskTag) {
|
||||
if taskTag == comm.TASK_DAILY {
|
||||
for _, v := range task.DayList {
|
||||
if p, ok := dr.Vals[v.TypeId]; ok {
|
||||
if len(p.Data) > 0 {
|
||||
v.Progress = p.Data[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if taskTag == comm.TASK_WEEKLY {
|
||||
for _, v := range task.WeekList {
|
||||
if p, ok := dr.Vals[v.TypeId]; ok {
|
||||
if len(p.Data) > 0 {
|
||||
v.Progress = p.Data[0]
|
||||
}
|
||||
}
|
||||
taskList = append(taskList, v)
|
||||
}
|
||||
}
|
||||
|
||||
// 当前玩家任务
|
||||
getCurTask := func(taskId int32) *pb.DBTask {
|
||||
for _, v := range list {
|
||||
// 当前玩家成就任务
|
||||
getCurTask := func(taskId int32) *pb.TaskData {
|
||||
for _, v := range task.AchieveList {
|
||||
if v.TaskId == taskId {
|
||||
return v
|
||||
}
|
||||
@ -103,114 +124,183 @@ func (this *ModelTask) getTaskListByTag(uid string, taskTag comm.TaskTag) (newli
|
||||
}
|
||||
|
||||
// 成就列表
|
||||
var achieveList []*pb.TaskData
|
||||
if taskTag == comm.TASK_ACHIEVE {
|
||||
for _, v := range taskList {
|
||||
for _, v := range task.AchieveList {
|
||||
if curTask := this.moduleTask.configure.getTaskById(v.TaskId); curTask != nil {
|
||||
if v.Received == 0 {
|
||||
isFirst := this.moduleTask.configure.isFirstTask(curTask.Key)
|
||||
if curTask.IdAfter == 0 && isFirst { //未领取和没有下个连续任务的
|
||||
newlist = append(newlist, v)
|
||||
achieveList = append(achieveList, v)
|
||||
continue
|
||||
}
|
||||
|
||||
if isFirst && curTask.IdAfter != 0 { //连续任务的第一个任务
|
||||
next := this.moduleTask.configure.getTaskById(curTask.IdAfter)
|
||||
if next != nil && v.Received == 0 {
|
||||
newlist = append(newlist, v)
|
||||
achieveList = append(achieveList, v)
|
||||
}
|
||||
} else {
|
||||
if isReceived(curTask.Key) {
|
||||
newlist = append(newlist, v)
|
||||
achieveList = append(achieveList, v)
|
||||
}
|
||||
// else {
|
||||
// break
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newlist = taskList
|
||||
task.AchieveList = achieveList
|
||||
}
|
||||
return
|
||||
|
||||
return task
|
||||
}
|
||||
|
||||
// 获取用户任务
|
||||
func (this *ModelTask) getTaskById(uid string, taskId int32) (newlist []*pb.DBTask) {
|
||||
list := []*pb.DBTask{}
|
||||
if err := this.GetList(uid, &list); err != nil {
|
||||
func (this *ModelTask) getTaskById(uid string, taskTag comm.TaskTag, taskId int32) *pb.DBTask {
|
||||
task := &pb.DBTask{}
|
||||
if err := this.Get(uid, task); err != nil {
|
||||
this.moduleTask.Errorf("getTaskById err %v", err)
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, v := range list {
|
||||
if v.TaskId == taskId {
|
||||
newlist = append(newlist, v)
|
||||
if task != nil {
|
||||
if taskTag == comm.TASK_DAILY {
|
||||
for _, v := range task.DayList {
|
||||
if v.TaskId == taskId {
|
||||
task.DayList = append(task.DayList, v)
|
||||
}
|
||||
}
|
||||
} else if taskTag == comm.TASK_WEEKLY {
|
||||
for _, v := range task.WeekList {
|
||||
if v.TaskId == taskId {
|
||||
task.WeekList = append(task.WeekList, v)
|
||||
}
|
||||
}
|
||||
} else if taskTag == comm.TASK_ACHIEVE {
|
||||
for _, v := range task.AchieveList {
|
||||
if v.TaskId == taskId {
|
||||
task.AchieveList = append(task.AchieveList, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
return task
|
||||
}
|
||||
|
||||
//初始化任务
|
||||
func (this *ModelTask) initTask(uid string, taskTag comm.TaskTag) error {
|
||||
task := &pb.DBTask{}
|
||||
if err := this.Get(uid, task); err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
objId := primitive.NewObjectID().Hex()
|
||||
task = &pb.DBTask{
|
||||
Uid: uid,
|
||||
Id: objId,
|
||||
}
|
||||
if err := this.Add(uid, task); err != nil {
|
||||
this.moduleTask.Errorf("initTask addlists err %v", err)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
this.moduleTask.Errorf("getTaskList err %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
data := this.moduleTask.configure.getTaskByTag(int32(taskTag))
|
||||
update := map[string]interface{}{}
|
||||
for _, cnf := range data {
|
||||
objId := primitive.NewObjectID().Hex()
|
||||
task := &pb.DBTask{
|
||||
Id: objId,
|
||||
t := &pb.TaskData{
|
||||
Tag: cnf.IdTag,
|
||||
Uid: uid,
|
||||
TypeId: cnf.TypeId,
|
||||
TaskId: cnf.Key,
|
||||
Active: cnf.Active,
|
||||
Sort: cnf.IdList,
|
||||
}
|
||||
if err := this.AddList(uid, task.Id, task); err != nil {
|
||||
this.moduleTask.Errorf("initTask addlists err %v", err)
|
||||
return err
|
||||
if taskTag == comm.TASK_DAILY {
|
||||
task.DayList = append(task.DayList, t)
|
||||
update["dayList"] = task.DayList
|
||||
} else if taskTag == comm.TASK_WEEKLY {
|
||||
task.WeekList = append(task.WeekList, t)
|
||||
update["weekList"] = task.WeekList
|
||||
} else if taskTag == comm.TASK_ACHIEVE {
|
||||
task.AchieveList = append(task.AchieveList, t)
|
||||
update["achieveList"] = task.AchieveList
|
||||
}
|
||||
}
|
||||
|
||||
if err := this.Change(uid, update); err != nil {
|
||||
this.moduleTask.Errorf("initTask err %v", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//查询用户任务
|
||||
func (this *ModelTask) getUserTask(uid string, taskId string) *pb.DBTask {
|
||||
userTask := &pb.DBTask{}
|
||||
if err := this.moduleTask.modelTask.GetListObj(uid, taskId, userTask); err != nil {
|
||||
this.moduleTask.Errorf("getUserTask err:%v", err)
|
||||
func (this *ModelTask) getUserTask(uid string, taskId int32) *pb.DBTask {
|
||||
task := &pb.DBTask{}
|
||||
if err := this.Get(uid, task); err != nil {
|
||||
this.moduleTask.Errorf("getTaskList err %v", err)
|
||||
return nil
|
||||
}
|
||||
return userTask
|
||||
return task
|
||||
}
|
||||
|
||||
// 获取已完成的任务
|
||||
func (this *ModelTask) getFinishTasks(uid string, taskTag comm.TaskTag) (list []*pb.DBTask) {
|
||||
taskList := this.getTaskListByTag(uid, taskTag)
|
||||
for _, v := range taskList {
|
||||
if v.Status == 1 {
|
||||
list = append(list, v)
|
||||
// 获取已完成的(日、周)任务
|
||||
func (this *ModelTask) getFinishTasks(uid string, taskTag comm.TaskTag) (list []*pb.TaskData) {
|
||||
task := this.getTaskListByTag(uid, taskTag)
|
||||
if taskTag == comm.TASK_DAILY {
|
||||
for _, v := range task.DayList {
|
||||
if v.Status == 1 {
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
} else if taskTag == comm.TASK_WEEKLY {
|
||||
for _, v := range task.WeekList {
|
||||
if v.Status == 1 {
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取待处理的任务
|
||||
func (this *ModelTask) getUnFinishTasks(uid string, taskId int32) (list []*pb.DBTask) {
|
||||
taskList := this.getTaskById(uid, taskId)
|
||||
for _, v := range taskList {
|
||||
if v.Status == 0 {
|
||||
list = append(list, v)
|
||||
// 获取待处理的(日、周)任务
|
||||
func (this *ModelTask) getUnFinishTasks(uid string, taskId int32) (list []*pb.TaskData) {
|
||||
task := &pb.DBTask{}
|
||||
if err := this.Get(uid, task); err != nil {
|
||||
this.moduleTask.Errorf("getTaskById err %v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if task != nil {
|
||||
for _, v := range task.DayList {
|
||||
if v.TaskId == taskId && v.Status == 0 {
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range task.WeekList {
|
||||
if v.TaskId == taskId && v.Status == 0 {
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range task.AchieveList {
|
||||
if v.TaskId == taskId && v.Status == 0 {
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//检查任务状态 返回等待处理的任务
|
||||
func (this *ModelTask) checkTask(uid string, taskId int32) (*pb.DBTask, bool) {
|
||||
func (this *ModelTask) checkTask(uid string, taskId int32) (*pb.TaskData, bool) {
|
||||
taskList := this.getUnFinishTasks(uid, taskId)
|
||||
for _, v := range taskList {
|
||||
if taskId == v.TaskId && v.Status == 0 {
|
||||
if taskId == v.TaskId {
|
||||
return v, true
|
||||
}
|
||||
}
|
||||
@ -218,12 +308,47 @@ func (this *ModelTask) checkTask(uid string, taskId int32) (*pb.DBTask, bool) {
|
||||
}
|
||||
|
||||
//更改用户任务
|
||||
func (this *ModelTask) modifyUserTask(uid string, taskId string, data map[string]interface{}) error {
|
||||
if err := this.ChangeList(uid, taskId, data); err != nil {
|
||||
this.moduleTask.Errorf("err %v", err)
|
||||
return err
|
||||
func (this *ModelTask) modifyUserTask(uid string, taskId int32, data map[string]interface{}) error {
|
||||
var task *pb.DBTask
|
||||
if err := this.GetList(uid, &task); err != nil {
|
||||
this.moduleTask.Errorf("getTaskById err %v", err)
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
var err error
|
||||
for _, v := range task.DayList {
|
||||
if v.TaskId == taskId {
|
||||
v.Progress = data["progress"].(int32)
|
||||
v.Status = data["status"].(int32)
|
||||
}
|
||||
}
|
||||
day_update := map[string]interface{}{
|
||||
"dayList": task.DayList,
|
||||
}
|
||||
err = this.Change(uid, day_update)
|
||||
|
||||
for _, v := range task.WeekList {
|
||||
if v.TaskId == taskId {
|
||||
v.Progress = data["progress"].(int32)
|
||||
v.Status = data["status"].(int32)
|
||||
}
|
||||
}
|
||||
week_update := map[string]interface{}{
|
||||
"weekList": task.WeekList,
|
||||
}
|
||||
err = this.Change(uid, week_update)
|
||||
|
||||
for _, v := range task.AchieveList {
|
||||
if v.TaskId == taskId {
|
||||
v.Progress = data["progress"].(int32)
|
||||
v.Status = data["status"].(int32)
|
||||
}
|
||||
}
|
||||
achieve_update := map[string]interface{}{
|
||||
"achieveList": task.AchieveList,
|
||||
}
|
||||
err = this.Change(uid, achieve_update)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
//清空任务
|
||||
@ -232,56 +357,59 @@ func (this *ModelTask) clearTask(uid string, taskTag ...comm.TaskTag) {
|
||||
this.moduleTask.Error("TaskTag参数缺失", log.Fields{"uid": uid, "params": taskTag})
|
||||
return
|
||||
}
|
||||
taskList := this.getTaskListByTag(uid, taskTag[0])
|
||||
var task *pb.DBTask
|
||||
if err := this.GetList(uid, &task); err != nil {
|
||||
this.moduleTask.Errorf("getTaskById err %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if task == nil {
|
||||
this.moduleTask.Error("任务数据空", log.Fields{"uid": uid, "taskTag": taskTag})
|
||||
return
|
||||
}
|
||||
|
||||
dr := this.moduleTask.ModuleRtask.GetCondiData(uid)
|
||||
for _, v := range taskList {
|
||||
if err := this.moduleTask.modelTask.DelListlds(uid, v.Id); err != nil {
|
||||
this.moduleTask.Error("清除任务", log.Fields{"uid": uid, "taskId": v.Id})
|
||||
return
|
||||
}
|
||||
//删除任务条件数据
|
||||
if dr != nil && dr.Vals != nil {
|
||||
delete(dr.Vals, v.TypeId)
|
||||
}
|
||||
}
|
||||
if err := this.moduleTask.ModuleRtask.ChangeCondi(uid, dr.Vals); err != nil {
|
||||
this.moduleTask.Error("更新任务条件数据", log.Fields{"uid": uid})
|
||||
}
|
||||
}
|
||||
|
||||
//进入卡牌攻略
|
||||
// Deprecated
|
||||
func (this *ModelTask) inStrategy(uid string, heroCfgId int32) (taskIds []int32, err error) {
|
||||
//检查此英雄攻略是否完成
|
||||
taskList := this.getTaskListByTag(uid, comm.TASK_STRATEGY)
|
||||
allFinished := true
|
||||
for _, v := range taskList {
|
||||
conf := this.moduleTask.configure.getTaskById(v.TaskId)
|
||||
if conf != nil {
|
||||
// if conf.RestrictiveCondition == heroCfgId && v.Status != 1 {
|
||||
// allFinished = false
|
||||
// break
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if !allFinished {
|
||||
//重置状态
|
||||
for _, v := range taskList {
|
||||
if v.Status != 0 {
|
||||
update := map[string]interface{}{
|
||||
"status": 0,
|
||||
}
|
||||
if err = this.modifyUserTask(uid, v.Id, update); err != nil {
|
||||
this.moduleTask.Errorf("doStrategy err %v", err)
|
||||
break
|
||||
}
|
||||
update := map[string]interface{}{}
|
||||
if taskTag[0] == comm.TASK_DAILY {
|
||||
for _, v := range task.DayList {
|
||||
//删除任务条件数据
|
||||
if dr != nil && dr.Vals != nil {
|
||||
delete(dr.Vals, v.TypeId)
|
||||
}
|
||||
taskIds = append(taskIds, v.TaskId)
|
||||
}
|
||||
if err := this.moduleTask.ModuleRtask.ChangeCondi(uid, dr.Vals); err != nil {
|
||||
this.moduleTask.Error("更新任务条件数据", log.Fields{"uid": uid})
|
||||
}
|
||||
update["dayList"] = make([]*pb.TaskData, 0)
|
||||
} else if taskTag[0] == comm.TASK_WEEKLY {
|
||||
for _, v := range task.WeekList {
|
||||
//删除任务条件数据
|
||||
if dr != nil && dr.Vals != nil {
|
||||
delete(dr.Vals, v.TypeId)
|
||||
}
|
||||
}
|
||||
if err := this.moduleTask.ModuleRtask.ChangeCondi(uid, dr.Vals); err != nil {
|
||||
this.moduleTask.Error("更新任务条件数据", log.Fields{"uid": uid})
|
||||
}
|
||||
update["weekList"] = make([]*pb.TaskData, 0)
|
||||
} else if taskTag[0] == comm.TASK_ACHIEVE {
|
||||
for _, v := range task.AchieveList {
|
||||
//删除任务条件数据
|
||||
if dr != nil && dr.Vals != nil {
|
||||
delete(dr.Vals, v.TypeId)
|
||||
}
|
||||
}
|
||||
if err := this.moduleTask.ModuleRtask.ChangeCondi(uid, dr.Vals); err != nil {
|
||||
this.moduleTask.Error("更新任务条件数据", log.Fields{"uid": uid})
|
||||
}
|
||||
update["weekList"] = make([]*pb.TaskData, 0)
|
||||
}
|
||||
|
||||
if err := this.moduleTask.modelTask.Change(uid, update); err != nil {
|
||||
this.moduleTask.Error("清空任务数据", log.Fields{"uid": uid})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 任务处理
|
||||
@ -318,6 +446,7 @@ func (this *ModelTask) doTaskHandle(event interface{}, next func(event interface
|
||||
progress int32
|
||||
update map[string]interface{}
|
||||
)
|
||||
|
||||
if code := this.moduleTask.ModuleRtask.CheckCondi(tl.Uid, conf.TypeId); code == pb.ErrorCode_Success {
|
||||
// update data
|
||||
if ret != nil && len(ret.Data) > 0 {
|
||||
@ -327,7 +456,6 @@ func (this *ModelTask) doTaskHandle(event interface{}, next func(event interface
|
||||
"progress": progress,
|
||||
"status": 1,
|
||||
}
|
||||
// err = this.updateActive(tl.Uid, conf.Key)
|
||||
} else {
|
||||
if ret != nil && len(ret.Data) > 0 {
|
||||
progress = ret.Data[0]
|
||||
@ -336,7 +464,7 @@ func (this *ModelTask) doTaskHandle(event interface{}, next func(event interface
|
||||
"progress": progress,
|
||||
}
|
||||
}
|
||||
if err = this.modifyUserTask(tl.Uid, task.Id, update); err != nil {
|
||||
if err = this.modifyUserTask(tl.Uid, task.TaskId, update); err != nil {
|
||||
return
|
||||
}
|
||||
this.moduleTask.Debug("更新任务",
|
||||
|
@ -104,17 +104,21 @@ func (this *ModuleTask) resetActive(uid string, taskTag comm.TaskTag) {
|
||||
}
|
||||
|
||||
// 获取玩家指定任务
|
||||
func (this *ModuleTask) GetTaskById(uid string, taskId int32) *pb.DBTask {
|
||||
list := []*pb.DBTask{}
|
||||
if err := this.modelTask.GetList(uid, &list); err != nil {
|
||||
func (this *ModuleTask) GetTaskById(uid string, taskTag, taskId int32) *pb.TaskData {
|
||||
var task *pb.DBTask
|
||||
if err := this.modelTask.GetList(uid, &task); err != nil {
|
||||
log.Errorf("GetTaskById err %v", err)
|
||||
return nil
|
||||
}
|
||||
for _, v := range list {
|
||||
if v.TaskId == taskId {
|
||||
return v
|
||||
|
||||
if taskTag == int32(comm.TASK_DAILY) {
|
||||
for _, v := range task.DayList {
|
||||
if v.TaskId == taskId {
|
||||
return v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -134,8 +138,9 @@ func (this *ModuleTask) CleanData(uid string) {
|
||||
//任务处理器注册
|
||||
type taskHandle func(uid string, taskId int32, tp *pb.TaskParam) *pb.DBTask
|
||||
|
||||
func (this *ModuleTask) GetTaskFinished(uid string, taskTage comm.TaskTag) []*pb.DBTask {
|
||||
return this.modelTask.getFinishTasks(uid, taskTage)
|
||||
// 获取每日任务列表
|
||||
func (this *ModuleTask) GetTaskDayFinished(uid string) []*pb.TaskData {
|
||||
return this.modelTask.getFinishTasks(uid, comm.TASK_DAILY)
|
||||
}
|
||||
|
||||
func (this *ModuleTask) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
|
||||
|
@ -145,7 +145,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
// 初始化随机任务数据
|
||||
// this.module.ModuleRtask.InitCondiData(user.Uid)
|
||||
// 日常登录任务
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype7, 1)
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype8, 1)
|
||||
|
||||
this.module.ModulePrivilege.CheckDailyPrivilegeMail(session)
|
||||
|
||||
|
384
pb/task_db.pb.go
384
pb/task_db.pb.go
@ -25,16 +25,11 @@ type DBTask struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
TaskId int32 `protobuf:"varint,3,opt,name=taskId,proto3" json:"taskId" bson:"taskId"` //任务Id
|
||||
Tag int32 `protobuf:"varint,4,opt,name=tag,proto3" json:"tag" bson:"tag"` //标签
|
||||
Progress int32 `protobuf:"varint,5,opt,name=progress,proto3" json:"progress" bson:"progress"` //任务进度/完成次数
|
||||
Active int32 `protobuf:"varint,6,opt,name=active,proto3" json:"active" bson:"active"` //活跃度
|
||||
Status int32 `protobuf:"varint,7,opt,name=status,proto3" json:"status" bson:"status"` // 任务状态 默认0未完成 1已完成
|
||||
Received int32 `protobuf:"varint,8,opt,name=received,proto3" json:"received" bson:"received"` //领取状态 默认0未领取 1已领取
|
||||
TypeId int32 `protobuf:"varint,9,opt,name=typeId,proto3" json:"typeId" bson:"typeId"`
|
||||
Sort int32 `protobuf:"varint,10,opt,name=sort,proto3" json:"sort" bson:"sort"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
DayList []*TaskData `protobuf:"bytes,4,rep,name=dayList,proto3" json:"dayList" bson:"dayList"` //日常任务列表
|
||||
WeekList []*TaskData `protobuf:"bytes,5,rep,name=weekList,proto3" json:"weekList" bson:"weekList"` //周常任务列表
|
||||
AchieveList []*TaskData `protobuf:"bytes,6,rep,name=achieveList,proto3" json:"achieveList" bson:"achieveList"` //成就任务列表
|
||||
}
|
||||
|
||||
func (x *DBTask) Reset() {
|
||||
@ -83,76 +78,44 @@ func (x *DBTask) GetUid() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBTask) GetTaskId() int32 {
|
||||
func (x *DBTask) GetDayList() []*TaskData {
|
||||
if x != nil {
|
||||
return x.TaskId
|
||||
return x.DayList
|
||||
}
|
||||
return 0
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBTask) GetTag() int32 {
|
||||
func (x *DBTask) GetWeekList() []*TaskData {
|
||||
if x != nil {
|
||||
return x.Tag
|
||||
return x.WeekList
|
||||
}
|
||||
return 0
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBTask) GetProgress() int32 {
|
||||
func (x *DBTask) GetAchieveList() []*TaskData {
|
||||
if x != nil {
|
||||
return x.Progress
|
||||
return x.AchieveList
|
||||
}
|
||||
return 0
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBTask) GetActive() int32 {
|
||||
if x != nil {
|
||||
return x.Active
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBTask) GetStatus() int32 {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBTask) GetReceived() int32 {
|
||||
if x != nil {
|
||||
return x.Received
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBTask) GetTypeId() int32 {
|
||||
if x != nil {
|
||||
return x.TypeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBTask) GetSort() int32 {
|
||||
if x != nil {
|
||||
return x.Sort
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DBTaskActive struct {
|
||||
type TaskData struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
RId int32 `protobuf:"varint,3,opt,name=rId,proto3" json:"rId" bson:"taskId"` //rewardId
|
||||
Tag int32 `protobuf:"varint,4,opt,name=tag,proto3" json:"tag" bson:"tag"` //标签
|
||||
Received int32 `protobuf:"varint,5,opt,name=received,proto3" json:"received" bson:"received"` //领取状态 默认0未领取 1已领取
|
||||
TaskId int32 `protobuf:"varint,3,opt,name=taskId,proto3" json:"taskId" bson:"taskId"` //任务Id
|
||||
Tag int32 `protobuf:"varint,4,opt,name=tag,proto3" json:"tag" bson:"tag"` //标签
|
||||
Progress int32 `protobuf:"varint,5,opt,name=progress,proto3" json:"progress" bson:"progress"` //任务进度/完成次数
|
||||
Active int32 `protobuf:"varint,6,opt,name=active,proto3" json:"active" bson:"active"` //活跃度
|
||||
Status int32 `protobuf:"varint,7,opt,name=status,proto3" json:"status" bson:"status"` // 任务状态 默认0未完成 1已完成
|
||||
Received int32 `protobuf:"varint,8,opt,name=received,proto3" json:"received" bson:"received"` //领取状态 默认0未领取 1已领取
|
||||
TypeId int32 `protobuf:"varint,9,opt,name=typeId,proto3" json:"typeId" bson:"typeId"`
|
||||
Sort int32 `protobuf:"varint,10,opt,name=sort,proto3" json:"sort" bson:"sort"`
|
||||
}
|
||||
|
||||
func (x *DBTaskActive) Reset() {
|
||||
*x = DBTaskActive{}
|
||||
func (x *TaskData) Reset() {
|
||||
*x = TaskData{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_task_task_db_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -160,13 +123,13 @@ func (x *DBTaskActive) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DBTaskActive) String() string {
|
||||
func (x *TaskData) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DBTaskActive) ProtoMessage() {}
|
||||
func (*TaskData) ProtoMessage() {}
|
||||
|
||||
func (x *DBTaskActive) ProtoReflect() protoreflect.Message {
|
||||
func (x *TaskData) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_task_task_db_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -178,40 +141,187 @@ func (x *DBTaskActive) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DBTaskActive.ProtoReflect.Descriptor instead.
|
||||
func (*DBTaskActive) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use TaskData.ProtoReflect.Descriptor instead.
|
||||
func (*TaskData) Descriptor() ([]byte, []int) {
|
||||
return file_task_task_db_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *DBTaskActive) GetId() string {
|
||||
func (x *TaskData) GetTaskId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBTaskActive) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBTaskActive) GetRId() int32 {
|
||||
if x != nil {
|
||||
return x.RId
|
||||
return x.TaskId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBTaskActive) GetTag() int32 {
|
||||
func (x *TaskData) GetTag() int32 {
|
||||
if x != nil {
|
||||
return x.Tag
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBTaskActive) GetReceived() int32 {
|
||||
func (x *TaskData) GetProgress() int32 {
|
||||
if x != nil {
|
||||
return x.Progress
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TaskData) GetActive() int32 {
|
||||
if x != nil {
|
||||
return x.Active
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TaskData) GetStatus() int32 {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TaskData) GetReceived() int32 {
|
||||
if x != nil {
|
||||
return x.Received
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TaskData) GetTypeId() int32 {
|
||||
if x != nil {
|
||||
return x.TypeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TaskData) GetSort() int32 {
|
||||
if x != nil {
|
||||
return x.Sort
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DBActivity struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
ActivityList []*ActivityData `protobuf:"bytes,3,rep,name=activityList,proto3" json:"activityList" bson:"activityList"` //活跃度列表
|
||||
}
|
||||
|
||||
func (x *DBActivity) Reset() {
|
||||
*x = DBActivity{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_task_task_db_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DBActivity) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DBActivity) ProtoMessage() {}
|
||||
|
||||
func (x *DBActivity) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_task_task_db_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 DBActivity.ProtoReflect.Descriptor instead.
|
||||
func (*DBActivity) Descriptor() ([]byte, []int) {
|
||||
return file_task_task_db_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *DBActivity) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBActivity) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBActivity) GetActivityList() []*ActivityData {
|
||||
if x != nil {
|
||||
return x.ActivityList
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ActivityData struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId" bson:"taskId"` //taskId
|
||||
Tag int32 `protobuf:"varint,2,opt,name=tag,proto3" json:"tag" bson:"tag"` //标签
|
||||
Received int32 `protobuf:"varint,3,opt,name=received,proto3" json:"received" bson:"received"` //领取状态 默认0未领取 1已领取
|
||||
}
|
||||
|
||||
func (x *ActivityData) Reset() {
|
||||
*x = ActivityData{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_task_task_db_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ActivityData) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ActivityData) ProtoMessage() {}
|
||||
|
||||
func (x *ActivityData) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_task_task_db_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 ActivityData.ProtoReflect.Descriptor instead.
|
||||
func (*ActivityData) Descriptor() ([]byte, []int) {
|
||||
return file_task_task_db_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ActivityData) GetTaskId() int32 {
|
||||
if x != nil {
|
||||
return x.TaskId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ActivityData) GetTag() int32 {
|
||||
if x != nil {
|
||||
return x.Tag
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ActivityData) GetReceived() int32 {
|
||||
if x != nil {
|
||||
return x.Received
|
||||
}
|
||||
@ -222,30 +332,42 @@ var File_task_task_db_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_task_task_db_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe8, 0x01, 0x0a, 0x06, 0x44, 0x42, 0x54, 0x61, 0x73, 0x6b, 0x12,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x01, 0x0a, 0x06, 0x44, 0x42, 0x54, 0x61, 0x73, 0x6b, 0x12,
|
||||
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69,
|
||||
0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70,
|
||||
0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70,
|
||||
0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76,
|
||||
0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69,
|
||||
0x76, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69,
|
||||
0x76, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x64, 0x18, 0x09, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73,
|
||||
0x6f, 0x72, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x22,
|
||||
0x70, 0x0a, 0x0c, 0x44, 0x42, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12,
|
||||
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69,
|
||||
0x64, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03,
|
||||
0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
|
||||
0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
|
||||
0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
0x64, 0x12, 0x23, 0x0a, 0x07, 0x64, 0x61, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x04, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x64,
|
||||
0x61, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x08, 0x77, 0x65, 0x65, 0x6b, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x44,
|
||||
0x61, 0x74, 0x61, 0x52, 0x08, 0x77, 0x65, 0x65, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2b, 0x0a,
|
||||
0x0b, 0x61, 0x63, 0x68, 0x69, 0x65, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x06, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x61,
|
||||
0x63, 0x68, 0x69, 0x65, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x22, 0xc8, 0x01, 0x0a, 0x08, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x74, 0x61,
|
||||
0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61,
|
||||
0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
|
||||
0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x79, 0x70,
|
||||
0x65, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x79, 0x70, 0x65, 0x49,
|
||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x04, 0x73, 0x6f, 0x72, 0x74, 0x22, 0x61, 0x0a, 0x0a, 0x44, 0x42, 0x41, 0x63, 0x74, 0x69, 0x76,
|
||||
0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x31, 0x0a, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
|
||||
0x79, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63,
|
||||
0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69,
|
||||
0x76, 0x69, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x54, 0x0a, 0x0c, 0x41, 0x63, 0x74, 0x69,
|
||||
0x76, 0x69, 0x74, 0x79, 0x44, 0x61, 0x74, 0x61, 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, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x74,
|
||||
0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -260,17 +382,23 @@ func file_task_task_db_proto_rawDescGZIP() []byte {
|
||||
return file_task_task_db_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_task_task_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_task_task_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_task_task_db_proto_goTypes = []interface{}{
|
||||
(*DBTask)(nil), // 0: DBTask
|
||||
(*DBTaskActive)(nil), // 1: DBTaskActive
|
||||
(*TaskData)(nil), // 1: TaskData
|
||||
(*DBActivity)(nil), // 2: DBActivity
|
||||
(*ActivityData)(nil), // 3: ActivityData
|
||||
}
|
||||
var file_task_task_db_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
1, // 0: DBTask.dayList:type_name -> TaskData
|
||||
1, // 1: DBTask.weekList:type_name -> TaskData
|
||||
1, // 2: DBTask.achieveList:type_name -> TaskData
|
||||
3, // 3: DBActivity.activityList:type_name -> ActivityData
|
||||
4, // [4:4] is the sub-list for method output_type
|
||||
4, // [4:4] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_task_task_db_proto_init() }
|
||||
@ -292,7 +420,31 @@ func file_task_task_db_proto_init() {
|
||||
}
|
||||
}
|
||||
file_task_task_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DBTaskActive); i {
|
||||
switch v := v.(*TaskData); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_task_task_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DBActivity); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_task_task_db_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ActivityData); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -310,7 +462,7 @@ func file_task_task_db_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_task_task_db_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -26,8 +26,8 @@ type TaskReceiveReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
TaskTag int32 `protobuf:"varint,1,opt,name=taskTag,proto3" json:"taskTag"` // 1日常/2周常/3成就
|
||||
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id"` //任务唯一ID
|
||||
TaskTag int32 `protobuf:"varint,1,opt,name=taskTag,proto3" json:"taskTag"` // 1日常/2周常/3成就
|
||||
Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id"` //任务唯一ID
|
||||
}
|
||||
|
||||
func (x *TaskReceiveReq) Reset() {
|
||||
@ -69,11 +69,11 @@ func (x *TaskReceiveReq) GetTaskTag() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TaskReceiveReq) GetId() string {
|
||||
func (x *TaskReceiveReq) GetId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
type TaskReceiveResp struct {
|
||||
@ -176,7 +176,7 @@ type TaskListResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
List []*DBTask `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
|
||||
List []*TaskData `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
|
||||
}
|
||||
|
||||
func (x *TaskListResp) Reset() {
|
||||
@ -211,7 +211,7 @@ func (*TaskListResp) Descriptor() ([]byte, []int) {
|
||||
return file_task_task_msg_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *TaskListResp) GetList() []*DBTask {
|
||||
func (x *TaskListResp) GetList() []*TaskData {
|
||||
if x != nil {
|
||||
return x.List
|
||||
}
|
||||
@ -271,7 +271,7 @@ type TaskActiveListResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
List []*DBTaskActive `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` //活跃度列表
|
||||
List []*ActivityData `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` //活跃度列表
|
||||
Active int32 `protobuf:"varint,2,opt,name=active,proto3" json:"active"` //活跃度值
|
||||
}
|
||||
|
||||
@ -307,7 +307,7 @@ func (*TaskActiveListResp) Descriptor() ([]byte, []int) {
|
||||
return file_task_task_msg_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *TaskActiveListResp) GetList() []*DBTaskActive {
|
||||
func (x *TaskActiveListResp) GetList() []*ActivityData {
|
||||
if x != nil {
|
||||
return x.List
|
||||
}
|
||||
@ -327,8 +327,8 @@ type TaskActiveReceiveReq struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
TaskTag int32 `protobuf:"varint,1,opt,name=taskTag,proto3" json:"taskTag"` // 1日常/2周常
|
||||
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id"` //唯一id
|
||||
TaskTag int32 `protobuf:"varint,1,opt,name=taskTag,proto3" json:"taskTag"` // 1日常/2周常
|
||||
Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id"` //唯一id
|
||||
}
|
||||
|
||||
func (x *TaskActiveReceiveReq) Reset() {
|
||||
@ -370,11 +370,11 @@ func (x *TaskActiveReceiveReq) GetTaskTag() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TaskActiveReceiveReq) GetId() string {
|
||||
func (x *TaskActiveReceiveReq) GetId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
type TaskActiveReceiveResp struct {
|
||||
@ -382,8 +382,8 @@ type TaskActiveReceiveResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
TaskTag int32 `protobuf:"varint,1,opt,name=taskTag,proto3" json:"taskTag"`
|
||||
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id"`
|
||||
TaskTag int32 `protobuf:"varint,1,opt,name=taskTag,proto3" json:"taskTag"`
|
||||
Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id"`
|
||||
}
|
||||
|
||||
func (x *TaskActiveReceiveResp) Reset() {
|
||||
@ -425,108 +425,13 @@ func (x *TaskActiveReceiveResp) GetTaskTag() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TaskActiveReceiveResp) GetId() string {
|
||||
func (x *TaskActiveReceiveResp) GetId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
//攻略
|
||||
type TaskDoStrategyReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
HeroCfgId int32 `protobuf:"varint,1,opt,name=heroCfgId,proto3" json:"heroCfgId"` //英雄ID
|
||||
}
|
||||
|
||||
func (x *TaskDoStrategyReq) Reset() {
|
||||
*x = TaskDoStrategyReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_task_task_msg_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *TaskDoStrategyReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TaskDoStrategyReq) ProtoMessage() {}
|
||||
|
||||
func (x *TaskDoStrategyReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_task_task_msg_proto_msgTypes[8]
|
||||
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 TaskDoStrategyReq.ProtoReflect.Descriptor instead.
|
||||
func (*TaskDoStrategyReq) Descriptor() ([]byte, []int) {
|
||||
return file_task_task_msg_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *TaskDoStrategyReq) GetHeroCfgId() int32 {
|
||||
if x != nil {
|
||||
return x.HeroCfgId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type TaskDoStrategyResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
TaskIds []int32 `protobuf:"varint,1,rep,packed,name=taskIds,proto3" json:"taskIds"` //任务ID
|
||||
}
|
||||
|
||||
func (x *TaskDoStrategyResp) Reset() {
|
||||
*x = TaskDoStrategyResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_task_task_msg_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *TaskDoStrategyResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TaskDoStrategyResp) ProtoMessage() {}
|
||||
|
||||
func (x *TaskDoStrategyResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_task_task_msg_proto_msgTypes[9]
|
||||
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 TaskDoStrategyResp.ProtoReflect.Descriptor instead.
|
||||
func (*TaskDoStrategyResp) Descriptor() ([]byte, []int) {
|
||||
return file_task_task_msg_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *TaskDoStrategyResp) GetTaskIds() []int32 {
|
||||
if x != nil {
|
||||
return x.TaskIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//任务完成推送
|
||||
type TaskFinishedPush struct {
|
||||
state protoimpl.MessageState
|
||||
@ -539,7 +444,7 @@ type TaskFinishedPush struct {
|
||||
func (x *TaskFinishedPush) Reset() {
|
||||
*x = TaskFinishedPush{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_task_task_msg_proto_msgTypes[10]
|
||||
mi := &file_task_task_msg_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -552,7 +457,7 @@ func (x *TaskFinishedPush) String() string {
|
||||
func (*TaskFinishedPush) ProtoMessage() {}
|
||||
|
||||
func (x *TaskFinishedPush) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_task_task_msg_proto_msgTypes[10]
|
||||
mi := &file_task_task_msg_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -565,7 +470,7 @@ func (x *TaskFinishedPush) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use TaskFinishedPush.ProtoReflect.Descriptor instead.
|
||||
func (*TaskFinishedPush) Descriptor() ([]byte, []int) {
|
||||
return file_task_task_msg_proto_rawDescGZIP(), []int{10}
|
||||
return file_task_task_msg_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *TaskFinishedPush) GetTaskId() int32 {
|
||||
@ -584,41 +489,35 @@ var file_task_task_msg_proto_rawDesc = []byte{
|
||||
0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x29, 0x0a, 0x0f, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63,
|
||||
0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x29, 0x0a, 0x0f, 0x54, 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, 0x27, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x2b, 0x0a, 0x0c, 0x54, 0x61, 0x73,
|
||||
0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x6c, 0x69, 0x73,
|
||||
0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x54, 0x61, 0x73, 0x6b,
|
||||
0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2d, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63,
|
||||
0x74, 0x69, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x4f, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74,
|
||||
0x69, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x6c,
|
||||
0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x54, 0x61,
|
||||
0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
|
||||
0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x40, 0x0a, 0x14, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63,
|
||||
0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x41, 0x0a, 0x15, 0x54, 0x61, 0x73, 0x6b,
|
||||
0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73,
|
||||
0x70, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x31, 0x0a, 0x11, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x44, 0x6f, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x52, 0x65, 0x71,
|
||||
0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x43, 0x66, 0x67, 0x49, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x43, 0x66, 0x67, 0x49, 0x64, 0x22, 0x2e,
|
||||
0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x6f, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
|
||||
0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18,
|
||||
0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x22, 0x2a,
|
||||
0x0a, 0x10, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x50, 0x75,
|
||||
0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
|
||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x2d, 0x0a, 0x0c, 0x54, 0x61, 0x73,
|
||||
0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x6c, 0x69, 0x73,
|
||||
0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x61,
|
||||
0x74, 0x61, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2d, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b,
|
||||
0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
|
||||
0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x4f, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41,
|
||||
0x63, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a,
|
||||
0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63,
|
||||
0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x40, 0x0a, 0x14, 0x54, 0x61, 0x73, 0x6b,
|
||||
0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x41, 0x0a, 0x15, 0x54, 0x61,
|
||||
0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52,
|
||||
0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2a, 0x0a,
|
||||
0x10, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x50, 0x75, 0x73,
|
||||
0x68, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -633,7 +532,7 @@ func file_task_task_msg_proto_rawDescGZIP() []byte {
|
||||
return file_task_task_msg_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_task_task_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_task_task_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_task_task_msg_proto_goTypes = []interface{}{
|
||||
(*TaskReceiveReq)(nil), // 0: TaskReceiveReq
|
||||
(*TaskReceiveResp)(nil), // 1: TaskReceiveResp
|
||||
@ -643,15 +542,13 @@ var file_task_task_msg_proto_goTypes = []interface{}{
|
||||
(*TaskActiveListResp)(nil), // 5: TaskActiveListResp
|
||||
(*TaskActiveReceiveReq)(nil), // 6: TaskActiveReceiveReq
|
||||
(*TaskActiveReceiveResp)(nil), // 7: TaskActiveReceiveResp
|
||||
(*TaskDoStrategyReq)(nil), // 8: TaskDoStrategyReq
|
||||
(*TaskDoStrategyResp)(nil), // 9: TaskDoStrategyResp
|
||||
(*TaskFinishedPush)(nil), // 10: TaskFinishedPush
|
||||
(*DBTask)(nil), // 11: DBTask
|
||||
(*DBTaskActive)(nil), // 12: DBTaskActive
|
||||
(*TaskFinishedPush)(nil), // 8: TaskFinishedPush
|
||||
(*TaskData)(nil), // 9: TaskData
|
||||
(*ActivityData)(nil), // 10: ActivityData
|
||||
}
|
||||
var file_task_task_msg_proto_depIdxs = []int32{
|
||||
11, // 0: TaskListResp.list:type_name -> DBTask
|
||||
12, // 1: TaskActiveListResp.list:type_name -> DBTaskActive
|
||||
9, // 0: TaskListResp.list:type_name -> TaskData
|
||||
10, // 1: TaskActiveListResp.list:type_name -> ActivityData
|
||||
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
|
||||
@ -763,30 +660,6 @@ func file_task_task_msg_proto_init() {
|
||||
}
|
||||
}
|
||||
file_task_task_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TaskDoStrategyReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_task_task_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TaskDoStrategyResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_task_task_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TaskFinishedPush); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@ -805,7 +678,7 @@ func file_task_task_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_task_task_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 11,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
42
sys/configure/structs/Game.EnchantBoss.go
Normal file
42
sys/configure/structs/Game.EnchantBoss.go
Normal file
@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
type GameEnchantBoss struct {
|
||||
_dataMap map[int32]*GameEnchantBossData
|
||||
_dataList []*GameEnchantBossData
|
||||
}
|
||||
|
||||
func NewGameEnchantBoss(_buf []map[string]interface{}) (*GameEnchantBoss, error) {
|
||||
_dataList := make([]*GameEnchantBossData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GameEnchantBossData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGameEnchantBossData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.Id] = _v
|
||||
}
|
||||
}
|
||||
return &GameEnchantBoss{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GameEnchantBoss) GetDataMap() map[int32]*GameEnchantBossData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GameEnchantBoss) GetDataList() []*GameEnchantBossData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GameEnchantBoss) Get(key int32) *GameEnchantBossData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
143
sys/configure/structs/Game.EnchantBossData.go
Normal file
143
sys/configure/structs/Game.EnchantBossData.go
Normal file
@ -0,0 +1,143 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
import "errors"
|
||||
|
||||
type GameEnchantBossData struct {
|
||||
Id int32
|
||||
Bossid int32
|
||||
Name string
|
||||
Grade string
|
||||
ScoreLow int32
|
||||
ScoreUp int32
|
||||
RewardDrop []int32
|
||||
Dropshow1 []*Gameatn
|
||||
Dropshow2 []*Gameatn
|
||||
Dropshow3 []*Gameatn
|
||||
Dropshow []int32
|
||||
Bossmodel int32
|
||||
MainText string
|
||||
StrategyText string
|
||||
BossSkill int32
|
||||
Boss []int32
|
||||
}
|
||||
|
||||
const TypeId_GameEnchantBossData = -287548876
|
||||
|
||||
func (*GameEnchantBossData) GetTypeId() int32 {
|
||||
return -287548876
|
||||
}
|
||||
|
||||
func (_v *GameEnchantBossData)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["bossid"].(float64); !_ok_ { err = errors.New("bossid error"); return }; _v.Bossid = int32(_tempNum_) }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
{ var _ok_ bool; if _v.Grade, _ok_ = _buf["grade"].(string); !_ok_ { err = errors.New("grade error"); return } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["score_low"].(float64); !_ok_ { err = errors.New("score_low error"); return }; _v.ScoreLow = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["score_up"].(float64); !_ok_ { err = errors.New("score_up error"); return }; _v.ScoreUp = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["reward_drop"].([]interface{}); !_ok_ { err = errors.New("reward_drop error"); return }
|
||||
|
||||
_v.RewardDrop = make([]int32, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ int32
|
||||
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
|
||||
_v.RewardDrop = append(_v.RewardDrop, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["dropshow1"].([]interface{}); !_ok_ { err = errors.New("dropshow1 error"); return }
|
||||
|
||||
_v.Dropshow1 = make([]*Gameatn, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ *Gameatn
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
_v.Dropshow1 = append(_v.Dropshow1, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["dropshow2"].([]interface{}); !_ok_ { err = errors.New("dropshow2 error"); return }
|
||||
|
||||
_v.Dropshow2 = make([]*Gameatn, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ *Gameatn
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
_v.Dropshow2 = append(_v.Dropshow2, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["dropshow3"].([]interface{}); !_ok_ { err = errors.New("dropshow3 error"); return }
|
||||
|
||||
_v.Dropshow3 = make([]*Gameatn, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ *Gameatn
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
_v.Dropshow3 = append(_v.Dropshow3, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["dropshow"].([]interface{}); !_ok_ { err = errors.New("dropshow error"); return }
|
||||
|
||||
_v.Dropshow = make([]int32, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ int32
|
||||
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
|
||||
_v.Dropshow = append(_v.Dropshow, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["bossmodel"].(float64); !_ok_ { err = errors.New("bossmodel error"); return }; _v.Bossmodel = int32(_tempNum_) }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["main_text"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.MainText error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.MainText, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["strategy_text"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.StrategyText error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.StrategyText, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["boss_skill"].(float64); !_ok_ { err = errors.New("boss_skill error"); return }; _v.BossSkill = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["boss"].([]interface{}); !_ok_ { err = errors.New("boss error"); return }
|
||||
|
||||
_v.Boss = make([]int32, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ int32
|
||||
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
|
||||
_v.Boss = append(_v.Boss, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGameEnchantBossData(_buf map[string]interface{}) (*GameEnchantBossData, error) {
|
||||
v := &GameEnchantBossData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
42
sys/configure/structs/Game.EnchantShop.go
Normal file
42
sys/configure/structs/Game.EnchantShop.go
Normal file
@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
type GameEnchantShop struct {
|
||||
_dataMap map[int32]*GameEnchantShopData
|
||||
_dataList []*GameEnchantShopData
|
||||
}
|
||||
|
||||
func NewGameEnchantShop(_buf []map[string]interface{}) (*GameEnchantShop, error) {
|
||||
_dataList := make([]*GameEnchantShopData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GameEnchantShopData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGameEnchantShopData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.Buynum] = _v
|
||||
}
|
||||
}
|
||||
return &GameEnchantShop{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GameEnchantShop) GetDataMap() map[int32]*GameEnchantShopData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GameEnchantShop) GetDataList() []*GameEnchantShopData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GameEnchantShop) Get(key int32) *GameEnchantShopData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
50
sys/configure/structs/Game.EnchantShopData.go
Normal file
50
sys/configure/structs/Game.EnchantShopData.go
Normal file
@ -0,0 +1,50 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
import "errors"
|
||||
|
||||
type GameEnchantShopData struct {
|
||||
Buynum int32
|
||||
Need []*Gameatn
|
||||
}
|
||||
|
||||
const TypeId_GameEnchantShopData = 1535577405
|
||||
|
||||
func (*GameEnchantShopData) GetTypeId() int32 {
|
||||
return 1535577405
|
||||
}
|
||||
|
||||
func (_v *GameEnchantShopData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buynum"].(float64); !_ok_ { err = errors.New("buynum error"); return }; _v.Buynum = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["need"].([]interface{}); !_ok_ { err = errors.New("need error"); return }
|
||||
|
||||
_v.Need = make([]*Gameatn, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ *Gameatn
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
_v.Need = append(_v.Need, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGameEnchantShopData(_buf map[string]interface{}) (*GameEnchantShopData, error) {
|
||||
v := &GameEnchantShopData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user