短信发送方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.0 KiB

package sms
import (
"log"
"strings"
// "github.com/json-iterator/go"
)
/**
* 发送联通融合通信短信
* @cpcode 商户编号
* @key accessKey
* @excode 扩展码
* @mobiles 手机号,多个用逗号隔开
* @templetId 模板id
* @msg 模板中变量的值,如果包含多个参数,以半角英文逗号分隔
*/
func SendByWo(cpcode, key, excode, mobiles, templetid, msg string) (map[string]interface{}, error) {
sign_str := StringJoin(cpcode, msg, mobiles, excode, templetid, key)
sign := strings.ToLower(Md5Str(sign_str))
url := "http://rcsapi.wo.cn:8000/umcinterface/sendtempletmsg"
data := map[string]string{
"cpcode": cpcode,
"msg": msg,
"mobiles": mobiles,
"excode": excode,
"templetid": templetid,
"sign": sign,
}
reply, err := PostJsonData(url, data)
if err != nil {
return nil, err
}
var reply_data map[string]interface{}
err = json.Unmarshal(reply, &reply_data)
if err != nil {
log.Println(string(reply), err)
return nil, err
}
return reply_data, err
}