|
|
@@ -43,7 +43,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
43
|
43
|
}
|
|
44
|
44
|
return strbul.ToString().ToLower (); ;
|
|
45
|
45
|
}
|
|
46
|
|
- public static bool SendSms(string msg,string mobiles,string templetid,string excode = "")
|
|
|
46
|
+ public static string SendSms(string msg,string mobiles,string templetid,string excode = "")
|
|
47
|
47
|
{
|
|
48
|
48
|
bool n=false ;
|
|
49
|
49
|
string sign = Md5(cpcode + msg + mobiles + excode + templetid + key);
|
|
|
@@ -73,31 +73,37 @@ namespace CallCenterApi.Interface.Controllers
|
|
73
|
73
|
var responseString = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")).ReadToEnd();
|
|
74
|
74
|
JObject jo = (JObject)JsonConvert.DeserializeObject(responseString );
|
|
75
|
75
|
string access_token = jo["resultcode"].ToString();
|
|
76
|
|
- if (access_token == "0")
|
|
77
|
|
- n = true;
|
|
78
|
|
- return n;
|
|
|
76
|
+ return access_token;
|
|
79
|
77
|
}
|
|
80
|
78
|
public static bool AddSmS(int userId,string count ,string msg, string mobiles, string templetid)
|
|
81
|
79
|
{
|
|
82
|
|
-
|
|
83
|
|
- bool n = SendSms(msg, mobiles, templetid);
|
|
84
|
|
- if (n ==false )
|
|
85
|
|
- return n;
|
|
|
80
|
+ bool res = false ;
|
|
|
81
|
+ string n = SendSms(msg, mobiles, templetid);
|
|
86
|
82
|
Model.T_SMS_RecvSMS dModel = new Model.T_SMS_RecvSMS();
|
|
87
|
83
|
dModel.CallerNum = mobiles.Trim();
|
|
88
|
84
|
dModel.Content = count.Trim();
|
|
|
85
|
+ dModel.RecvModemIMEI = n;
|
|
89
|
86
|
dModel.State = 0;
|
|
90
|
87
|
dModel.F_UserID = userId;
|
|
91
|
88
|
dModel.RecvTime = DateTime.Now;
|
|
92
|
89
|
int b = new BLL.T_SMS_RecvSMS().Add(dModel);
|
|
93
|
|
- if (b > 0)
|
|
|
90
|
+ if (n == "0")
|
|
|
91
|
+ res = true;
|
|
|
92
|
+ if (res)
|
|
94
|
93
|
{
|
|
95
|
|
- return true;
|
|
|
94
|
+ if (b > 0)
|
|
|
95
|
+ {
|
|
|
96
|
+ return true;
|
|
|
97
|
+ }
|
|
|
98
|
+ else
|
|
|
99
|
+ {
|
|
|
100
|
+ return false;
|
|
|
101
|
+ }
|
|
96
|
102
|
}
|
|
97
|
103
|
else
|
|
98
|
|
- {
|
|
99
|
|
- return false;
|
|
100
|
|
- }
|
|
|
104
|
+ return res;
|
|
|
105
|
+
|
|
|
106
|
+
|
|
101
|
107
|
}
|
|
102
|
108
|
#region 接收短信
|
|
103
|
109
|
[Authority]
|
|
|
@@ -131,7 +137,7 @@ namespace CallCenterApi.Interface.Controllers
|
|
131
|
137
|
{
|
|
132
|
138
|
sql += " and RecvTime <= '" + Convert.ToDateTime(strendtime.Trim()) + "' ";
|
|
133
|
139
|
}
|
|
134
|
|
-
|
|
|
140
|
+ sql += "and F_UserID is not null";
|
|
135
|
141
|
if (strpageindex.Trim() != "")
|
|
136
|
142
|
{
|
|
137
|
143
|
pageindex = Convert.ToInt32(strpageindex);
|
|
|
@@ -152,14 +158,20 @@ namespace CallCenterApi.Interface.Controllers
|
|
152
|
158
|
pageindex,
|
|
153
|
159
|
true,
|
|
154
|
160
|
out recordCount);
|
|
155
|
|
-
|
|
|
161
|
+ List<Model.T_SMS_RecvSMS> modelList = new BLL.T_SMS_RecvSMS().DataTableToList(dt);
|
|
156
|
162
|
var obj = new
|
|
157
|
163
|
{
|
|
158
|
|
- state = "success",
|
|
159
|
|
- message = "成功",
|
|
160
|
|
- rows = dt,
|
|
|
164
|
+ rows = modelList.Select(x => new
|
|
|
165
|
+ {
|
|
|
166
|
+ x.CallerNum,
|
|
|
167
|
+ x.Content,
|
|
|
168
|
+ x.F_Name,
|
|
|
169
|
+ usercode = new BLL.T_Sys_UserAccount().GetModel((int)x.F_UserID) != null ? new BLL.T_Sys_UserAccount().GetModel((int)x.F_UserID).F_UserCode : "系统发送",
|
|
|
170
|
+ x.RecvTime
|
|
|
171
|
+ }),
|
|
161
|
172
|
total = recordCount
|
|
162
|
173
|
};
|
|
|
174
|
+
|
|
163
|
175
|
|
|
164
|
176
|
return Content(obj.ToJson());
|
|
165
|
177
|
|