package sms

import (
	"eta/eta_mini_ht_api/models"
	"time"
)

type ApiMtZsyyt struct {
	SMID           int       `gorm:"column:SM_ID;type:decimal(8,0) unsigned;not null;default:0"`
	SrcID          int       `gorm:"column:SRC_ID;type:decimal(8,0) unsigned;not null;default:0"`
	Mobiles        string    `gorm:"column:MOBILES;type:longtext;not null"`
	Content        string    `gorm:"column:CONTENT;type:text;not null"`
	IsWap          bool      `gorm:"column:IS_WAP;type:tinyint(1);not null;default:0"`
	URL            string    `gorm:"column:URL;type:varchar(110);not null;default:''"`
	SendTime       time.Time `gorm:"column:SEND_TIME;type:datetime;default:'0000-00-00 00:00:00'"`
	SmType         int       `gorm:"column:SM_TYPE;type:tinyint(1);not null;default:0"`
	MsgFmt         int       `gorm:"column:MSG_FMT;type:int(11);not null;default:0"`
	TpPid          int       `gorm:"column:TP_PID;type:tinyint(1);not null;default:0"`
	TpUdhi         int       `gorm:"column:TP_UDHI;type:tinyint(1);not null;default:0"`
	FeeTerminalId  string    `gorm:"column:FEE_TERMINAL_ID;type:varchar(10);not null;default:''"`
	FeeType        string    `gorm:"column:FEE_TYPE;type:varchar(10);not null;default:''"`
	FeeCode        string    `gorm:"column:FEE_CODE;type:varchar(10);not null;default:''"`
	FeeUserType    int       `gorm:"column:FEE_USER_TYPE;type:int(11);not null;default:0"`
	UnicodeContent string    `gorm:"column:UNICODE_CONTENT;type:text;not null"`
}

func (ApiMtZsyyt) TableName() string {
	return "api_mt_zsyyt"
}

// 发送短信方法
func Send(msg ApiMtZsyyt) error {
	// 创建记录
	err := models.EMAS().Create(&msg).Error
	if err != nil {
		return err
	}
	return nil
}
