zhupei лет назад: 4
Родитель
Сommit
639a12f87e

+ 9 - 9
RMYY_CallCenter_Api.Dal/T_Call_Blacklist.cs

@@ -41,9 +41,9 @@ namespace RMYY_CallCenter_Api.Dal
41 41
         {
42 42
             StringBuilder strSql = new StringBuilder();
43 43
             strSql.Append("insert into T_Call_Blacklist(");
44
-            strSql.Append("F_CallId,F_TelPhone,F_BlackType,F_SetTime,F_RemoveTime,F_Describe,F_UserId,F_InterceptNum,F_IsDelete,F_CreateTime)");
44
+            strSql.Append("F_CallId,F_TelPhone,F_BlackType,F_SetTime,F_RemoveTime,F_Describe,F_UserId,F_InterceptNum,F_IsDelete)");
45 45
             strSql.Append(" values (");
46
-            strSql.Append("@F_CallId,@F_TelPhone,@F_BlackType,@F_SetTime,@F_RemoveTime,@F_Describe,@F_UserId,@F_InterceptNum,@F_IsDelete,getdate())");
46
+            strSql.Append("@F_CallId,@F_TelPhone,@F_BlackType,@F_SetTime,@F_RemoveTime,@F_Describe,@F_UserId,@F_InterceptNum,@F_IsDelete)");
47 47
             strSql.Append(";select @@IDENTITY");
48 48
             SqlParameter[] parameters = {
49 49
                     new SqlParameter("@F_CallId", SqlDbType.VarChar,50),
@@ -182,7 +182,7 @@ namespace RMYY_CallCenter_Api.Dal
182 182
         {
183 183
 
184 184
             StringBuilder strSql = new StringBuilder();
185
-            strSql.Append("select  top 1 F_BlackId,F_CallId,F_TelPhone,F_BlackType,F_SetTime,F_RemoveTime,F_Describe,F_UserId,F_InterceptNum,F_IsDelete,F_CreateTime from T_Call_Blacklist with(nolock)");
185
+            strSql.Append("select  top 1 F_BlackId,F_CallId,F_TelPhone,F_BlackType,F_SetTime,F_RemoveTime,F_Describe,F_UserId,F_InterceptNum,F_IsDelete from T_Call_Blacklist with(nolock)");
186 186
             strSql.Append(" where F_BlackId=@F_BlackId");
187 187
             SqlParameter[] parameters = {
188 188
                     new SqlParameter("@F_BlackId", SqlDbType.Int,4)
@@ -257,10 +257,10 @@ namespace RMYY_CallCenter_Api.Dal
257 257
                         model.F_IsDelete = false;
258 258
                     }
259 259
                 }
260
-                if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
261
-                {
262
-                    model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
263
-                }
260
+                //if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
261
+                //{
262
+                //    model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
263
+                //}
264 264
             }
265 265
             return model;
266 266
         }
@@ -271,7 +271,7 @@ namespace RMYY_CallCenter_Api.Dal
271 271
         public DataSet GetList(string strWhere)
272 272
         {
273 273
             StringBuilder strSql = new StringBuilder();
274
-            strSql.Append("select F_BlackId,F_CallId,F_TelPhone,F_BlackType,F_SetTime,F_RemoveTime,F_Describe,F_UserId,F_InterceptNum,F_IsDelete,F_CreateTime ");
274
+            strSql.Append("select F_BlackId,F_CallId,F_TelPhone,F_BlackType,F_SetTime,F_RemoveTime,F_Describe,F_UserId,F_InterceptNum,F_IsDelete ");
275 275
             strSql.Append(" FROM T_Call_Blacklist with(nolock)");
276 276
             if (strWhere.Trim() != "")
277 277
             {
@@ -291,7 +291,7 @@ namespace RMYY_CallCenter_Api.Dal
291 291
             {
292 292
                 strSql.Append(" top " + Top.ToString());
293 293
             }
294
-            strSql.Append(" F_BlackId,F_CallId,F_TelPhone,F_BlackType,F_SetTime,F_RemoveTime,F_Describe,F_UserId,F_InterceptNum,F_IsDelete,F_CreateTime ");
294
+            strSql.Append(" F_BlackId,F_CallId,F_TelPhone,F_BlackType,F_SetTime,F_RemoveTime,F_Describe,F_UserId,F_InterceptNum,F_IsDelete ");
295 295
             strSql.Append(" FROM T_Call_Blacklist with(nolock)");
296 296
             if (strWhere.Trim() != "")
297 297
             {

+ 1 - 1
RMYY_CallCenter_Api.Dal/T_Sys_UserAccount.cs

@@ -358,7 +358,7 @@ namespace RMYY_CallCenter_Api.Dal
358 358
         public DataSet GetList(string strWhere)
359 359
         {
360 360
             StringBuilder strSql = new StringBuilder();
361
-            strSql.Append("select F_UserId,F_UserCode,F_Password,F_ExtensionNumber,F_UserName,F_DeptId,F_RoleId,F_Sex,F_Telephone,F_WxOpenId,F_Remark,F_SeatFlag,F_EnableFlag,F_CreateUser,F_CreateTime,F_DeleteFlag,F_DeleteUser,F_DeleteTime ");
361
+            strSql.Append("select F_UserId,F_UserCode,F_Password,F_ExtensionNumber,F_UserName,F_DeptId,F_RoleId,F_Sex,F_Telephone,F_WxOpenId,F_Remark,F_SeatFlag,F_SeatGroup,F_EnableFlag,F_CreateUser,F_CreateTime,F_DeleteFlag,F_DeleteUser,F_DeleteTime");
362 362
             strSql.Append(" FROM T_Sys_UserAccount with(nolock) ");
363 363
             if (strWhere.Trim() != "")
364 364
             {

+ 5 - 5
RMYY_CallCenter_Api.Model/T_Call_Blacklist.cs

@@ -109,11 +109,11 @@ namespace RMYY_CallCenter_Api.Model
109 109
         /// <summary>
110 110
         /// 
111 111
         /// </summary>
112
-        public DateTime? F_CreateTime
113
-        {
114
-            set { _f_createtime = value; }
115
-            get { return _f_createtime; }
116
-        }
112
+        //public DateTime? F_CreateTime
113
+        //{
114
+        //    set { _f_createtime = value; }
115
+        //    get { return _f_createtime; }
116
+        //}
117 117
         #endregion Model
118 118
     }
119 119
 }

+ 0 - 1
RMYY_CallCenter_Api.Model/T_Sys_Department.cs

@@ -92,7 +92,6 @@ namespace RMYY_CallCenter_Api.Model
92 92
             get { return _f_createtime; }
93 93
         }
94 94
         #endregion Model
95
-
96 95
     }
97 96
 }
98 97
 

+ 5 - 0
RMYY_CallCenter_Api.Model/T_Sys_UserAccount.cs

@@ -183,6 +183,11 @@ namespace RMYY_CallCenter_Api.Model
183 183
         }
184 184
         #endregion Model
185 185
 
186
+        public string F_DeptName//部门名称
187
+        { get; set; }
188
+
189
+        public string F_ZXZCode { get; set; }//坐席组编码
190
+
186 191
     }
187 192
 }
188 193
 

+ 4 - 0
RMYY_CallCenter_Api.Utility/RMYY_CallCenter_Api.Utility.csproj

@@ -83,13 +83,17 @@
83 83
     <Compile Include="Helper\ConfigHelper.cs" />
84 84
     <Compile Include="Extention\Json.cs" />
85 85
     <Compile Include="Properties\AssemblyInfo.cs" />
86
+    <Compile Include="Request\RequestString.cs" />
87
+    <Compile Include="Request\TypeConverter.cs" />
86 88
     <Compile Include="Tree\Tree.cs" />
87 89
     <Compile Include="Tree\TreeModel.cs" />
88 90
     <Compile Include="Tree\TreeSelect.cs" />
89 91
     <Compile Include="Tree\TreeSelectModel.cs" />
92
+    <Compile Include="Web\WebHelper.cs" />
90 93
   </ItemGroup>
91 94
   <ItemGroup>
92 95
     <None Include="packages.config" />
93 96
   </ItemGroup>
97
+  <ItemGroup />
94 98
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
95 99
 </Project>

+ 644 - 0
RMYY_CallCenter_Api.Utility/Request/RequestString.cs

@@ -0,0 +1,644 @@
1
+using System;
2
+using System.Globalization;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Text.RegularExpressions;
6
+using System.Web;
7
+using System.Net;
8
+using System.IO;
9
+
10
+namespace RMYY_CallCenter_Api.Utility
11
+{
12
+    /// <summary>
13
+    /// 页面获取数据类
14
+
15
+    /// </summary>
16
+    public class RequestString
17
+    {
18
+        /// <summary>
19
+        /// 判断当前页面是否接收到了Post请求
20
+        /// </summary>
21
+        /// <returns>是否接收到了Post请求</returns>
22
+        public static bool IsPost()
23
+        {
24
+            return HttpContext.Current.Request.HttpMethod.Equals("POST");
25
+        }
26
+
27
+        /// <summary>
28
+        /// 判断当前页面是否接收到了Get请求
29
+        /// </summary>
30
+        /// <returns>是否接收到了Get请求</returns>
31
+        public static bool IsGet()
32
+        {
33
+            return HttpContext.Current.Request.HttpMethod.Equals("GET");
34
+        }
35
+        /// <summary>
36
+        /// 获取文件
37
+        /// </summary>
38
+        /// <returns></returns>
39
+        public static HttpFileCollection GetFiles()
40
+        {
41
+            return HttpContext.Current.Request.Files;
42
+        }
43
+        /// <summary>
44
+        /// 返回URL中结尾的文件名
45
+        /// </summary>		
46
+        public static string GetFilename(string url)
47
+        {
48
+            if (url == null)
49
+            {
50
+                return "";
51
+            }
52
+            string[] strs1 = url.Split(new[] { '/' });
53
+            return strs1[strs1.Length - 1].Split(new[] { '?' })[0];
54
+        }
55
+
56
+
57
+        /// <summary>
58
+        /// 返回指定的服务器变量信息
59
+        /// </summary>
60
+        /// <param name="strName">服务器变量名</param>
61
+        /// <returns>服务器变量信息</returns>
62
+        public static string GetServerString(string strName)
63
+        {
64
+            if (HttpContext.Current.Request.ServerVariables[strName] == null)
65
+                return "";
66
+
67
+            return HttpContext.Current.Request.ServerVariables[strName];
68
+        }
69
+
70
+        /// <summary>
71
+        /// 返回上一个页面的地址
72
+        /// </summary>
73
+        /// <returns>上一个页面的地址</returns>
74
+        public static string GetUrlReferrer()
75
+        {
76
+            string retVal = null;
77
+
78
+            try
79
+            {
80
+                if (HttpContext.Current.Request.UrlReferrer != null)
81
+                    retVal = HttpContext.Current.Request.UrlReferrer.ToString();
82
+            }
83
+            catch (Exception)
84
+            { }
85
+
86
+            if (retVal == null)
87
+                return "";
88
+
89
+            return retVal;
90
+        }
91
+
92
+        /// <summary>
93
+        /// 得到当前完整主机头
94
+        /// </summary>
95
+        /// <returns></returns>
96
+        public static string GetCurrentFullHost()
97
+        {
98
+            HttpRequest request = HttpContext.Current.Request;
99
+            if (!request.Url.IsDefaultPort)
100
+                return string.Format("{0}:{1}", request.Url.Host, request.Url.Port.ToString(CultureInfo.InvariantCulture));
101
+
102
+            return request.Url.Host;
103
+        }
104
+
105
+        /// <summary>
106
+        /// 得到主机头
107
+        /// </summary>
108
+        /// <returns></returns>
109
+        public static string GetHost()
110
+        {
111
+            return HttpContext.Current.Request.Url.Host;
112
+        }
113
+        /// <summary>
114
+        /// 得到主机名
115
+        /// </summary>
116
+        public static string GetDnsSafeHost()
117
+        {
118
+            return HttpContext.Current.Request.Url.DnsSafeHost;
119
+        }
120
+
121
+        /// <summary>
122
+        /// 获取当前请求的原始 URL(URL 中域信息之后的部分,包括查询字符串(如果存在))
123
+        /// </summary>
124
+        /// <returns>原始 URL</returns>
125
+        public static string GetRawUrl()
126
+        {
127
+            return HttpContext.Current.Request.RawUrl;
128
+        }
129
+
130
+        /// <summary>
131
+        /// 判断当前访问是否来自浏览器软件
132
+        /// </summary>
133
+        /// <returns>当前访问是否来自浏览器软件</returns>
134
+        public static bool IsBrowserGet()
135
+        {
136
+            string[] BrowserName = { "ie", "opera", "netscape", "mozilla", "konqueror", "firefox" };
137
+            string curBrowser = HttpContext.Current.Request.Browser.Type.ToLower();
138
+            return BrowserName.Any(t => curBrowser.IndexOf(t, StringComparison.Ordinal) >= 0);
139
+        }
140
+
141
+        /// <summary>
142
+        /// 判断是否来自搜索引擎链接
143
+        /// </summary>
144
+        /// <returns>是否来自搜索引擎链接</returns>
145
+        public static bool IsSearchEnginesGet()
146
+        {
147
+            if (HttpContext.Current.Request.UrlReferrer == null)
148
+                return false;
149
+
150
+            string[] SearchEngine = { "google", "yahoo", "msn", "baidu", "sogou", "sohu", "sina", "163", "lycos", "tom", "yisou", "iask", "soso", "gougou", "zhongsou" };
151
+            string tmpReferrer = HttpContext.Current.Request.UrlReferrer.ToString().ToLower();
152
+            return SearchEngine.Any(t => tmpReferrer.IndexOf(t, StringComparison.Ordinal) >= 0);
153
+        }
154
+
155
+        /// <summary>
156
+        /// 获得当前完整Url地址
157
+        /// </summary>
158
+        /// <returns>当前完整Url地址</returns>
159
+        public static string GetUrl()
160
+        {
161
+            return HttpContext.Current.Request.Url.ToString();
162
+        }
163
+
164
+        /// <summary>
165
+        /// 获取文件
166
+        /// </summary>
167
+        /// <param name="strName"></param>
168
+        /// <returns></returns>
169
+        public static HttpPostedFile GetFile(string strName)
170
+        {
171
+            return HttpContext.Current.Request.Files[strName];
172
+        }
173
+
174
+        /// <summary>
175
+        /// 获取stream
176
+        /// </summary>
177
+        /// <returns></returns>
178
+        public static Stream GetInputStream()
179
+        {
180
+            return HttpContext.Current.Request.InputStream;
181
+        }
182
+
183
+        /// <summary>
184
+        /// 获得指定Url参数的值
185
+        /// </summary>
186
+        /// <param name="strName">Url参数</param>
187
+        /// <returns>Url参数的值</returns>
188
+        public static string GetQueryString(string strName)
189
+        {
190
+            return GetQueryString(strName, false);
191
+        }
192
+
193
+        /// <summary>
194
+        /// 获得指定Url参数的值
195
+        /// </summary> 
196
+        /// <param name="strName">Url参数</param>
197
+        /// <param name="sqlSafeCheck">是否进行SQL安全检查</param>
198
+        /// <returns>Url参数的值</returns>
199
+        public static string GetQueryString(string strName, bool sqlSafeCheck)
200
+        {
201
+            if (HttpContext.Current.Request.QueryString[strName] == null)
202
+                return "";
203
+
204
+            if (sqlSafeCheck && !IsSafeSqlString(HttpContext.Current.Request.QueryString[strName]))
205
+                return "";
206
+
207
+            return HttpContext.Current.Request.QueryString[strName];
208
+        }
209
+
210
+        /// <summary>
211
+        /// 获得指定Url参数的值
212
+        /// </summary> 
213
+        /// <param name="strName">Url参数</param>
214
+        /// <param name="sqlSafeCheck">是否进行SQL安全检查</param>
215
+        /// <param name="defValue">当SQL安全检查不通过或无值时的默认值</param>
216
+        /// <returns>Url参数的值</returns>
217
+        public static string GetQueryString(string strName, bool sqlSafeCheck, string defValue)
218
+        {
219
+            if (HttpContext.Current.Request.QueryString[strName] == null)
220
+                return defValue;
221
+
222
+            if (sqlSafeCheck && !IsSafeSqlString(HttpContext.Current.Request.QueryString[strName]))
223
+                return defValue;
224
+
225
+            return HttpContext.Current.Request.QueryString[strName];
226
+        }
227
+
228
+        /// <summary>
229
+        /// SQL危险字符过滤
230
+        /// </summary>
231
+        /// <param name="source">要过滤的字符串</param>
232
+        /// <param name="SafeLevel">安全级别{1最高}</param>
233
+        /// <returns></returns>
234
+        public static string FilterSql(string source, int SafeLevel)
235
+        {
236
+
237
+            //单引号替换成两个单引号
238
+            source = source.Replace("'", "''");
239
+            source = source.Replace("--", "--");
240
+
241
+            if (SafeLevel == 1)
242
+            {
243
+                //单引号替换成两个单引号
244
+                source = source.Replace("\"", "“");
245
+                source = source.Replace("|", "|");
246
+
247
+                //半角封号替换为全角封号,防止多语句执行
248
+                source = source.Replace(";", ";");
249
+
250
+                source = source.Replace("=", "=");
251
+                //半角括号替换为全角括号
252
+                source = source.Replace("(", "(");
253
+                source = source.Replace(")", ")");
254
+            }
255
+            return source;
256
+        }
257
+
258
+        /// <summary>
259
+        /// 检测是否有Sql危险字符
260
+        /// </summary>
261
+        /// <param name="str">要判断字符串</param>
262
+        /// <returns>判断结果</returns>
263
+        public static bool IsSafeSqlString(string str)
264
+        {
265
+            return !Regex.IsMatch(str, @"[-|;|,|\/|\(|\)|\[|\]|\}|\{|%|@|\*|!|\']");
266
+        }
267
+
268
+        /// <summary>
269
+        /// 检测是否有危险的可能用于链接的字符串
270
+        /// </summary>
271
+        /// <param name="str">要判断字符串</param>
272
+        /// <returns>判断结果</returns>
273
+        public static bool IsSafeUserInfoString(string str)
274
+        {
275
+            return !Regex.IsMatch(str, @"^\s*$|^c:\\con\\con$|[%,\*" + "\"" + @"\s\t\<\>\&]|游客|^Guest");
276
+        }
277
+
278
+        /// <summary>
279
+        /// 获得当前页面的名称
280
+        /// </summary>
281
+        /// <returns>当前页面的名称</returns>
282
+        public static string GetPageName()
283
+        {
284
+            string[] urlArr = HttpContext.Current.Request.Url.AbsolutePath.Split('/');
285
+            return urlArr[urlArr.Length - 1].ToLower();
286
+        }
287
+
288
+        /// <summary>
289
+        /// 返回表单或Url参数的总个数
290
+        /// </summary>
291
+        /// <returns></returns>
292
+        public static int GetParamCount()
293
+        {
294
+            return HttpContext.Current.Request.Form.Count + HttpContext.Current.Request.QueryString.Count;
295
+        }
296
+
297
+
298
+        /// <summary>
299
+        /// 获得指定表单参数的值
300
+        /// </summary>
301
+        /// <param name="strName">表单参数</param>
302
+        /// <returns>表单参数的值</returns>
303
+        public static string GetFormString(string strName)
304
+        {
305
+            return GetFormString(strName, false);
306
+        }
307
+
308
+        /// <summary>
309
+        /// 获得指定表单参数的值
310
+        /// </summary>
311
+        /// <param name="strName">表单参数</param>
312
+        /// <param name="sqlSafeCheck">是否进行SQL安全检查</param>
313
+        /// <returns>表单参数的值</returns>
314
+        public static string GetFormString(string strName, bool sqlSafeCheck)
315
+        {
316
+            if (HttpContext.Current.Request.Form[strName] == null)
317
+                return "";
318
+
319
+            if (sqlSafeCheck && !IsSafeSqlString(HttpContext.Current.Request.Form[strName]))
320
+                return "";
321
+
322
+            return HttpContext.Current.Request.Form[strName];
323
+        }
324
+
325
+
326
+        /// <summary>
327
+        /// 获得指定表单参数的值
328
+        /// </summary>
329
+        /// <param name="strName">表单参数</param>
330
+        /// <param name="sqlSafeCheck">是否进行SQL安全检查</param>
331
+        /// <param name="defValue">当SQL安全检查不通过或无值时的默认值</param>
332
+        /// <returns>表单参数的值</returns>
333
+        public static string GetFormString(string strName, bool sqlSafeCheck, string defValue)
334
+        {
335
+            if (HttpContext.Current.Request.Form[strName] == null)
336
+                return defValue;
337
+
338
+            if (sqlSafeCheck && !IsSafeSqlString(HttpContext.Current.Request.Form[strName]))
339
+                return defValue;
340
+
341
+            return HttpContext.Current.Request.Form[strName];
342
+        }
343
+
344
+        /// <summary>
345
+        /// 获得Url或表单参数的值, 先判断Url参数是否为空字符串, 如为True则返回表单参数的值
346
+        /// </summary>
347
+        /// <param name="strName">参数</param>
348
+        /// <returns>Url或表单参数的值</returns>
349
+        public static string GetString(string strName)
350
+        {
351
+            return GetString(strName, false);
352
+        }
353
+
354
+        /// <summary>
355
+        /// 获得Url或表单参数的值, 先判断Url参数是否为空字符串, 如为True则返回表单参数的值
356
+        /// </summary>
357
+        /// <param name="strName">参数</param>
358
+        /// <param name="sqlSafeCheck">是否进行SQL安全检查</param>
359
+        /// <returns>Url或表单参数的值</returns>
360
+        public static string GetString(string strName, bool sqlSafeCheck)
361
+        {
362
+            if ("".Equals(GetQueryString(strName)))
363
+                return GetFormString(strName, sqlSafeCheck);
364
+            return GetQueryString(strName, sqlSafeCheck);
365
+        }
366
+
367
+        /// <summary>
368
+        /// 获得Url或表单参数的值, 先判断Url参数是否为空字符串, 如为True则返回表单参数的值
369
+        /// </summary>
370
+        /// <param name="strName">参数</param>
371
+        /// <param name="sqlSafeCheck">是否进行SQL安全检查</param>
372
+        /// <param name="defValue">当SQL安全检查不通过或无值时的默认值</param>
373
+        /// <returns>Url或表单参数的值</returns>
374
+        public static string GetString(string strName, bool sqlSafeCheck, string defValue)
375
+        {
376
+            if ("".Equals(GetQueryString(strName)))
377
+                return GetFormString(strName, sqlSafeCheck, defValue);
378
+            return GetQueryString(strName, sqlSafeCheck, defValue);
379
+        }
380
+
381
+        /// <summary>
382
+        /// 获得指定Url参数的int类型值
383
+        /// </summary>
384
+        /// <param name="strName">Url参数</param>
385
+        /// <returns>Url参数的int类型值</returns>
386
+        public static int GetQueryInt(string strName)
387
+        {
388
+            return TypeConverter.StrToInt(HttpContext.Current.Request.QueryString[strName], 0);
389
+        }
390
+
391
+
392
+        /// <summary>
393
+        /// 获得指定Url参数的int类型值
394
+        /// </summary>
395
+        /// <param name="strName">Url参数</param>
396
+        /// <param name="defValue">缺省值</param>
397
+        /// <returns>Url参数的int类型值</returns>
398
+        public static int GetQueryInt(string strName, int defValue)
399
+        {
400
+            return TypeConverter.StrToInt(HttpContext.Current.Request.QueryString[strName], defValue);
401
+        }
402
+
403
+
404
+        /// <summary>
405
+        /// 获得指定表单参数的int类型值
406
+        /// </summary>
407
+        /// <param name="strName">表单参数</param>
408
+        /// <param name="defValue">缺省值</param>
409
+        /// <returns>表单参数的int类型值</returns>
410
+        public static int GetFormInt(string strName, int defValue)
411
+        {
412
+            return TypeConverter.StrToInt(HttpContext.Current.Request.Form[strName], defValue);
413
+        }
414
+
415
+        /// <summary>
416
+        /// 获得指定Url或表单参数的int类型值, 先判断Url参数是否为缺省值, 如为True则返回表单参数的值
417
+        /// </summary>
418
+        /// <param name="strName">Url或表单参数</param>
419
+        /// <param name="defValue">缺省值</param>
420
+        /// <returns>Url或表单参数的int类型值</returns>
421
+        public static int GetInt(string strName, int defValue)
422
+        {
423
+            if (GetQueryInt(strName, defValue) == defValue)
424
+                return GetFormInt(strName, defValue);
425
+            return GetQueryInt(strName, defValue);
426
+        }
427
+
428
+        /// <summary>
429
+        /// 获得指定Url参数的float类型值
430
+        /// </summary>
431
+        /// <param name="strName">Url参数</param>
432
+        /// <param name="defValue">缺省值</param>
433
+        /// <returns>Url参数的int类型值</returns>
434
+        public static float GetQueryFloat(string strName, float defValue)
435
+        {
436
+            return TypeConverter.StrToFloat(HttpContext.Current.Request.QueryString[strName], defValue);
437
+        }
438
+
439
+
440
+        /// <summary>
441
+        /// 获得指定表单参数的float类型值
442
+        /// </summary>
443
+        /// <param name="strName">表单参数</param>
444
+        /// <param name="defValue">缺省值</param>
445
+        /// <returns>表单参数的float类型值</returns>
446
+        public static float GetFormFloat(string strName, float defValue)
447
+        {
448
+            return TypeConverter.StrToFloat(HttpContext.Current.Request.Form[strName], defValue);
449
+        }
450
+
451
+        /// <summary>
452
+        /// 获得指定Url或表单参数的float类型值, 先判断Url参数是否为缺省值, 如为True则返回表单参数的值
453
+        /// </summary>
454
+        /// <param name="strName">Url或表单参数</param>
455
+        /// <param name="defValue">缺省值</param>
456
+        /// <returns>Url或表单参数的int类型值</returns>
457
+        public static float GetFloat(string strName, float defValue)
458
+        {
459
+            if (GetQueryFloat(strName, defValue) == defValue)
460
+                return GetFormFloat(strName, defValue);
461
+            return GetQueryFloat(strName, defValue);
462
+        }
463
+
464
+        /// <summary>
465
+        /// 获得当前页面客户端的IP
466
+        /// </summary>
467
+        /// <returns>当前页面客户端的IP</returns>
468
+        //public static string GetIP()
469
+        //{
470
+        //    string result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
471
+        //    if (string.IsNullOrEmpty(result))
472
+        //        result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
473
+
474
+        //    if (string.IsNullOrEmpty(result))
475
+        //        result = HttpContext.Current.Request.UserHostAddress;
476
+
477
+        //    if (string.IsNullOrEmpty(result) || !ValidateString.IsIP(result))
478
+        //        return "127.0.0.1";
479
+
480
+        //    return result;
481
+        //}
482
+
483
+        /// <summary>
484
+        /// 获取URL地址的网页内容
485
+        /// </summary>
486
+        public class GetUrlText
487
+        {
488
+            /// <summary>
489
+            /// Gets the text.
490
+            /// </summary>
491
+            /// <param name="url">地址 The URL.</param>
492
+            /// <param name="Encoding">编码 The encoding.</param>
493
+            /// <returns></returns>
494
+            public static string GetText(string url, string Encoding)
495
+            {
496
+                WebResponse wr_result = null;
497
+                var txthtml = new StringBuilder();
498
+                try
499
+                {
500
+                    WebRequest wr_req = WebRequest.Create(url);
501
+                    wr_result = wr_req.GetResponse();
502
+                    Stream ReceiveStream = wr_result.GetResponseStream();
503
+                    Encoding encode = System.Text.Encoding.GetEncoding(Encoding);
504
+                    var sr = new StreamReader(ReceiveStream, encode);
505
+                    if (true)
506
+                    {
507
+                        var read = new Char[256];
508
+                        int count = sr.Read(read, 0, 256);
509
+                        while (count > 0)
510
+                        {
511
+                            var str = new String(read, 0, count);
512
+                            txthtml.Append(str);
513
+                            count = sr.Read(read, 0, 256);
514
+                        }
515
+                    }
516
+                }
517
+                catch (Exception)
518
+                {
519
+                    txthtml.Append("err");
520
+                }
521
+                finally
522
+                {
523
+                    if (wr_result != null)
524
+                    {
525
+                        wr_result.Close();
526
+                    }
527
+                }
528
+                return txthtml.ToString();
529
+            }
530
+
531
+            //public static string GetText(string HttpUrl)
532
+            //{
533
+            //    try
534
+            //    {
535
+            //        HttpHelper http = new HttpHelper();
536
+            //        HttpItem item = new HttpItem()
537
+            //        {
538
+            //            URL = HttpUrl,//URL     必需项    
539
+            //            Method = "get",//URL     可选项 默认为Get   
540
+            //            IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
541
+            //            Cookie = "",//字符串Cookie     可选项   
542
+            //            Referer = "",//来源URL     可选项   
543
+            //            Postdata = "",//Post数据     可选项GET时不需要写   
544
+            //            Timeout = 100000,//连接超时时间     可选项默认为100000    
545
+            //            ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
546
+            //            ContentType = "text/html",//返回类型    可选项有默认值   
547
+            //            Allowautoredirect = false,//是否根据301跳转     可选项   
548
+            //            //CerPath = "d:\123.cer",//证书绝对路径     可选项不需要证书时可以不写这个参数   
549
+            //            //Connectionlimit = 1024,//最大连接数     可选项 默认为1024    
550
+            //            ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数    
551
+            //            //ProxyPwd = "123456",//代理服务器密码     可选项    
552
+            //            //ProxyUserName = "administrator",//代理服务器账户名     可选项   
553
+            //        };
554
+            //        var result = http.GetHtml(item);
555
+            //        string html = result.Html;
556
+            //        return html;
557
+            //        //var request = (HttpWebRequest)HttpWebRequest.Create(HttpUrl);
558
+            //        //var response = (HttpWebResponse)request.GetResponse();
559
+            //        //var strConfig = String.Empty;
560
+            //        //using (var reader = new StreamReader(response.GetResponseStream()))
561
+            //        //{
562
+            //        //    strConfig = reader.ReadToEnd();
563
+            //        //}
564
+            //        //return strConfig;
565
+            //    }
566
+            //    catch (Exception)
567
+            //    {
568
+
569
+            //        return "";
570
+            //    }
571
+            //}
572
+            
573
+        }
574
+
575
+        /// 转全角的函数(SBC case)
576
+        ///
577
+        ///任意字符串
578
+        ///全角字符串
579
+        ///
580
+        ///全角空格为12288,半角空格为32
581
+        ///其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
582
+        ///
583
+        public static String ToSBC(String input)
584
+        {
585
+            // 半角转全角:
586
+            char[] c = input.ToCharArray();
587
+            for (int i = 0; i < c.Length; i++)
588
+            {
589
+                if (c[i] == 32)
590
+                {
591
+                    c[i] = (char)12288;
592
+                    continue;
593
+                }
594
+                if (c[i] < 127)
595
+                    c[i] = (char)(c[i] + 65248);
596
+            }
597
+            return new String(c);
598
+        }
599
+
600
+        /**/
601
+        // /
602
+        // / 转半角的函数(DBC case)
603
+        // /
604
+        // /任意字符串
605
+        // /半角字符串
606
+        // /
607
+        // /全角空格为12288,半角空格为32
608
+        // /其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
609
+        // /
610
+        public static String ToDBC(String input)
611
+        {
612
+            char[] c = input.ToCharArray();
613
+            for (int i = 0; i < c.Length; i++)
614
+            {
615
+                if (c[i] == 12288)
616
+                {
617
+                    c[i] = (char)32;
618
+                    continue;
619
+                }
620
+                if (c[i] > 65280 && c[i] < 65375)
621
+                    c[i] = (char)(c[i] - 65248);
622
+            }
623
+            return new String(c);
624
+        }
625
+        /// <summary>
626
+        /// 去掉所有的非数字
627
+        /// </summary>
628
+        /// <param name="key"></param>
629
+        /// <returns></returns>
630
+        public static string RemoveNotNumber(string key)
631
+        {
632
+            return Regex.Replace(key, @"[^\d]*", "");
633
+        }
634
+        /// <summary>
635
+        /// 去掉所有的数字
636
+        /// </summary>
637
+        /// <param name="key"></param>
638
+        /// <returns></returns>
639
+        public static string RemoveNumber(string key)
640
+        {
641
+            return Regex.Replace(key, @"\d", "");
642
+        }
643
+    }
644
+}

+ 164 - 0
RMYY_CallCenter_Api.Utility/Request/TypeConverter.cs

@@ -0,0 +1,164 @@
1
+using System;
2
+using System.Text.RegularExpressions;
3
+
4
+namespace RMYY_CallCenter_Api.Utility
5
+{
6
+    /// <summary>
7
+    /// 数据转换操作类
8
+    /// </summary>
9
+    public class TypeConverter
10
+    {
11
+        /// <summary>
12
+        /// string型转换为bool型
13
+        /// </summary>
14
+        /// <param name="expression">要转换的字符串</param>
15
+        /// <param name="defValue">缺省值</param>
16
+        /// <returns>转换后的bool类型结果</returns>
17
+        public static bool StrToBool(object expression, bool defValue)
18
+        {
19
+            if (expression != null)
20
+                return StrToBool(expression, defValue);
21
+
22
+            return defValue;
23
+        }
24
+
25
+        /// <summary>
26
+        /// string型转换为bool型
27
+        /// </summary>
28
+        /// <param name="expression">要转换的字符串</param>
29
+        /// <param name="defValue">缺省值</param>
30
+        /// <returns>转换后的bool类型结果</returns>
31
+        public static bool StrToBool(string expression, bool defValue)
32
+        {
33
+            if (expression != null)
34
+            {
35
+                if (String.Compare(expression, "true", StringComparison.OrdinalIgnoreCase) == 0)
36
+                    return true;
37
+                if (String.Compare(expression, "false", StringComparison.OrdinalIgnoreCase) == 0)
38
+                    return false;
39
+            }
40
+            return defValue;
41
+        }
42
+
43
+        /// <summary>
44
+        /// 将对象转换为Int32类型
45
+        /// </summary>
46
+        /// <param name="expression">要转换的字符串</param>
47
+        /// <returns>转换后的int类型结果</returns>
48
+        public static int ObjectToInt(object expression)
49
+        {
50
+            return ObjectToInt(expression, 0);
51
+        }
52
+
53
+        /// <summary>
54
+        /// 将对象转换为Int32类型
55
+        /// </summary>
56
+        /// <param name="expression">要转换的字符串</param>
57
+        /// <param name="defValue">缺省值</param>
58
+        /// <returns>转换后的int类型结果</returns>
59
+        public static int ObjectToInt(object expression, int defValue)
60
+        {
61
+            if (expression != null)
62
+                return StrToInt(expression.ToString(), defValue);
63
+
64
+            return defValue;
65
+        }
66
+
67
+        /// <summary>
68
+        /// 将对象转换为Int32类型,转换失败返回0
69
+        /// </summary>
70
+        /// <param name="str">要转换的字符串</param>
71
+        /// <returns>转换后的int类型结果</returns>
72
+        public static int StrToInt(string str)
73
+        {
74
+            return StrToInt(str, 0);
75
+        }
76
+
77
+        /// <summary>
78
+        /// 将对象转换为Int32类型
79
+        /// </summary>
80
+        /// <param name="str">要转换的字符串</param>
81
+        /// <param name="defValue">缺省值</param>
82
+        /// <returns>转换后的int类型结果</returns>
83
+        public static int StrToInt(string str, int defValue)
84
+        {
85
+            if (string.IsNullOrEmpty(str) || str.Trim().Length >= 11 || !Regex.IsMatch(str.Trim(), @"^([-]|[0-9])[0-9]*(\.\w*)?$"))
86
+                return defValue;
87
+
88
+            int rv;
89
+            if (Int32.TryParse(str, out rv))
90
+                return rv;
91
+
92
+            return Convert.ToInt32(StrToFloat(str, defValue));
93
+        }
94
+
95
+        /// <summary>
96
+        /// string型转换为float型
97
+        /// </summary>
98
+        /// <param name="strValue">要转换的字符串</param>
99
+        /// <param name="defValue">缺省值</param>
100
+        /// <returns>转换后的int类型结果</returns>
101
+        public static float StrToFloat(object strValue, float defValue)
102
+        {
103
+            if ((strValue == null))
104
+                return defValue;
105
+
106
+            return StrToFloat(strValue.ToString(), defValue);
107
+        }
108
+
109
+        /// <summary>
110
+        /// string型转换为float型
111
+        /// </summary>
112
+        /// <param name="strValue">要转换的字符串</param>
113
+        /// <param name="defValue">缺省值</param>
114
+        /// <returns>转换后的int类型结果</returns>
115
+        public static float ObjectToFloat(object strValue, float defValue)
116
+        {
117
+            if ((strValue == null))
118
+                return defValue;
119
+
120
+            return StrToFloat(strValue.ToString(), defValue);
121
+        }
122
+
123
+        /// <summary>
124
+        /// string型转换为float型
125
+        /// </summary>
126
+        /// <param name="strValue">要转换的字符串</param>
127
+        /// <returns>转换后的int类型结果</returns>
128
+        public static float ObjectToFloat(object strValue)
129
+        {
130
+            return ObjectToFloat(strValue.ToString(), 0);
131
+        }
132
+
133
+        /// <summary>
134
+        /// string型转换为float型
135
+        /// </summary>
136
+        /// <param name="strValue">要转换的字符串</param>
137
+        /// <returns>转换后的int类型结果</returns>
138
+        public static float StrToFloat(object strValue)
139
+        {
140
+            if ((strValue == null))
141
+                return 0;
142
+
143
+            return StrToFloat(strValue.ToString(), 0);
144
+        }
145
+
146
+        /// <summary>
147
+        /// string型转换为float型
148
+        /// </summary>
149
+        /// <param name="strValue">要转换的字符串</param>
150
+        /// <param name="defValue">缺省值</param>
151
+        /// <returns>转换后的int类型结果</returns>
152
+        public static float StrToFloat(string strValue, float defValue)
153
+        {
154
+            if ((strValue == null) || (strValue.Length > 10))
155
+                return defValue;
156
+
157
+            float intValue = defValue;
158
+            bool IsFloat = Regex.IsMatch(strValue, @"^([-]|[0-9])[0-9]*(\.\w*)?$");
159
+            if (IsFloat)
160
+                float.TryParse(strValue, out intValue);
161
+            return intValue;
162
+        }
163
+    }
164
+}

+ 397 - 0
RMYY_CallCenter_Api.Utility/Web/WebHelper.cs

@@ -0,0 +1,397 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.IO;
4
+using System.Net;
5
+using System.Text;
6
+using System.Text.RegularExpressions;
7
+using System.Web;
8
+namespace RMYY_CallCenter_Api.Utility
9
+{
10
+    public class WebHelper
11
+    {
12
+        #region ResolveUrl(解析相对Url)
13
+        /// <summary>
14
+        /// 解析相对Url
15
+        /// </summary>
16
+        /// <param name="relativeUrl">相对Url</param>
17
+        public static string ResolveUrl(string relativeUrl)
18
+        {
19
+            if (string.IsNullOrWhiteSpace(relativeUrl))
20
+                return string.Empty;
21
+            relativeUrl = relativeUrl.Replace("\\", "/");
22
+            if (relativeUrl.StartsWith("/"))
23
+                return relativeUrl;
24
+            if (relativeUrl.Contains("://"))
25
+                return relativeUrl;
26
+            return VirtualPathUtility.ToAbsolute(relativeUrl);
27
+        }
28
+
29
+        #endregion
30
+
31
+        #region HtmlEncode(对html字符串进行编码)
32
+        /// <summary>
33
+        /// 对html字符串进行编码
34
+        /// </summary>
35
+        /// <param name="html">html字符串</param>
36
+        public static string HtmlEncode(string html)
37
+        {
38
+            return HttpUtility.HtmlEncode(html);
39
+        }
40
+        /// <summary>
41
+        /// 对html字符串进行解码
42
+        /// </summary>
43
+        /// <param name="html">html字符串</param>
44
+        public static string HtmlDecode(string html)
45
+        {
46
+            return HttpUtility.HtmlDecode(html);
47
+        }
48
+
49
+        #endregion
50
+
51
+        #region UrlEncode(对Url进行编码)
52
+
53
+        /// <summary>
54
+        /// 对Url进行编码
55
+        /// </summary>
56
+        /// <param name="url">url</param>
57
+        /// <param name="isUpper">编码字符是否转成大写,范例,"http://"转成"http%3A%2F%2F"</param>
58
+        public static string UrlEncode(string url, bool isUpper = false)
59
+        {
60
+            return UrlEncode(url, Encoding.UTF8, isUpper);
61
+        }
62
+
63
+        /// <summary>
64
+        /// 对Url进行编码
65
+        /// </summary>
66
+        /// <param name="url">url</param>
67
+        /// <param name="encoding">字符编码</param>
68
+        /// <param name="isUpper">编码字符是否转成大写,范例,"http://"转成"http%3A%2F%2F"</param>
69
+        public static string UrlEncode(string url, Encoding encoding, bool isUpper = false)
70
+        {
71
+            var result = HttpUtility.UrlEncode(url, encoding);
72
+            if (!isUpper)
73
+                return result;
74
+            return GetUpperEncode(result);
75
+        }
76
+
77
+        /// <summary>
78
+        /// 获取大写编码字符串
79
+        /// </summary>
80
+        private static string GetUpperEncode(string encode)
81
+        {
82
+            var result = new StringBuilder();
83
+            int index = int.MinValue;
84
+            for (int i = 0; i < encode.Length; i++)
85
+            {
86
+                string character = encode[i].ToString();
87
+                if (character == "%")
88
+                    index = i;
89
+                if (i - index == 1 || i - index == 2)
90
+                    character = character.ToUpper();
91
+                result.Append(character);
92
+            }
93
+            return result.ToString();
94
+        }
95
+
96
+        #endregion
97
+
98
+        #region UrlDecode(对Url进行解码)
99
+
100
+        /// <summary>
101
+        /// 对Url进行解码,对于javascript的encodeURIComponent函数编码参数,应使用utf-8字符编码来解码
102
+        /// </summary>
103
+        /// <param name="url">url</param>
104
+        public static string UrlDecode(string url)
105
+        {
106
+            return HttpUtility.UrlDecode(url);
107
+        }
108
+
109
+        /// <summary>
110
+        /// 对Url进行解码,对于javascript的encodeURIComponent函数编码参数,应使用utf-8字符编码来解码
111
+        /// </summary>
112
+        /// <param name="url">url</param>
113
+        /// <param name="encoding">字符编码,对于javascript的encodeURIComponent函数编码参数,应使用utf-8字符编码来解码</param>
114
+        public static string UrlDecode(string url, Encoding encoding)
115
+        {
116
+            return HttpUtility.UrlDecode(url, encoding);
117
+        }
118
+
119
+        #endregion
120
+
121
+        #region Session操作
122
+        /// <summary>
123
+        /// 写Session
124
+        /// </summary>
125
+        /// <typeparam name="T">Session键值的类型</typeparam>
126
+        /// <param name="key">Session的键名</param>
127
+        /// <param name="value">Session的键值</param>
128
+        public static void WriteSession<T>(string key, T value)
129
+        {
130
+            if (string.IsNullOrWhiteSpace(key))
131
+                return;
132
+            HttpContext.Current.Session[key] = value;
133
+        }
134
+
135
+        /// <summary>
136
+        /// 写Session
137
+        /// </summary>
138
+        /// <param name="key">Session的键名</param>
139
+        /// <param name="value">Session的键值</param>
140
+        public static void WriteSession(string key, string value)
141
+        {
142
+            WriteSession<string>(key, value);
143
+        }
144
+
145
+        /// <summary>
146
+        /// 读取Session的值
147
+        /// </summary>
148
+        /// <param name="key">Session的键名</param>        
149
+        public static string GetSession(string key)
150
+        {
151
+            if (string.IsNullOrWhiteSpace(key))
152
+                return string.Empty;
153
+            return HttpContext.Current.Session[key] as string;
154
+        }
155
+        /// <summary>
156
+        /// 删除指定Session
157
+        /// </summary>
158
+        /// <param name="key">Session的键名</param>
159
+        public static void RemoveSession(string key)
160
+        {
161
+            if (string.IsNullOrWhiteSpace(key))
162
+                return;
163
+            HttpContext.Current.Session.Contents.Remove(key);
164
+        }
165
+
166
+        #endregion
167
+
168
+        #region Cookie操作
169
+        /// <summary>
170
+        /// 写cookie值
171
+        /// </summary>
172
+        /// <param name="strName">名称</param>
173
+        /// <param name="strValue">值</param>
174
+        public static void WriteCookie(string strName, string strValue)
175
+        {
176
+            HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
177
+            if (cookie == null)
178
+            {
179
+                cookie = new HttpCookie(strName);
180
+            }
181
+            cookie.Value = strValue;
182
+            HttpContext.Current.Response.AppendCookie(cookie);
183
+        }
184
+        /// <summary>
185
+        /// 写cookie值
186
+        /// </summary>
187
+        /// <param name="strName">名称</param>
188
+        /// <param name="strValue">值</param>
189
+        /// <param name="strValue">过期时间(分钟)</param>
190
+        public static void WriteCookie(string strName, string strValue, int expires)
191
+        {
192
+            HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
193
+            if (cookie == null)
194
+            {
195
+                cookie = new HttpCookie(strName);
196
+            }
197
+            cookie.Value = strValue;
198
+            cookie.Expires = DateTime.Now.AddMinutes(expires);
199
+            HttpContext.Current.Response.AppendCookie(cookie);
200
+        }
201
+        /// <summary>
202
+        /// 读cookie值
203
+        /// </summary>
204
+        /// <param name="strName">名称</param>
205
+        /// <returns>cookie值</returns>
206
+        public static string GetCookie(string strName)
207
+        {
208
+            if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies[strName] != null)
209
+            {
210
+                return HttpContext.Current.Request.Cookies[strName].Value.ToString();
211
+            }
212
+            return "";
213
+        }
214
+        /// <summary>
215
+        /// 删除Cookie对象
216
+        /// </summary>
217
+        /// <param name="CookiesName">Cookie对象名称</param>
218
+        public static void RemoveCookie(string CookiesName)
219
+        {
220
+            HttpCookie objCookie = new HttpCookie(CookiesName.Trim());
221
+            objCookie.Expires = DateTime.Now.AddYears(-5);
222
+            HttpContext.Current.Response.Cookies.Add(objCookie);
223
+        }
224
+        #endregion
225
+
226
+        #region GetFileControls(获取客户端文件控件集合)
227
+
228
+        /// <summary>
229
+        /// 获取有效客户端文件控件集合,文件控件必须上传了内容,为空将被忽略,
230
+        /// 注意:Form标记必须加入属性 enctype="multipart/form-data",服务器端才能获取客户端file控件.
231
+        /// </summary>
232
+        public static List<HttpPostedFile> GetFileControls()
233
+        {
234
+            var result = new List<HttpPostedFile>();
235
+            var files = HttpContext.Current.Request.Files;
236
+            if (files.Count == 0)
237
+                return result;
238
+            for (int i = 0; i < files.Count; i++)
239
+            {
240
+                var file = files[i];
241
+                if (file.ContentLength == 0)
242
+                    continue;
243
+                result.Add(files[i]);
244
+            }
245
+            return result;
246
+        }
247
+
248
+        #endregion
249
+
250
+        #region GetFileControl(获取第一个有效客户端文件控件)
251
+
252
+        /// <summary>
253
+        /// 获取第一个有效客户端文件控件,文件控件必须上传了内容,为空将被忽略,
254
+        /// 注意:Form标记必须加入属性 enctype="multipart/form-data",服务器端才能获取客户端file控件.
255
+        /// </summary>
256
+        public static HttpPostedFile GetFileControl()
257
+        {
258
+            var files = GetFileControls();
259
+            if (files == null || files.Count == 0)
260
+                return null;
261
+            return files[0];
262
+        }
263
+
264
+        #endregion
265
+
266
+        #region HttpWebRequest(请求网络资源)
267
+
268
+        /// <summary>
269
+        /// 请求网络资源,返回响应的文本
270
+        /// </summary>
271
+        /// <param name="url">网络资源地址</param>
272
+        public static string HttpWebRequest(string url)
273
+        {
274
+            return HttpWebRequest(url, string.Empty, Encoding.GetEncoding("utf-8"));
275
+        }
276
+
277
+        /// <summary>
278
+        /// 请求网络资源,返回响应的文本
279
+        /// </summary>
280
+        /// <param name="url">网络资源Url地址</param>
281
+        /// <param name="parameters">提交的参数,格式:参数1=参数值1&amp;参数2=参数值2</param>
282
+        public static string HttpWebRequest(string url, string parameters)
283
+        {
284
+            return HttpWebRequest(url, parameters, Encoding.GetEncoding("utf-8"), true);
285
+        }
286
+
287
+        /// <summary>
288
+        /// 请求网络资源,返回响应的文本
289
+        /// </summary>
290
+        /// <param name="url">网络资源地址</param>
291
+        /// <param name="parameters">提交的参数,格式:参数1=参数值1&amp;参数2=参数值2</param>
292
+        /// <param name="encoding">字符编码</param>
293
+        /// <param name="isPost">是否Post提交</param>
294
+        /// <param name="contentType">内容类型</param>
295
+        /// <param name="cookie">Cookie容器</param>
296
+        /// <param name="timeout">超时时间</param>
297
+        public static string HttpWebRequest(string url, string parameters, Encoding encoding, bool isPost = false,
298
+             string contentType = "application/x-www-form-urlencoded", CookieContainer cookie = null, int timeout = 120000)
299
+        {
300
+            var request = (HttpWebRequest)WebRequest.Create(url);
301
+            request.Timeout = timeout;
302
+            request.CookieContainer = cookie;
303
+            if (isPost)
304
+            {
305
+                byte[] postData = encoding.GetBytes(parameters);
306
+                request.Method = "POST";
307
+                request.ContentType = contentType;
308
+                request.ContentLength = postData.Length;
309
+                using (Stream stream = request.GetRequestStream())
310
+                {
311
+                    stream.Write(postData, 0, postData.Length);
312
+                }
313
+            }
314
+            var response = (HttpWebResponse)request.GetResponse();
315
+            string result;
316
+            using (Stream stream = response.GetResponseStream())
317
+            {
318
+                if (stream == null)
319
+                    return string.Empty;
320
+                using (var reader = new StreamReader(stream, encoding))
321
+                {
322
+                    result = reader.ReadToEnd();
323
+                }
324
+            }
325
+            return result;
326
+        }
327
+
328
+        #endregion
329
+
330
+        #region 去除HTML标记
331
+        /// <summary>
332
+        /// 去除HTML标记
333
+        /// </summary>
334
+        /// <param name="NoHTML">包括HTML的源码 </param>
335
+        /// <returns>已经去除后的文字</returns>
336
+        public static string NoHtml(string Htmlstring)
337
+        {
338
+            //删除脚本
339
+            Htmlstring = Regex.Replace(Htmlstring, @"<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
340
+            //删除HTML
341
+            Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
342
+            Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
343
+            Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
344
+            Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
345
+            Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
346
+            Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
347
+            Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
348
+            Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
349
+            Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
350
+            Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
351
+            Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
352
+            Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
353
+            Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
354
+            Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
355
+            Htmlstring = Regex.Replace(Htmlstring, @"&hellip;", "", RegexOptions.IgnoreCase);
356
+            Htmlstring = Regex.Replace(Htmlstring, @"&mdash;", "", RegexOptions.IgnoreCase);
357
+            Htmlstring = Regex.Replace(Htmlstring, @"&ldquo;", "", RegexOptions.IgnoreCase);
358
+            Htmlstring.Replace("<", "");
359
+            Htmlstring = Regex.Replace(Htmlstring, @"&rdquo;", "", RegexOptions.IgnoreCase);
360
+            Htmlstring.Replace(">", "");
361
+            Htmlstring.Replace("\r\n", "");
362
+            Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim();
363
+            return Htmlstring;
364
+
365
+        }
366
+        #endregion
367
+
368
+        #region 格式化文本(防止SQL注入)
369
+        /// <summary>
370
+        /// 格式化文本(防止SQL注入)
371
+        /// </summary>
372
+        /// <param name="str"></param>
373
+        /// <returns></returns>
374
+        public static string Formatstr(string html)
375
+        {
376
+            System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex(@"<script[\s\S]+</script *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
377
+            System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex(@" href *= *[\s\S]*script *:", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
378
+            System.Text.RegularExpressions.Regex regex3 = new System.Text.RegularExpressions.Regex(@" on[\s\S]*=", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
379
+            System.Text.RegularExpressions.Regex regex4 = new System.Text.RegularExpressions.Regex(@"<iframe[\s\S]+</iframe *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
380
+            System.Text.RegularExpressions.Regex regex5 = new System.Text.RegularExpressions.Regex(@"<frameset[\s\S]+</frameset *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
381
+            System.Text.RegularExpressions.Regex regex10 = new System.Text.RegularExpressions.Regex(@"select", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
382
+            System.Text.RegularExpressions.Regex regex11 = new System.Text.RegularExpressions.Regex(@"update", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
383
+            System.Text.RegularExpressions.Regex regex12 = new System.Text.RegularExpressions.Regex(@"delete", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
384
+            html = regex1.Replace(html, ""); //过滤<script></script>标记
385
+            html = regex2.Replace(html, ""); //过滤href=javascript: (<A>) 属性
386
+            html = regex3.Replace(html, " _disibledevent="); //过滤其它控件的on...事件
387
+            html = regex4.Replace(html, ""); //过滤iframe
388
+            html = regex10.Replace(html, "s_elect");
389
+            html = regex11.Replace(html, "u_pudate");
390
+            html = regex12.Replace(html, "d_elete");
391
+            html = html.Replace("'", "’");
392
+            html = html.Replace("&nbsp;", " ");
393
+            return html;
394
+        }
395
+        #endregion
396
+    }
397
+}

+ 2 - 2
RMYY_CallCenter_Api/Common/Common.cs

@@ -16,7 +16,7 @@ namespace RMYY_CallCenter_Api
16 16
         public static List<string> GetAuthActions()
17 17
         {
18 18
             var actions = CacheHelper.Get<List<string>>("AuthActions");
19
-            if (actions != null)
19
+            if (actions != null && actions.Count > 0)
20 20
             {
21 21
                 return actions;
22 22
             }
@@ -36,7 +36,7 @@ namespace RMYY_CallCenter_Api
36 36
         public static List<string> GetRoleActions(int roleId)
37 37
         {
38 38
             var actions = CacheHelper.Get<List<string>>("RoleActions_" + roleId);
39
-            if (actions != null)
39
+            if (actions!=null && actions.Count>0)
40 40
             {
41 41
                 return actions;
42 42
             }

+ 135 - 0
RMYY_CallCenter_Api/Controllers/CallOutOptController.cs

@@ -0,0 +1,135 @@
1
+using RMYY_CallCenter_Api.Utility;
2
+using RMYY_CallCenter_Api.Controllers;
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Linq;
6
+using System.Web;
7
+using System.Web.Mvc;
8
+
9
+namespace RMYY_CallCenter_Api.Controllers
10
+{
11
+    public class CallOutOptController : BaseController
12
+    {
13
+        //外呼判断本地外地以及加前缀返回
14
+        public ActionResult GetCallOutprefix(string phone)
15
+        {
16
+            ActionResult res = NoToken("未知错误,请重新登录");
17
+            if (Request.IsAuthenticated)
18
+            {
19
+                string phone1 = RequestString.ToDBC(RequestString.RemoveNotNumber(WebHelper.NoHtml(phone)));
20
+                string tophone = phone1;
21
+                string zipcode = ""; string bfix = ""; string wfix = ""; string fix = "";
22
+                string userseatgroupid = User.F_SeatGroup.ToString();
23
+                if (userseatgroupid != "" && userseatgroupid != "0")
24
+                {
25
+                    Model.T_Sys_SeatGroup smodel = new Bll.T_Sys_SeatGroup().GetModel(int.Parse(userseatgroupid));
26
+                    if (smodel != null)
27
+                    {
28
+                        zipcode = smodel.F_ZXAtt.Trim();
29
+                        bfix = smodel.F_WHBDKey.Trim();
30
+                        wfix = smodel.F_WHWDKey.Trim();
31
+                    }
32
+                }
33
+                int zip = GetZipCodeByPhone(phone1, zipcode);
34
+                #region 
35
+                if (zip == 1)
36
+                {//手机本地号码
37
+                    fix = bfix;
38
+                }
39
+                else if (zip == 2)
40
+                {//手机外地号码
41
+                    fix = wfix;
42
+                }
43
+                else {
44
+                    tophone = phone1.TrimStart('0');
45
+                    if (zip == 3)
46
+                    {//本地固话去0加9 比如:988888517,937188888517
47
+                        fix = bfix;
48
+                    }
49
+                    else if (zip == 4)
50
+                    {//外地固话前加9 比如:9037188888517
51
+                        fix = wfix;
52
+                    }
53
+                }
54
+                #endregion
55
+                var obj = new
56
+                {
57
+                    phone = fix+tophone,
58
+                    fix = fix
59
+                };
60
+
61
+                res = Success("外呼号码加前缀", obj);
62
+            }
63
+            return res;
64
+        }
65
+
66
+        /// <summary>
67
+        /// 根据号码和区号判断号码是否为归属地号码
68
+        /// 返回0为分机号或特殊号码
69
+        /// 返回1为手机本地号码
70
+        /// 返回2为手机外地号码
71
+        /// 返回3为固定电话本地号码
72
+        /// 返回4为固定电话外地号码
73
+        /// </summary>
74
+        /// <param name="phone"></param>
75
+        /// <param name="zipcode"></param>
76
+        /// <returns></returns>
77
+        [NonAction]
78
+        public int GetZipCodeByPhone(string phone, string zipcode)
79
+        {
80
+            int res = 0;
81
+            if (phone.Trim().Length >= 7)
82
+            {
83
+                //7位及7位以上是固定电话或手机
84
+                //判断是否手机
85
+                if (phone.Trim().Length == 11 && phone[0] == '1')
86
+                {//号码为11位,首位是1,为手机号
87
+                    Bll.T_Sys_MobileData mobile_Bll = new Bll.T_Sys_MobileData();
88
+                    Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModelList("F_MobileNum='"+ phone.Substring(0, 7) + "'").FirstOrDefault();
89
+                    if (mobileModel != null)
90
+                    {
91
+                        if (mobileModel.F_ZipCode.Equals(zipcode))
92
+                        {
93
+                            res = 1;
94
+                        }
95
+                        else
96
+                        {
97
+                            res = 2;
98
+                        }
99
+                    }
100
+                }
101
+                else
102
+                {
103
+                    if (phone.Trim().Length == 11 && phone.Substring(0, 3).Equals(zipcode))
104
+                    {//号码为11位
105
+                        //截取前三位区号判断是否本地
106
+                        bool resbd3 = phone.Substring(0, 3).Equals(zipcode);
107
+                        //截取前四位区号判断是否本地
108
+                        bool resbd4 = phone.Substring(0, 4).Equals(zipcode);
109
+                        if (resbd3 || resbd4)
110
+                        {
111
+                            res = 3;
112
+                        }
113
+                        else
114
+                        {
115
+                            res = 4;
116
+                        }
117
+                    }
118
+                    else if (phone.Trim().Length < 11)
119
+                    {//号码小于11位,为本地
120
+                        res = 3;
121
+                    }
122
+                    else if (phone.Trim().Length > 11 && phone.Substring(0, 4).Equals(zipcode))
123
+                    {//号码大于11位,截取前四位区号判断是否本地
124
+                        res = 3;
125
+                    }
126
+                    else
127
+                    {
128
+                        res = 4;
129
+                    }
130
+                }
131
+            }
132
+            return res;
133
+        }
134
+    }
135
+}

+ 6 - 6
RMYY_CallCenter_Api/Controllers/CallTel/CallblackController.cs

@@ -35,9 +35,9 @@ namespace RMYY_CallCenter_Api.Controllers.CallTel
35 35
 
36 36
             int recordCount = 0;
37 37
             dt = Bll.PagerBll.GetListPager(
38
-                "T_Call_Blacklist with(nolock)",
38
+                "T_Call_Blacklist a with(nolock)",
39 39
                 "F_BlackId",
40
-                "*,dbo.GetUserNameByID(F_UserId) as F_UserName",
40
+                "*,(select F_UserName from T_Sys_UserAccount  where F_UserId=a.F_UserId)as F_UserName",
41 41
                 sql,
42 42
                 "ORDER BY F_BlackId desc",
43 43
                 pagesize,
@@ -67,9 +67,9 @@ namespace RMYY_CallCenter_Api.Controllers.CallTel
67 67
                 {
68 68
                     var sdate = ""; var edate = "";
69 69
                     if (dModel.F_SetTime != null)
70
-                        sdate = dModel.F_SetTime.Value.ToString("yyyy-MM-dd");
70
+                        sdate = dModel.F_SetTime.Value.ToString("yyyy-MM-dd  hh:mm:ss");
71 71
                     if (dModel.F_RemoveTime != null)
72
-                        edate = dModel.F_RemoveTime.Value.ToString("yyyy-MM-dd");
72
+                        edate = dModel.F_RemoveTime.Value.ToString("yyyy-MM-dd  hh:mm:ss");
73 73
                     var obj = new
74 74
                     {
75 75
                         F_BlackId = dModel.F_BlackId,
@@ -79,7 +79,7 @@ namespace RMYY_CallCenter_Api.Controllers.CallTel
79 79
                         F_RemoveTime = edate,
80 80
                         F_Describe = dModel.F_Describe,
81 81
                         F_UserId = dModel.F_UserId,
82
-                        F_CreateTime = dModel.F_CreateTime
82
+                        //F_CreateTime = dModel.F_CreateTime
83 83
                     };
84 84
                     return Success("获取黑名单成功", obj);
85 85
                 }
@@ -96,7 +96,7 @@ namespace RMYY_CallCenter_Api.Controllers.CallTel
96 96
         }
97 97
 
98 98
         //添加黑名单
99
-        public ActionResult AddBlack(int blackid, string telphone, int? type, string settime, string removetime, string des)
99
+        public ActionResult AddBlack(string telphone, int? type, string des, string settime="", string removetime="",  int blackid = 0)
100 100
         {
101 101
             var date = DateTime.Now;
102 102
             if (blackid > 0)

+ 3 - 5
RMYY_CallCenter_Api/Controllers/CallTel/CallrecordsController.cs

@@ -13,7 +13,7 @@ namespace RMYY_CallCenter_Api.Controllers.CallTel
13 13
     public class CallrecordsController : BaseController
14 14
     {
15 15
         //获取通话记录列表
16
-        public ActionResult GetList( string phone, string usercode, string extnumber, string starttime, string endtime, int islike=1, int type=0,int actiontype=0,int calltype=-1, int callstate=-1, int page = 1, int pagesize = 10, int isdc=0)
16
+        public ActionResult GetList( string phone, string usercode, string extnumber="", string starttime="", string endtime="", int islike=1, int type=0,int actiontype=0,int calltype=-1, int callstate=-1, int page = 1, int pagesize = 10, int isdc=0)
17 17
         {
18 18
             string sql = "";
19 19
             DataTable dt = new DataTable();
@@ -138,13 +138,11 @@ namespace RMYY_CallCenter_Api.Controllers.CallTel
138 138
 
139 139
                 return Content(obj.ToJson());
140 140
             }
141
-           
142
-
143 141
 
144 142
         }
145 143
 
146 144
         //获取未接来电
147
-        public ActionResult GetListWJ(string phone, string starttime, string endtime, int ishfSuccess=-1,int ishf=-1,int page = 1, int pagesize = 10)
145
+        public ActionResult GetListWJ(string phone, string starttime="", string endtime="", int ishfSuccess=-1,int ishf=-1,int page = 1, int pagesize = 10)
148 146
         {
149 147
 
150 148
             string sql = "";
@@ -199,7 +197,7 @@ namespace RMYY_CallCenter_Api.Controllers.CallTel
199 197
 
200 198
         //获取转移或三方通话,均为手机号
201 199
         //rep_transfer只有转移的数据
202
-        public ActionResult GetListZY(string phone, string usercode, string starttime, string endtime, int callstate = -1, int page = 1, int pagesize = 10)
200
+        public ActionResult GetListZY(string phone, string usercode, string starttime="", string endtime="", int callstate = -1, int page = 1, int pagesize = 10)
203 201
         {
204 202
             string sql = "";
205 203
             DataTable dt = new DataTable();

+ 33 - 22
RMYY_CallCenter_Api/Controllers/IndexController.cs

@@ -20,6 +20,11 @@ namespace RMYY_CallCenter_Api.Controllers
20 20
         {
21 21
             var Role = new Bll.T_Sys_Role().GetModel(User.F_RoleId);
22 22
             var Dept = new Bll.T_Sys_Department().GetModel(User.F_DeptId);
23
+            if (!string.IsNullOrEmpty(User.F_SeatGroup.ToString()))
24
+            {
25
+                User.F_ZXZCode = new Bll.T_Sys_SeatGroup().GetModel((int)User.F_SeatGroup).F_ZXZCode;
26
+            }
27
+            else User.F_ZXZCode = "";
23 28
             return Success("成功", new { User, Role, Dept });
24 29
         }
25 30
         /// <summary>
@@ -36,43 +41,49 @@ namespace RMYY_CallCenter_Api.Controllers
36 41
             }
37 42
             else
38 43
             {
39
-                if (User.F_UserCode == "8000")
40
-                {
41
-                    dt = DB.DbHelperSQL.Query("select * FROM T_Sys_Menu m with(nolock) where F_State=1 ").Tables[0];
42
-                }
43
-                else
44
-                {
45
-                    dt = DB.DbHelperSQL.Query("select m.* FROM T_Sys_RoleMenu rm with(nolock) left join T_Sys_Menu m with(nolock) on rm.F_MenuId=m.F_MenuId where m.F_State=1 and rm.F_RoleId=" + User.F_RoleId + " and isnull(m.F_Action,'')!='' ").Tables[0];
46
-                }
44
+                //if (User.F_UserCode == "8000")
45
+                //{
46
+                //    dt = DB.DbHelperSQL.Query("select * FROM T_Sys_Menu m with(nolock) where F_State=1 ").Tables[0];
47
+                //}
48
+                //else
49
+                //{
50
+                    dt = DB.DbHelperSQL.Query("select m.* FROM T_Sys_RoleMenu rm with(nolock) left join T_Sys_Menu m with(nolock) on rm.F_MenuId=m.F_MenuId where m.F_State=1 and rm.F_RoleId=" + User.F_RoleId + "").Tables[0];
51
+                //}
47 52
 
48 53
                 CacheHelper.Insert("RoleMenus_" + User.F_RoleId, dt, 10);              
49 54
               
50 55
             }
51 56
             List<Model.T_Sys_Menu> moduleInfoList = menbll.DataTableToList(dt);
52
-            moduleInfoList.Sort((x, y) => x.F_Sort ?? 0 - y.F_Sort ?? 0);
53
-            return Success("获取符合权限的菜单", TreeRecursion(moduleInfoList));
57
+            List<Model.T_Sys_Menu> newmodelList = moduleInfoList.Where(p => p.F_ParentId == 0).OrderBy(p => p.F_Sort).ToList();
58
+            foreach (var item in newmodelList)
59
+            {
60
+                item.children = TreeRecursion(moduleInfoList, item.F_MenuId.ToString());
61
+            }
62
+            //moduleInfoList.Sort((x, y) => x.F_Sort ?? 0 - y.F_Sort ?? 0);
63
+            return Success("获取符合权限的菜单", newmodelList);
54 64
         }
55 65
 
56 66
 
57 67
         private List<Model.T_Sys_Menu> TreeRecursion(List<Model.T_Sys_Menu> data, string parentId = "0")
58 68
         {
59 69
             List<Model.T_Sys_Menu> newList = new List<Model.T_Sys_Menu>();
60
-            List<Model.T_Sys_Menu> item = data.FindAll(t => t.F_ParentId.ToString() == parentId);//data建议在调用此扩展方法前已经排序过
61
-            if (item.Count > 0)
62
-            {
63
-                foreach (Model.T_Sys_Menu entity in item)
70
+
71
+                List<Model.T_Sys_Menu> item = data.FindAll(t => t.F_ParentId.ToString() == parentId).OrderBy(p => p.F_Sort).ToList();//data建议在调用此扩展方法前已经排序过
72
+                if (item.Count > 0)
64 73
                 {
65
-                    if (entity.F_Type == 2)
74
+                    foreach (Model.T_Sys_Menu entity in item)
66 75
                     {
67
-                        entity.button = TreeRecursion(data, entity.F_MenuId.ToString());
76
+                        if (entity.F_Type == 2)
77
+                        {
78
+                            entity.button = TreeRecursion(data, entity.F_MenuId.ToString());
79
+                        }
80
+                        else if (entity.F_Type == 1)
81
+                        {
82
+                            entity.children = TreeRecursion(data, entity.F_MenuId.ToString());
83
+                        }
84
+                        newList.Add(entity);
68 85
                     }
69
-                    else if (entity.F_Type == 1)
70
-                    {
71
-                        entity.children = TreeRecursion(data, entity.F_MenuId.ToString());
72
-                    }
73
-                    newList.Add(entity);
74 86
                 }
75
-            }
76 87
 
77 88
             return newList;
78 89
         }

+ 8 - 2
RMYY_CallCenter_Api/Controllers/System/CustomerController.cs

@@ -90,7 +90,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
90 90
         /// 添加/修改客户信息
91 91
         /// </summary>
92 92
         /// <returns></returns>
93
-        public ActionResult AddCustomer(string name, string mobile, string telphone, string fax, string postcode, string email, string sex, string province, string city, string county,int id=0)
93
+        public ActionResult AddCustomer(string name, string mobile, string telphone, string fax, string postcode, string email, string sex, string province, string city, string county,string code,int layer,string adddress, int id =0)
94 94
         {
95 95
 
96 96
             #region 验证
@@ -114,6 +114,9 @@ namespace RMYY_CallCenter_Api.Controllers.System
114 114
                 model.F_City = city;//市
115 115
                 model.F_County = county;    //区
116 116
                 model.F_Sex = sex;                  //性别
117
+                model.F_CustomerCode = code;//客户编码
118
+                model.F_Layer = layer;//级别
119
+                model.F_Address = adddress;//地址
117 120
 
118 121
                 model.F_CreateBy = User.F_UserCode;          //创建人
119 122
                 model.F_CreatedOn = DateTime.Now;   //创建时间
@@ -143,6 +146,9 @@ namespace RMYY_CallCenter_Api.Controllers.System
143 146
                     model.F_City = city;//市
144 147
                     model.F_County = county;    //区
145 148
                     model.F_Sex = sex;                  //性别
149
+                    model.F_CustomerCode = code;//客户编码
150
+                    model.F_Layer = layer;//级别
151
+                    model.F_Address = adddress;//地址
146 152
                     model.F_ModifiedOn = DateTime.Now;
147 153
                     model.F_ModifyBy = User.F_UserCode;
148 154
                     if (bll.Update(model))
@@ -178,7 +184,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
178 184
                 }
179 185
                 //string state = RequestString.GetQueryString("state");
180 186
 
181
-                string sql = "update T_Cus_CustomerBase set F_DeleteFlag=1,F_DeleteOn=getdate(),F_DeleteBy='" + User.F_UserCode + "' where F_CustomerId in(" + idd.TrimEnd(',') + ")";
187
+                string sql = "update T_Cus_Customer set F_DeleteFlag=1,F_DeleteOn=getdate(),F_DeleteBy='" + User.F_UserCode + "' where F_CustomerId in(" + idd.TrimEnd(',') + ")";
182 188
 
183 189
                 if (DB.DbHelperSQL.ExecuteSql(sql) > 0)
184 190
                 {

+ 1 - 1
RMYY_CallCenter_Api/Controllers/System/DepartmentController.cs

@@ -67,7 +67,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
67 67
             var dptmodel = departmentBLL.GetModelList(" F_State=1");
68 68
             dptmodel.Sort((x, y) => x.F_Sort ?? 0 - y.F_Sort ?? 0);//排序
69 69
             var treeList = new List<TreeModel>();
70
-            foreach (var item in dptmodel)
70
+            foreach (var item in dptmodel.Where(p =>p.F_ParentId == 0).ToList())
71 71
             {
72 72
                 TreeModel treeModel = new TreeModel();
73 73
                 treeModel.id = item.F_DeptId.ToString();

+ 12 - 7
RMYY_CallCenter_Api/Controllers/System/SeatGroupController.cs

@@ -16,16 +16,21 @@ namespace RMYY_CallCenter_Api.Controllers.System
16 16
         /// 获取坐席组列表
17 17
         /// </summary>
18 18
         /// <returns></returns>
19
-        public ActionResult GetList(int page = 1, int pagesize = 10)
19
+        public ActionResult GetList(string keyword, int page = 1, int pagesize = 10)
20 20
         {
21 21
             DataTable dt = new DataTable();
22
+            string sql = "";
23
+            if (!string.IsNullOrEmpty(keyword))
24
+            {
25
+                sql += $"and (F_ZXZCode like '%" + keyword.Trim() + "%' or F_ZXZName like '%" + keyword.Trim() + "%' or F_ZXAtt like '%" + keyword.Trim() + "%')";
26
+            }
22 27
             int recordCount = 0;
23 28
             dt = Bll.PagerBll.GetListPager(
24 29
                 "T_Sys_SeatGroup",
25
-                "F_ZXZID",
30
+                "F_ID",
26 31
                 "*",
27
-                "",
28
-                "ORDER BY F_ZXZID desc",
32
+                sql,
33
+                "ORDER BY F_ID desc",
29 34
                 pagesize,
30 35
                 page,
31 36
                 true,
@@ -46,7 +51,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
46 51
             ActionResult res = NoToken("未知错误,请重新登录");
47 52
             if (Request.IsAuthenticated)
48 53
             {
49
-                List<Model.T_Sys_SeatGroup> seatList = seatBLL.GetModelList(" 1=1 order by F_ZXZID desc ");
54
+                List<Model.T_Sys_SeatGroup> seatList = seatBLL.GetModelList(" 1=1 order by F_ID desc ");
50 55
                 if (seatList.Count > 0)
51 56
                     res = Success("坐席组列表加载成功", seatList);
52 57
                 else
@@ -98,7 +103,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
98 103
                 sModel.F_Des = Des.Trim();
99 104
 
100 105
             sModel.F_CreateTime = DateTime.Now;
101
-            sModel.F_CreateUser = User.F_CreateUser;
106
+            sModel.F_CreateUser = User.F_UserCode;
102 107
 
103 108
             if (seatBLL.Add(sModel) > 0)
104 109
                 return Success("添加成功");
@@ -120,7 +125,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
120 125
             if (sModel == null)
121 126
                 return Error("获取信息失败");
122 127
 
123
-            int n = seatBLL.GetRecordCount(" ZXZID!='" + ZXZID + "' and (F_ZXZCode='" + ZXZCode + "' or F_ZXZName='" + ZXZName + "')");
128
+            int n = seatBLL.GetRecordCount(" F_ID!='" + ZXZID + "' and (F_ZXZCode='" + ZXZCode + "' or F_ZXZName='" + ZXZName + "')");
124 129
             if (Int32.Parse(n.ToString()) > 0)
125 130
             {
126 131
                 return Error("坐席组编号和名称必须唯一,请重新输入!");

+ 30 - 3
RMYY_CallCenter_Api/Controllers/System/UserAccountController.cs

@@ -42,7 +42,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
42 42
             dt = Bll.PagerBll.GetListPager(
43 43
                                     "T_Sys_UserAccount a with(nolock)",
44 44
                                     "F_UserId",
45
-                                    "*,(select F_DeptName from T_Sys_Department  where F_DeptId=a.F_DeptId)as F_DeptName,(select F_RoleName from T_Sys_Role where F_RoleId=a.F_RoleId)as F_RoleName",
45
+                                    "*,(select F_DeptName from T_Sys_Department  where F_DeptId=a.F_DeptId)as F_DeptName,(select F_RoleName from T_Sys_Role where F_RoleId=a.F_RoleId)as F_RoleName,(select F_ZXZName from T_Sys_SeatGroup  where F_ID=a.F_SeatGroup)as F_SeatGroupName",
46 46
                                     sql,
47 47
                                     "ORDER BY F_UserId desc",
48 48
                                     pagesize,
@@ -66,7 +66,7 @@ namespace RMYY_CallCenter_Api.Controllers.System
66 66
         /// <returns></returns>
67 67
         public ActionResult GetModel(int userid = 0, string usercode = "")
68 68
         {
69
-            string sql = " 1=1 ";
69
+            string sql = " 1=1 ";        
70 70
             if (userid > 0)
71 71
             {
72 72
                 sql += " and F_UserId=" + userid;
@@ -79,6 +79,11 @@ namespace RMYY_CallCenter_Api.Controllers.System
79 79
                 return Error("获取失败");
80 80
 
81 81
             Model.T_Sys_UserAccount ua = new Bll.T_Sys_UserAccount().GetModelList(sql).FirstOrDefault();
82
+            if (ua != null)
83
+            {
84
+              var dptmodel = new Bll.T_Sys_Department().GetModel(ua.F_DeptId);
85
+              ua.F_DeptName = dptmodel.F_DeptName;
86
+            }
82 87
             if (ua == null)
83 88
                 return Error("不存在此用户信息!");
84 89
             return Success("获取成功", ua);
@@ -99,7 +104,6 @@ namespace RMYY_CallCenter_Api.Controllers.System
99 104
             }
100 105
             umodel.F_UserCode = Usercode.Trim();
101 106
             umodel.F_UserName = Username.Trim();
102
-            umodel.F_Password = Password.Trim();
103 107
             umodel.F_ExtensionNumber = Extno.Trim();
104 108
             umodel.F_DeptId = DeptId;
105 109
             umodel.F_RoleId = RoleId;
@@ -167,6 +171,29 @@ namespace RMYY_CallCenter_Api.Controllers.System
167 171
             return Error("请重新登陆!");
168 172
         }
169 173
 
174
+        /// <summary>
175
+        /// 重置密码
176
+        /// </summary>
177
+        /// <param name="usercode"></param>
178
+        /// <param name="pwd"></param>
179
+        /// <returns></returns>
180
+        public ActionResult ResetPwd(string usercode = "", string pwd = "")
181
+        {
182
+            if (Request.IsAuthenticated)
183
+            {
184
+                if (string.IsNullOrEmpty(pwd))
185
+                    return Error("请输入密码");
186
+                var model = userbll.GetModel(usercode);
187
+                if (model == null) return Error("此用户不存在");
188
+                model.F_Password = pwd;
189
+                if (userbll.Update(model))
190
+                    return Success("重置密码成功");
191
+                else
192
+                    return Error("重置密码失败");
193
+            }
194
+            return NoToken("未知错误,请重新登录");
195
+        }
196
+
170 197
 
171 198
     }
172 199
 }

+ 51 - 51
RMYY_CallCenter_Api/Controllers/WorkOrder/Con_WorkOrderController.cs

@@ -130,58 +130,58 @@ namespace RMYY_CallCenter_Api.Controllers
130 130
             return Error("无操作权限!");
131 131
         }
132 132
 
133
-        private List<ItemListLog> ItemList(List<Model.T_Con_WorkOrderItem> list)
134
-        {
135
-            List<ItemListLog> Modellist = new List<ItemListLog>();
136
-            foreach (var it in list)
137
-            {
138
-                ItemListLog log = new ItemListLog();
139
-                log.F_ID = it.F_ID;
140
-                if (it.F_WoID > 0)
141
-                {
142
-                    if (orderbll.GetModel((int)it.F_WoID) != null)
143
-                    {
144
-                        log.F_WoID = orderbll.GetModel((int)it.F_WoID).F_WorkOrderCode;
145
-                    }
146
-                }
147
-                log.F_WoState = it.F_WoState;
148
-                log.F_ItemType = it.F_ItemType;
149
-                log.F_OptContent = it.F_OptContent;
150
-                log.F_IsUsed = it.F_IsUsed;
151
-                log.F_LimitTime = it.F_LimitTime;
152
-                log.F_IsSMS = it.F_IsSMS;
153
-                log.F_SMSContent = it.F_SMSContent;
154
-                log.F_SMSToUser = it.F_SMSToUser;
155
-                log.F_SMSToPhone = it.F_SMSToPhone;
156
-                log.F_CreateTime = it.F_CreateTime;
157
-                string username = "";
158
-                if (!string.IsNullOrEmpty(it.F_CreateUser))
159
-                {
160
-                    if (userbll.GetModel(it.F_CreateUser) != null)
161
-                    {
162
-                        username = userbll.GetModel(it.F_CreateUser).F_UserName;
163
-                        log.F_CreateUser = it.F_CreateUser + "(" + username + ")";
164
-                    }
165
-                }
166
-                if (!string.IsNullOrEmpty(it.F_NextUser))
167
-                {
168
-                    if (userbll.GetModel(it.F_NextUser) != null)
169
-                    {
170
-                        log.F_NextUser = it.F_NextUser + "(" + userbll.GetModel(it.F_NextUser).F_UserName + ")";
171
-                    }
172
-                }
173
-                if (it.F_NextDept > 0)
174
-                {
175
-                    if (deptbll.GetModel(int.Parse(it.F_NextDept.ToString())) != null)
176
-                    {
177
-                        log.F_NextDept = deptbll.GetModel(int.Parse(it.F_NextDept.ToString())).F_DeptName;
178
-                    }
133
+        //private List<ItemListLog> ItemList(List<Model.T_Con_WorkOrderItem> list)
134
+        //{
135
+        //    List<ItemListLog> Modellist = new List<ItemListLog>();
136
+        //    foreach (var it in list)
137
+        //    {
138
+        //        ItemListLog log = new ItemListLog();
139
+        //        log.F_ID = it.F_ID;
140
+        //        if (it.F_WoID > 0)
141
+        //        {
142
+        //            if (orderbll.GetModel((int)it.F_WoID) != null)
143
+        //            {
144
+        //                log.F_WoID = orderbll.GetModel((int)it.F_WoID).F_WorkOrderCode;
145
+        //            }
146
+        //        }
147
+        //        log.F_WoState = it.F_WoState;
148
+        //        log.F_ItemType = it.F_ItemType;
149
+        //        log.F_OptContent = it.F_OptContent;
150
+        //        log.F_IsUsed = it.F_IsUsed;
151
+        //        log.F_LimitTime = it.F_LimitTime;
152
+        //        log.F_IsSMS = it.F_IsSMS;
153
+        //        log.F_SMSContent = it.F_SMSContent;
154
+        //        log.F_SMSToUser = it.F_SMSToUser;
155
+        //        log.F_SMSToPhone = it.F_SMSToPhone;
156
+        //        log.F_CreateTime = it.F_CreateTime;
157
+        //        string username = "";
158
+        //        if (!string.IsNullOrEmpty(it.F_CreateUser))
159
+        //        {
160
+        //            if (userbll.GetModel(it.F_CreateUser) != null)
161
+        //            {
162
+        //                username = userbll.GetModel(it.F_CreateUser).F_UserName;
163
+        //                log.F_CreateUser = it.F_CreateUser + "(" + username + ")";
164
+        //            }
165
+        //        }
166
+        //        if (!string.IsNullOrEmpty(it.F_NextUser))
167
+        //        {
168
+        //            if (userbll.GetModel(it.F_NextUser) != null)
169
+        //            {
170
+        //                log.F_NextUser = it.F_NextUser + "(" + userbll.GetModel(it.F_NextUser).F_UserName + ")";
171
+        //            }
172
+        //        }
173
+        //        if (it.F_NextDept > 0)
174
+        //        {
175
+        //            if (deptbll.GetModel(int.Parse(it.F_NextDept.ToString())) != null)
176
+        //            {
177
+        //                log.F_NextDept = deptbll.GetModel(int.Parse(it.F_NextDept.ToString())).F_DeptName;
178
+        //            }
179 179
 
180
-                }
181
-                Modellist.Add(log);
182
-            }
183
-            return Modellist;
184
-        }
180
+        //        }
181
+        //        Modellist.Add(log);
182
+        //    }
183
+        //    return Modellist;
184
+        //}
185 185
 
186 186
         /// <summary>
187 187
         /// 查询工单记录列表

+ 2 - 1
RMYY_CallCenter_Api/Filter/AuthorizeFilter.cs

@@ -49,7 +49,8 @@ namespace RMYY_CallCenter_Api.Filter
49 49
                             if (user != null && user.F_RoleId.ToString() == userData["F_RoleId"])
50 50
                             {
51 51
                                 string action = ad.ControllerDescriptor.ControllerName + "/" + ad.ActionName;
52
-                                if ((Common.GetAuthActions().Contains(action.ToLower()) && Common.GetRoleActions(user.F_RoleId).Contains(action.ToLower()))|| user.F_UserCode == "8000")
52
+                                bool actionauth = Common.GetAuthActions().Contains(action.ToLower());
53
+                                if ((actionauth && Common.GetRoleActions(user.F_RoleId).Contains(action.ToLower()))|| !actionauth)
53 54
                                 {
54 55
                                     isAuth = true;
55 56
                                     context.User = new FormsPrincipal<Model.T_Sys_UserAccount>(ticket, user);//重新给context.User赋值。

+ 1 - 0
RMYY_CallCenter_Api/RMYY_CallCenter_Api.csproj

@@ -122,6 +122,7 @@
122 122
     <Compile Include="Common\Common.cs" />
123 123
     <Compile Include="Common\ListBase.cs" />
124 124
     <Compile Include="Controllers\BaseController.cs" />
125
+    <Compile Include="Controllers\CallOutOptController.cs" />
125 126
     <Compile Include="Controllers\CallTel\CallblackController.cs" />
126 127
     <Compile Include="Controllers\CallTel\CallInScreenController.cs" />
127 128
     <Compile Include="Controllers\CallTel\CallleaveController.cs" />