Browse Source

修改创蓝地址,修改UMS返回参数

master v1.1.1
guzeng 1 year ago
parent
commit
006a73e54a
4 changed files with 18 additions and 17 deletions
  1. +2
    -2
      chuanglan.go
  2. +7
    -7
      chuanglan_test.go
  3. +6
    -6
      ums.go
  4. +3
    -2
      ums_test.go

+ 2
- 2
chuanglan.go View File

@ -23,7 +23,7 @@ var CL_PASSWORD string = "zmkj64U5A"
func SendByCL(account, password, mobile, sms_sign, msg string) (bool, map[string]interface{}, error) { func SendByCL(account, password, mobile, sms_sign, msg string) (bool, map[string]interface{}, error) {
const CL_SIMPLE_SMS_URL string = "http://smssh1.253.com/msg/send/json"
const CL_SIMPLE_SMS_URL string = "https://smssh1.253.com/msg/v1/send/json" // "http://smssh1.253.com/msg/send/json"
if account == "" { if account == "" {
account = CL_ACCOUNT account = CL_ACCOUNT
@ -69,7 +69,7 @@ func SendByCL(account, password, mobile, sms_sign, msg string) (bool, map[string
*/ */
func QueryRemaining(account, password string) (bool, string, map[string]interface{}, error) { func QueryRemaining(account, password string) (bool, string, map[string]interface{}, error) {
const URL string = "http://smssh1.253.com/msg/balance/json"
const URL string = "https://smssh1.253.com/msg/balance/json"
if account == "" { if account == "" {
account = CL_ACCOUNT account = CL_ACCOUNT


+ 7
- 7
chuanglan_test.go View File

@ -4,14 +4,14 @@ import (
"testing" "testing"
) )
// func Test_SendByCL(t *testing.T) {
// msg := "罗您好,您的商店新增2单物理灭蚊仪-天眼款,请及时登录商家后台处理!"
// ret, reply, err := SendByCL("", "", "18607565510", "特特乐", msg)
func Test_SendByCL(t *testing.T) {
msg := "罗您好,您的商店新增2单物理灭蚊仪-天眼款,请及时登录商家后台处理!"
ret, reply, err := SendByCL("", "", "18607565510", "平沙数字云店", msg)
// t.Log(ret)
// t.Log(reply)
// t.Log(err)
// }
t.Log(ret)
t.Log(reply)
t.Log(err)
}
func Test_QueryRemaining(t *testing.T) { func Test_QueryRemaining(t *testing.T) {
ret, total, reply, err := QueryRemaining("", "") ret, total, reply, err := QueryRemaining("", "")


+ 6
- 6
ums.go View File

@ -20,9 +20,9 @@ import (
* @mobiles 手机号多个用逗号隔开 * @mobiles 手机号多个用逗号隔开
* @content 短信内容 * @content 短信内容
*/ */
func SendByUms(spCode, appKey, secretKey, mobiles, templateId, content string) (bool, error) {
func SendByUms(spCode, appKey, secretKey, mobiles, templateId, content string) (bool, []byte, error) {
if spCode == "" || appKey == "" || secretKey == "" || mobiles == "" || templateId == "" || content == "" { if spCode == "" || appKey == "" || secretKey == "" || mobiles == "" || templateId == "" || content == "" {
return false, errors.New("参数不全")
return false, []byte(""), errors.New("参数不全")
} }
api := "https://api.ums86.com/api/sms/send" api := "https://api.ums86.com/api/sms/send"
@ -56,7 +56,7 @@ func SendByUms(spCode, appKey, secretKey, mobiles, templateId, content string) (
if err != nil { if err != nil {
log.Println("post err", err) log.Println("post err", err)
return false, err
return false, reply, err
} }
var reply_data map[string]interface{} var reply_data map[string]interface{}
@ -65,14 +65,14 @@ func SendByUms(spCode, appKey, secretKey, mobiles, templateId, content string) (
if err != nil { if err != nil {
log.Println(string(reply), err) log.Println(string(reply), err)
return false, err
return false, reply, err
} }
if helper.ToStr(reply_data["code"]) != "0" { if helper.ToStr(reply_data["code"]) != "0" {
return false, errors.New("短信发送失败," + helper.ToStr(reply_data["msg"]))
return false, reply, errors.New("短信发送失败," + helper.ToStr(reply_data["msg"]))
} }
return true, nil
return true, reply, nil
} }
// ums验签 // ums验签


+ 3
- 2
ums_test.go View File

@ -8,11 +8,12 @@ func Test_SendByUms(t *testing.T) {
spCode := "257980" spCode := "257980"
appKey := "zx_jfsw" appKey := "zx_jfsw"
secretKey := "cRgpvZ0242l7tE" secretKey := "cRgpvZ0242l7tE"
mobiles := "13790717280"
mobiles := "18607565510"
templateId := "1011012121170" templateId := "1011012121170"
content := "您好!您的园区消费的账号为88888,初始密码为666666aa。请尽快修改初始密码,密码设置需包含字母、数字、特殊字符2种以上且最少8位。密码修改方式:微信小程序搜索“园区消费”,首次登录会自动进入修改密码页面,后续修改密码请登录后选择“我的”——更多服务——修改密码。如有问题,请联系信息技术中心。" content := "您好!您的园区消费的账号为88888,初始密码为666666aa。请尽快修改初始密码,密码设置需包含字母、数字、特殊字符2种以上且最少8位。密码修改方式:微信小程序搜索“园区消费”,首次登录会自动进入修改密码页面,后续修改密码请登录后选择“我的”——更多服务——修改密码。如有问题,请联系信息技术中心。"
ret, err := SendByUms(spCode,appKey,secretKey,mobiles,templateId,content)
ret, data, err := SendByUms(spCode, appKey, secretKey, mobiles, templateId, content)
t.Log(ret) t.Log(ret)
t.Log(string(data))
t.Log(err) t.Log(err)
} }

Loading…
Cancel
Save