91 lines
2.4 KiB
Go
91 lines
2.4 KiB
Go
package dreamwarorder
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
"go_dreamfactory/utils"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.DreamWarorderInfoReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// /获取自己的排行榜信息
|
|
func (this *apiComp) Info(session comm.IUserSession, req *pb.DreamWarorderInfoReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
confs []*cfg.GamePassCheckTaskData
|
|
info *pb.DBDreamWarorder
|
|
condiIds []int32
|
|
progress []*pb.ConIProgress
|
|
update map[string]interface{} = make(map[string]interface{})
|
|
err error
|
|
)
|
|
if errdata = this.InfoCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
|
|
if confs, err = this.module.configure.getGamePassCheckTask(); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ConfigNoFound,
|
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if info, err = this.module.model.getUserDreamwarorder(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if utils.IsToday(info.Daytime) {
|
|
daynum := this.module.ModuleTools.GetGlobalConf().Passcheck4DayNum
|
|
this.module.model.refreshDayTask(info, confs, daynum)
|
|
update["daytime"] = info.Daytime
|
|
update["daytasks"] = info.Daytasks
|
|
}
|
|
if utils.IsSameWeek(info.Weektime) {
|
|
weeknum := this.module.ModuleTools.GetGlobalConf().Passcheck4WeekNum
|
|
this.module.model.refreshDayTask(info, confs, weeknum)
|
|
update["weektime"] = info.Weektime
|
|
update["weektasks"] = info.Weektasks
|
|
}
|
|
condiIds = make([]int32, 0)
|
|
for _, v := range info.Daytasks {
|
|
condiIds = append(condiIds, v)
|
|
}
|
|
for _, v := range info.Weektasks {
|
|
condiIds = append(condiIds, v)
|
|
}
|
|
|
|
for _, v := range confs {
|
|
if v.Page == 3 {
|
|
condiIds = append(condiIds, v.Parameter)
|
|
}
|
|
}
|
|
|
|
if progress, err = this.module.ModuleBuried.CheckCondition(session.GetUserId(), condiIds...); err != nil {
|
|
return
|
|
}
|
|
|
|
if len(update) > 0 {
|
|
if err = this.module.model.Change(session.GetUserId(), update); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
}
|
|
}
|
|
|
|
session.SendMsg(string(this.module.GetType()), "info", &pb.DreamWarorderInfoResp{Conlds: progress, Info: info})
|
|
return
|
|
}
|