42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package oldtimes
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/log"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
func (this *apiComp) GetallCheck(session comm.IUserSession, req *pb.OldtimesGetallReq) (code pb.ErrorCode) {
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) Getall(session comm.IUserSession, req *pb.OldtimesGetallReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
|
uid := session.GetUserId()
|
|
|
|
rsp := &pb.OldtimesGetallResp{}
|
|
d := this.module.modelOldtimes.getDBOldtimes(uid)
|
|
|
|
if imodule, err := this.service.GetModule(comm.ModuleCombat); err == nil {
|
|
if combat, ok := imodule.(comm.ICombat); ok {
|
|
for _, chapter := range d.Chapters {
|
|
for _, level := range chapter.Levels {
|
|
conf := this.module.configure.getMaintaskCfgBy(level.Lid)
|
|
if conf != nil {
|
|
if combat.GetLevelStatus(uid, conf.Stageid) {
|
|
level.Status = int32(finish)
|
|
if err := this.module.modelOldtimes.updateOldtimes(uid, d); err != nil {
|
|
this.module.Error("oldtime更新失败",
|
|
log.Field{Key: "uid", Value: uid})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
rsp.Data = d
|
|
session.SendMsg(string(this.module.GetType()), "getall", rsp)
|
|
return
|
|
}
|