掠夺结束时间

This commit is contained in:
meixiongfeng 2024-01-30 14:43:18 +08:00
parent 83170939c2
commit 4fe2e92dc6
2 changed files with 6 additions and 8 deletions

View File

@ -54,10 +54,8 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
return return
} }
var uids []string var uids []string
etime := this.module.modelLand.GetEndTime()
// 清理岛数据 // 清理岛数据
if land.Etime > configure.Now().Unix() { if land.Etime < configure.Now().Unix() {
land.Etime = etime
for _, v := range land.Uinfo { // 重置成员信息 for _, v := range land.Uinfo { // 重置成员信息
uids = append(uids, v.Uid) uids = append(uids, v.Uid)
} }
@ -65,9 +63,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
fmt.Printf("err:%v", err) fmt.Printf("err:%v", err)
return return
} }
}
// 校验是否过期
if list.Etime > configure.Now().Unix() {
if land, err = this.module.modelLand.createPlunderLandData(list); err != nil { if land, err = this.module.modelLand.createPlunderLandData(list); err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError, Code: pb.ErrorCode_DBError,
@ -77,7 +73,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
} }
list.Landid = land.Id list.Landid = land.Id
update["landid"] = land.Id update["landid"] = land.Id
list.Etime = etime list.Etime = land.Etime
update["etime"] = land.Etime update["etime"] = land.Etime
} }

View File

@ -52,13 +52,15 @@ func (this *modelLand) createPlunderLandData(user *pb.DBPlunder) (land *pb.DBPlu
other []string other []string
users []*pb.DBPlunder users []*pb.DBPlunder
socre int32 socre int32
eTime int64
) )
eTime = this.module.modelLand.GetEndTime()
land = &pb.DBPlunderLand{ land = &pb.DBPlunderLand{
Id: primitive.NewObjectID().Hex(), Id: primitive.NewObjectID().Hex(),
Ship: map[string]*pb.ShipData{}, Ship: map[string]*pb.ShipData{},
Uinfo: make(map[int32]*pb.BaseUserInfo, 0), Uinfo: make(map[int32]*pb.BaseUserInfo, 0),
Score: make(map[string]int32, 0), Score: make(map[string]int32, 0),
Etime: utils.GetTodayZeroTime(configure.Now().Unix()) + 48*3600, // 临时处理 后面走配置 Etime: eTime,
} }
socre = user.Score - 100 socre = user.Score - 100