|
|
@@ -26,20 +26,20 @@ namespace Quanjiang.DigitalScholl.SendSms |
|
|
|
var (templatecode, templateparam, randomNum) = GetSmsTemplateBySmsType(st); |
|
|
|
try |
|
|
|
{ |
|
|
|
StringBuilder sb=new StringBuilder(); |
|
|
|
// 按照协议组织 post 请求包体 |
|
|
|
JObject data = new JObject(); |
|
|
|
data.Add("SpCode", SpCode); |
|
|
|
data.Add("LoginName", LoginName); |
|
|
|
data.Add("Password", Password); |
|
|
|
data.Add("MessageContent", sendParams.FirstOrDefault()); |
|
|
|
data.Add("UserNumber", phoneNumber); |
|
|
|
data.Add("templateId", templatecode); |
|
|
|
data.Add("SerialNumber", DateTime.Now.ToString("yyyyMMddHHmmssffffff")); |
|
|
|
data.Add("ScheduleTime", ""); |
|
|
|
data.Add("f", "1"); |
|
|
|
data.Add("signCode", ""); |
|
|
|
sb.Append("SpCode="+SpCode); |
|
|
|
sb.Append("&LoginName=" + LoginName); |
|
|
|
sb.Append("&Password=" + Password); |
|
|
|
sb.Append("&MessageContent=" + sendParams.FirstOrDefault()); |
|
|
|
sb.Append("&UserNumber=" + phoneNumber); |
|
|
|
//sb.Append("&templateId=" + templatecode);//测试帐号去掉 |
|
|
|
sb.Append("&SerialNumber=" + DateTime.Now.ToString("yyyyMMddHHmmssffffff")); |
|
|
|
sb.Append("&f=1"); |
|
|
|
//data.Add("ScheduleTime", ""); |
|
|
|
//data.Add("signCode", ""); |
|
|
|
//调接口 |
|
|
|
string pushresult = Learun.Util.HttpMethods.HttpPost("https://api.ums86.com:9600/sms/Api/Send.do", JsonConvert.SerializeObject(data), Encoding.GetEncoding("gb2312")); |
|
|
|
string pushresult = Learun.Util.HttpMethods.HttpPost("https://api.ums86.com:9600/sms/Api/Send.do", sb.ToString(), Encoding.GetEncoding("gbk")); |
|
|
|
//返回体 |
|
|
|
pushresult = pushresult.Replace("<br>", "&"); |
|
|
|
NameValueCollection query = HttpUtility.ParseQueryString(pushresult, Encoding.GetEncoding("gb2312")); |
|
|
@@ -119,7 +119,7 @@ namespace Quanjiang.DigitalScholl.SendSms |
|
|
|
result = ("SMS_137485060", JsonConvert.SerializeObject(new { code = randomNum }), randomNum); |
|
|
|
break; |
|
|
|
case SmsType.EADateArrangeNotification: |
|
|
|
result = ("1011012133213", JsonConvert.SerializeObject(new { code = randomNum }), randomNum); |
|
|
|
result = ("1", JsonConvert.SerializeObject(new { code = randomNum }), randomNum); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new ArgumentOutOfRangeException(nameof(st), st, null); |
|
|
|