Browse Source

搜索网站二级导航栏目seo

15313670163 2 months ago
parent
commit
8df9d47da7

+ 30 - 0
app/Controller/WebController.php

@@ -582,6 +582,36 @@ class WebController extends AbstractController
         $data = $requireData;
         $data['website_id'] = Context::get("SiteId");
         $result = $this->websiteServiceClient->selectWebsiteCategory($data);
+        if ($result['code']!= ErrorCode::SUCCESS) {
+            return Result::error($result['message'],0,[]); 
+        }else{
+            return Result::success($result['data']);
+        }
+
+    }
+    /**
+     * 搜索二级导航
+     * @return array
+     */
+    public function getWebsiteCategoryHead()
+    {
+        $requireData = $this->request->all();
+        $validator = $this->validationFactory->make(
+            $requireData,
+            [
+                'catid' =>'required|integer'
+            ], 
+            [
+                'catid.required' => 'id不能为空'
+            ]
+        ) ;
+        if ($validator->fails()){
+            $errorMessage = $validator->errors()->first();
+            return Result::error($errorMessage);
+        }
+        $data = $requireData;
+        $data['website_id'] = Context::get("SiteId");
+        $result = $this->websiteServiceClient->getWebsiteCategoryHead($data);
         if ($result['code']!= ErrorCode::SUCCESS) {
             return Result::error($result['message'],0,[]); 
         }else{

+ 8 - 0
app/JsonRpc/WebsiteService.php

@@ -489,6 +489,14 @@ class WebsiteService extends AbstractServiceClient implements WebsiteServiceInte
      * @return mixed
      */
     public function selectWebsiteCategory(array $data)
+    {
+        return $this->__request(__FUNCTION__, $data);
+    }
+     /**
+     * @param array $data
+     * @return mixed
+     */
+    public function getWebsiteCategoryHead(array $data)
     {
         return $this->__request(__FUNCTION__, $data);
     }

+ 5 - 0
app/JsonRpc/WebsiteServiceInterface.php

@@ -419,5 +419,10 @@ interface WebsiteServiceInterface
      * @return mixed
      */
     public function selectWebsiteCategory(array $data);
+     /**
+     * @param array $data
+     * @return mixed
+     */
+    public function getWebsiteCategoryHead(array $data);
 }
 

+ 2 - 0
config/api/web.php

@@ -29,6 +29,8 @@ Router::addGroup(
                 Router::get('/getWebsiteFooterCategoryInfo', [WebController::class, 'getWebsiteFooterCategoryInfo']);
                 // 搜索网站二级导航
                 Router::get('/selectWebsiteCategory', [WebController::class, 'selectWebsiteCategory']);
+                // 搜索网站二级导航-seo列表页
+                Router::get('/getWebsiteCategoryHead', [WebController::class, 'getWebsiteCategoryHead']);
             },
     ['middleware' => [WebMiddleware::class]]
 );