作者 tangxvhui

调整短信的发送时间

... ... @@ -19,6 +19,8 @@ func (notices notifyConfirmEvaluationScore) from() string {
}
func (notices notifyConfirmEvaluationScore) makeNotify(param *domain.SummaryEvaluation) *domain.LogSms {
nextTime := time.Now().Add(6 * time.Hour)
executeAt := notices.getTimeExecuteAt(nextTime)
newSms := domain.LogSms{
Id: 0,
Phone: param.TargetUser.Account,
... ... @@ -32,7 +34,7 @@ func (notices notifyConfirmEvaluationScore) makeNotify(param *domain.SummaryEval
Status: domain.SmsWait,
From: notices.from(),
Index: param.Id,
ExecuteAt: notices.getTimeExecuteAt(time.Now()),
ExecuteAt: executeAt,
CreatedAt: time.Now(),
}
return &newSms
... ... @@ -75,8 +77,6 @@ func (notices notifyConfirmEvaluationScore) ifSend(index int) (bool, error) {
//计算下一条短信
smsMessage := notices.makeNotify(summaryEvaluationData)
nextTime := nowTime.Add(6 * time.Hour)
smsMessage.ExecuteAt = notices.getTimeExecuteAt(nextTime)
logSmsRepo := factory.CreateLogSmsRepository(map[string]interface{}{"transactionContext": transactionContext})
err = logSmsRepo.Save(smsMessage)
if err != nil {
... ...