log_sms.go 1.1 KB
package domain

import "time"

//记录 发送的短信消息

type LogSms struct {
	Id         int
	Phone      string
	TemplateId int
	Template   string
	Value      map[string]string
	Result     string
	Status     SmsStatus
	From       string //业务来源
	Index      int    //业务数据索引
	ExecuteAt  time.Time
	CreatedAt  time.Time
}

type SmsStatus string

const (
	SmsWait    SmsStatus = "wait"    //等待执行
	SmsInit    SmsStatus = "init"    //正在执行
	SmsSuccess SmsStatus = "success" //执行成功
	SmsFailed  SmsStatus = "failed"  //执行失败
	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 {
	Insert(param *LogSms) error
	Save(param *LogSms) error
	Find(queryOptions map[string]interface{}) (int, []*LogSms, error)
}