15313670163 1 hónapja
szülő
commit
7959a1b0af

+ 43 - 3
app/JsonRpc/WebsiteService.php

@@ -1489,9 +1489,7 @@ class WebsiteService implements WebsiteServiceInterface
             return Result::error("参数错误",0);
         }
     }
-
-
-
+   
     // 自助建站--fr-------------------
 
      /**
@@ -2018,4 +2016,46 @@ class WebsiteService implements WebsiteServiceInterface
         }
         return Result::success($result);
     }
+
+     /*
+     * 获取父级/子级栏目
+     * @param array $data
+     * @return array
+     * */
+    public function getWebsiteParentCategory(array $data): array
+    {
+        if(isset($data['website_id']) &&!empty($data['website_id'])){
+            $website = Website::where('id',$data['website_id'])->where('status',1)->first(); 
+        } 
+        if (empty($website)) {
+            return Result::error("暂无该网站",0); 
+        }
+        if($data['id']==0){
+            $category = WebsiteCategory::where('website_id', $data['website_id'])
+            ->where('pid', 0)
+            ->pluck('aLIas_pinyin')
+            ->map(function ($alias) {
+                return "/{$alias}/:id";
+            })
+            ->values()
+            ->all();
+        }else{
+            $category = WebsiteCategory::where('website_id', $data['website_id'])
+            ->where('pid','!=', 0)
+            ->pluck('aLIas_pinyin')
+            ->map(function ($alias) {
+                return "/{$alias}/:id";
+            })
+            ->values()
+            ->all();
+        }
+        if (empty($category)) {
+            return Result::error("暂无此导航",0);
+        }
+        // $result = [];
+        return Result::success($category);
+    }
+
+
+
 }

+ 2 - 1
app/JsonRpc/WebsiteServiceInterface.php

@@ -109,5 +109,6 @@ interface WebsiteServiceInterface
     public function addWebFootInfo(array $data): array;
     public function upWebFootInfo(array $data): array;
     // --网站底部基础信息-----------fr----------------------end
-
+    
+    public function getWebsiteParentCategory(array $data): array;
 }