🎨 The reminder message will no longer pop up when the subscription expires for more than 2 days Fix https://github.com/siyuan-note/siyuan/issues/7816

This commit is contained in:
Liang Ding 2023-03-29 13:26:00 +08:00
parent cdb662f2bf
commit 574b7f39c9
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 14 additions and 11 deletions

View file

@ -227,12 +227,15 @@ func refreshSubscriptionExpirationRemind() {
}
if IsSubscriber() && -1 != Conf.User.UserSiYuanProExpireTime {
expired := int64(Conf.User.UserSiYuanProExpireTime)
if time.Now().UnixMilli() >= expired { // 已经过期
time.Sleep(time.Second * 30)
util.PushErrMsg(Conf.Language(128), 0)
now := time.Now().UnixMilli()
if now >= expired { // 已经过期
if now-expired <= 1000*60*60*24*2 { // 2 天内提醒 https://github.com/siyuan-note/siyuan/issues/7816
time.Sleep(time.Second * 30)
util.PushErrMsg(Conf.Language(128), 0)
}
return
}
remains := int((expired - time.Now().UnixMilli()) / 1000 / 60 / 60 / 24)
remains := int((expired - now) / 1000 / 60 / 60 / 24)
expireDay := 15 // 付费订阅提前 15 天提醒
if 2 == Conf.User.UserSiYuanSubscriptionPlan {
expireDay = 3 // 试用订阅提前 3 天提醒