活跃度
This commit is contained in:
parent
849e501842
commit
b6feed3aba
@ -26,7 +26,7 @@ var (
|
|||||||
fmt.Printf("%v \n", v)
|
fmt.Printf("%v \n", v)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled: true,
|
// enabled: true,
|
||||||
}, {
|
}, {
|
||||||
Desc: "领取任务奖励",
|
Desc: "领取任务奖励",
|
||||||
mainType: string(comm.ModuleTask),
|
mainType: string(comm.ModuleTask),
|
||||||
@ -38,11 +38,24 @@ var (
|
|||||||
rsp: &pb.TaskReceiveResp{},
|
rsp: &pb.TaskReceiveResp{},
|
||||||
// enabled: true,
|
// enabled: true,
|
||||||
}, {
|
}, {
|
||||||
|
Desc: "活跃度",
|
||||||
mainType: string(comm.ModuleTask),
|
mainType: string(comm.ModuleTask),
|
||||||
subType: "active",
|
subType: task.TaskSubTypeActiveList,
|
||||||
req: &pb.TaskActiveReq{},
|
req: &pb.TaskActiveListReq{
|
||||||
rsp: &pb.TaskActiveResp{},
|
TaskTag: int32(comm.TASK_DAILY),
|
||||||
|
},
|
||||||
|
rsp: &pb.TaskActiveListResp{},
|
||||||
// enabled: true,
|
// enabled: true,
|
||||||
|
}, {
|
||||||
|
Desc: "活跃度领取",
|
||||||
|
mainType: string(comm.ModuleTask),
|
||||||
|
subType: task.TaskSubTypeActiveReceive,
|
||||||
|
req: &pb.TaskActiveReceiveReq{
|
||||||
|
Id: "62c676d57deea8b9af8884fb",
|
||||||
|
TaskTag: int32(comm.TASK_DAILY),
|
||||||
|
},
|
||||||
|
rsp: &pb.TaskActiveReceiveResp{},
|
||||||
|
enabled: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -14,7 +14,7 @@ var user_builders = []*TestCase{
|
|||||||
mainType: string(comm.ModuleUser),
|
mainType: string(comm.ModuleUser),
|
||||||
subType: user.UserSubTypeCreate,
|
subType: user.UserSubTypeCreate,
|
||||||
req: &pb.UserCreateReq{ //设置请求参数
|
req: &pb.UserCreateReq{ //设置请求参数
|
||||||
NickName: "乐谷70614",
|
NickName: "乐谷70616",
|
||||||
},
|
},
|
||||||
rsp: &pb.UserCreateResp{},
|
rsp: &pb.UserCreateResp{},
|
||||||
// enabled: true,
|
// enabled: true,
|
||||||
|
@ -78,11 +78,11 @@ type (
|
|||||||
//任务
|
//任务
|
||||||
ITask interface {
|
ITask interface {
|
||||||
//初始化用户任务
|
//初始化用户任务
|
||||||
InitTask(uid string, taskTag TaskTag) (code pb.ErrorCode)
|
InitTask(uid string, taskTag TaskTag)
|
||||||
//初始化 日常/周常/成就
|
//初始化 日常/周常/成就
|
||||||
InitTaskAll(uid string) (code pb.ErrorCode)
|
InitTaskAll(uid string)
|
||||||
//清空任务
|
//清空任务
|
||||||
ResetTask(uid string, taskTag TaskTag) (code pb.ErrorCode)
|
ResetTask(uid string, taskTag TaskTag)
|
||||||
//任务通知
|
//任务通知
|
||||||
SendToTask(uid string, taskType TaskType, param *pb.TaskParam) (code pb.ErrorCode)
|
SendToTask(uid string, taskType TaskType, param *pb.TaskParam) (code pb.ErrorCode)
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
TaskSubTypeList = "list" //任务列表
|
TaskSubTypeList = "list" //任务列表
|
||||||
TaskSubTypeReceive = "receive" //领取
|
TaskSubTypeReceive = "receive" //领取
|
||||||
|
TaskSubTypeActiveList = "activelist" //活跃度列表
|
||||||
|
TaskSubTypeActiveReceive = "activereceive" //活跃度领取
|
||||||
)
|
)
|
||||||
|
|
||||||
type apiComp struct {
|
type apiComp struct {
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
package task
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go_dreamfactory/comm"
|
|
||||||
"go_dreamfactory/pb"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
//用于测试
|
|
||||||
|
|
||||||
func (this *apiComp) ActiveCheck(session comm.IUserSession, req *pb.TaskActiveReq) (code pb.ErrorCode) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *apiComp) Active(session comm.IUserSession, req *pb.TaskActiveReq) (code pb.ErrorCode, data proto.Message) {
|
|
||||||
this.moduleTask.ModuleTask.SendToTask(session.GetUserId(), comm.TaskTypeGetHero, &pb.TaskParam{First: 5})
|
|
||||||
return
|
|
||||||
}
|
|
35
modules/task/api_activelist.go
Normal file
35
modules/task/api_activelist.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package task
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/utils"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
//活跃度
|
||||||
|
func (this *apiComp) ActiveListCheck(session comm.IUserSession, req *pb.TaskActiveListReq) (code pb.ErrorCode) {
|
||||||
|
if req.TaskTag == 0 {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveListReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
|
// this.moduleTask.ModuleTask.SendToTask(session.GetUserId(), comm.TaskTypeGetHero, &pb.TaskParam{First: 5})
|
||||||
|
|
||||||
|
resp := &pb.TaskActiveListResp{}
|
||||||
|
defer func() {
|
||||||
|
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveList, resp)
|
||||||
|
if err != nil {
|
||||||
|
code = pb.ErrorCode_SystemError
|
||||||
|
}
|
||||||
|
utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveList, req, resp)
|
||||||
|
}()
|
||||||
|
|
||||||
|
//遍历活跃度奖励表
|
||||||
|
resp.List = this.moduleTask.modelTaskActive.getUserActiveList(session.GetUserId(), comm.TaskTag(req.TaskTag))
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
52
modules/task/api_activereceive.go
Normal file
52
modules/task/api_activereceive.go
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package task
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/utils"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
//活跃度领取
|
||||||
|
func (this *apiComp) ActiveReceiveCheck(session comm.IUserSession, req *pb.TaskActiveReceiveReq) (code pb.ErrorCode) {
|
||||||
|
if req.Id == "" || req.TaskTag == 0 {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActiveReceiveReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
|
resp := &pb.TaskActiveReceiveResp{
|
||||||
|
TaskTag: req.TaskTag,
|
||||||
|
Id: req.Id,
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, resp)
|
||||||
|
if err != nil {
|
||||||
|
code = pb.ErrorCode_SystemError
|
||||||
|
}
|
||||||
|
utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, req, resp)
|
||||||
|
}()
|
||||||
|
|
||||||
|
ua := this.moduleTask.modelTaskActive.getUserActive(session.GetUserId(), req.Id, comm.TaskTag(req.TaskTag))
|
||||||
|
if ua == nil {
|
||||||
|
code = pb.ErrorCode_TaskActiveNofound
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
conf := this.moduleTask.configure.getTaskActiveById(ua.RId)
|
||||||
|
if conf == nil {
|
||||||
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
code = this.moduleTask.modelTaskActive.receiveHandle(session.GetUserId(), req.Id, conf, ua, comm.TaskTag(req.TaskTag))
|
||||||
|
if code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//派发奖励
|
||||||
|
code = this.moduleTask.DispenseRes(session.GetUserId(), conf.Reword)
|
||||||
|
return
|
||||||
|
}
|
@ -129,3 +129,35 @@ func (this *configureComp) getTaskByTag(taskTag int32) (data []*cfg.Game_taskRou
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取活跃度奖励
|
||||||
|
func (this *configureComp) getTaskActiveByTag(taskTag int32) (data []*cfg.Game_activeRewardData, err error) {
|
||||||
|
conf, err := this.getActiveRewardCfg()
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("get conf err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if conf != nil {
|
||||||
|
for _, v := range conf.GetDataList() {
|
||||||
|
if v.IdTag == taskTag {
|
||||||
|
data = append(data, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *configureComp) getTaskActiveById(id int32) (data *cfg.Game_activeRewardData) {
|
||||||
|
conf, err := this.getActiveRewardCfg()
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("get conf err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if conf != nil {
|
||||||
|
if v, ok := conf.GetDataMap()[id]; ok {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
package task
|
|
||||||
|
|
118
modules/task/model_active.go
Normal file
118
modules/task/model_active.go
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
package task
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
)
|
||||||
|
|
||||||
|
const ( //Redis
|
||||||
|
TableTaskActive core.SqlTable = "taskactive" //活跃度表
|
||||||
|
)
|
||||||
|
|
||||||
|
type ModelTaskActive struct {
|
||||||
|
modules.MCompModel
|
||||||
|
moduleTask *ModuleTask
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ModelTaskActive) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
|
this.moduleTask = module.(*ModuleTask)
|
||||||
|
this.TableName = string(TableTaskActive)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化活跃度
|
||||||
|
func (this *ModelTaskActive) initActiveRewardByTag(uid string, taskTag comm.TaskTag) {
|
||||||
|
data, err := this.moduleTask.configure.getTaskActiveByTag(int32(taskTag))
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("uid:%v tag:%v initActiveRewardByTag err %v", uid, taskTag, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, conf := range data {
|
||||||
|
objId := primitive.NewObjectID().Hex()
|
||||||
|
ta := &pb.DBTaskActive{
|
||||||
|
Id: objId,
|
||||||
|
Uid: uid,
|
||||||
|
RId: conf.Key,
|
||||||
|
}
|
||||||
|
if err := this.moduleTask.modelTaskActive.AddList(swapKey(uid, taskTag), ta.Id, ta); err != nil {
|
||||||
|
log.Errorf("uid:%v tag:%v initActiv add err %v", uid, taskTag, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取玩家活跃度列表
|
||||||
|
func (this *ModelTaskActive) getUserActiveList(uid string, taskTag comm.TaskTag) []*pb.DBTaskActive {
|
||||||
|
al := []*pb.DBTaskActive{}
|
||||||
|
if err := this.GetList(swapKey(uid, taskTag), &al); err != nil {
|
||||||
|
log.Errorf("getUserActiveList err:%v", err)
|
||||||
|
return al
|
||||||
|
}
|
||||||
|
return al
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取玩家活跃记录 id 唯一ID
|
||||||
|
func (this *ModelTaskActive) getUserActive(uid, id string, taskTag comm.TaskTag) *pb.DBTaskActive {
|
||||||
|
record := this.getUserActiveList(uid, taskTag)
|
||||||
|
for _, v := range record {
|
||||||
|
if v.Id == id {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ModelTaskActive) updateReceive(uid, id string, taskTag comm.TaskTag, data map[string]interface{}) error {
|
||||||
|
return this.moduleTask.modelTaskActive.ChangeList(swapKey(uid, taskTag), id, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
//领取处理
|
||||||
|
func (this *ModelTaskActive) receiveHandle(uid, id string, conf *cfg.Game_activeRewardData,
|
||||||
|
ua *pb.DBTaskActive, taskTag comm.TaskTag) (code pb.ErrorCode) {
|
||||||
|
if conf == nil {
|
||||||
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//玩家活跃度数
|
||||||
|
userActiveTotal := this.moduleTask.modelTask.countActive(uid, taskTag)
|
||||||
|
|
||||||
|
if ua.Received == 0 { //未领取
|
||||||
|
if userActiveTotal >= conf.Active {
|
||||||
|
//更新玩家领取状态
|
||||||
|
update := map[string]interface{}{
|
||||||
|
"received": 1, //标识已领取
|
||||||
|
}
|
||||||
|
if err := this.updateReceive(uid, ua.Id, taskTag, update); err != nil {
|
||||||
|
log.Errorf("updateReceive err %v", err)
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
code = pb.ErrorCode_TaskActiveNoenough
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
code = pb.ErrorCode_TaskReceived
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//清空任务
|
||||||
|
func (this *ModelTaskActive) clearTask(uid string, taskTag comm.TaskTag) error {
|
||||||
|
data := this.getUserActiveList(uid, taskTag)
|
||||||
|
for _, v := range data {
|
||||||
|
if err := this.moduleTask.modelTask.DelListlds(swapKey(uid, taskTag), v.Id); err != nil {
|
||||||
|
log.Errorf("uid: %v taskTag:%v err:%v", uid, taskTag, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
@ -1,2 +0,0 @@
|
|||||||
package task
|
|
||||||
|
|
@ -28,13 +28,13 @@ func (this *ModelTask) Init(service core.IService, module core.IModule, comp cor
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelTask) swapKey(uid string, tag comm.TaskTag) string {
|
func swapKey(uid string, tag comm.TaskTag) string {
|
||||||
return fmt.Sprintf("%s_%v", uid, tag)
|
return fmt.Sprintf("%s_%v", uid, tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取玩家任务列表
|
//获取玩家任务列表
|
||||||
func (this *ModelTask) getTaskList(uid string, taskTag comm.TaskTag) (list []*pb.DBTask) {
|
func (this *ModelTask) getTaskList(uid string, taskTag comm.TaskTag) (list []*pb.DBTask) {
|
||||||
if err := this.GetList(this.swapKey(uid, taskTag), &list); err != nil {
|
if err := this.GetList(swapKey(uid, taskTag), &list); err != nil {
|
||||||
log.Errorf("initTaskByTag err %v", err)
|
log.Errorf("initTaskByTag err %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -48,15 +48,16 @@ func (this *ModelTask) initTaskByTag(uid string, taskTag comm.TaskTag) error {
|
|||||||
return fmt.Errorf("clear data before init task")
|
return fmt.Errorf("clear data before init task")
|
||||||
}
|
}
|
||||||
if data, err := this.moduleTask.configure.getTaskByTag(int32(taskTag)); err == nil {
|
if data, err := this.moduleTask.configure.getTaskByTag(int32(taskTag)); err == nil {
|
||||||
for _, v := range data {
|
for _, cnf := range data {
|
||||||
objId := primitive.NewObjectID().Hex()
|
objId := primitive.NewObjectID().Hex()
|
||||||
task := &pb.DBTask{
|
task := &pb.DBTask{
|
||||||
Id: objId,
|
Id: objId,
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
TaskId: v.Key,
|
TaskId: cnf.Key,
|
||||||
Progress: v.ConditionSecond,
|
Active: cnf.Active,
|
||||||
|
Progress: cnf.ConditionSecond,
|
||||||
}
|
}
|
||||||
if err := this.AddList(this.swapKey(uid, taskTag), task.Id, task); err != nil {
|
if err := this.AddList(swapKey(uid, taskTag), task.Id, task); err != nil {
|
||||||
log.Errorf("initTaskByTag addlists err %v", err)
|
log.Errorf("initTaskByTag addlists err %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -68,18 +69,13 @@ func (this *ModelTask) initTaskByTag(uid string, taskTag comm.TaskTag) error {
|
|||||||
//查询用户任务
|
//查询用户任务
|
||||||
func (this *ModelTask) getUserTask(uid string, taskTag comm.TaskTag, taskId string) *pb.DBTask {
|
func (this *ModelTask) getUserTask(uid string, taskTag comm.TaskTag, taskId string) *pb.DBTask {
|
||||||
userTask := &pb.DBTask{}
|
userTask := &pb.DBTask{}
|
||||||
if err := this.moduleTask.modelTask.GetListObj(this.swapKey(uid, taskTag), taskId, userTask); err != nil {
|
if err := this.moduleTask.modelTask.GetListObj(swapKey(uid, taskTag), taskId, userTask); err != nil {
|
||||||
log.Errorf("getUserTask err:%v", err)
|
log.Errorf("getUserTask err:%v", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return userTask
|
return userTask
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查活跃度
|
|
||||||
func (this *ModelTask) checkActiveVal(uid string) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取未完成的任务列表
|
//获取未完成的任务列表
|
||||||
func (this *ModelTask) getUnFinishTaskList(uid string, taskTag comm.TaskTag) (list []*pb.DBTask) {
|
func (this *ModelTask) getUnFinishTaskList(uid string, taskTag comm.TaskTag) (list []*pb.DBTask) {
|
||||||
taskList := this.getTaskList(uid, taskTag)
|
taskList := this.getTaskList(uid, taskTag)
|
||||||
@ -91,6 +87,17 @@ func (this *ModelTask) getUnFinishTaskList(uid string, taskTag comm.TaskTag) (li
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//活跃度统计
|
||||||
|
func (this *ModelTask) countActive(uid string, taskTag comm.TaskTag) (total int32) {
|
||||||
|
taskList := this.getTaskList(uid, taskTag)
|
||||||
|
for _, v := range taskList {
|
||||||
|
if v.Status == 1 {
|
||||||
|
total += v.Active
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//检查任务进度 返回未完成的
|
//检查任务进度 返回未完成的
|
||||||
func (this *ModelTask) checkTaskProgress(uid string, config *cfg.Game_taskRoundData) (*pb.DBTask, bool) {
|
func (this *ModelTask) checkTaskProgress(uid string, config *cfg.Game_taskRoundData) (*pb.DBTask, bool) {
|
||||||
taskList := this.getUnFinishTaskList(uid, comm.TaskTag(config.IdTag))
|
taskList := this.getUnFinishTaskList(uid, comm.TaskTag(config.IdTag))
|
||||||
@ -105,7 +112,7 @@ func (this *ModelTask) checkTaskProgress(uid string, config *cfg.Game_taskRoundD
|
|||||||
|
|
||||||
//更改用户任务
|
//更改用户任务
|
||||||
func (this *ModelTask) modifyUserTask(uid string, taskTag comm.TaskTag, taskId string, data map[string]interface{}) error {
|
func (this *ModelTask) modifyUserTask(uid string, taskTag comm.TaskTag, taskId string, data map[string]interface{}) error {
|
||||||
if err := this.ChangeList(this.swapKey(uid, taskTag), taskId, data); err != nil {
|
if err := this.ChangeList(swapKey(uid, taskTag), taskId, data); err != nil {
|
||||||
log.Errorf("err %v", err)
|
log.Errorf("err %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -166,7 +173,7 @@ func (this *ModelTask) finishHandle(userTask *pb.DBTask, taskTag comm.TaskTag, c
|
|||||||
func (this *ModelTask) clearTask(uid string, taskTag comm.TaskTag) error {
|
func (this *ModelTask) clearTask(uid string, taskTag comm.TaskTag) error {
|
||||||
taskList := this.getTaskList(uid, taskTag)
|
taskList := this.getTaskList(uid, taskTag)
|
||||||
for _, v := range taskList {
|
for _, v := range taskList {
|
||||||
if err := this.moduleTask.modelTask.DelListlds(this.swapKey(uid, taskTag), v.Id); err != nil {
|
if err := this.moduleTask.modelTask.DelListlds(swapKey(uid, taskTag), v.Id); err != nil {
|
||||||
log.Errorf("uid: %v taskTag:%v err:%v", uid, taskTag, err)
|
log.Errorf("uid: %v taskTag:%v err:%v", uid, taskTag, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package task
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"time"
|
"time"
|
||||||
@ -11,6 +12,7 @@ import (
|
|||||||
type ModuleTask struct {
|
type ModuleTask struct {
|
||||||
modules.ModuleBase
|
modules.ModuleBase
|
||||||
modelTask *ModelTask
|
modelTask *ModelTask
|
||||||
|
modelTaskActive *ModelTaskActive
|
||||||
api *apiComp
|
api *apiComp
|
||||||
configure *configureComp
|
configure *configureComp
|
||||||
lastDayTime int64 //上次日任务执行时间戳
|
lastDayTime int64 //上次日任务执行时间戳
|
||||||
@ -44,6 +46,7 @@ func (this *ModuleTask) OnInstallComp() {
|
|||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
this.modelTask = this.RegisterComp(new(ModelTask)).(*ModelTask)
|
this.modelTask = this.RegisterComp(new(ModelTask)).(*ModelTask)
|
||||||
|
this.modelTaskActive = this.RegisterComp(new(ModelTaskActive)).(*ModelTaskActive)
|
||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,28 +84,35 @@ func (this *ModuleTask) taskWeekDay(t time.Time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//初始化任务
|
//初始化任务
|
||||||
func (this *ModuleTask) InitTask(uid string, taskTag comm.TaskTag) (code pb.ErrorCode) {
|
func (this *ModuleTask) InitTask(uid string, taskTag comm.TaskTag) {
|
||||||
if err := this.modelTask.initTaskByTag(uid, taskTag); err != nil {
|
if err := this.modelTask.initTaskByTag(uid, taskTag); err != nil {
|
||||||
code = pb.ErrorCode_TaskInit
|
log.Errorf("uid:%v tag:%v initTask err: %v", uid, taskTag, err)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化日常、周常、成就
|
//初始化日常、周常、成就
|
||||||
func (this *ModuleTask) InitTaskAll(uid string) (code pb.ErrorCode) {
|
func (this *ModuleTask) InitTaskAll(uid string) {
|
||||||
this.InitTask(uid, comm.TASK_DAILY)
|
this.InitTask(uid, comm.TASK_DAILY)
|
||||||
this.InitTask(uid, comm.TASK_WEEKLY)
|
this.InitTask(uid, comm.TASK_WEEKLY)
|
||||||
this.InitTask(uid, comm.TASK_ACHIEVE)
|
this.InitTask(uid, comm.TASK_ACHIEVE)
|
||||||
return
|
|
||||||
|
this.modelTaskActive.initActiveRewardByTag(uid, comm.TASK_DAILY)
|
||||||
|
this.modelTaskActive.initActiveRewardByTag(uid, comm.TASK_WEEKLY)
|
||||||
}
|
}
|
||||||
|
|
||||||
//重置任务
|
//重置任务
|
||||||
func (this *ModuleTask) ResetTask(uid string, taskTag comm.TaskTag) (code pb.ErrorCode) {
|
func (this *ModuleTask) ResetTask(uid string, taskTag comm.TaskTag) {
|
||||||
if err := this.modelTask.clearTask(uid, taskTag); err != nil {
|
if err := this.modelTask.clearTask(uid, taskTag); err != nil {
|
||||||
code = pb.ErrorCode_TaskReset
|
log.Errorf("uid:%v tag:%v ResetTask err:%v", uid, taskTag, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return this.InitTask(uid, taskTag)
|
this.InitTask(uid, taskTag)
|
||||||
|
|
||||||
|
if err := this.modelTaskActive.clearTask(uid, taskTag); err != nil {
|
||||||
|
log.Errorf("uid:%v tag:%v ResetTaskActive err:%v", uid, taskTag, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.modelTaskActive.initActiveRewardByTag(uid, taskTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
//任务处理
|
//任务处理
|
||||||
|
@ -106,14 +106,10 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
|||||||
|
|
||||||
if this.module.modelUser.isLoginFirst(user.Logintime) {
|
if this.module.modelUser.isLoginFirst(user.Logintime) {
|
||||||
//清空日常
|
//清空日常
|
||||||
if code = this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_DAILY); code != pb.ErrorCode_Success {
|
this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_DAILY)
|
||||||
return
|
|
||||||
}
|
|
||||||
//清周常
|
//清周常
|
||||||
if utils.IsAfterWeek(user.Logintime) {
|
if utils.IsAfterWeek(user.Logintime) {
|
||||||
if code = this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_WEEKLY); code != pb.ErrorCode_Success {
|
this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_WEEKLY)
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,14 +112,6 @@ func (this *User) AddAttributeValue(uid string, attr string, add int32) (code pb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
update[comm.ResDiamond] = user.Diamond + add
|
update[comm.ResDiamond] = user.Diamond + add
|
||||||
case comm.ResTaskActive:
|
|
||||||
if add < 0 {
|
|
||||||
if user.TaskActive+add < 0 {
|
|
||||||
code = pb.ErrorCode_ResNoEnough
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
update[comm.ResTaskActive] = user.TaskActive + add
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := this.modelUser.updateUserAttr(uid, update); err != nil {
|
if err := this.modelUser.updateUserAttr(uid, update); err != nil {
|
||||||
|
@ -93,6 +93,10 @@ const (
|
|||||||
ErrorCode_TaskInit ErrorCode = 1600 //初始化失败
|
ErrorCode_TaskInit ErrorCode = 1600 //初始化失败
|
||||||
ErrorCode_TaskReset ErrorCode = 1601 //重置任务失败
|
ErrorCode_TaskReset ErrorCode = 1601 //重置任务失败
|
||||||
ErrorCode_TaskHandle ErrorCode = 1602 //任务处理失败
|
ErrorCode_TaskHandle ErrorCode = 1602 //任务处理失败
|
||||||
|
ErrorCode_TaskReceived ErrorCode = 1603 //已领取
|
||||||
|
ErrorCode_TaskActiveInit ErrorCode = 1606 //初始化活跃度失败
|
||||||
|
ErrorCode_TaskActiveNofound ErrorCode = 1604 //未找到用户活跃度配置
|
||||||
|
ErrorCode_TaskActiveNoenough ErrorCode = 1605 //活跃值未达标
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for ErrorCode.
|
// Enum value maps for ErrorCode.
|
||||||
@ -161,6 +165,10 @@ var (
|
|||||||
1600: "TaskInit",
|
1600: "TaskInit",
|
||||||
1601: "TaskReset",
|
1601: "TaskReset",
|
||||||
1602: "TaskHandle",
|
1602: "TaskHandle",
|
||||||
|
1603: "TaskReceived",
|
||||||
|
1606: "TaskActiveInit",
|
||||||
|
1604: "TaskActiveNofound",
|
||||||
|
1605: "TaskActiveNoenough",
|
||||||
}
|
}
|
||||||
ErrorCode_value = map[string]int32{
|
ErrorCode_value = map[string]int32{
|
||||||
"Success": 0,
|
"Success": 0,
|
||||||
@ -226,6 +234,10 @@ var (
|
|||||||
"TaskInit": 1600,
|
"TaskInit": 1600,
|
||||||
"TaskReset": 1601,
|
"TaskReset": 1601,
|
||||||
"TaskHandle": 1602,
|
"TaskHandle": 1602,
|
||||||
|
"TaskReceived": 1603,
|
||||||
|
"TaskActiveInit": 1606,
|
||||||
|
"TaskActiveNofound": 1604,
|
||||||
|
"TaskActiveNoenough": 1605,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -260,7 +272,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_errorcode_proto_rawDesc = []byte{
|
var file_errorcode_proto_rawDesc = []byte{
|
||||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x2a, 0x9b, 0x0a, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
0x6f, 0x2a, 0xf4, 0x0a, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
||||||
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
||||||
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
@ -341,8 +353,14 @@ var file_errorcode_proto_rawDesc = []byte{
|
|||||||
0x74, 0x6f, 0x72, 0x79, 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x12,
|
0x74, 0x6f, 0x72, 0x79, 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x12,
|
||||||
0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc0, 0x0c, 0x12, 0x0e,
|
0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc0, 0x0c, 0x12, 0x0e,
|
||||||
0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, 0x10, 0xc1, 0x0c, 0x12, 0x0f,
|
0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, 0x10, 0xc1, 0x0c, 0x12, 0x0f,
|
||||||
0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, 0x42,
|
0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, 0x12,
|
||||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x10,
|
||||||
|
0xc3, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65,
|
||||||
|
0x49, 0x6e, 0x69, 0x74, 0x10, 0xc6, 0x0c, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41,
|
||||||
|
0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xc4, 0x0c, 0x12,
|
||||||
|
0x17, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x65,
|
||||||
|
0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc5, 0x0c, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -78,4 +78,8 @@ enum ErrorCode {
|
|||||||
TaskInit = 1600; //初始化失败
|
TaskInit = 1600; //初始化失败
|
||||||
TaskReset = 1601; //重置任务失败
|
TaskReset = 1601; //重置任务失败
|
||||||
TaskHandle = 1602; //任务处理失败
|
TaskHandle = 1602; //任务处理失败
|
||||||
|
TaskReceived = 1603; //已领取
|
||||||
|
TaskActiveInit = 1606; //初始化活跃度失败
|
||||||
|
TaskActiveNofound = 1604; //未找到用户活跃度配置
|
||||||
|
TaskActiveNoenough = 1605; //活跃值未达标
|
||||||
}
|
}
|
@ -6,6 +6,14 @@ message DBTask {
|
|||||||
string uid = 2; //@go_tags(`bson:"uid"`) 用户ID
|
string uid = 2; //@go_tags(`bson:"uid"`) 用户ID
|
||||||
int32 taskId = 3; //@go_tags(`bson:"taskId"`) 任务Id
|
int32 taskId = 3; //@go_tags(`bson:"taskId"`) 任务Id
|
||||||
int32 progress = 4; //@go_tags(`bson:"progress"`) 任务进度/完成次数
|
int32 progress = 4; //@go_tags(`bson:"progress"`) 任务进度/完成次数
|
||||||
int32 status = 5; //@go_tags(`bson:"status"`) 任务状态 默认0未完成 1已完成
|
int32 active = 5; //@go_tags(`bson:"active"`) 活跃度
|
||||||
int32 received = 6; //@go_tags(`bson:"received"`) 领取状态 默认0未领取 1已领取
|
int32 status = 6; //@go_tags(`bson:"status"`) 任务状态 默认0未完成 1已完成
|
||||||
|
int32 received = 7; //@go_tags(`bson:"received"`) 领取状态 默认0未领取 1已领取
|
||||||
|
}
|
||||||
|
|
||||||
|
message DBTaskActive {
|
||||||
|
string id = 1; //@go_tags(`bson:"_id"`) ID
|
||||||
|
string uid = 2; //@go_tags(`bson:"uid"`) 用户ID
|
||||||
|
int32 rId = 3; //@go_tags(`bson:"taskId"`) rewardId
|
||||||
|
int32 received = 4; //@go_tags(`bson:"received"`) 领取状态 默认0未领取 1已领取
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ import "task/task_db.proto";
|
|||||||
|
|
||||||
//领取
|
//领取
|
||||||
message TaskReceiveReq {
|
message TaskReceiveReq {
|
||||||
int32 taskTag = 1; //日常/周常/成就
|
int32 taskTag = 1; // 1日常/2周常/3成就
|
||||||
string id = 2; //任务唯一ID
|
string id = 2; //任务唯一ID
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,6 +19,16 @@ message TaskListReq {
|
|||||||
|
|
||||||
message TaskListResp { repeated DBTask list = 1; }
|
message TaskListResp { repeated DBTask list = 1; }
|
||||||
|
|
||||||
//激活测试
|
//活跃度
|
||||||
message TaskActiveReq {}
|
message TaskActiveListReq { int32 taskTag = 1; }
|
||||||
message TaskActiveResp {}
|
message TaskActiveListResp { repeated DBTaskActive list = 1; }
|
||||||
|
|
||||||
|
//活跃度领取
|
||||||
|
message TaskActiveReceiveReq {
|
||||||
|
int32 taskTag = 1; // 1日常/2周常
|
||||||
|
string id = 2; //唯一id
|
||||||
|
}
|
||||||
|
message TaskActiveReceiveResp {
|
||||||
|
int32 taskTag = 1;
|
||||||
|
string id = 2;
|
||||||
|
}
|
@ -27,6 +27,5 @@ message DBUser {
|
|||||||
bool created = 15; //@go_tags(`bson:"created"`) 创角
|
bool created = 15; //@go_tags(`bson:"created"`) 创角
|
||||||
int32 lv = 16; //@go_tags(`bson:"lv"`) 等级
|
int32 lv = 16; //@go_tags(`bson:"lv"`) 等级
|
||||||
int32 vip = 17; //@go_tags(`bson:"vip"`) vip
|
int32 vip = 17; //@go_tags(`bson:"vip"`) vip
|
||||||
int32 taskActive = 18; //@go_tags(`bson:"taskActive"`) 任务活跃度
|
int32 diamond = 18; //@go_tags(`bson:"diamond"`) 钻石
|
||||||
int32 diamond = 19; //@go_tags(`bson:"diamond"`) 钻石
|
|
||||||
}
|
}
|
120
pb/task_db.pb.go
120
pb/task_db.pb.go
@ -29,8 +29,9 @@ type DBTask struct {
|
|||||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户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
|
TaskId int32 `protobuf:"varint,3,opt,name=taskId,proto3" json:"taskId" bson:"taskId"` //任务Id
|
||||||
Progress int32 `protobuf:"varint,4,opt,name=progress,proto3" json:"progress" bson:"progress"` //任务进度/完成次数
|
Progress int32 `protobuf:"varint,4,opt,name=progress,proto3" json:"progress" bson:"progress"` //任务进度/完成次数
|
||||||
Status int32 `protobuf:"varint,5,opt,name=status,proto3" json:"status" bson:"status"` // 任务状态 默认0未完成 1已完成
|
Active int32 `protobuf:"varint,5,opt,name=active,proto3" json:"active" bson:"active"` //活跃度
|
||||||
Received int32 `protobuf:"varint,6,opt,name=received,proto3" json:"received" bson:"received"` //领取状态 默认0未领取 1已领取
|
Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status" bson:"status"` // 任务状态 默认0未完成 1已完成
|
||||||
|
Received int32 `protobuf:"varint,7,opt,name=received,proto3" json:"received" bson:"received"` //领取状态 默认0未领取 1已领取
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBTask) Reset() {
|
func (x *DBTask) Reset() {
|
||||||
@ -93,6 +94,13 @@ func (x *DBTask) GetProgress() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *DBTask) GetActive() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Active
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (x *DBTask) GetStatus() int32 {
|
func (x *DBTask) GetStatus() int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Status
|
return x.Status
|
||||||
@ -107,21 +115,100 @@ func (x *DBTask) GetReceived() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DBTaskActive 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
|
||||||
|
Received int32 `protobuf:"varint,4,opt,name=received,proto3" json:"received" bson:"received"` //领取状态 默认0未领取 1已领取
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBTaskActive) Reset() {
|
||||||
|
*x = DBTaskActive{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_task_task_db_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBTaskActive) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DBTaskActive) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DBTaskActive) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_task_task_db_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use DBTaskActive.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DBTaskActive) Descriptor() ([]byte, []int) {
|
||||||
|
return file_task_task_db_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBTaskActive) GetId() string {
|
||||||
|
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 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBTaskActive) GetReceived() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Received
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
var File_task_task_db_proto protoreflect.FileDescriptor
|
var File_task_task_db_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_task_task_db_proto_rawDesc = []byte{
|
var file_task_task_db_proto_rawDesc = []byte{
|
||||||
0x0a, 0x12, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70,
|
0x0a, 0x12, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x01, 0x0a, 0x06, 0x44, 0x42, 0x54, 0x61, 0x73, 0x6b, 0x12,
|
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaa, 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,
|
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,
|
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,
|
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, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f,
|
0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f,
|
||||||
0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x72, 0x6f,
|
0x67, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x72, 0x6f,
|
||||||
0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
|
0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
|
||||||
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a,
|
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x16, 0x0a,
|
||||||
0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52,
|
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73,
|
||||||
0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
|
||||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
|
||||||
|
0x64, 0x22, 0x5e, 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, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
|
||||||
|
0x64, 0x18, 0x04, 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 (
|
var (
|
||||||
@ -136,9 +223,10 @@ func file_task_task_db_proto_rawDescGZIP() []byte {
|
|||||||
return file_task_task_db_proto_rawDescData
|
return file_task_task_db_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_task_task_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
var file_task_task_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
var file_task_task_db_proto_goTypes = []interface{}{
|
var file_task_task_db_proto_goTypes = []interface{}{
|
||||||
(*DBTask)(nil), // 0: DBTask
|
(*DBTask)(nil), // 0: DBTask
|
||||||
|
(*DBTaskActive)(nil), // 1: DBTaskActive
|
||||||
}
|
}
|
||||||
var file_task_task_db_proto_depIdxs = []int32{
|
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 output_type
|
||||||
@ -166,6 +254,18 @@ func file_task_task_db_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_task_task_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*DBTaskActive); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@ -173,7 +273,7 @@ func file_task_task_db_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_task_task_db_proto_rawDesc,
|
RawDescriptor: file_task_task_db_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 1,
|
NumMessages: 2,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
@ -26,7 +26,7 @@ type TaskReceiveReq struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
TaskTag int32 `protobuf:"varint,1,opt,name=taskTag,proto3" json:"taskTag"` //日常/周常/成就
|
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
|
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id"` //任务唯一ID
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,15 +218,17 @@ func (x *TaskListResp) GetList() []*DBTask {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//激活测试
|
//活跃度
|
||||||
type TaskActiveReq struct {
|
type TaskActiveListReq struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
TaskTag int32 `protobuf:"varint,1,opt,name=taskTag,proto3" json:"taskTag"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TaskActiveReq) Reset() {
|
func (x *TaskActiveListReq) Reset() {
|
||||||
*x = TaskActiveReq{}
|
*x = TaskActiveListReq{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_task_task_msg_proto_msgTypes[4]
|
mi := &file_task_task_msg_proto_msgTypes[4]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -234,13 +236,13 @@ func (x *TaskActiveReq) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TaskActiveReq) String() string {
|
func (x *TaskActiveListReq) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*TaskActiveReq) ProtoMessage() {}
|
func (*TaskActiveListReq) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *TaskActiveReq) ProtoReflect() protoreflect.Message {
|
func (x *TaskActiveListReq) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_task_task_msg_proto_msgTypes[4]
|
mi := &file_task_task_msg_proto_msgTypes[4]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -252,19 +254,28 @@ func (x *TaskActiveReq) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use TaskActiveReq.ProtoReflect.Descriptor instead.
|
// Deprecated: Use TaskActiveListReq.ProtoReflect.Descriptor instead.
|
||||||
func (*TaskActiveReq) Descriptor() ([]byte, []int) {
|
func (*TaskActiveListReq) Descriptor() ([]byte, []int) {
|
||||||
return file_task_task_msg_proto_rawDescGZIP(), []int{4}
|
return file_task_task_msg_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
type TaskActiveResp struct {
|
func (x *TaskActiveListReq) GetTaskTag() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.TaskTag
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type TaskActiveListResp struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
List []*DBTaskActive `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TaskActiveResp) Reset() {
|
func (x *TaskActiveListResp) Reset() {
|
||||||
*x = TaskActiveResp{}
|
*x = TaskActiveListResp{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_task_task_msg_proto_msgTypes[5]
|
mi := &file_task_task_msg_proto_msgTypes[5]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -272,13 +283,13 @@ func (x *TaskActiveResp) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TaskActiveResp) String() string {
|
func (x *TaskActiveListResp) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*TaskActiveResp) ProtoMessage() {}
|
func (*TaskActiveListResp) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *TaskActiveResp) ProtoReflect() protoreflect.Message {
|
func (x *TaskActiveListResp) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_task_task_msg_proto_msgTypes[5]
|
mi := &file_task_task_msg_proto_msgTypes[5]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -290,11 +301,129 @@ func (x *TaskActiveResp) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use TaskActiveResp.ProtoReflect.Descriptor instead.
|
// Deprecated: Use TaskActiveListResp.ProtoReflect.Descriptor instead.
|
||||||
func (*TaskActiveResp) Descriptor() ([]byte, []int) {
|
func (*TaskActiveListResp) Descriptor() ([]byte, []int) {
|
||||||
return file_task_task_msg_proto_rawDescGZIP(), []int{5}
|
return file_task_task_msg_proto_rawDescGZIP(), []int{5}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *TaskActiveListResp) GetList() []*DBTaskActive {
|
||||||
|
if x != nil {
|
||||||
|
return x.List
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//活跃度领取
|
||||||
|
type TaskActiveReceiveReq struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveReq) Reset() {
|
||||||
|
*x = TaskActiveReceiveReq{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_task_task_msg_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*TaskActiveReceiveReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_task_task_msg_proto_msgTypes[6]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use TaskActiveReceiveReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*TaskActiveReceiveReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_task_task_msg_proto_rawDescGZIP(), []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveReq) GetTaskTag() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.TaskTag
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveReq) GetId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type TaskActiveReceiveResp struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveResp) Reset() {
|
||||||
|
*x = TaskActiveReceiveResp{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_task_task_msg_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveResp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*TaskActiveReceiveResp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveResp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_task_task_msg_proto_msgTypes[7]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use TaskActiveReceiveResp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*TaskActiveReceiveResp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_task_task_msg_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveResp) GetTaskTag() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.TaskTag
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TaskActiveReceiveResp) GetId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_task_task_msg_proto protoreflect.FileDescriptor
|
var File_task_task_msg_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_task_task_msg_proto_rawDesc = []byte{
|
var file_task_task_msg_proto_rawDesc = []byte{
|
||||||
@ -312,10 +441,23 @@ var file_task_task_msg_proto_rawDesc = []byte{
|
|||||||
0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x2b, 0x0a, 0x0c, 0x54, 0x61, 0x73,
|
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,
|
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,
|
0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x54, 0x61, 0x73, 0x6b,
|
||||||
0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x0f, 0x0a, 0x0d, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63,
|
0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2d, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63,
|
||||||
0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x22, 0x10, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41,
|
0x74, 0x69, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x74,
|
||||||
0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61,
|
||||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x73, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x37, 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, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -330,23 +472,27 @@ func file_task_task_msg_proto_rawDescGZIP() []byte {
|
|||||||
return file_task_task_msg_proto_rawDescData
|
return file_task_task_msg_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_task_task_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
var file_task_task_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||||
var file_task_task_msg_proto_goTypes = []interface{}{
|
var file_task_task_msg_proto_goTypes = []interface{}{
|
||||||
(*TaskReceiveReq)(nil), // 0: TaskReceiveReq
|
(*TaskReceiveReq)(nil), // 0: TaskReceiveReq
|
||||||
(*TaskReceiveResp)(nil), // 1: TaskReceiveResp
|
(*TaskReceiveResp)(nil), // 1: TaskReceiveResp
|
||||||
(*TaskListReq)(nil), // 2: TaskListReq
|
(*TaskListReq)(nil), // 2: TaskListReq
|
||||||
(*TaskListResp)(nil), // 3: TaskListResp
|
(*TaskListResp)(nil), // 3: TaskListResp
|
||||||
(*TaskActiveReq)(nil), // 4: TaskActiveReq
|
(*TaskActiveListReq)(nil), // 4: TaskActiveListReq
|
||||||
(*TaskActiveResp)(nil), // 5: TaskActiveResp
|
(*TaskActiveListResp)(nil), // 5: TaskActiveListResp
|
||||||
(*DBTask)(nil), // 6: DBTask
|
(*TaskActiveReceiveReq)(nil), // 6: TaskActiveReceiveReq
|
||||||
|
(*TaskActiveReceiveResp)(nil), // 7: TaskActiveReceiveResp
|
||||||
|
(*DBTask)(nil), // 8: DBTask
|
||||||
|
(*DBTaskActive)(nil), // 9: DBTaskActive
|
||||||
}
|
}
|
||||||
var file_task_task_msg_proto_depIdxs = []int32{
|
var file_task_task_msg_proto_depIdxs = []int32{
|
||||||
6, // 0: TaskListResp.list:type_name -> DBTask
|
8, // 0: TaskListResp.list:type_name -> DBTask
|
||||||
1, // [1:1] is the sub-list for method output_type
|
9, // 1: TaskActiveListResp.list:type_name -> DBTaskActive
|
||||||
1, // [1:1] is the sub-list for method input_type
|
2, // [2:2] is the sub-list for method output_type
|
||||||
1, // [1:1] is the sub-list for extension type_name
|
2, // [2:2] is the sub-list for method input_type
|
||||||
1, // [1:1] is the sub-list for extension extendee
|
2, // [2:2] is the sub-list for extension type_name
|
||||||
0, // [0:1] is the sub-list for field type_name
|
2, // [2:2] is the sub-list for extension extendee
|
||||||
|
0, // [0:2] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_task_task_msg_proto_init() }
|
func init() { file_task_task_msg_proto_init() }
|
||||||
@ -405,7 +551,7 @@ func file_task_task_msg_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_task_task_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
file_task_task_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*TaskActiveReq); i {
|
switch v := v.(*TaskActiveListReq); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@ -417,7 +563,31 @@ func file_task_task_msg_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_task_task_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
file_task_task_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*TaskActiveResp); i {
|
switch v := v.(*TaskActiveListResp); 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[6].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*TaskActiveReceiveReq); 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[7].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*TaskActiveReceiveResp); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@ -435,7 +605,7 @@ func file_task_task_msg_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_task_task_msg_proto_rawDesc,
|
RawDescriptor: file_task_task_msg_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 6,
|
NumMessages: 8,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
@ -113,8 +113,7 @@ type DBUser struct {
|
|||||||
Created bool `protobuf:"varint,15,opt,name=created,proto3" json:"created" bson:"created"` //创角
|
Created bool `protobuf:"varint,15,opt,name=created,proto3" json:"created" bson:"created"` //创角
|
||||||
Lv int32 `protobuf:"varint,16,opt,name=lv,proto3" json:"lv" bson:"lv"` //等级
|
Lv int32 `protobuf:"varint,16,opt,name=lv,proto3" json:"lv" bson:"lv"` //等级
|
||||||
Vip int32 `protobuf:"varint,17,opt,name=vip,proto3" json:"vip" bson:"vip"` // vip
|
Vip int32 `protobuf:"varint,17,opt,name=vip,proto3" json:"vip" bson:"vip"` // vip
|
||||||
TaskActive int32 `protobuf:"varint,18,opt,name=taskActive,proto3" json:"taskActive" bson:"taskActive"` //任务活跃度
|
Diamond int32 `protobuf:"varint,18,opt,name=diamond,proto3" json:"diamond" bson:"diamond"` // 钻石
|
||||||
Diamond int32 `protobuf:"varint,19,opt,name=diamond,proto3" json:"diamond" bson:"diamond"` // 钻石
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBUser) Reset() {
|
func (x *DBUser) Reset() {
|
||||||
@ -268,13 +267,6 @@ func (x *DBUser) GetVip() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBUser) GetTaskActive() int32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.TaskActive
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *DBUser) GetDiamond() int32 {
|
func (x *DBUser) GetDiamond() int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Diamond
|
return x.Diamond
|
||||||
@ -293,7 +285,7 @@ var file_user_user_db_proto_rawDesc = []byte{
|
|||||||
0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76,
|
0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76,
|
||||||
0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74,
|
0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74,
|
||||||
0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x0e, 0x0a,
|
0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x0e, 0x0a,
|
||||||
0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0xc6, 0x03,
|
0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0xa6, 0x03,
|
||||||
0x0a, 0x06, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
0x0a, 0x06, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
|
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, 0x12, 0x0a, 0x04, 0x75, 0x75,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75,
|
||||||
@ -318,10 +310,8 @@ var file_user_user_db_proto_rawDesc = []byte{
|
|||||||
0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28,
|
0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28,
|
||||||
0x08, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76,
|
0x08, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76,
|
||||||
0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x69,
|
0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x69,
|
||||||
0x70, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x76, 0x69, 0x70, 0x12, 0x1e, 0x0a, 0x0a,
|
0x70, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x76, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x07,
|
||||||
0x74, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x05,
|
0x64, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x18, 0x12, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64,
|
||||||
0x52, 0x0a, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x18, 0x0a, 0x07,
|
|
||||||
0x64, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64,
|
|
||||||
0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestIsToday(t *testing.T) {
|
func TestIsToday(t *testing.T) {
|
||||||
// tt := time.Unix(1657163870, 0)
|
fmt.Println(utils.IsToday(1657163870))
|
||||||
// fmt.Println(utils.IsToday(tt))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSubTime(t *testing.T) {
|
func TestSubTime(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user