12345678910111213141516171819202122232425262728293031323334353637383940 |
- package services
- import (
- "context"
- "fmt"
- "hongze/hongze_task/models"
- "hongze/hongze_task/utils"
- "time"
- )
- //英文研报客户 临时->终止
- func EnglishReportEmailTermination(cont context.Context) (err error) {
- defer func() {
- if err != nil {
- go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "英文研报客户 临时->终止 ErrMsg:"+err.Error(), utils.EmailSendToUsers)
- }
- }()
- expiredTime := time.Now().AddDate(0, 0, -31).Format(utils.FormatDate)
- items, err := models.GetEndEnglishReportEmailListByDate(expiredTime)
- if err != nil && err.Error() != utils.ErrNoRow() {
- fmt.Println("GetEndEnglishReportEmailListByDate Err:" + err.Error())
- utils.FileLog.Info("GetEndEnglishReportEmailListByDate Err:%s" + err.Error())
- return
- }
- disableIds := make([]int, 0)
- for _, v := range items {
- disableIds = append(disableIds, v.Id)
- }
- if len(disableIds) > 0 {
- err = models.UpdateEnglishReportEmailTermination(disableIds)
- if err != nil {
- return err
- }
- }
- return
- }
|