正在显示
1 个修改的文件
包含
48 行增加
和
27 行删除
| @@ -19,33 +19,6 @@ func (notices notifyStaffAssess) from() string { | @@ -19,33 +19,6 @@ func (notices notifyStaffAssess) from() string { | ||
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | // makeNotify 生成待执行的短信通知内容 | 21 | // makeNotify 生成待执行的短信通知内容 |
| 22 | -// func (notices notifyStaffAssess) makeNotify(param *domain.StaffAssess) *domain.LogSms { | ||
| 23 | -// newSms := domain.LogSms{ | ||
| 24 | -// Id: 0, | ||
| 25 | -// Phone: param.Executor.Account, | ||
| 26 | -// TemplateId: 5475050, | ||
| 27 | -// Template: "您好,#name#,百忙之中不要忘记填写今天的绩效自评反馈哦", | ||
| 28 | -// Value: map[string]string{ | ||
| 29 | -// "name": param.Executor.UserName, | ||
| 30 | -// }, | ||
| 31 | -// Result: "", | ||
| 32 | -// Status: domain.SmsWait, | ||
| 33 | -// From: notices.from(), | ||
| 34 | -// Index: param.Id, | ||
| 35 | -// // ExecuteAt: executeAt, | ||
| 36 | -// CreatedAt: time.Now(), | ||
| 37 | -// } | ||
| 38 | -// // 每日自评 结束前30 分钟 | ||
| 39 | -// // newSms.ExecuteAt = param.EndTime.Add(-1800 * time.Second) | ||
| 40 | -// //改为 固定在截止时间 那天的 前一天晚上10 | ||
| 41 | -// y, m, d := param.EndTime.Local().Date() | ||
| 42 | -// dayTime := time.Date(y, m, d, 0, 0, 0, 0, time.Local) | ||
| 43 | -// newSms.ExecuteAt = dayTime.Add(-2 * time.Hour) | ||
| 44 | - | ||
| 45 | -// return &newSms | ||
| 46 | -// } | ||
| 47 | -// | ||
| 48 | -// makeNotify 生成待执行的短信通知内容 | ||
| 49 | func (notices notifyStaffAssess) makeNotify(param *domain.StaffAssess) *domain.LogSms { | 22 | func (notices notifyStaffAssess) makeNotify(param *domain.StaffAssess) *domain.LogSms { |
| 50 | year, month, dayNumber := param.BeginTime.Local().Date() | 23 | year, month, dayNumber := param.BeginTime.Local().Date() |
| 51 | 24 | ||
| @@ -109,3 +82,51 @@ func (notices notifyStaffAssess) ifSend(index int) (bool, error) { | @@ -109,3 +82,51 @@ func (notices notifyStaffAssess) ifSend(index int) (bool, error) { | ||
| 109 | } | 82 | } |
| 110 | return false, nil | 83 | return false, nil |
| 111 | } | 84 | } |
| 85 | + | ||
| 86 | +// TODO | ||
| 87 | +type notifyStaffAssess2 struct { | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +var _ notifySendOrNot = (*notifyStaffAssess2)(nil) | ||
| 91 | + | ||
| 92 | +func (notices notifyStaffAssess2) from() string { | ||
| 93 | + return "StaffAssess2" | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +// makeNotify 生成待执行的短信通知内容 | ||
| 97 | +func (notices notifyStaffAssess2) makeNotify(param *domain.StaffAssess) *domain.LogSms { | ||
| 98 | + year, month, dayNumber := param.BeginTime.Local().Date() | ||
| 99 | + | ||
| 100 | + // 限制只有 在每月的15号进行每日评估填报时,才进行短信消息提醒 | ||
| 101 | + if dayNumber != 15 { | ||
| 102 | + return nil | ||
| 103 | + } | ||
| 104 | + // 每月15日的每日评估必做,15日上午9点 发送短信提醒 | ||
| 105 | + dayTime := time.Date(year, month, dayNumber, 9, 0, 0, 0, time.Local) | ||
| 106 | + newSms := domain.LogSms{ | ||
| 107 | + Id: 0, | ||
| 108 | + Phone: param.Executor.Account, | ||
| 109 | + TemplateId: 5824230, | ||
| 110 | + Template: "您好,#name#,百忙之中不要忘记填写#date#的绩效自评反馈哦", | ||
| 111 | + Value: map[string]string{ | ||
| 112 | + "name": param.Executor.UserName, | ||
| 113 | + "date": "本月15日", | ||
| 114 | + }, | ||
| 115 | + Result: "", | ||
| 116 | + Status: domain.SmsWait, | ||
| 117 | + From: notices.from(), | ||
| 118 | + Index: param.Id, | ||
| 119 | + ExecuteAt: dayTime, | ||
| 120 | + CreatedAt: time.Now(), | ||
| 121 | + } | ||
| 122 | + return &newSms | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +// ifSend 确认是否发送通知 | ||
| 126 | +func (notices notifyStaffAssess2) ifSend(index int) (bool, error) { | ||
| 127 | + if constant.Env != "prd" { | ||
| 128 | + return false, nil | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + return true, nil | ||
| 132 | +} |
-
请 注册 或 登录 后发表评论