|
@ -0,0 +1,56 @@ |
|
|
|
|
|
package sms |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
|
"log" |
|
|
|
|
|
|
|
|
|
|
|
"git.tetele.net/tgo/helper" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
* |
|
|
|
|
|
|
|
|
|
|
|
- 百世云发送短信 |
|
|
|
|
|
* |
|
|
|
|
|
|
|
|
|
|
|
- @param string $sp_id sp_id |
|
|
|
|
|
- @param string $password 密码 |
|
|
|
|
|
- @param string $mobile 手机号码 |
|
|
|
|
|
|
|
|
|
|
|
- @param string $content 短信内容 |
|
|
|
|
|
|
|
|
|
|
|
- @param string $sms_sign 短信签名 |
|
|
|
|
|
|
|
|
|
|
|
- @return success bool, reply map[string]string, err error |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
func SendByBaishiy(sp_id, password, mobile, sms_sign, content string) (bool, map[string]interface{}, error) { |
|
|
|
|
|
|
|
|
|
|
|
url := "http://124.220.34.130:9511/api/send-sms-single" |
|
|
|
|
|
//创蓝接口参数
|
|
|
|
|
|
data := map[string]string{ |
|
|
|
|
|
"sp_id": sp_id, |
|
|
|
|
|
"password": password, |
|
|
|
|
|
"content": StringJoin("【", sms_sign, "】", content), |
|
|
|
|
|
"mobile": mobile, |
|
|
|
|
|
} |
|
|
|
|
|
response, err := SendHttp("POST", url, data) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return false, nil, err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var reply map[string]interface{} |
|
|
|
|
|
|
|
|
|
|
|
err = json.Unmarshal(response, &reply) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
log.Println(string(response), err) |
|
|
|
|
|
return false, nil, err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if helper.ToStr(reply["code"]) != "0" { |
|
|
|
|
|
return false, reply, nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true, reply, err |
|
|
|
|
|
} |