月梦战令提交

This commit is contained in:
liwei 2023-08-11 11:41:51 +08:00
parent 37190a544c
commit ffffd51ee4
3 changed files with 47 additions and 25 deletions

View File

@ -18,13 +18,14 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.WarorderInfoRe
// /获取系统公告 // /获取系统公告
func (this *apiComp) Info(session comm.IUserSession, req *pb.WarorderInfoReq) (errdata *pb.ErrorData) { func (this *apiComp) Info(session comm.IUserSession, req *pb.WarorderInfoReq) (errdata *pb.ErrorData) {
var ( var (
confs []*cfg.GamePassCheckTaskData confs map[int32]*cfg.GamePassCheckTaskData
info *pb.DBWarorders info *pb.DBWarorders
warorder *pb.Warorder warorder *pb.Warorder
dwarorder *pb.DreamWarorder dwarorder *pb.DreamWarorder
activity *pb.DBHuodong activity *pb.DBHuodong
condiIds []int32 condiIds []int32
progress []*pb.ConIProgress progress []*pb.ConIProgress
activation []int32 = make([]int32, 0)
err error err error
ok bool ok bool
) )
@ -75,12 +76,22 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.WarorderInfoReq) (e
if dwarorder, ok = info.Dreamwarorder[req.Rtype]; !ok { if dwarorder, ok = info.Dreamwarorder[req.Rtype]; !ok {
dwarorder = &pb.DreamWarorder{ dwarorder = &pb.DreamWarorder{
Lv: 1, Lv: 1,
Opentime: activity.Stime,
Endtime: activity.Etime,
Freeprogress: 0,
Payprogress: 0,
} }
info.Dreamwarorder[req.Rtype] = dwarorder info.Dreamwarorder[req.Rtype] = dwarorder
for _, v := range confs {
if v.Page == 3 {
activation = append(activation, v.Parameter)
}
}
} }
if dwarorder.Opentime != activity.Stime { if dwarorder.Opentime != activity.Stime {
dwarorder.Opentime = activity.Stime dwarorder.Opentime = activity.Stime
dwarorder.Endtime = activity.Etime dwarorder.Endtime = activity.Etime
dwarorder.Freeprogress = 0
dwarorder.Payprogress = 0 dwarorder.Payprogress = 0
} }
@ -88,20 +99,31 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.WarorderInfoReq) (e
daynum := this.module.ModuleTools.GetGlobalConf().Passcheck4DayNum daynum := this.module.ModuleTools.GetGlobalConf().Passcheck4DayNum
this.module.model.refreshDayTask(dwarorder, confs, daynum) this.module.model.refreshDayTask(dwarorder, confs, daynum)
dwarorder.Daytime = configure.Now().Unix() dwarorder.Daytime = configure.Now().Unix()
for _, v := range dwarorder.Daytasks {
activation = append(activation, confs[v].Parameter)
}
} }
if !utils.IsSameWeek(dwarorder.Weektime) { if !utils.IsSameWeek(dwarorder.Weektime) {
weeknum := this.module.ModuleTools.GetGlobalConf().Passcheck4WeekNum weeknum := this.module.ModuleTools.GetGlobalConf().Passcheck4WeekNum
this.module.model.refreshWeekTask(dwarorder, confs, weeknum) this.module.model.refreshWeekTask(dwarorder, confs, weeknum)
dwarorder.Weektime = configure.Now().Unix() dwarorder.Weektime = configure.Now().Unix()
for _, v := range dwarorder.Weektasks {
activation = append(activation, confs[v].Parameter)
}
}
if len(activation) > 0 {
if errdata = this.module.ModuleBuried.ActiveCondition(session.GetUserId(), activation...); errdata != nil {
return
}
} }
condiIds = make([]int32, 0) condiIds = make([]int32, 0)
for _, v := range dwarorder.Daytasks { for _, v := range dwarorder.Daytasks {
condiIds = append(condiIds, v) condiIds = append(condiIds, confs[v].Parameter)
} }
for _, v := range dwarorder.Weektasks { for _, v := range dwarorder.Weektasks {
condiIds = append(condiIds, v) condiIds = append(condiIds, confs[v].Parameter)
} }
for _, v := range confs { for _, v := range confs {
@ -110,14 +132,14 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.WarorderInfoReq) (e
} }
} }
// if progress, err = this.module.ModuleBuried.CheckCondition(session.GetUserId(), condiIds...); err != nil { if progress, err = this.module.ModuleBuried.CheckCondition(session.GetUserId(), condiIds...); err != nil {
// errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
// Code: pb.ErrorCode_ExternalModule, Code: pb.ErrorCode_ExternalModule,
// Title: pb.ErrorCode_ExternalModule.ToString(), Title: pb.ErrorCode_ExternalModule.ToString(),
// Message: err.Error(), Message: err.Error(),
// } }
// return return
// } }
} }
if err = this.module.model.updateUserWarorders(session.GetUserId(), info); err != nil { if err = this.module.model.updateUserWarorders(session.GetUserId(), info); err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{

View File

@ -137,14 +137,14 @@ func (this *configureComp) updatePassCheckExp() {
} }
// 读取任务配置表 // 读取任务配置表
func (this *configureComp) getGamePassCheckTask() (confs []*cfg.GamePassCheckTaskData, err error) { func (this *configureComp) getGamePassCheckTask() (confs map[int32]*cfg.GamePassCheckTaskData, err error) {
var ( var (
v interface{} v interface{}
) )
if v, err = this.GetConfigure(game_passchecktask); err != nil { if v, err = this.GetConfigure(game_passchecktask); err != nil {
return return
} else { } else {
confs = v.(*cfg.GamePassCheckTask).GetDataList() confs = v.(*cfg.GamePassCheckTask).GetDataMap()
} }
return return
} }

View File

@ -82,7 +82,7 @@ func (this *modelWarorder) updateUserWarorders(uid string, data *pb.DBWarorders)
} }
//刷新日常任务 //刷新日常任务
func (this *modelWarorder) refreshDayTask(info *pb.DreamWarorder, confs []*cfg.GamePassCheckTaskData, num int32) { func (this *modelWarorder) refreshDayTask(info *pb.DreamWarorder, confs map[int32]*cfg.GamePassCheckTaskData, num int32) {
var ( var (
tasks []*cfg.GamePassCheckTaskData = make([]*cfg.GamePassCheckTaskData, 0) tasks []*cfg.GamePassCheckTaskData = make([]*cfg.GamePassCheckTaskData, 0)
weight []int32 = make([]int32, 0) weight []int32 = make([]int32, 0)
@ -104,7 +104,7 @@ func (this *modelWarorder) refreshDayTask(info *pb.DreamWarorder, confs []*cfg.G
} }
//刷新日常任务 //刷新日常任务
func (this *modelWarorder) refreshWeekTask(info *pb.DreamWarorder, confs []*cfg.GamePassCheckTaskData, num int32) { func (this *modelWarorder) refreshWeekTask(info *pb.DreamWarorder, confs map[int32]*cfg.GamePassCheckTaskData, num int32) {
var ( var (
tasks []*cfg.GamePassCheckTaskData = make([]*cfg.GamePassCheckTaskData, 0) tasks []*cfg.GamePassCheckTaskData = make([]*cfg.GamePassCheckTaskData, 0)
weight []int32 = make([]int32, 0) weight []int32 = make([]int32, 0)