log_sms.go
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package domain
import "time"
//记录 发送的短信消息
type LogSms struct {
Id int `json:"id"`
Phone string `json:"phone"`
TemplateId int `json:"templateId"`
Template string `json:"template"`
Value map[string]string `json:"value"`
Result string `json:"result"`
Status SmsStatus `json:"status"`
From string `json:"from"` //业务来源
Index int `json:"index"` //业务数据索引
ExecuteAt time.Time `json:"executeAt"`
CreatedAt time.Time `json:"createdAt"`
}
type SmsStatus string
const (
SmsWait SmsStatus = "wait" //等待执行
SmsSuccess SmsStatus = "success" //执行成功
SmsIgnore SmsStatus = "ignore" //忽略执行
)
// 每日自评 短信消息提醒
func (sms *LogSms) SummaryEvaluationMessage(phone string, name string) {
*sms = LogSms{
Id: 0,
Phone: phone,
TemplateId: 5475050,
Template: "您好,#name#,百忙之中不要忘记填写今天的绩效自评反馈哦",
Value: map[string]string{
"name": name,
},
CreatedAt: time.Now(),
}
}
type LogSmsRepository interface {
Save(param *LogSms) error
BatchInsert(params []*LogSms) error
Find(queryOptions map[string]interface{}) (int, []*LogSms, error)
}