Kaynağa Gözat

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

15313670163 5 ay önce
ebeveyn
işleme
52e6eb6205
1 değiştirilmiş dosya ile 9 ekleme ve 8 silme
  1. 9 8
      app/JsonRpc/NewsService.php

+ 9 - 8
app/JsonRpc/NewsService.php

@@ -2963,22 +2963,23 @@ private function fetchArticles($catId, $website, $limit, $isImageArticle = false
       
       $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
         ->where('category_id',$catid)
-        ->select('path')
-        ->pluck('path');
+        ->first('path')
+        ->toArray();
     }else{
-        if ($last_category['pid'] != 0) {
+        // if ($last_category['pid'] != 0) {
             $cat_arr = json_decode($last_category['category_arr_id'], true);
             $catid = !empty($cat_arr) ? end($cat_arr) : null;
             $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
                 ->where('category_id',$catid)
                 ->where('path',$data['all_route'])
-                ->pluck('path');
-        } else {
-            $pinyin[0] = $last_category['aLIas_pinyin'];
-        }
+                ->first('path')
+                ->toArray();
+        // } else {
+        //     $pinyin[0] = $last_category['aLIas_pinyin'];
+        // }
     }
     // return Result::success($pinyin[0]);
-    if (empty($pinyin) || count($pinyin)>1 || $pinyin[0] != $data['all_route']) {
+    if (empty($pinyin) || count($pinyin)>1 || $pinyin['path'] != $data['all_route']) {
       return Result::error('非法路径!');
     } else {
       return Result::success($pinyin);