配置空判断
This commit is contained in:
parent
e36e16ae92
commit
2a06c90585
@ -17,9 +17,9 @@ var (
|
||||
subType: task.TaskSubTypeList,
|
||||
req: &pb.TaskListReq{
|
||||
//设置任务类型
|
||||
TaskTag: int32(comm.TASK_DAILY), //每天任务
|
||||
// TaskTag: int32(comm.TASK_DAILY), //每天任务
|
||||
// TaskTag: int32(comm.TASK_WEEKLY), //周任务
|
||||
// TaskTag: int32(comm.TASK_ACHIEVE),
|
||||
TaskTag: int32(comm.TASK_ACHIEVE),
|
||||
// TaskTag: int32(comm.TASK_STRATEGY),
|
||||
},
|
||||
rsp: &pb.TaskListResp{},
|
||||
@ -39,8 +39,8 @@ var (
|
||||
mainType: string(comm.ModuleTask),
|
||||
subType: task.TaskSubTypeReceive,
|
||||
req: &pb.TaskReceiveReq{
|
||||
TaskTag: int32(comm.TASK_DAILY),
|
||||
Id: "62dfee653be162da508224a4",
|
||||
TaskTag: int32(comm.TASK_ACHIEVE),
|
||||
Id: "62e0d79d7eefc9f4ef5803e3",
|
||||
},
|
||||
rsp: &pb.TaskReceiveResp{},
|
||||
// enabled: true,
|
||||
@ -65,7 +65,7 @@ var (
|
||||
}
|
||||
fmt.Printf("玩家活跃度 :%v \n", out.Active)
|
||||
},
|
||||
enabled: true,
|
||||
// enabled: true,
|
||||
}, {
|
||||
desc: "活跃度领取",
|
||||
mainType: string(comm.ModuleTask),
|
||||
|
@ -48,23 +48,27 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
||||
return
|
||||
}
|
||||
|
||||
//更新活跃度
|
||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
if ue != nil {
|
||||
update := make(map[string]interface{})
|
||||
if comm.TaskTag(req.TaskTag) == comm.TASK_DAILY {
|
||||
update["activeday"] = ue.Activeday + conf.Active
|
||||
} else if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY {
|
||||
update["activeweek"] = ue.Activeweek + conf.Active
|
||||
}
|
||||
if err = this.moduleTask.ModuleUser.ChanageUserExpand(session.GetUserId(), update); err != nil {
|
||||
if conf.Active > 0 {
|
||||
//更新活跃度
|
||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
if ue != nil {
|
||||
update := make(map[string]interface{})
|
||||
if comm.TaskTag(req.TaskTag) == comm.TASK_DAILY {
|
||||
update["activeday"] = ue.Activeday + conf.Active
|
||||
} else if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY {
|
||||
update["activeweek"] = ue.Activeweek + conf.Active
|
||||
}
|
||||
if len(update) > 0 {
|
||||
if err = this.moduleTask.ModuleUser.ChanageUserExpand(session.GetUserId(), update); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//奖励
|
||||
|
Loading…
Reference in New Issue
Block a user