Преглед изворни кода

修改c端:验证网站路由的接口

FengR пре 5 месеци
родитељ
комит
fe5bda7a18
1 измењених фајлова са 35 додато и 33 уклоњено
  1. 35 33
      app/JsonRpc/NewsService.php

+ 35 - 33
app/JsonRpc/NewsService.php

@@ -2850,13 +2850,13 @@ private function fetchArticles($catId, $website, $limit, $isImageArticle = false
     }
     // 验证栏目路由
     $last_category = WebsiteCategory::where('website_id', $data['website_id'])
-      ->where('aLIas_pinyin', $data['last_route'])
+      ->where('path', $data['all_route'])
       ->get()->all();
     if (count($last_category) == 0) {
       return Result::error("该栏目不存在", 0);
     }
     if(count($last_category) > 1){
-      return Result::error("该子级栏目存在多个,路由验证失败!", 0);
+      return Result::error("该栏目路由存在多个,路由验证失败!", 0);
     }
     if(count($last_category) == 1){
       $last_category = $last_category[0];
@@ -2954,41 +2954,43 @@ private function fetchArticles($catId, $website, $limit, $isImageArticle = false
           break;
       }
     //   return Result::success($article);
-      $catid =0 ;
+    //   $catid =0 ;
       
-      if(!isset($article['cat_arr_id'])){
-        $catid = isset($article['catid']) ? $article['catid'] : (isset($article['category_id']) ? $article['category_id'] : null);
-      }else{
-        $catidArray = json_decode($article['cat_arr_id'], true);
-        $catid = !empty($catidArray) ? end($catidArray) : null;
-      }
-    //   return Result::success($catid);
-    //    return Result::success($article['cat_arr_id']);
-      if (empty($catid)) {
-        return Result::error("该数据不存在", 0);
-      }
+    //   if(!isset($article['cat_arr_id'])){
+    //     $catid = isset($article['catid']) ? $article['catid'] : (isset($article['category_id']) ? $article['category_id'] : null);
+    //   }else{
+    //     $catidArray = json_decode($article['cat_arr_id'], true);
+    //     $catid = !empty($catidArray) ? end($catidArray) : null;
+    //   }
+    // //   return Result::success($catid);
+    // //    return Result::success($article['cat_arr_id']);
+    //   if (empty($catid)) {
+    //     return Result::error("该数据不存在", 0);
+    //   }
       
-      $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
-        ->where('category_id',$catid)
-        ->first('path');
-    }else{
-        // if ($last_category['pid'] != 0) {
-            $cat_arr = json_decode($last_category['category_arr_id'], true);
-            $catid = !empty($cat_arr) && is_array($cat_arr) ? end($cat_arr) : null;
-            $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
-                ->where('category_id',$catid)
-                ->where('path',$data['all_route'])
-                ->first('path');
-        // } else {
-        //     $pinyin[0] = $last_category['aLIas_pinyin'];
-        // }
+    //   $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
+    //     ->where('category_id',$catid)
+    //     ->first('path');
     }
+
+    // else{
+    //     // if ($last_category['pid'] != 0) {
+    //         $cat_arr = json_decode($last_category['category_arr_id'], true);
+    //         $catid = !empty($cat_arr) && is_array($cat_arr) ? end($cat_arr) : null;
+    //         $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
+    //             ->where('category_id',$catid)
+    //             ->where('path',$data['all_route'])
+    //             ->first('path');
+    //     // } else {
+    //     //     $pinyin[0] = $last_category['aLIas_pinyin'];
+    //     // }
+    // }
     // return Result::success($pinyin);
-    if (empty($pinyin)  || $pinyin['path'] != $data['all_route']) {
-      return Result::error('非法路径!');
-    } else {
-      return Result::success($pinyin);
-    }
+    // if (empty($pinyin)) {
+    //   return Result::error('非法路径!');
+    // } else {
+      return Result::success( $last_category['path']);
+    // }
   }
     /**
      * 招工招聘  -  获取推荐职位