diff --git a/txop/headwear_tx/headwear.go b/txop/headwear_tx/headwear.go index 43173529594fde2bcd2acf2ea71c9b3c1beb7244..42575ea8b418bdc7c91df6cecb6e6ec909202690 100644 --- a/txop/headwear_tx/headwear.go +++ b/txop/headwear_tx/headwear.go @@ -9,6 +9,7 @@ import ( "git.hilo.cn/hilo-common/internal/model/res_m" "git.hilo.cn/hilo-common/internal/model/user_m" "git.hilo.cn/hilo-common/resource/mysql" + "git.hilo.cn/hilo-common/utils" "strconv" "time" ) @@ -29,6 +30,10 @@ func SendHeadwear(model *domain.Model, receiverUserId mysql.ID, headdressId mysq nowTime = userHeadwear.EndTime } userHeadwear.EndTime = nowTime.Add(time.Duration(receiveHeadwearDuration) * time.Second) + maxEndTime, _ := time.ParseInLocation(utils.DATETIME_FORMAT, "2038-01-01 23:59:59", time.Local) + if userHeadwear.EndTime.After(maxEndTime) { + userHeadwear.EndTime = maxEndTime + } if err := userHeadwear.Persistent(); err != nil { return err }