Commit 5a89c1c9 authored by chenweijian's avatar chenweijian

最大时间

parent 7ea268ea
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment