Merge pull request 'dev-feat-IRONFANS-70-Robin' (#286) from dev-feat-IRONFANS-70-Robin into feat-IRONFANS-70

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/286
This commit is contained in:
chenhao 2024-04-12 23:07:12 +08:00
commit c1a2237479
3 changed files with 16 additions and 2 deletions

View File

@ -214,3 +214,8 @@ const (
IsHeaded_No = 0 //否
IsHeaded_Yes = 1 //是
)
// 从未更新的时间跨度
const (
DaysElapsedSinceTheLastZonesUpdate_Never = -1
)

View File

@ -16,7 +16,7 @@ func ApiCreateZoneThirdPartner(ctx *gin.Context) {
ec := service.DefaultService.ApiCreateZoneThirdPartner(ctx, req)
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
logger.Error("ApiCreateZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrorMsg(ctx, "server error")
ReplyErrCodeMsg(ctx, ec)
return
}

View File

@ -763,8 +763,17 @@ func (s *Service) utilGetStreamerExtMapByMids(ctx *gin.Context, mids []int64, op
streamerExt.CopyZones(zonesMap[mid])
// 计算空间更新时间距离现在时间跨度
nowTime := time.Now()
lastZoneMomentCt := int64(0)
for _, zone := range zonesMap[mid] {
lastZoneMomentCreateDay := util.GetDayStartTimeStamp(time.Unix(util.DerefInt64(zone.LastZoneMomentCt), 0))
if util.DerefInt64(zone.LastZoneMomentCt) > lastZoneMomentCt {
lastZoneMomentCt = util.DerefInt64(zone.LastZoneMomentCt)
}
}
if lastZoneMomentCt == 0 {
streamerExt.SetIsActiveWithinAWeek(consts.ZoneIsActiveWithinAWeek_No)
streamerExt.SetDaysElapsedSinceTheLastZonesUpdate(consts.DaysElapsedSinceTheLastZonesUpdate_Never)
} else {
lastZoneMomentCreateDay := util.GetDayStartTimeStamp(time.Unix(lastZoneMomentCt, 0))
today := util.GetDayStartTimeStamp(nowTime)
daysElapsedSinceTheLastZonesUpdate := (today - lastZoneMomentCreateDay) / int64(86400) // 24 * 60 * 60 = 86400秒
streamerExt.SetDaysElapsedSinceTheLastZonesUpdate(daysElapsedSinceTheLastZonesUpdate)