54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package task
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
// 活跃度列表
|
|
func (this *apiComp) ActiveListCheck(session comm.IUserSession, req *pb.TaskActiveListReq) (errdata *pb.ErrorData) {
|
|
if req.TaskTag <= 0 || req.TaskTag > 2 {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ReqParameterError,
|
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveListReq) (errdata *pb.ErrorData) {
|
|
if errdata = this.ActiveListCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
|
|
resp := &pb.TaskActiveListResp{}
|
|
defer func() {
|
|
session.SendMsg(string(this.module.GetType()), TaskSubTypeActiveList, resp)
|
|
}()
|
|
|
|
// 获取玩家活跃度
|
|
expand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
|
|
if err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if expand != nil {
|
|
// 返回活跃度
|
|
if req.TaskTag == int32(comm.TASK_DAILY) {
|
|
resp.Active = expand.Activeday
|
|
} else if req.TaskTag == int32(comm.TASK_WEEKLY) {
|
|
resp.Active = expand.Activeweek
|
|
}
|
|
}
|
|
|
|
//获取当前Tag的活跃度列表
|
|
resp.List = this.module.modelTaskActive.getActiveListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
|
|
|
|
return
|
|
}
|