log_sms.go 1.3 KB
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
	Find(queryOptions map[string]interface{}) (int, []*LogSms, error)
}