Documentation
¶
Index ¶
- Variables
- func GetAllSmsReceiptFailedRecords(query map[string]string, fields []string, sortby []string, order []string, ...) (ml []interface{}, err error)
- func GetAllSmsRechargeRecords(query map[string]string, fields []string, sortby []string, order []string, ...) (ml []interface{}, err error)
- func GetAllSmsSendRecords(query map[string]string, fields []string, sortby []string, order []string, ...) (ml []interface{}, err error)
- func GetAllSmsServiceProviders(query map[string]string, fields []string, sortby []string, order []string, ...) (ml []interface{}, err error)
- func GetAllSmsTemplates(query map[string]string, fields []string, sortby []string, order []string, ...) (ml []interface{}, err error)
- func GetChuanglanRemainingSMS(companyId int64) (platformVerificationCount int64, platformMarketingCount int64, ...)
- func UpdateChuanglanRemaingSMS(companyId int64, platformVerificationInc int64, platformMarketingInc int64, ...)
- type BatchSmsSendRespInfo
- type ChuanglanInfo
- func (t *ChuanglanInfo) QueryBalance(accountType int16) (remainingCount int, retcode int, err error)
- func (t *ChuanglanInfo) ReceivedNotification(mobile string, msgid string, code string, reportTime string) (retcode int, err error)
- func (t *ChuanglanInfo) SendMarketingSms(content string, mobiles []string) (countPerSingle int, smsSendCount int, msgid string, retcode int, err error)
- func (t *ChuanglanInfo) SendVerificationSms(content string, mobiles []string) (countPerSingle int, smsSendCount int, msgid string, retcode int, err error)
- type ISMS
- type SendSmsRespInfo
- type SmsReceiptFailedRecords
- type SmsRechargeRecords
- func (t *SmsRechargeRecords) InsertSmsRechargeRecordNoLock(o *orm.Ormer) (retcode int, err error)
- func (t *SmsRechargeRecords) TableName() string
- func (t *SmsRechargeRecords) UpdateSmsRechargeInfoByOutTradeNoNoLock(o *orm.Ormer) (retcode int, err error)
- func (t *SmsRechargeRecords) UpdateSmsRechargeInfoNoLock(o *orm.Ormer) (retcode int, err error)
- type SmsSendRecords
- type SmsServer
- type SmsServiceProviders
- type SmsTemplates
- type YunpianInfo
- func (t *YunpianInfo) CheckBlackWord(content string) (blackWords []string, retcode int, err error)
- func (t *YunpianInfo) DeleteTemplate(tplId int64) (checkStatus int, reason string, retcode int, err error)
- func (t *YunpianInfo) GetAllTemplates() (resp []*YunpianTemplateRespInfo, retcode int, err error)
- func (t *YunpianInfo) GetRecords(searchMobile string, startTime time.Time, endTime time.Time, pageIndex int64, ...) (infos []YunpianSendRecordInfo, retcode int, err error)
- func (t *YunpianInfo) GetTemplateByTplId(tplId int64) (resp *YunpianTemplateRespInfo, retcode int, err error)
- func (t *YunpianInfo) InsertSign(sign string, notify bool, applyVip bool, industry string) (checkStatus int, retcode int, err error)
- func (t *YunpianInfo) InsertSmsTemplate(templateContent string, notifyType int16) (tplId int64, checkStatus int, reason string, retcode int, err error)
- func (t *YunpianInfo) ModifyTemplate(tplId int64, tplContent string) (checkStatus int, reason string, retcode int, err error)
- func (t *YunpianInfo) ReceivedNotification(yunpianReceipt *YunpianReceipt) (retcode int, err error)
- func (t *YunpianInfo) SearchSign(sign string, pageIndex int64, pageSize int64) (yunpianSignInfos []YunpianSignInfo, count int, retcode int, err error)
- func (t *YunpianInfo) SendBatchSms(content string, mobiles []string) (count int, totalFee int, retcode int, err error)
- func (t *YunpianInfo) SendMultiSms(contents []string, mobiles []string) (count int, totalFee int, retcode int, err error)
- func (t *YunpianInfo) SendSingleSms(content string, mobile string) (count int, fee int, msgid string, retcode int, err error)
- func (t *YunpianInfo) UpdateSign(oldSign string, newSign string, notify bool, applyVip bool, industry string) (checkStatus int, retcode int, err error)
- type YunpianReceipt
- type YunpianReceiptInfo
- type YunpianSendRecordInfo
- type YunpianSignInfo
- type YunpianSignRespInfo
- type YunpianSingleSendInfo
- type YunpianSingleSendRespInfo
- type YunpianTempateInfo
- type YunpianTemplateRespInfo
Constants ¶
This section is empty.
Variables ¶
var ( SMS_CHUANGLAN_VERIFICATION_TYPE = 1 // 验证码短信,不可退订的, 独立账户 SMS_CHUANGLAN_MARKETING_TYPE = 2 // 营销短信,可退订的, 独立账户 )
var ( // 短信充值支付状态: SMS_PAY_TOBEPAY = 10 // 未支付 SMS_PAY_PAYED = 20 // 已支付 // 10: 微信公众号支付 Native, 11:微信公众号支付 JSAPI, 12: 微信公众号支付 APP WECHAT_TRADE_TYPE_NATIVE = 10 WECHAT_TRADE_TYPE_JSAPI = 11 WECHAT_TRADE_TYPE_APP = 12 )
var ( // 服务是否已启用:10: 未启用;20:已启用 SMS_SERVICE_INVALID = 10 SMS_SERVICE_VALID = 20 // 10:创蓝253短信提供商;20: 云片网短信提供商 SMS_SERVICE_PROVIDER_TYPE_253_CHUANGLAN = 10 SMS_SERVICE_PROVIDER_TYPE_YUNPIAN = 10 )
var ( TEMPLATE_SMS_CHECKING = 10 // 模板审核中 TEMPLATE_SMS_SUCCESS = 20 // 模板审核通过 TEMPLATE_SMS_FAIL = 30 // 模板审核拒绝 // 短信模板编码 MOBILE_VERIFICATION_CODE_CONTENT = "MOBILE_VERIFICATION_CODE_CONTENT" )
Functions ¶
func GetAllSmsReceiptFailedRecords ¶
func GetAllSmsReceiptFailedRecords(query map[string]string, fields []string, sortby []string, order []string, offset int64, limit int64) (ml []interface{}, err error)
GetAllSmsReceiptFailedRecords retrieves all SmsReceiptFailedRecords matches certain condition. Returns empty list if no records exist
func GetAllSmsRechargeRecords ¶
func GetAllSmsRechargeRecords(query map[string]string, fields []string, sortby []string, order []string, offset int64, limit int64) (ml []interface{}, err error)
GetAllSmsRechargeRecords retrieves all SmsRechargeRecords matches certain condition. Returns empty list if no records exist
func GetAllSmsSendRecords ¶
func GetAllSmsSendRecords(query map[string]string, fields []string, sortby []string, order []string, offset int64, limit int64) (ml []interface{}, err error)
GetAllSmsSendRecords retrieves all SmsSendRecords matches certain condition. Returns empty list if no records exist
func GetAllSmsServiceProviders ¶
func GetAllSmsServiceProviders(query map[string]string, fields []string, sortby []string, order []string, offset int64, limit int64) (ml []interface{}, err error)
GetAllSmsServiceProviders retrieves all SmsServiceProviders matches certain condition. Returns empty list if no records exist
func GetAllSmsTemplates ¶
func GetAllSmsTemplates(query map[string]string, fields []string, sortby []string, order []string, offset int64, limit int64) (ml []interface{}, err error)
GetAllSmsTemplates retrieves all SmsTemplates matches certain condition. Returns empty list if no records exist
Types ¶
type BatchSmsSendRespInfo ¶
type BatchSmsSendRespInfo struct {
TotalCount int `json:"total_count"`
TotalFee string `json:"total_fee"`
Unit string `json:"unit"`
Datas []SendSmsRespInfo `json:"data"`
}
type ChuanglanInfo ¶
type ChuanglanInfo struct {
HttpApi string // 创蓝253短信服务HTTP API
QueryBalanceHttpApi string // 额度查询接口
ReceiverHttpApi string // 接收响应状态请求地址
VerificationAccount string // 必填参数。用户验证码账号
VerificationPassword string // 必填参数。用户验证码密码
MarketingAccount string // 必填参数。用户营销账号
MarketingPassword string // 必填参数。用户营销密码
Mobiles string // 必填参数。合法的手机号码,号码间用英文逗号分隔
SingleSmsMaxLength int // 创蓝单条短信最大长度,超过此长度,则分条发送
SmsContent string // 必填参数。短信内容,短信内容长度不能超过536个字符。使用URL方式编码为UTF-8格式。短信内容超过70个字符(企信通是60个字符)时,会被拆分成多条,然后以长短信的格式发送。
ReceivedStatus int16 // 必填参数。是否需要状态报告,0表示不需要,1表示需要
Extend int16 // 可选参数,扩展码,用户定义扩展码,扩展码的长度将直接影响短信上行接收的接收。固需要传扩展码参数时,请提前咨询客服相关设置问题。
SignName string // 短信服务应用签名
SmsServiceProviderId int // 内部短信服务商ID
}
func GetChuanglanInstance ¶
func GetChuanglanInstance() (instance *ChuanglanInfo)
func (*ChuanglanInfo) QueryBalance ¶
func (t *ChuanglanInfo) QueryBalance(accountType int16) (remainingCount int, retcode int, err error)
额度查询接口 @param accountType : 账户类型,1.验证码短信是不可退订的,属于verification_account
2.营销短信是可退订的,属于marketing_account
func (*ChuanglanInfo) ReceivedNotification ¶
func (*ChuanglanInfo) SendMarketingSms ¶
func (t *ChuanglanInfo) SendMarketingSms(content string, mobiles []string) (countPerSingle int, smsSendCount int, msgid string, retcode int, err error)
发送营销短信:是指可以退订的
func (*ChuanglanInfo) SendVerificationSms ¶
func (t *ChuanglanInfo) SendVerificationSms(content string, mobiles []string) (countPerSingle int, smsSendCount int, msgid string, retcode int, err error)
发送专用通道短信:是不可退订的
type SendSmsRespInfo ¶
type SendSmsRespInfo struct {
Code int `json:"code"`
Msg string `json:"msg"`
Count int `json:"count"`
Fee float64 `json:"fee"`
Unit string `json:"unit"`
Mobile string `json:"mobile"`
Sid int64 `json:"sid"`
}
批量发送接口返回结构体
type SmsReceiptFailedRecords ¶
type SmsReceiptFailedRecords struct {
Id int `orm:"column(sms_receipt_failed_record_id);pk"`
MessageId string `orm:"column(message_id);size(100);null"`
Mobile string `orm:"column(mobile);size(20);null"`
ReceiptStatus int16 `orm:"column(receipt_status);null"`
ReceiptAt string `orm:"column(receipt_at);size(30);null"`
}
func (*SmsReceiptFailedRecords) InsertSmsReceiptFailedRecordNoLock ¶
func (t *SmsReceiptFailedRecords) InsertSmsReceiptFailedRecordNoLock(o *orm.Ormer) (retcode int, err error)
func (*SmsReceiptFailedRecords) TableName ¶
func (t *SmsReceiptFailedRecords) TableName() string
type SmsRechargeRecords ¶
type SmsRechargeRecords struct {
Id int `orm:"column(sms_recharge_record_id);auto"`
CompanyId int `orm:"column(company_id);null"`
UserId int `orm:"column(user_id);null"`
RechargeMoney int `orm:"column(recharge_money);null"`
OutTradeNo string `orm:"column(out_trade_no);size(50);null"`
TransactionId string `orm:"column(transaction_id);size(100);null"`
PayType int16 `orm:"column(pay_type);null"`
PayStatus int16 `orm:"column(pay_status);null"`
Status int16 `orm:"column(status);null"`
UpdatedAt time.Time `orm:"column(updated_at);type(datetime);null"`
CreatedAt time.Time `orm:"column(created_at);type(datetime);null"`
}
func (*SmsRechargeRecords) InsertSmsRechargeRecordNoLock ¶
func (t *SmsRechargeRecords) InsertSmsRechargeRecordNoLock(o *orm.Ormer) (retcode int, err error)
func (*SmsRechargeRecords) TableName ¶
func (t *SmsRechargeRecords) TableName() string
func (*SmsRechargeRecords) UpdateSmsRechargeInfoByOutTradeNoNoLock ¶
func (t *SmsRechargeRecords) UpdateSmsRechargeInfoByOutTradeNoNoLock(o *orm.Ormer) (retcode int, err error)
通过订单号out_trade_no,更新短信订单
func (*SmsRechargeRecords) UpdateSmsRechargeInfoNoLock ¶
func (t *SmsRechargeRecords) UpdateSmsRechargeInfoNoLock(o *orm.Ormer) (retcode int, err error)
type SmsSendRecords ¶
type SmsSendRecords struct {
Id int `orm:"column(sms_send_record_id);auto"`
SmsTemplateId int `orm:"column(sms_template_id);null"`
CompanyId int `orm:"column(company_id);null"`
Content string `orm:"column(content);size(1000);null"`
ReceiverMobiles string `orm:"column(receiver_mobiles);size(2000);null"`
SendStatus string `orm:"column(send_status);size(20);null"`
Count int `orm:"column(count);null"`
CountPerContent int16 `orm:"column(count_per_content);null"`
MessageId string `orm:"column(message_id);size(100);null"`
SendAt time.Time `orm:"column(send_at);type(datetime);null"`
}
func (*SmsSendRecords) InsertSmsSendRecordNoLock ¶
func (t *SmsSendRecords) InsertSmsSendRecordNoLock(o *orm.Ormer) (retcode int, err error)
func (*SmsSendRecords) TableName ¶
func (t *SmsSendRecords) TableName() string
type SmsServer ¶
type SmsServer struct{}
func (*SmsServer) SendSingleSms ¶
func (*SmsServer) UpdateSmsRechargeInfo ¶
func (t *SmsServer) UpdateSmsRechargeInfo(in *pb.SmsRechargeOrderInfo, out *pb.SmsRechargeOrderInfo) (err error)
type SmsServiceProviders ¶
type SmsServiceProviders struct {
Id int `orm:"column(sms_service_provider_id);auto"`
Type int16 `orm:"column(type);null"`
Name string `orm:"column(name);size(100);null"`
Code string `orm:"column(code);size(50);null"`
SignName string `orm:"column(sign_name);size(50);null"`
SingleSmsMaxLength int `orm:"column(single_sms_max_length);null"`
IsValid int16 `orm:"column(is_valid);null"`
Status int16 `orm:"column(status);null"`
UpdatedAt time.Time `orm:"column(updated_at);type(datetime);null"`
CreatedAt time.Time `orm:"column(created_at);type(datetime);null"`
}
func (*SmsServiceProviders) TableName ¶
func (t *SmsServiceProviders) TableName() string
type SmsTemplates ¶
type SmsTemplates struct {
Id int `orm:"column(sms_template_id);auto"`
SmsServiceProviderId int `orm:"column(sms_service_provider_id);null"`
TemplateName string `orm:"column(template_name);size(50);null"`
TemplateContent string `orm:"column(template_content);size(1000);null"`
CheckStatus int16 `orm:"column(check_status);null"`
Status int16 `orm:"column(status);null"`
UpdatedAt time.Time `orm:"column(updated_at);type(datetime);null"`
CreatedAt time.Time `orm:"column(created_at);type(datetime);null"`
}
func GetSmsTemplate ¶
func GetSmsTemplate(smsServiceProviderId int, templateName string) (template *SmsTemplates, retcode int, err error)
func (*SmsTemplates) ReadSmsTemplateNoLock ¶
func (t *SmsTemplates) ReadSmsTemplateNoLock(o *orm.Ormer) (retcode int, err error)
func (*SmsTemplates) TableName ¶
func (t *SmsTemplates) TableName() string
type YunpianInfo ¶
type YunpianInfo struct {
SingleApiKey string // 普通发送apikey值
GroupApiKey string // 群发短信apikey值
HttpApi string // 短信服务调用Http api地址
ReceiverHttpApi string // 短信服务系统接收地址
SingleSmsMaxLength int // 云片网单条短信最大长度,超过此长度,则分条发送
}
func GetYunpianInstance ¶
func GetYunpianInstance() (instance *YunpianInfo)
func (*YunpianInfo) CheckBlackWord ¶
func (t *YunpianInfo) CheckBlackWord(content string) (blackWords []string, retcode int, err error)
查屏蔽词
func (*YunpianInfo) DeleteTemplate ¶
func (t *YunpianInfo) DeleteTemplate(tplId int64) (checkStatus int, reason string, retcode int, err error)
删除模板
func (*YunpianInfo) GetAllTemplates ¶
func (t *YunpianInfo) GetAllTemplates() (resp []*YunpianTemplateRespInfo, retcode int, err error)
获取云片网账户下所有模板
func (*YunpianInfo) GetRecords ¶
func (t *YunpianInfo) GetRecords(searchMobile string, startTime time.Time, endTime time.Time, pageIndex int64, pageSize int64) (infos []YunpianSendRecordInfo, retcode int, err error)
查短信发送记录
func (*YunpianInfo) GetTemplateByTplId ¶
func (t *YunpianInfo) GetTemplateByTplId(tplId int64) (resp *YunpianTemplateRespInfo, retcode int, err error)
取指定模板
func (*YunpianInfo) InsertSign ¶
func (t *YunpianInfo) InsertSign(sign string, notify bool, applyVip bool, industry string) (checkStatus int, retcode int, err error)
3.签名接口
3.1 添加签名
@param sign 签名内容 @param notify 是否短信通知结果,默认true @param applyVip 是否申请专用通道,默认false @param isOnlyGlobal 是否仅发国际短信,默认false @param industryType 所属行业,默认“其它”
func (*YunpianInfo) InsertSmsTemplate ¶
func (t *YunpianInfo) InsertSmsTemplate(templateContent string, notifyType int16) (tplId int64, checkStatus int, reason string, retcode int, err error)
2. 模板接口列表 2.1 添加模板
func (*YunpianInfo) ModifyTemplate ¶
func (t *YunpianInfo) ModifyTemplate(tplId int64, tplContent string) (checkStatus int, reason string, retcode int, err error)
修改模版
func (*YunpianInfo) ReceivedNotification ¶
func (t *YunpianInfo) ReceivedNotification(yunpianReceipt *YunpianReceipt) (retcode int, err error)
func (*YunpianInfo) SearchSign ¶
func (t *YunpianInfo) SearchSign(sign string, pageIndex int64, pageSize int64) (yunpianSignInfos []YunpianSignInfo, count int, retcode int, err error)
搜索签名
func (*YunpianInfo) SendBatchSms ¶
func (t *YunpianInfo) SendBatchSms(content string, mobiles []string) (count int, totalFee int, retcode int, err error)
1.2 批量发送相同内容 https://sms.yunpian.com/v2/sms/batch_send.json
func (*YunpianInfo) SendMultiSms ¶
func (*YunpianInfo) SendSingleSms ¶
type YunpianReceipt ¶
type YunpianReceipt struct {
SmsStatus []YunpianReceiptInfo `json:"sms_status"`
}
type YunpianReceiptInfo ¶
type YunpianReceiptInfo struct {
Sid int64 `json:"sid"`
UserReceiveTime time.Time `json:"user_receive_time"`
ErrMsg string `json:"error_msg"`
Mobile string `json:"mobile"`
ReportStatus string `json:"report_status"`
}
云片回执推送报告结构体
type YunpianSendRecordInfo ¶
type YunpianSendRecordInfo struct {
MsgId string `json:"sid"`
Mobile string `json:"mobile"`
SendTime time.Time `json:"send_time"`
Content string `json:"text"`
SendStatus string `json:"send_status"`
ReportStatus string `json:"report_status"`
Fee int `json:"report_status"`
UserReceiveTime time.Time `json:"user_receive_time"`
ErrMsg string `json:"error_msg"`
}
type YunpianSignInfo ¶
type YunpianSignInfo struct {
Chan string `json:"chan"` // 通道类型,'NONE'暂未分配,'GLOBAL'国际短信通道,'MARKET'营销通道,'VIP'专用通道,'NORMAL'普通通道
CheckStatus string `json:"check_status"` // 当前状态,'CHECKING'审核中,'FAIL'审核失败,'SUCCESS'审核成功,'APLLYING_VIP'普通通道审核成功申请升级专用通道
Enabled bool `json:"enabled"` // 当前签名是否启用
Extend string `json:"extend"` // 扩展号,为空表示暂未分配
Industry string `json:"industry_type"` // "商业服务",行业
OnlyGlobal bool `json:"only_global"` // 是否用于国际短信
Remark string `json:"remark"` // 客服给的审核结果解释,一般见于审核失败
Sign string `json:"sign"` // 签名
Vip bool `json:"vip"` // 是否专用通道
}
type YunpianSignRespInfo ¶
type YunpianSignRespInfo struct {
Code int `json:"code"`
Total int `json:"total"`
Sign []YunpianSignInfo `json:"sign"`
}
type YunpianSingleSendInfo ¶
type YunpianSingleSendRespInfo ¶
type YunpianSingleSendRespInfo struct {
Code int `json:"code"` // 0代表发送成功,其他code代表出错,详细见"返回值说明"页面
Msg string `json:"msg"` // 例如""发送成功"",或者相应错误信息
Count int `json:"count"` // 发送成功短信的计费条数(计费条数:70个字一条,超出70个字时按每67字一条计费)
Fee float64 `json:"fee"` // 扣费金额,单位:元,类型:双精度浮点型/double
Sid int64 `json:"sid"` // 短信id,64位整型, 对应Java和C#的Long,不可用int解析
}