🎨 新增短信宝发送平台接口
This commit is contained in:
@@ -116,3 +116,27 @@ func SendSMSTest(phone, code string) bool {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DxbSendSMS(phone, code string) bool {
|
||||||
|
// 内容 通过urlEncode编码
|
||||||
|
content := "【海口龙华铁坚成电子商务商行】您的验证码是" + code + "。如非本人操作,请忽略本短信"
|
||||||
|
// urlencode编码内容
|
||||||
|
content = url.QueryEscape(content)
|
||||||
|
|
||||||
|
api := "https://api.smsbao.com/sms?u=lchz5599&p=7ea114c87a224cd38a0d616b9be3faed&g=海口龙华铁坚成电子商务商行&m=" + phone + "&c=" + content
|
||||||
|
|
||||||
|
// 发送GET请求
|
||||||
|
resp, err := http.Get(api)
|
||||||
|
if err != nil {
|
||||||
|
global.GVA_LOG.Error("发送短信请求失败:", zap.Error(err))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
if resp.StatusCode == http.StatusOK {
|
||||||
|
global.GVA_LOG.Info("发送短信请求成功,手机号:" + phone + ",验证码:" + code)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
global.GVA_LOG.Error("发送短信请求失败:", zap.Error(err))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user