Przeglądaj źródła

地区类别接口优化

lihai 6 lat temu
rodzic
commit
0725543ed6

+ 80 - 15
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/RegionCategoryController.cs

@@ -247,6 +247,72 @@ namespace CallCenterApi.Interface.Controllers.customer
247 247
         
248 248
         }
249 249
 
250
+        #region 获取地市列表 - 优化前的
251
+        ///// <summary>
252
+        ///// 获取地市列表
253
+        ///// </summary>
254
+        ///// <returns></returns>
255
+        //public ActionResult GetRegionList(int pId = 0)
256
+        //{
257
+        //    if (Request.IsAuthenticated)
258
+        //    {
259
+        //        DataTable dt = new DataTable();
260
+        //        dt = new BLL.T_RegionCategory().GetList(" F_DeleteFlag=0 and F_ParentId=" + pId).Tables[0];
261
+        //        List<Model.TreeModel> modelList = BindTree(dt, "0");
262
+
263
+        //        if (modelList != null)
264
+        //        {
265
+        //            if (modelList.Count > 0)
266
+        //                return Success("加载成功", modelList);
267
+        //        }
268
+        //        return Error("加载失败");
269
+        //    }
270
+        //    return NoToken("未知错误,请重新登录");
271
+        //}
272
+        ///// <summary>
273
+        ///// tree  树形地市
274
+        ///// </summary>
275
+        ///// <param name="tab"></param>
276
+        ///// <param name="parentid"></param>
277
+        ///// <returns></returns>
278
+        //private List<Model.TreeModel> BindTree(DataTable tab, string parentid)
279
+        //{
280
+        //    DataTable tab2 = new DataTable();
281
+
282
+        //    if (tab != null && tab.Rows.Count > 0)
283
+        //    {
284
+        //        List<Model.T_RegionCategory> categorylist = new BLL.T_RegionCategory().DataTableToList(tab);
285
+        //        List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
286
+        //        for (int i = 0; i < categorylist.Count; i++)
287
+        //        {
288
+        //            Model.TreeModel model = new Model.TreeModel();
289
+        //            string currentID = categorylist[i].F_RegionId.ToString();//当前功能ID
290
+        //            model.id = currentID;
291
+        //            model.IconCls = "";//图标
292
+        //            model.headerid =int .Parse ( categorylist[i].F_Layer.ToString ());
293
+        //            model.text = categorylist[i].F_RegionName;
294
+        //            tab2 = new BLL.T_RegionCategory().GetList("F_ParentId=" + currentID + " and F_DeleteFlag=0 order by f_sort").Tables[0];
295
+        //            if (tab2 != null && tab2.Rows.Count > 0)
296
+        //            {
297
+        //                model.children = BindTree(tab2, currentID);
298
+        //            }
299
+        //            modelList.Add(model);
300
+        //        }
301
+        //        return modelList;
302
+
303
+        //    }
304
+        //    else
305
+        //    {
306
+        //        return null;
307
+        //    }
308
+
309
+        //}
310
+
311
+        #endregion
312
+
313
+
314
+        public List<T_RegionCategory> list = null;
315
+        #region 获取地市列表 - 优化后的
250 316
         /// <summary>
251 317
         /// 获取地市列表
252 318
         /// </summary>
@@ -255,9 +321,9 @@ namespace CallCenterApi.Interface.Controllers.customer
255 321
         {
256 322
             if (Request.IsAuthenticated)
257 323
             {
258
-                DataTable dt = new DataTable();
259
-                dt = new BLL.T_RegionCategory().GetList(" F_DeleteFlag=0 and F_ParentId=" + pId).Tables[0];
260
-                List<Model.TreeModel> modelList = BindTree(dt, "0");
324
+                list = new BLL.T_RegionCategory().GetModelList(" F_DeleteFlag=0 ");
325
+                var list_p = list.Where(x => x.F_ParentId == pId).ToList();
326
+                List<Model.TreeModel> modelList = BindTree(list_p, "0");
261 327
 
262 328
                 if (modelList != null)
263 329
                 {
@@ -274,24 +340,22 @@ namespace CallCenterApi.Interface.Controllers.customer
274 340
         /// <param name="tab"></param>
275 341
         /// <param name="parentid"></param>
276 342
         /// <returns></returns>
277
-        private List<Model.TreeModel> BindTree(DataTable tab, string parentid)
343
+        private List<Model.TreeModel> BindTree(List<T_RegionCategory> tab, string parentid)
278 344
         {
279
-            DataTable tab2 = new DataTable();
280
-
281
-            if (tab != null && tab.Rows.Count > 0)
345
+            if (tab.Count > 0)
282 346
             {
283
-                List<Model.T_RegionCategory> categorylist = new BLL.T_RegionCategory().DataTableToList(tab);
284
-                List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
285
-                for (int i = 0; i < categorylist.Count; i++)
347
+                List<Model.TreeModel> modelList = new List<Model.TreeModel>(tab.Count);
348
+                for (int i = 0; i < tab.Count; i++)
286 349
                 {
287 350
                     Model.TreeModel model = new Model.TreeModel();
288
-                    string currentID = categorylist[i].F_RegionId.ToString();//当前功能ID
351
+                    int F_RegionId = tab[i].F_RegionId;
352
+                    string currentID = tab[i].F_RegionId.ToString();//当前功能ID
289 353
                     model.id = currentID;
290 354
                     model.IconCls = "";//图标
291
-                    model.headerid =int .Parse ( categorylist[i].F_Layer.ToString ());
292
-                    model.text = categorylist[i].F_RegionName;
293
-                    tab2 = new BLL.T_RegionCategory().GetList("F_ParentId=" + currentID + " and F_DeleteFlag=0 order by f_sort").Tables[0];
294
-                    if (tab2 != null && tab2.Rows.Count > 0)
355
+                    model.headerid = int.Parse(tab[i].F_Layer.ToString());
356
+                    model.text = tab[i].F_RegionName;
357
+                    var tab2 = list.Where(x => x.F_ParentId == F_RegionId).OrderByDescending(x=>x.F_Sort).ToList();
358
+                    if (tab2.Count > 0)
295 359
                     {
296 360
                         model.children = BindTree(tab2, currentID);
297 361
                     }
@@ -306,5 +370,6 @@ namespace CallCenterApi.Interface.Controllers.customer
306 370
             }
307 371
 
308 372
         }
373
+        #endregion
309 374
     }
310 375
 }

BIN
文档/接口文档/382_3776_cn.pdf


+ 14 - 0
文档/接口文档/readme.txt

@@ -0,0 +1,14 @@
1
+
2
+这是腾讯云短信API接口说明
3
+
4
+腾讯云API秘钥:
5
+secretId:AKIDQ1j9T9R13utkRfhlZzGSXUIpEfiiNCh5
6
+secretKey:2koocL2d7NTOq6AQrK0VLMCyfJlkbJk0
7
+
8
+
9
+
10
+https://cloud.tencent.com/document/product/382/13297
11
+
12
+SDK APPID: 1400238721  
13
+
14
+App Key : 2b2094bcaf2c841fdb50bcaebabf6f54