duhongyu 5 lat temu
rodzic
commit
99fe0a7afd

+ 26 - 55
代码/TVShoppingCallCenter_ZLJ/Controllers/IndexCategory/IndexBaseController.cs

212
                 return Content(obj.ToJson());
212
                 return Content(obj.ToJson());
213
             }
213
             }
214
         }
214
         }
215
-        private string Category(int? CategoryId,int type,  string key="")
216
-        {
217
-            var model = _qc_indexcategoryreposytory.GetSingle(x => x.F_CategoryId == CategoryId).Result;
218
-            if (model != null)
219
-            {
220
-                if (key == "")
221
-                {
222
-                    if (type == 0)
223
-                    {
224
-                        key = CategoryId + "";
225
-                        if (model .F_ParentId >0)
226
-                        {
227
-                            key +=","+ Category((int )model.F_ParentId, 0, key);
228
-                        }
229
-                    }
230
-                    else
231
-                    {
232
-                        key = model.F_CategoryName ;
233
-                        if (model.F_ParentId > 0)
234
-                        {
235
-                            key += "," + Category((int)model.F_ParentId, 1, key);
236
-                        }
237
-                    }
238
-                }
239
-                else
240
-                {
241
-                    if (type == 0)
242
-                    {
243
-                        if (model.F_ParentId > 0)
244
-                        {
245
-                            key += "," + Category((int)model.F_ParentId, 0, key);
246
-                        }
247
-                    }
248
-                    else
249
-                    {
250
-                        if (model.F_ParentId > 0)
251
-                        {
252
-                            key += "," + Category((int)model.F_ParentId, 1, key);
253
-                        }
254
-                    }
255
-
256
-                }
257
-                return key;
258
-
259
-            }
260
-            else
261
-                return key;
262
-
263
-
264
-
265
-
266
-
267
-        }
215
+       
268
       
216
       
269
         private string CategoryId(int parentid)
217
         private string CategoryId(int parentid)
270
         {
218
         {
297
             {
245
             {
298
                 return Error("获取失败");
246
                 return Error("获取失败");
299
             }
247
             }
248
+            List<string> CategoryId = new List<string>();
249
+            List<string> F_CategoryName = new List<string>();
300
             var result =new {
250
             var result =new {
301
 
251
 
302
-                CategoryId = Category(model.F_CategoryId, 0),
303
-                F_CategoryName = Category(model.F_CategoryId, 1),
252
+                CategoryId = Category(model.F_CategoryId, 0, CategoryId),
253
+                F_CategoryName = Category(model.F_CategoryId, 1, F_CategoryName),
304
                 model.F_Content,
254
                 model.F_Content,
305
                 model.F_Remark,
255
                 model.F_Remark,
306
                 model.F_Title,
256
                 model.F_Title,
310
            
260
            
311
             return Success("获取成功!", result);
261
             return Success("获取成功!", result);
312
         }
262
         }
263
+        public List<string> Category(int? CategoryId, int type, List<string> key)
264
+        {
265
+            var model = _qc_indexcategoryreposytory.GetSingle(x => x.F_CategoryId == CategoryId).Result;
266
+            if (type == 0)
267
+            {
268
+                key.Add("" + CategoryId);
269
+                if (model.F_ParentId > 0)
270
+                {
271
+                    key = Category((int)model.F_ParentId, 0, key);
272
+                }
273
+            }
274
+            else
275
+            {
276
+                key.Add(model.F_CategoryName);
277
+                if (model.F_ParentId > 0)
278
+                {
279
+                    key = Category((int)model.F_ParentId, 1, key);
280
+                }
281
+            }
282
+            return key;
283
+        }
313
         //设置指标分数
284
         //设置指标分数
314
         private void SetScoreByCategory(int  categoryid, int source, int type=0,int F_Score=0)
285
         private void SetScoreByCategory(int  categoryid, int source, int type=0,int F_Score=0)
315
         {
286
         {

+ 14 - 39
代码/TVShoppingCallCenter_ZLJ/Controllers/IndexCategory/IndexCategoryController.cs

187
             {
187
             {
188
                 return Error("获取失败");
188
                 return Error("获取失败");
189
             }
189
             }
190
+            List<string> ParentId = new List<string>();
191
+            List<string> ParentName = new List<string>();
190
             var obj = new
192
             var obj = new
191
             {
193
             {
192
                 model.F_CategoryId,
194
                 model.F_CategoryId,
193
                 model.F_CategoryName,
195
                 model.F_CategoryName,
194
                 model.F_Expand1,
196
                 model.F_Expand1,
195
                 model.F_ParentId,
197
                 model.F_ParentId,
196
-               ParentId= Category(model .F_ParentId ,0),
197
-                ParentName = Category(model.F_ParentId, 1),
198
+               ParentId= Category(model .F_ParentId   ,0, ParentId),
199
+                ParentName = Category(model.F_ParentId, 1, ParentName),
198
             };
200
             };
199
             return Success("获取成功!", obj);
201
             return Success("获取成功!", obj);
200
         }
202
         }
201
-        private string Category(int? CategoryId, int type, string key = "")
203
+        public List <string > Category(int? CategoryId, int type, List<string> key)
202
         {
204
         {
203
             var model = _qc_indexcategoryreposytory.GetSingle(x => x.F_CategoryId == CategoryId).Result;
205
             var model = _qc_indexcategoryreposytory.GetSingle(x => x.F_CategoryId == CategoryId).Result;
204
-            if (model != null)
205
-            {
206
-                if (key == "")
206
+                if (type==0)
207
                 {
207
                 {
208
-                    if (type == 0)
209
-                    {
210
-                        key = CategoryId + "";
211
-                        if (model.F_ParentId > 0)
212
-                        {
213
-                            key += "," + Category((int)model.F_ParentId, 0, key);
214
-                        }
215
-                    }
216
-                    else
208
+                    key.Add("" + CategoryId);
209
+                    if (model.F_ParentId > 0)
217
                     {
210
                     {
218
-                        key = model.F_CategoryName;
219
-                        if (model.F_ParentId > 0)
220
-                        {
221
-                            key += "," + Category((int)model.F_ParentId, 1, key);
222
-                        }
211
+                        key = Category((int)model.F_ParentId, 0, key);
223
                     }
212
                     }
224
                 }
213
                 }
225
                 else
214
                 else
226
                 {
215
                 {
227
-                    if (type == 0)
228
-                    {
229
-                        if (model.F_ParentId > 0)
230
-                        {
231
-                            key += "," + Category((int)model.F_ParentId, 0, key);
232
-                        }
233
-                    }
234
-                    else
216
+                    key.Add( model.F_CategoryName);
217
+                    if (model.F_ParentId > 0)
235
                     {
218
                     {
236
-                        if (model.F_ParentId > 0)
237
-                        {
238
-                            key += "," + Category((int)model.F_ParentId, 1, key);
239
-                        }
219
+                        key = Category((int)model.F_ParentId, 1, key);
240
                     }
220
                     }
241
-
242
                 }
221
                 }
243
-                return key;
244
-
245
-            }
246
-            else
247
-                return key;
248
-
222
+            return key;
249
         }
223
         }
224
+       
250
     }
225
     }
251
 }
226
 }