活跃度

This commit is contained in:
zhaocy 2022-07-07 14:35:31 +08:00
parent 849e501842
commit b6feed3aba
24 changed files with 695 additions and 162 deletions

View File

@ -26,7 +26,7 @@ var (
fmt.Printf("%v \n", v)
}
},
enabled: true,
// enabled: true,
}, {
Desc: "领取任务奖励",
mainType: string(comm.ModuleTask),
@ -38,11 +38,24 @@ var (
rsp: &pb.TaskReceiveResp{},
// enabled: true,
}, {
Desc: "活跃度",
mainType: string(comm.ModuleTask),
subType: "active",
req: &pb.TaskActiveReq{},
rsp: &pb.TaskActiveResp{},
// enabled: true,
subType: task.TaskSubTypeActiveList,
req: &pb.TaskActiveListReq{
TaskTag: int32(comm.TASK_DAILY),
},
rsp: &pb.TaskActiveListResp{},
// 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,
},
}
)

View File

@ -14,9 +14,9 @@ var user_builders = []*TestCase{
mainType: string(comm.ModuleUser),
subType: user.UserSubTypeCreate,
req: &pb.UserCreateReq{ //设置请求参数
NickName: "乐谷70614",
NickName: "乐谷70616",
},
rsp: &pb.UserCreateResp{},
rsp: &pb.UserCreateResp{},
// enabled: true,
}, {
Desc: "添加资源",

View File

@ -78,11 +78,11 @@ type (
//任务
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)
}

View File

@ -6,8 +6,10 @@ import (
)
const (
TaskSubTypeList = "list" //任务列表
TaskSubTypeReceive = "receive" //领取
TaskSubTypeList = "list" //任务列表
TaskSubTypeReceive = "receive" //领取
TaskSubTypeActiveList = "activelist" //活跃度列表
TaskSubTypeActiveReceive = "activereceive" //活跃度领取
)
type apiComp struct {

View File

@ -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
}

View 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
}

View 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
}

View File

@ -129,3 +129,35 @@ func (this *configureComp) getTaskByTag(taskTag int32) (data []*cfg.Game_taskRou
}
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
}

View File

@ -1,2 +0,0 @@
package task

View 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
}

View File

@ -1,2 +0,0 @@
package task

View File

@ -28,13 +28,13 @@ func (this *ModelTask) Init(service core.IService, module core.IModule, comp cor
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)
}
//获取玩家任务列表
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)
return
}
@ -48,15 +48,16 @@ func (this *ModelTask) initTaskByTag(uid string, taskTag comm.TaskTag) error {
return fmt.Errorf("clear data before init task")
}
if data, err := this.moduleTask.configure.getTaskByTag(int32(taskTag)); err == nil {
for _, v := range data {
for _, cnf := range data {
objId := primitive.NewObjectID().Hex()
task := &pb.DBTask{
Id: objId,
Uid: uid,
TaskId: v.Key,
Progress: v.ConditionSecond,
TaskId: cnf.Key,
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)
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 {
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)
return nil
}
return userTask
}
//检查活跃度
func (this *ModelTask) checkActiveVal(uid string) error {
return nil
}
//获取未完成的任务列表
func (this *ModelTask) getUnFinishTaskList(uid string, taskTag comm.TaskTag) (list []*pb.DBTask) {
taskList := this.getTaskList(uid, taskTag)
@ -91,6 +87,17 @@ func (this *ModelTask) getUnFinishTaskList(uid string, taskTag comm.TaskTag) (li
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) {
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 {
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)
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 {
taskList := this.getTaskList(uid, taskTag)
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)
return err
}

View File

@ -3,6 +3,7 @@ package task
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"time"
@ -10,11 +11,12 @@ import (
type ModuleTask struct {
modules.ModuleBase
modelTask *ModelTask
api *apiComp
configure *configureComp
lastDayTime int64 //上次日任务执行时间戳
lastWeekTime int64 //上次周任务执行时间戳
modelTask *ModelTask
modelTaskActive *ModelTaskActive
api *apiComp
configure *configureComp
lastDayTime int64 //上次日任务执行时间戳
lastWeekTime int64 //上次周任务执行时间戳
}
func NewModule() core.IModule {
@ -44,6 +46,7 @@ func (this *ModuleTask) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelTask = this.RegisterComp(new(ModelTask)).(*ModelTask)
this.modelTaskActive = this.RegisterComp(new(ModelTaskActive)).(*ModelTaskActive)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
@ -81,32 +84,39 @@ 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 {
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_WEEKLY)
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 {
code = pb.ErrorCode_TaskReset
log.Errorf("uid:%v tag:%v ResetTask err:%v", uid, taskTag, err)
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)
}
//任务处理
func (this *ModuleTask) SendToTask(uid string, taskType comm.TaskType, taskPram *pb.TaskParam) (code pb.ErrorCode) {
func (this *ModuleTask) SendToTask(uid string, taskType comm.TaskType, taskPram *pb.TaskParam) (code pb.ErrorCode) {
if err := this.modelTask.taskHandle(uid, taskType, taskPram); err != nil {
code = pb.ErrorCode_TaskHandle
}

View File

@ -106,14 +106,10 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
if this.module.modelUser.isLoginFirst(user.Logintime) {
//清空日常
if code = this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_DAILY); code != pb.ErrorCode_Success {
return
}
this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_DAILY)
//清周常
if utils.IsAfterWeek(user.Logintime) {
if code = this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_WEEKLY); code != pb.ErrorCode_Success {
return
}
this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_WEEKLY)
}
}

View File

@ -112,14 +112,6 @@ func (this *User) AddAttributeValue(uid string, attr string, add int32) (code pb
}
}
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 {

View File

@ -90,9 +90,13 @@ const (
ErrorCode_StoryNotFindChapter ErrorCode = 1500 // 没有找到主线关卡信息
ErrorCode_StoryIDFailed ErrorCode = 1501 // 关卡ID 错误
// task
ErrorCode_TaskInit ErrorCode = 1600 //初始化失败
ErrorCode_TaskReset ErrorCode = 1601 //重置任务失败
ErrorCode_TaskHandle ErrorCode = 1602 //任务处理失败
ErrorCode_TaskInit ErrorCode = 1600 //初始化失败
ErrorCode_TaskReset ErrorCode = 1601 //重置任务失败
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.
@ -161,6 +165,10 @@ var (
1600: "TaskInit",
1601: "TaskReset",
1602: "TaskHandle",
1603: "TaskReceived",
1606: "TaskActiveInit",
1604: "TaskActiveNofound",
1605: "TaskActiveNoenough",
}
ErrorCode_value = map[string]int32{
"Success": 0,
@ -226,6 +234,10 @@ var (
"TaskInit": 1600,
"TaskReset": 1601,
"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{
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,
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,
@ -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,
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, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, 0x12,
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 (

View File

@ -65,17 +65,21 @@ enum ErrorCode {
HeroCreate = 1310; //
HeroEquipUpdate = 1311; //
HeroMaxAwaken = 1312; //
HeroIsLock = 1313; //
HeroIsLock = 1313; //
// equipment
EquipmentOnFoundEquipment = 1400; //
EquipmentLvlimitReached = 1401; //
// mainStory
StoryNotFindChapter = 1500; // 线
StoryIDFailed = 1501; // ID
StoryIDFailed = 1501; // ID
// task
TaskInit = 1600; //
TaskReset = 1601; //
TaskHandle = 1602; //
TaskInit = 1600; //
TaskReset = 1601; //
TaskHandle = 1602; //
TaskReceived = 1603; //
TaskActiveInit = 1606; //
TaskActiveNofound = 1604; //
TaskActiveNoenough = 1605; //
}

View File

@ -6,6 +6,14 @@ message DBTask {
string uid = 2; //@go_tags(`bson:"uid"`) ID
int32 taskId = 3; //@go_tags(`bson:"taskId"`) Id
int32 progress = 4; //@go_tags(`bson:"progress"`) /
int32 status = 5; //@go_tags(`bson:"status"`) 0 1
int32 received = 6; //@go_tags(`bson:"received"`) 0 1
int32 active = 5; //@go_tags(`bson:"active"`)
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
}

View File

@ -4,7 +4,7 @@ import "task/task_db.proto";
//
message TaskReceiveReq {
int32 taskTag = 1; ////
int32 taskTag = 1; // 1/2/3
string id = 2; //ID
}
@ -19,6 +19,16 @@ message TaskListReq {
message TaskListResp { repeated DBTask list = 1; }
//
message TaskActiveReq {}
message TaskActiveResp {}
//
message TaskActiveListReq { int32 taskTag = 1; }
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;
}

View File

@ -27,6 +27,5 @@ message DBUser {
bool created = 15; //@go_tags(`bson:"created"`)
int32 lv = 16; //@go_tags(`bson:"lv"`)
int32 vip = 17; //@go_tags(`bson:"vip"`) vip
int32 taskActive = 18; //@go_tags(`bson:"taskActive"`)
int32 diamond = 19; //@go_tags(`bson:"diamond"`)
int32 diamond = 18; //@go_tags(`bson:"diamond"`)
}

View File

@ -29,8 +29,9 @@ type DBTask struct {
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
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已完成
Received int32 `protobuf:"varint,6,opt,name=received,proto3" json:"received" bson:"received"` //领取状态 默认0未领取 1已领取
Active int32 `protobuf:"varint,5,opt,name=active,proto3" json:"active" bson:"active"` //活跃度
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() {
@ -93,6 +94,13 @@ func (x *DBTask) GetProgress() int32 {
return 0
}
func (x *DBTask) GetActive() int32 {
if x != nil {
return x.Active
}
return 0
}
func (x *DBTask) GetStatus() int32 {
if x != nil {
return x.Status
@ -107,21 +115,100 @@ func (x *DBTask) GetReceived() int32 {
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_rawDesc = []byte{
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,
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, 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, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x05, 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, 0x06, 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,
0x67, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 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, 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 (
@ -136,9 +223,10 @@ 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, 1)
var file_task_task_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
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{
0, // [0:0] is the sub-list for method output_type
@ -166,6 +254,18 @@ func file_task_task_db_proto_init() {
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{}
out := protoimpl.TypeBuilder{
@ -173,7 +273,7 @@ func file_task_task_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_task_task_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -26,7 +26,7 @@ type TaskReceiveReq struct {
sizeCache protoimpl.SizeCache
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
}
@ -218,15 +218,17 @@ func (x *TaskListResp) GetList() []*DBTask {
return nil
}
//激活测试
type TaskActiveReq struct {
//活跃度
type TaskActiveListReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskTag int32 `protobuf:"varint,1,opt,name=taskTag,proto3" json:"taskTag"`
}
func (x *TaskActiveReq) Reset() {
*x = TaskActiveReq{}
func (x *TaskActiveListReq) Reset() {
*x = TaskActiveListReq{}
if protoimpl.UnsafeEnabled {
mi := &file_task_task_msg_proto_msgTypes[4]
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)
}
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]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -252,19 +254,28 @@ func (x *TaskActiveReq) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use TaskActiveReq.ProtoReflect.Descriptor instead.
func (*TaskActiveReq) Descriptor() ([]byte, []int) {
// Deprecated: Use TaskActiveListReq.ProtoReflect.Descriptor instead.
func (*TaskActiveListReq) Descriptor() ([]byte, []int) {
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
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
List []*DBTaskActive `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
}
func (x *TaskActiveResp) Reset() {
*x = TaskActiveResp{}
func (x *TaskActiveListResp) Reset() {
*x = TaskActiveListResp{}
if protoimpl.UnsafeEnabled {
mi := &file_task_task_msg_proto_msgTypes[5]
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)
}
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]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -290,11 +301,129 @@ func (x *TaskActiveResp) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use TaskActiveResp.ProtoReflect.Descriptor instead.
func (*TaskActiveResp) Descriptor() ([]byte, []int) {
// Deprecated: Use TaskActiveListResp.ProtoReflect.Descriptor instead.
func (*TaskActiveListResp) Descriptor() ([]byte, []int) {
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_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,
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, 0x0f, 0x0a, 0x0d, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63,
0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x22, 0x10, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41,
0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
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, 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 (
@ -330,23 +472,27 @@ 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, 6)
var file_task_task_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_task_task_msg_proto_goTypes = []interface{}{
(*TaskReceiveReq)(nil), // 0: TaskReceiveReq
(*TaskReceiveResp)(nil), // 1: TaskReceiveResp
(*TaskListReq)(nil), // 2: TaskListReq
(*TaskListResp)(nil), // 3: TaskListResp
(*TaskActiveReq)(nil), // 4: TaskActiveReq
(*TaskActiveResp)(nil), // 5: TaskActiveResp
(*DBTask)(nil), // 6: DBTask
(*TaskReceiveReq)(nil), // 0: TaskReceiveReq
(*TaskReceiveResp)(nil), // 1: TaskReceiveResp
(*TaskListReq)(nil), // 2: TaskListReq
(*TaskListResp)(nil), // 3: TaskListResp
(*TaskActiveListReq)(nil), // 4: TaskActiveListReq
(*TaskActiveListResp)(nil), // 5: TaskActiveListResp
(*TaskActiveReceiveReq)(nil), // 6: TaskActiveReceiveReq
(*TaskActiveReceiveResp)(nil), // 7: TaskActiveReceiveResp
(*DBTask)(nil), // 8: DBTask
(*DBTaskActive)(nil), // 9: DBTaskActive
}
var file_task_task_msg_proto_depIdxs = []int32{
6, // 0: TaskListResp.list:type_name -> DBTask
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
8, // 0: TaskListResp.list:type_name -> DBTask
9, // 1: TaskActiveListResp.list:type_name -> DBTaskActive
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_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{} {
switch v := v.(*TaskActiveReq); i {
switch v := v.(*TaskActiveListReq); i {
case 0:
return &v.state
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{} {
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:
return &v.state
case 1:
@ -435,7 +605,7 @@ func file_task_task_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_task_task_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -113,8 +113,7 @@ type DBUser struct {
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"` //等级
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,19,opt,name=diamond,proto3" json:"diamond" bson:"diamond"` // 钻石
Diamond int32 `protobuf:"varint,18,opt,name=diamond,proto3" json:"diamond" bson:"diamond"` // 钻石
}
func (x *DBUser) Reset() {
@ -268,13 +267,6 @@ func (x *DBUser) GetVip() int32 {
return 0
}
func (x *DBUser) GetTaskActive() int32 {
if x != nil {
return x.TaskActive
}
return 0
}
func (x *DBUser) GetDiamond() int32 {
if x != nil {
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,
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,
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,
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,
@ -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,
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,
0x70, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x76, 0x69, 0x70, 0x12, 0x1e, 0x0a, 0x0a,
0x74, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x05,
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,
0x70, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x76, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x07,
0x64, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x18, 0x12, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64,
0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}

View File

@ -7,8 +7,8 @@ import (
)
func TestIsToday(t *testing.T) {
// tt := time.Unix(1657163870, 0)
// fmt.Println(utils.IsToday(tt))
fmt.Println(utils.IsToday(1657163870))
}
func TestSubTime(t *testing.T) {