作者 tangxvhui

调整短信消息提醒

... ... @@ -115,6 +115,7 @@ func (notices *notifySms) checkSendSms() error {
"status": string(domain.SmsWait),
"executeAtBegin": nowDay,
"executeAtEnd": nowTime,
"limit": 1000,
})
if err != nil {
return err
... ...
... ... @@ -90,23 +90,18 @@ func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) {
}
// 输入的时间为基础微调短信的执行时间
// 适配规则 :(23:00-7:00期间不提醒)
// 适配规则 :每隔6个小时进行提醒(23:00-7:00期间不提醒)
func (notices notifyConfirmEvaluationScore) getTimeExecuteAt(nowTime time.Time) time.Time {
nowHour := nowTime.Local().Hour()
if nowHour < 23 && nowHour > 7 {
if nowHour < 23 && nowHour >= 7 {
return nowTime
}
year, month, day := nowTime.Local().Date()
//微调执行时间
if nowHour >= 23 {
//第二天:7:00
t1 := time.Date(year, month, day, 23, 59, 59, 0, time.Local)
return t1.Add(7 * time.Hour)
t1 := nowTime.Add(6 * time.Hour)
hour1 := t1.Local().Hour()
if hour1 < 23 && hour1 >= 7 {
return t1
}
if nowHour <= 7 {
//当天 7:00
t1 := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
return t1.Add(7 * time.Hour)
}
return nowTime
return t1.Add(6 * time.Hour)
}
... ...