This commit is contained in:
aozhiwei 2024-08-16 15:05:47 +08:00
parent fe6a4c2874
commit 07388637c5

View File

@ -221,10 +221,10 @@ func (this *AnncApi) AddIngameAnnc(c *gin.Context) {
annc.Uniid = uint64(f5.GetApp().NewNodeUuid()) annc.Uniid = uint64(f5.GetApp().NewNodeUuid())
nowDaySeconds := int32(f5.GetApp().GetRealSeconds()) nowDaySeconds := int32(f5.GetApp().GetRealSeconds())
annc.BeginTime = getTimeSeconds(annc.BeginTime) annc.BeginTime = int32(int64(annc.BeginTime) - q5.GetDaySeconds(int64(annc.BeginTime), 0))
annc.EndTime = getTimeSeconds(annc.EndTime) annc.EndTime = int32(int64(annc.EndTime) - q5.GetDaySeconds(int64(annc.EndTime), 0))
annc.BeginDate = getUtcDaysSeconds(annc.BeginDate) annc.BeginDate = int32(q5.GetDaySeconds(int64(annc.BeginDate), 0))
annc.EndDate = getUtcDaysSeconds(annc.EndDate) annc.EndDate = int32(q5.GetDaySeconds(int64(annc.EndDate), 0))
annc.CreateTime = nowDaySeconds annc.CreateTime = nowDaySeconds
annc.ModifyTime = nowDaySeconds annc.ModifyTime = nowDaySeconds
err := f5.GetApp().GetOrmDb(constant.CONF_DB).Create(&annc).Error err := f5.GetApp().GetOrmDb(constant.CONF_DB).Create(&annc).Error
@ -328,7 +328,8 @@ func (this *AnncApi) CheckIngameAnnc(annc system.IngameAnnc, c *gin.Context) boo
// return false // return false
// } // }
if getUtcDaysSeconds(annc.EndDate) < getUtcDaysSeconds(annc.BeginDate) || getUtcDaysSeconds(annc.EndDate) < getUtcDaysSeconds(int32(notsecs)) { if q5.GetDaySeconds(int64(annc.EndDate), 0) < q5.GetDaySeconds(int64(annc.BeginDate), 0) ||
q5.GetDaySeconds(int64(annc.EndDate), 0) < q5.GetDaySeconds(int64(notsecs), 0) {
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"code": 2, "code": 2,
"message": "发送日期不对", "message": "发送日期不对",
@ -338,11 +339,3 @@ func (this *AnncApi) CheckIngameAnnc(annc system.IngameAnnc, c *gin.Context) boo
return true return true
} }
func getUtcDaysSeconds(ts int32) int32 {
return ts / 3600 / 24 * 3600 * 24
}
func getTimeSeconds(ts int32) int32 {
return ts - ts/3600/24*3600*24
}