diff --git a/dri/ddsms/ddsms.go b/dri/ddsms/ddsms.go index 0d36b52..60edb73 100644 --- a/dri/ddsms/ddsms.go +++ b/dri/ddsms/ddsms.go @@ -18,8 +18,8 @@ type DDY struct { func (this *DDY) Init(apikey string) { this.ApiKey = apikey - this.YzmUrl = "https://api.dingdongcloud.com/v2/sms/single_send" - this.TzUrl = "https://api.dingdongcloud.com/v1/sms/notice/multi_send" + this.YzmUrl = "https://api.dingdongcloud.com/v2/sms/captcha/send.json" + this.TzUrl = "https://api.dingdongcloud.com/v2/sms/notice/send.json" } //发送短信验证码 code验证码如:123456 返回true表示发送成功flase表示发送失败 @@ -89,3 +89,9 @@ func (this *DDY) httpsPostForm(url string, data url.Values) (string, error) { return string(body), nil } + +var DefaultDDY DDY + +func init() { + DefaultDDY = DDY{} +} diff --git a/example/app/sms.go b/example/app/sms.go index 92f7eb9..7e8efb5 100644 --- a/example/app/sms.go +++ b/example/app/sms.go @@ -2,6 +2,7 @@ package app import ( . "../../../hotime" + "../../dri/ddsms" ) var Sms = Ctr{ @@ -25,7 +26,11 @@ var Sms = Ctr{ this.Session("phone", phone) 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, "发送成功") }, diff --git a/example/bzyy.exe b/example/bzyy.exe index 647b122..5620a3f 100644 Binary files a/example/bzyy.exe and b/example/bzyy.exe differ diff --git a/example/config/config.json b/example/config/config.json index 638c8e4..07098f6 100644 --- a/example/config/config.json +++ b/example/config/config.json @@ -45,5 +45,7 @@ "mode": 2, "port": "80", "sessionName": "HOTIME", + "smsKey": "b0eb4bf0198b9983cffcb85b69fdf4fa", + "smsLogin": "【恩易办】您的验证码为:{code},请在5分钟内使用,切勿将验证码泄露于他人,如非本人操作请忽略。", "tpt": "tpt" } \ No newline at end of file