Browse Source

获取栏目的文章

15313670163 1 tháng trước cách đây
mục cha
commit
da0c1434cd

+ 25 - 0
app/Controller/WebController.php

@@ -739,4 +739,29 @@ class WebController extends AbstractController
          }
 
     }
+    /**
+     * 获取网站模块新闻----图文
+     * @return array
+     */
+    public function getWebsiteCatidArticle()
+    {
+        $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); 
+        }
+        $requireData['website_id'] =  Context::get("SiteId");
+        // return Result::success($requireData);
+        $result = $this->websiteServiceClient->getWebsiteCatidArticle($requireData);
+        return $result['code']==200?Result::success($result['data']):Result::error($result['message']);
+    }
 }

+ 8 - 0
app/JsonRpc/WebsiteService.php

@@ -627,4 +627,12 @@ class WebsiteService extends AbstractServiceClient implements WebsiteServiceInte
     {
         return $this->__request(__FUNCTION__, $data);
     }
+    /**
+     * @param array $data
+     * @return mixed
+     */
+    public function getWebsiteCatidArticle(array $data)
+    {
+        return $this->__request(__FUNCTION__, $data);
+    }
 }

+ 5 - 0
app/JsonRpc/WebsiteServiceInterface.php

@@ -434,4 +434,9 @@ interface WebsiteServiceInterface
      *
      */
     public function getWebsiteParentCategory(array $data);
+    /**
+     * @param array $data
+     * @return mixed
+    */
+    public function getWebsiteCatidArticle(array $data);
 }