短信变更

This commit is contained in:
hoteas 2021-09-24 15:01:03 +08:00
parent 2291ba7402
commit d1a8f6c668
4 changed files with 16 additions and 3 deletions

View File

@ -18,8 +18,8 @@ type DDY struct {
func (this *DDY) Init(apikey string) { func (this *DDY) Init(apikey string) {
this.ApiKey = apikey this.ApiKey = apikey
this.YzmUrl = "https://api.dingdongcloud.com/v2/sms/single_send" this.YzmUrl = "https://api.dingdongcloud.com/v2/sms/captcha/send.json"
this.TzUrl = "https://api.dingdongcloud.com/v1/sms/notice/multi_send" this.TzUrl = "https://api.dingdongcloud.com/v2/sms/notice/send.json"
} }
//发送短信验证码 code验证码如123456 返回true表示发送成功flase表示发送失败 //发送短信验证码 code验证码如123456 返回true表示发送成功flase表示发送失败
@ -89,3 +89,9 @@ func (this *DDY) httpsPostForm(url string, data url.Values) (string, error) {
return string(body), nil return string(body), nil
} }
var DefaultDDY DDY
func init() {
DefaultDDY = DDY{}
}

View File

@ -2,6 +2,7 @@ package app
import ( import (
. "../../../hotime" . "../../../hotime"
"../../dri/ddsms"
) )
var Sms = Ctr{ var Sms = Ctr{
@ -25,7 +26,11 @@ var Sms = Ctr{
this.Session("phone", phone) this.Session("phone", phone)
this.Session("code", code) this.Session("code", code)
tencentSendYzm(phone, code) //tencentSendYzm(phone, code)
if ddsms.DefaultDDY.ApiKey == "" {
ddsms.DefaultDDY.Init(this.Config.GetString("smsKey"))
}
ddsms.DefaultDDY.SendYZM(phone, this.Config.GetString("smsLogin"), map[string]string{"code": code})
this.Display(0, "发送成功") this.Display(0, "发送成功")
}, },

Binary file not shown.

View File

@ -45,5 +45,7 @@
"mode": 2, "mode": 2,
"port": "80", "port": "80",
"sessionName": "HOTIME", "sessionName": "HOTIME",
"smsKey": "b0eb4bf0198b9983cffcb85b69fdf4fa",
"smsLogin": "【恩易办】您的验证码为:{code}请在5分钟内使用切勿将验证码泄露于他人如非本人操作请忽略。",
"tpt": "tpt" "tpt": "tpt"
} }