活动开启时间取开服时间做相应计算

This commit is contained in:
meixiongfeng 2023-05-24 11:02:00 +08:00
parent c5e09f3281
commit a46e6cd3f2
2 changed files with 12 additions and 4 deletions

View File

@ -45,12 +45,16 @@ func (this *modelCaravan) getCaravanList(uid string) (result *pb.DBCaravan, err
if err = this.Get(uid, result); err != nil && mgo.MongodbNil == err {
// 创建一条数据
result.Id = primitive.NewObjectID().Hex()
result.Resettime = this.module.service.GetOpentime().Unix() + int64(this.module.ModuleTools.GetGlobalConf().BusinessRewardday*24*3600)
// 活动持续时间
sTime := int64(this.module.ModuleTools.GetGlobalConf().BusinessRewardday * 24 * 3600) // 单位s
openTime := this.module.service.GetOpentime().Unix() // 获取开服时间
subTime := configure.Now().Unix() - openTime
result.Resettime = configure.Now().Unix() - (subTime % sTime) + sTime
//result.Resettime = +int64(this.module.ModuleTools.GetGlobalConf().BusinessRewardday * 24 * 3600)
result.Citystime = configure.Now().Unix()
result.Lv = 1
result.Curcity = this.module.configure.GetCaravanInitCity() // 获取默认城市
if conf := this.module.configure.GetCaravanLv(1); conf != nil {
if conf := this.module.configure.GetCaravanLv(result.Lv); conf != nil {
result.Baglimit = conf.Bagtop
}
this.module.InitCaravanCityData(uid, result) // 初始1级

View File

@ -203,8 +203,12 @@ func (this *Caravan) refreshCaravanCityInfo(uid string, caravan *pb.DBCaravan) {
}
}
if configure.Now().Unix() >= caravan.Resettime {
caravan.Resettime = this.service.GetOpentime().Unix() + int64(this.ModuleTools.GetGlobalConf().BusinessRewardday*24*3600)
sTime := int64(this.ModuleTools.GetGlobalConf().BusinessRewardday * 24 * 3600) // 单位s
openTime := this.service.GetOpentime().Unix() // 获取开服时间
subTime := configure.Now().Unix() - openTime
caravan.Resettime = configure.Now().Unix() - (subTime % sTime) + sTime
update["resettime"] = caravan.Resettime
bChange = true
}
if bChange {
update["city"] = caravan.City