diff --git a/chuanglan.go b/chuanglan.go index f7044a6..ed8e502 100644 --- a/chuanglan.go +++ b/chuanglan.go @@ -23,7 +23,7 @@ var CL_PASSWORD string = "zmkj64U5A" 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 == "" { 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) { - const URL string = "http://smssh1.253.com/msg/balance/json" + const URL string = "https://smssh1.253.com/msg/balance/json" if account == "" { account = CL_ACCOUNT diff --git a/chuanglan_test.go b/chuanglan_test.go index ba869ad..a641c51 100644 --- a/chuanglan_test.go +++ b/chuanglan_test.go @@ -4,14 +4,14 @@ import ( "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) { ret, total, reply, err := QueryRemaining("", "") diff --git a/ums.go b/ums.go index f1abaf3..96aabe4 100644 --- a/ums.go +++ b/ums.go @@ -20,9 +20,9 @@ import ( * @mobiles 手机号,多个用逗号隔开 * @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 == "" { - return false, errors.New("参数不全") + return false, []byte(""), errors.New("参数不全") } api := "https://api.ums86.com/api/sms/send" @@ -56,7 +56,7 @@ func SendByUms(spCode, appKey, secretKey, mobiles, templateId, content string) ( if err != nil { log.Println("post err", err) - return false, err + return false, reply, err } var reply_data map[string]interface{} @@ -65,14 +65,14 @@ func SendByUms(spCode, appKey, secretKey, mobiles, templateId, content string) ( if err != nil { log.Println(string(reply), err) - return false, err + return false, reply, err } 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验签 diff --git a/ums_test.go b/ums_test.go index 9f52611..2cf99a7 100644 --- a/ums_test.go +++ b/ums_test.go @@ -8,11 +8,12 @@ func Test_SendByUms(t *testing.T) { spCode := "257980" appKey := "zx_jfsw" secretKey := "cRgpvZ0242l7tE" - mobiles := "13790717280" + mobiles := "18607565510" templateId := "1011012121170" 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(string(data)) t.Log(err) }