|
@@ -11,7 +11,6 @@ import (
|
|
|
)
|
|
|
|
|
|
func SendSmsCode(mobile, vCode string) bool {
|
|
|
- flag := false
|
|
|
tplId := "65692"
|
|
|
result, err := sendSms(mobile, tplId, vCode)
|
|
|
if err != nil {
|
|
@@ -24,19 +23,18 @@ func SendSmsCode(mobile, vCode string) bool {
|
|
|
if err != nil {
|
|
|
//go SendEmail("短信验证码发送失败", "err:"+err.Error()+" result"+string(result), utils.EmailSendToUsers)
|
|
|
go alarm_msg.SendAlarmMsg("短信验证码发送失败, Err:"+err.Error()+";Result:"+string(result), 2)
|
|
|
- flag = false
|
|
|
+ return false
|
|
|
}
|
|
|
if netReturn["error_code"].(float64) == 0 {
|
|
|
fmt.Printf("接口返回result字段是:\r\n%v", netReturn["result"])
|
|
|
- flag = true
|
|
|
+ return true
|
|
|
} else {
|
|
|
// 忽略错误的手机号码这种错误
|
|
|
if netReturn["error_code"].(float64) != 205401 {
|
|
|
go alarm_msg.SendAlarmMsg("短信验证码发送失败, Result:"+string(result), 2)
|
|
|
}
|
|
|
- flag = false
|
|
|
+ return false
|
|
|
}
|
|
|
- return flag
|
|
|
}
|
|
|
|
|
|
func sendSms(mobile, tplId, code string) (rs []byte, err error) {
|
|
@@ -68,7 +66,6 @@ func sendSms(mobile, tplId, code string) (rs []byte, err error) {
|
|
|
|
|
|
// SendSmsCodeGj 发送国际短信
|
|
|
func SendSmsCodeGj(mobile, vCode, areaNum string) bool {
|
|
|
- flag := false
|
|
|
result, err := sendSmsGj(mobile, vCode, areaNum)
|
|
|
if err != nil {
|
|
|
fmt.Println("发送短信失败")
|
|
@@ -80,19 +77,18 @@ func SendSmsCodeGj(mobile, vCode, areaNum string) bool {
|
|
|
if err != nil {
|
|
|
//go SendEmail("短信验证码发送失败", "err:"+err.Error()+" result"+string(result), utils.EmailSendToUsers)
|
|
|
go alarm_msg.SendAlarmMsg("短信验证码发送失败, Err:"+err.Error()+";Result:"+string(result), 2)
|
|
|
- flag = false
|
|
|
+ return false
|
|
|
}
|
|
|
if netReturn["error_code"].(float64) == 0 {
|
|
|
fmt.Printf("接口返回result字段是:\r\n%v", netReturn["result"])
|
|
|
- flag = true
|
|
|
+ return true
|
|
|
} else {
|
|
|
// 忽略错误的手机号码这种错误
|
|
|
if netReturn["error_code"].(float64) != 205401 {
|
|
|
go alarm_msg.SendAlarmMsg("短信验证码发送失败, Result:"+string(result), 2)
|
|
|
}
|
|
|
- flag = false
|
|
|
+ return false
|
|
|
}
|
|
|
- return flag
|
|
|
}
|
|
|
|
|
|
// sendSmsGj 发送国际短信
|