Ver Código Fonte

新增对外网点接口

zhoufan 7 anos atrás
pai
commit
21c338f06f

+ 37 - 0
CallCenterApi.Interface/App_Start/OutActionFilter.cs

@@ -0,0 +1,37 @@
1
+using CallCenterApi.Common;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Linq;
5
+using System.Web;
6
+using System.Web.Mvc;
7
+
8
+namespace CallCenterApi.Interface.App_Start
9
+{
10
+    public class OutActionFilter : ActionFilterAttribute
11
+    {
12
+        public override void OnActionExecuting(ActionExecutingContext filterContext)
13
+        {
14
+            var sign = filterContext.HttpContext.Request["signcode"];
15
+            bool bl = true;
16
+            if (sign != null)
17
+            {
18
+                string insigncode = sign.ToString();
19
+                string outsigncode = Configs.GetValue("OutSignCode");
20
+                string controllercode = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToLower();
21
+                string actioncode = filterContext.ActionDescriptor.ActionName.ToLower();
22
+                string signcode = EncryptHelper.MD5Encrypt(controllercode + "/" + actioncode + "+" + EncryptHelper.SHA1Encrypt(outsigncode + "+" + DateTime.Now.ToString("yyyyMMdd")));
23
+                if (insigncode == signcode)
24
+                {
25
+                    bl = false;
26
+                }
27
+            }
28
+            if (bl)
29
+            {
30
+                filterContext.Result = new ContentResult() { Content = new AjaxResult { state = ResultTypes.error.ToString(), message = "签名错误" }.ToJson() };
31
+                return;
32
+            }
33
+
34
+            base.OnActionExecuting(filterContext);
35
+        }
36
+    }
37
+}

+ 1 - 0
CallCenterApi.Interface/CallCenterApi.Interface.csproj

@@ -97,6 +97,7 @@
97 97
     <Compile Include="App_Start\AuthorizeAttribute.cs" />
98 98
     <Compile Include="App_Start\FilterConfig.cs" />
99 99
     <Compile Include="App_Start\ErrorAttribute.cs" />
100
+    <Compile Include="App_Start\OutActionFilter.cs" />
100 101
     <Compile Include="App_Start\RouteConfig.cs" />
101 102
     <Compile Include="Controllers\Base\BaseController.cs" />
102 103
     <Compile Include="Controllers\County\CountyBranchController.cs" />

+ 2 - 1
CallCenterApi.Interface/Configs/system.config

@@ -12,5 +12,6 @@
12 12
   <!-- ================== 2:Redis配置 ================== -->
13 13
   <add key="Redis_Server" value="192.168.4.18"/>
14 14
   <add key="Redis_Port" value="6379"/>
15
-
15
+  <!-- ================== 3:验证码code ================== -->
16
+  <add key="OutSignCode" value="#SQS@Platform*12345$hykj#"/>
16 17
 </appSettings>

+ 42 - 1
CallCenterApi.Interface/Controllers/County/CountyBranchController.cs

@@ -1,5 +1,6 @@
1 1
 using CallCenterApi.Common;
2 2
 using CallCenterApi.DB;
3
+using CallCenterApi.Interface.App_Start;
3 4
 using CallCenterApi.Interface.Controllers.Base;
4 5
 using System;
5 6
 using System.Collections.Generic;
@@ -14,12 +15,52 @@ namespace CallCenterApi.Interface.Controllers.County
14 15
     {
15 16
         // GET: CountyBranch
16 17
 
17
-
18 18
         private BLL.T_Branch_List branchBLL = new BLL.T_Branch_List();
19 19
 
20 20
         #region 网点
21 21
 
22 22
         /// <summary>
23
+        /// 获取所有网点
24
+        /// </summary>
25
+        /// <returns></returns>
26
+        [OutActionFilter]
27
+        public ActionResult GetCityList(string code,string name)
28
+        {
29
+            string sql = " F_IsDelete=0 ";
30
+
31
+            if (!string.IsNullOrEmpty(code))
32
+            {
33
+                sql += " and F_Code like '%" + code + "%' ";
34
+            }
35
+            if (!string.IsNullOrEmpty(name))
36
+            {
37
+                sql += " and F_Name like '%" + name + "%' ";
38
+            }
39
+            DataTable dt = branchBLL.GetList(sql).Tables[0];
40
+
41
+            return Success("成功", dt);
42
+        }
43
+
44
+        /// <summary>
45
+        /// 获取详情
46
+        /// </summary>
47
+        /// <param name="code"></param>
48
+        /// <returns></returns>
49
+        [OutActionFilter]
50
+        public ActionResult GetCityDetail(string code)
51
+        {
52
+            string sql = " F_IsDelete=0 ";
53
+
54
+            if (!string.IsNullOrEmpty(code))
55
+            {
56
+                sql += " and F_Code = '" + code + "' ";
57
+            }
58
+            var model = branchBLL.GetModelList(sql).FirstOrDefault();
59
+
60
+            return Success("成功", model);
61
+        }
62
+
63
+        /// <summary>
23 64
         /// 获取网点列表
24 65
         /// </summary>
25 66
         /// <returns></returns>