|
|
@@ -1,24 +1,22 @@
|
|
1
|
1
|
|
|
2
|
|
-using System;
|
|
3
|
|
-using System.Collections.Generic;
|
|
4
|
|
-using System.Linq;
|
|
5
|
|
-using System.Web;
|
|
6
|
|
-using System.Web.Mvc;
|
|
7
|
|
-using CallCenterApi.Interface.Controllers.Base;
|
|
8
|
|
-using System.Data;
|
|
9
|
2
|
using CallCenter.Utility;
|
|
10
|
|
-using System.Configuration;
|
|
11
|
3
|
//using Top.Api;
|
|
12
|
4
|
//using Top.Api.Request;
|
|
13
|
5
|
//using Top.Api.Response;
|
|
14
|
6
|
using CallCenterApi.Common;
|
|
15
|
|
-using System.Net;
|
|
16
|
|
-using System.Text;
|
|
|
7
|
+using CallCenterApi.Interface.Controllers.Base;
|
|
17
|
8
|
using Newtonsoft.Json;
|
|
18
|
|
-using System.Xml;
|
|
|
9
|
+using Newtonsoft.Json.Linq;
|
|
|
10
|
+using System;
|
|
|
11
|
+using System.Collections.Generic;
|
|
|
12
|
+using System.Data;
|
|
19
|
13
|
using System.IO;
|
|
|
14
|
+using System.Linq;
|
|
|
15
|
+using System.Net;
|
|
20
|
16
|
using System.Security.Cryptography;
|
|
21
|
|
-using Newtonsoft.Json.Linq;
|
|
|
17
|
+using System.Text;
|
|
|
18
|
+using System.Web;
|
|
|
19
|
+using System.Web.Mvc;
|
|
22
|
20
|
|
|
23
|
21
|
namespace CallCenterApi.Interface.Controllers
|
|
24
|
22
|
{
|
|
|
@@ -27,8 +25,10 @@ namespace CallCenterApi.Interface.Controllers
|
|
27
|
25
|
#region 接收短信
|
|
28
|
26
|
//string url = "http://47.92.26.244/sms.aspx?";
|
|
29
|
27
|
//string account = "yhyy"; string password = "yhyy190903";
|
|
30
|
|
- string url = "http://sdk.lx198.com/sdk/";
|
|
|
28
|
+ string url = "http://sdk.lx198.com/sdk/";
|
|
31
|
29
|
string accName = "15003877636"; string password = "759089";
|
|
|
30
|
+
|
|
|
31
|
+ // string accName = "13783690587"; string password = "yhyy66";
|
|
32
|
32
|
/// <summary>
|
|
33
|
33
|
/// MD5加密
|
|
34
|
34
|
/// </summary>
|
|
|
@@ -63,46 +63,54 @@ namespace CallCenterApi.Interface.Controllers
|
|
63
|
63
|
|
|
64
|
64
|
public string SendSMS(string mobile, string sendTime, string content,int sendWay, int MBID )
|
|
65
|
65
|
{
|
|
66
|
|
- WebClient web = new WebClient();
|
|
67
|
|
- web.Encoding = Encoding.UTF8;
|
|
|
66
|
+ //WebClient web = new WebClient();
|
|
|
67
|
+ //web.Encoding = Encoding.UTF8;
|
|
68
|
68
|
content += "【郑州颐和医院】";
|
|
69
|
69
|
// url += "send?accName="+ accName + "&accPwd="+ Md5 (password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + DateTime .Now .ToString ("yyyy-MM-dd HH:mm:ss") + "&dataType=json& msgId=" + sendTime.Trim() + "454163135423543";
|
|
70
|
|
-
|
|
|
70
|
+ string param= string.Empty;
|
|
71
|
71
|
string mbid = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
72
|
72
|
if (!string.IsNullOrEmpty(sendTime))
|
|
73
|
73
|
{
|
|
74
|
74
|
string st = Convert.ToDateTime(sendTime).ToString ("yyyy-MM-dd HH:mm:ss");
|
|
75
|
|
- url += "send?accName=" + accName + "&accPwd=" + Md5(password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + st + "&dataType=json& msgId=" + mbid;// "454163135423543";
|
|
|
75
|
+ param = "accName=" + accName + "&accPwd=" + Md5(password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + st + "&dataType=json& msgId=" + mbid;// "454163135423543";
|
|
|
76
|
+ // url += "send?accName=" + accName + "&accPwd=" + Md5(password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + st + "&dataType=json& msgId=" + mbid;// "454163135423543";
|
|
|
77
|
+
|
|
76
|
78
|
}
|
|
77
|
79
|
|
|
78
|
80
|
else {
|
|
|
81
|
+ // url += "send?accName=" + accName + "&accPwd=" + Md5(password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + "&dataType=json& msgId=" + mbid;// "454163135423543";
|
|
79
|
82
|
|
|
80
|
|
- url += "send?accName=" + accName + "&accPwd=" + Md5(password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + "&dataType=json& msgId=" + mbid;// "454163135423543";
|
|
|
83
|
+ param = "accName=" + accName + "&accPwd=" + Md5(password) + "&aimcodes=" + mobile.Trim() + "&content=" + content.Trim() + "&schTime=" + "&dataType=json& msgId=" + mbid;// "454163135423543";
|
|
81
|
84
|
}
|
|
82
|
|
-
|
|
83
|
|
- string Dataaa = web.DownloadString(url);//这一句话就能请求到数据了
|
|
|
85
|
+ string Dataaa=HttpMethods.HttpPost(url +"send", param);
|
|
|
86
|
+ // string Dataaa = web.DownloadString(url);//这一句话就能请求到数据了
|
|
84
|
87
|
JObject jo = (JObject)JsonConvert.DeserializeObject(Dataaa);
|
|
85
|
88
|
string replyCode = jo["replyCode"].ToString();
|
|
86
|
89
|
string replyMsg = jo["replyMsg"].ToString();
|
|
87
|
90
|
|
|
88
|
91
|
string[] tel = mobile.Split(',');
|
|
89
|
92
|
|
|
90
|
|
- foreach (var item in tel)
|
|
91
|
|
- {
|
|
92
|
93
|
|
|
93
|
|
- if (sendWay == 0)//立即发送
|
|
94
|
|
- {
|
|
95
|
|
- AddSMSList(sendWay, null, DateTime.Now, Convert.ToInt32(replyCode), item, content, MBID);
|
|
96
|
|
- }
|
|
97
|
|
- else //定时发送
|
|
|
94
|
+ if (replyCode == "1")
|
|
|
95
|
+ {
|
|
|
96
|
+ foreach (var item in tel)
|
|
98
|
97
|
{
|
|
99
|
|
- AddSMSList(sendWay, Convert.ToDateTime(sendTime), Convert.ToDateTime(sendTime), Convert.ToInt32(replyCode), item, content, MBID);
|
|
|
98
|
+
|
|
|
99
|
+ if (sendWay == 0)//立即发送
|
|
|
100
|
+ {
|
|
|
101
|
+ AddSMSList(sendWay, null, DateTime.Now, Convert.ToInt32(replyCode), item, content, MBID);
|
|
|
102
|
+ }
|
|
|
103
|
+ else //定时发送
|
|
|
104
|
+ {
|
|
|
105
|
+ AddSMSList(sendWay, Convert.ToDateTime(sendTime), Convert.ToDateTime(sendTime), Convert.ToInt32(replyCode), item, content, MBID);
|
|
|
106
|
+
|
|
|
107
|
+ }
|
|
100
|
108
|
|
|
101
|
109
|
}
|
|
102
|
110
|
|
|
103
|
|
- }
|
|
104
|
|
- if (replyCode == "1")
|
|
105
|
111
|
return "发送成功";
|
|
|
112
|
+ }
|
|
|
113
|
+
|
|
106
|
114
|
else
|
|
107
|
115
|
return "发送失败";
|
|
108
|
116
|
|