瀏覽代碼

获取某个栏目

15313670163 1 月之前
父節點
當前提交
d1aba475bc
共有 3 個文件被更改,包括 17 次插入7 次删除
  1. 2 2
      .env
  2. 15 5
      app/JsonRpc/WebsiteService.php
  3. 0 0
      runtime/container/scan.cache

+ 2 - 2
.env

@@ -2,11 +2,11 @@ APP_NAME=public_producer
 APP_ENV=dev
 HOST = http://101.254.114.211:13306/
 DB_DRIVER=mysql
-DB_HOST=101.254.114.211
+DB_HOST=192.168.1.123
 DB_PORT=13306
 DB_DATABASE=hyperf
 DB_USERNAME=root
-DB_PASSWORD=xKmapDpKCxMMSkbe
+DB_PASSWORD=zxt_mysql_dev
 DB_CHARSET=utf8mb4
 DB_COLLATION=utf8mb4_unicode_ci
 DB_PREFIX=

+ 15 - 5
app/JsonRpc/WebsiteService.php

@@ -613,17 +613,27 @@ class WebsiteService implements WebsiteServiceInterface
     public function getWebsiteModelCategory(array $data): array 
     {
         $website_id=[ 
-            'website_id' => $data['website_id'] 
+            'website_category.website_id' => $data['website_id'] 
         ];
         $placeid=$data['placeid']-1; 
         $pid=[
-            'pid' => $data['pid'], 
+            'website_category.pid' => $data['pid'], 
         ];
+        var_dump( "=======",$pid);
         $num = $data['num'];
-        $result=WebsiteCategory::where($website_id)->where($pid)->withCount(['children' => function ($query) use ($website_id) {
+        // return Result::success($data);
+        $result=WebsiteCategory::where($website_id)
+        ->leftJoin("category",'website_category.category_id','category.id')
+        ->select('website_category.*','category.is_url','category.web_url')
+        ->where($pid)
+        ->withCount(['children' => function ($query) use ($website_id) {
             $query->where($website_id);
-        }])->orderBy('sort')->offset($placeid)->limit($num)->get();
-
+        }])
+        ->orderBy('website_category.sort')
+        
+        ->offset($placeid)
+        ->limit($num)->get();
+        return Result::success($result);
         if(!empty($result)){ 
             return Result::success($result);  
         }else{ 

File diff suppressed because it is too large
+ 0 - 0
runtime/container/scan.cache


Some files were not shown because too many files changed in this diff