|
|
@@ -6,6 +6,7 @@ using CallCenter.Utility;
|
|
6
|
6
|
using System.Text.RegularExpressions;
|
|
7
|
7
|
using System.Net;
|
|
8
|
8
|
using System.IO;
|
|
|
9
|
+using System.Collections.Generic;
|
|
9
|
10
|
|
|
10
|
11
|
namespace CallCenterApi.Common
|
|
11
|
12
|
{
|
|
|
@@ -299,5 +300,43 @@ namespace CallCenterApi.Common
|
|
299
|
300
|
string signcode = EncryptHelper.MD5Encrypt(controller.ToLower() + "/" + action.ToLower() + "+" + EncryptHelper.SHA1Encrypt(sign + "+" + DateTime.Now.ToString("yyyyMMdd")));
|
|
300
|
301
|
return signcode;
|
|
301
|
302
|
}
|
|
|
303
|
+
|
|
|
304
|
+ /// <summary>
|
|
|
305
|
+ /// 写日志
|
|
|
306
|
+ /// </summary>
|
|
|
307
|
+ /// <param name="request"></param>
|
|
|
308
|
+ /// <returns></returns>
|
|
|
309
|
+ public static string RequestLog(HttpRequestBase request)
|
|
|
310
|
+ {
|
|
|
311
|
+ Dictionary<string, string> Params = new Dictionary<string, string>();
|
|
|
312
|
+ Params.Add("request_url", request.Url.ToString());
|
|
|
313
|
+
|
|
|
314
|
+ if (request.HttpMethod.ToUpper() != "GET")
|
|
|
315
|
+ {
|
|
|
316
|
+ foreach (var key in request.Params.AllKeys)
|
|
|
317
|
+ {
|
|
|
318
|
+ if (key == "ALL_HTTP")
|
|
|
319
|
+ {
|
|
|
320
|
+ break;
|
|
|
321
|
+ }
|
|
|
322
|
+ Params.Add(key, request.Params[key]);
|
|
|
323
|
+ }
|
|
|
324
|
+ }
|
|
|
325
|
+
|
|
|
326
|
+ if (request.ContentLength > 0)
|
|
|
327
|
+ {
|
|
|
328
|
+ request.InputStream.Position = 0;
|
|
|
329
|
+ StreamReader reader = new StreamReader(request.InputStream);
|
|
|
330
|
+ string postString = reader.ReadToEnd();
|
|
|
331
|
+ //上传文件时截取
|
|
|
332
|
+ if (postString.IndexOf("\r\n\r\n") > 0)
|
|
|
333
|
+ {
|
|
|
334
|
+ postString = postString.Substring(0, postString.IndexOf("\r\n\r\n"));
|
|
|
335
|
+ }
|
|
|
336
|
+ Params.Add("InputStream", postString);
|
|
|
337
|
+ }
|
|
|
338
|
+
|
|
|
339
|
+ return Params.ToJson();
|
|
|
340
|
+ }
|
|
302
|
341
|
}
|
|
303
|
342
|
}
|