This commit is contained in:
parent
7423a7dd57
commit
3507d2ed74
@ -15,10 +15,10 @@ type DDY struct {
|
|||||||
TzUrl string
|
TzUrl string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *DDY) Init(apikey string, uzmurl string, tzurl string) {
|
func (this *DDY) Init(apikey string) {
|
||||||
this.ApiKey = apikey
|
this.ApiKey = apikey
|
||||||
this.YzmUrl = uzmurl
|
this.YzmUrl = "https://api.dingdongcloud.com/v1/sms/captcha/send"
|
||||||
this.TzUrl = tzurl
|
this.TzUrl = "https://api.dingdongcloud.com/v1/sms/notice/multi_send"
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送短信验证码 code验证码如:123456 返回true表示发送成功flase表示发送失败
|
//发送短信验证码 code验证码如:123456 返回true表示发送成功flase表示发送失败
|
||||||
@ -26,6 +26,7 @@ func (this *DDY) SendYZM(umoblie string, tpt string, data map[string]string) (bo
|
|||||||
for k, v := range data {
|
for k, v := range data {
|
||||||
tpt = strings.Replace(tpt, "{"+k+"}", v, -1)
|
tpt = strings.Replace(tpt, "{"+k+"}", v, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.send(this.YzmUrl, umoblie, tpt)
|
return this.send(this.YzmUrl, umoblie, tpt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
objtoobj.go
14
objtoobj.go
@ -22,8 +22,18 @@ func ObjToMap(obj interface{}, e ...*Error) Map {
|
|||||||
case map[string]interface{}:
|
case map[string]interface{}:
|
||||||
v = obj.(map[string]interface{})
|
v = obj.(map[string]interface{})
|
||||||
default:
|
default:
|
||||||
v = nil
|
data, err := json.Marshal(obj)
|
||||||
err = errors.New("没有合适的转换对象!")
|
if err != nil {
|
||||||
|
err = errors.New("没有合适的转换对象!" + err.Error())
|
||||||
|
v = nil
|
||||||
|
}
|
||||||
|
v = Map{}
|
||||||
|
e := json.Unmarshal(data, &v)
|
||||||
|
if e != nil {
|
||||||
|
err = errors.New("没有合适的转换对象!" + e.Error())
|
||||||
|
v = nil
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(e) != 0 {
|
if len(e) != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user