Bladeren bron

短信平台调试通过

娄底高职分支
liangkun 2 jaren geleden
bovenliggende
commit
89399a1b14
4 gewijzigde bestanden met toevoegingen van 32 en 32 verwijderingen
  1. +15
    -15
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EADateArrange/EADateArrangeService.cs
  2. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/HttpMethods.cs
  3. +3
    -3
      Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.SendSms/App.config
  4. +13
    -13
      Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.SendSms/Yixintong/YixintongSms.cs

+ 15
- 15
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/EADateArrange/EADateArrangeService.cs Bestand weergeven

@@ -239,21 +239,21 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
});
}
//todo:暂定
//if (informationPushEntity != null && informationPushEntity.StatusSMS == true)
//{
// //短信推送
// try
// {
// var listStr = new List<string>();
// var str1 = $"您有新的教学工作安排需要查看【{entity.WorkName}】。";
// listStr.Add(str1);
// yixintongSms.SendSmsToSingle("18335927079", SmsType.EADateArrangeNotification, listStr);
// }
// catch (Exception e)
// {
// throw;
// }
//}
if (informationPushEntity != null && informationPushEntity.StatusSMS == true)
{
//短信推送
try
{
var listStr = new List<string>();
var str1 = $"您的验证码为123456";
listStr.Add(str1);
yixintongSms.SendSmsToSingle("18534636609", SmsType.EADateArrangeNotification, listStr);
}
catch (Exception e)
{
throw;
}
}

}
}


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/HttpMethods.cs Bestand weergeven

@@ -153,7 +153,7 @@ namespace Learun.Util
string result = "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/json;charset=UTF-8";
req.ContentType = "application/x-www-form-urlencoded";

byte[] data = encoding.GetBytes(json);//把字符串转换为字节



+ 3
- 3
Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.SendSms/App.config Bestand weergeven

@@ -12,9 +12,9 @@
<add key="sdkappid" value="140009369387"/>
<add key="appkey" value="4d2743a4233e5d8625eefa31f876721b"/>
<!--一信通短信平台-->
<add key="SpCode" value="219988"/>
<add key="LoginName" value="zx_ygj"/>
<add key="Password" value="KObe24@$"/>
<add key="SpCode" value="222839"/>
<add key="LoginName" value="ld_yesf"/>
<add key="Password" value="e25492c02fdd658c76a79c83ae7b57ab"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
</appSettings>
<startup>


+ 13
- 13
Learun.Framework.Ultimate V7/Quanjiang.DigitalScholl.SendSms/Yixintong/YixintongSms.cs Bestand weergeven

@@ -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);


Laden…
Annuleren
Opslaan