rkljw 1 month ago
parent
commit
339a77e5de

+ 1 - 0
app/Controller/IndexController.php

@@ -23,5 +23,6 @@ class IndexController extends AbstractController
             'method' => $method,
             'method' => $method,
             'message' => "Hello {$user}.",
             'message' => "Hello {$user}.",
         ];
         ];
+        // master
     }
     }
 }
 }

+ 67 - 46
app/JsonRpc/WebsiteService.php

@@ -5,6 +5,7 @@ use App\Model\Article;
 
 
 use App\Model\Ad;
 use App\Model\Ad;
 use App\Model\Category;
 use App\Model\Category;
+
 use App\Model\AdPlace;
 use App\Model\AdPlace;
 use App\Model\Department;
 use App\Model\Department;
 use App\Model\District;
 use App\Model\District;
@@ -61,6 +62,7 @@ class WebsiteService implements WebsiteServiceInterface
             ->leftJoin("district", "district.id", "website.city_id")->count();
             ->leftJoin("district", "district.id", "website.city_id")->count();
 
 
         $result = $resultWwhere->select("website.*", "website_column.column_name", "district.name as city_name")
         $result = $resultWwhere->select("website.*", "website_column.column_name", "district.name as city_name")
+
             ->limit($data['pageSize'])->offset(($data['page'] - 1) * $data['pageSize'])->orderBy("website.id", "desc")->get();
             ->limit($data['pageSize'])->offset(($data['page'] - 1) * $data['pageSize'])->orderBy("website.id", "desc")->get();
 
 
         if (empty($result)) {
         if (empty($result)) {
@@ -473,10 +475,24 @@ class WebsiteService implements WebsiteServiceInterface
         $where = [
         $where = [
             'website_id'=>$data['website_id']
             'website_id'=>$data['website_id']
         ];
         ];
-        $result = WebsiteCategory::where($where)->orderBy('sort', 'asc')->get();
-        if (empty($result)) {
-            return Result::error("查询站点栏目失败", 0);
-        } else {
+        // 使用递归查询构建树状结构
+        $category = WebsiteCategory::where($where)
+            ->with([
+                'children' => function ($query) {
+                    $query->orderBy('sort', 'asc');
+                }
+            ])
+            ->orderBy('sort', 'asc')
+            ->where('pid', 0) // 仅查询顶级节点
+            ->get()->all();
+        if(empty($category)){
+            return Result::error("查询站点栏目失败",0);
+        }else{
+            $count = WebsiteCategory::where($where)->count();
+            $result = [
+                'rep' => $category,
+                'count' => $count
+            ];
             return Result::success($result);
             return Result::success($result);
         }
         }
     }
     }
@@ -493,7 +509,7 @@ class WebsiteService implements WebsiteServiceInterface
             'ad_place.status' => 1,
             'ad_place.status' => 1,
             // 'ad.status' => 1,
             // 'ad.status' => 1,
         ];
         ];
-        if(isset($data['ad_tag']) && !empty($data['ad_tag'])){
+        if (isset($data['ad_tag']) && !empty($data['ad_tag'])) {
             $now = Carbon::now()->format('Y-m-d H:i:s'); // 获取当前时间
             $now = Carbon::now()->format('Y-m-d H:i:s'); // 获取当前时间
             $where[] = ['ad_place.ad_tag','like','%'.$data['ad_tag'].'%'];
             $where[] = ['ad_place.ad_tag','like','%'.$data['ad_tag'].'%'];
             $result =  AdPlace::where($where)
             $result =  AdPlace::where($where)
@@ -608,44 +624,44 @@ class WebsiteService implements WebsiteServiceInterface
 
 
     public function getWebsiteModelCategory(array $data): array
     public function getWebsiteModelCategory(array $data): array
     {
     {
-        $website_id=[ 
-            'website_category.website_id' => $data['website_id'] 
+        $website_id = [
+            'website_category.website_id' => $data['website_id'],
         ];
         ];
-        $placeid=$data['placeid']-1; 
-        $pid=[
-            'website_category.pid' => $data['pid'], 
+        $placeid = $data['placeid'] - 1;
+        $pid = [
+            'website_category.pid' => $data['pid'],
         ];
         ];
-        var_dump( "=======",$pid);
+        var_dump("=======", $pid);
         $num = $data['num'];
         $num = $data['num'];
         // return Result::success($data);
         // 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)
+        $result = WebsiteCategory::where($website_id)
+            ->leftJoin("category", 'website_category.category_id', 'category.id')
+            ->select('website_category.*', 'category.is_url', 'category.web_url')
+            ->where($pid)
         // ->with(['children' => function ($query) use ($data) {
         // ->with(['children' => function ($query) use ($data) {
         //     $query->where('website_category.website_id', $data['website_id']);
         //     $query->where('website_category.website_id', $data['website_id']);
         // }])
         // }])
-        ->orderBy('website_category.sort')
-        
-        ->offset($placeid)
-        ->limit($num)
-        ->get();
-        foreach($result as $k=>$v){
-            $child[$k]['children_countent']=WebsiteCategory::where($website_id)
-            ->where('website_category.pid',$v['category_id'])
-            ->count();
-            if(!empty($child[$k]['children_countent'])){
-                $result[$k]['children_count']=$child[$k]['children_countent'];
-            }else{
-                $result[$k]['children_count']=0;
+            ->orderBy('website_category.sort')
+
+            ->offset($placeid)
+            ->limit($num)
+            ->get();
+        foreach ($result as $k => $v) {
+            $child[$k]['children_countent'] = WebsiteCategory::where($website_id)
+                ->where('website_category.pid', $v['category_id'])
+                ->count();
+            if (!empty($child[$k]['children_countent'])) {
+                $result[$k]['children_count'] = $child[$k]['children_countent'];
+            } else {
+                $result[$k]['children_count'] = 0;
             }
             }
         }
         }
         return Result::success($result);
         return Result::success($result);
-        if(!empty($result)){ 
-            return Result::success($result);  
-        }else{ 
-            return Result::error("本网站暂无栏目",0);  
-        } 
+        if (!empty($result)) {
+            return Result::success($result);
+        } else {
+            return Result::error("本网站暂无栏目", 0);
+        }
 
 
     }
     }
 
 
@@ -1280,7 +1296,7 @@ class WebsiteService implements WebsiteServiceInterface
         }
         }
         return Result::success($websiteInfo->toArray());
         return Result::success($websiteInfo->toArray());
     }
     }
-// 自助建站--fr-------------------
+
 
 
     /**
     /**
      * 获取网站底部基础信息
      * 获取网站底部基础信息
@@ -1408,7 +1424,7 @@ class WebsiteService implements WebsiteServiceInterface
             $category = WebsiteCategory::where('website_id',$data['website_id'])->pluck('category_id')->all();
             $category = WebsiteCategory::where('website_id',$data['website_id'])->pluck('category_id')->all();
             // return Result::success($category);
             // return Result::success($category);
             if (empty($category)) {
             if (empty($category)) {
-                return Result::error("暂无此导航",0); 
+                return Result::error("暂无此导航",0);
             }
             }
             $query = Category::whereIn('id', $category);
             $query = Category::whereIn('id', $category);
             if (isset($data['cityid']) && !empty($data['cityid'])) {
             if (isset($data['cityid']) && !empty($data['cityid'])) {
@@ -1419,7 +1435,7 @@ class WebsiteService implements WebsiteServiceInterface
                     $city_category = $query->whereRaw('JSON_CONTAINS(city_arr_id,?)', [$data['cityid']])->pluck('id');
                     $city_category = $query->whereRaw('JSON_CONTAINS(city_arr_id,?)', [$data['cityid']])->pluck('id');
                     // $where[] = ['JSON_CONTAINS(city_arr_id, ?)', $data['cityid']];
                     // $where[] = ['JSON_CONTAINS(city_arr_id, ?)', $data['cityid']];
                     if (empty($city_category)) {
                     if (empty($city_category)) {
-                        return Result::error("暂无此城市下的导航", 0); 
+                        return Result::error("暂无此城市下的导航", 0);
                     }
                     }
                     $result['catid'] = $city_category;
                     $result['catid'] = $city_category;
                     $city = 1;
                     $city = 1;
@@ -1440,8 +1456,8 @@ class WebsiteService implements WebsiteServiceInterface
                     $department = 1;
                     $department = 1;
                 }
                 }
             }
             }
-           if(!empty($city) && !empty($department)){
-            // var_dump("城市和职能部门----------------------",$result);
+            if (!empty($city) && !empty($department)) {
+                // var_dump("城市和职能部门----------------------",$result);
                 $sel_category = $query->whereRaw('JSON_CONTAINS(city_arr_id,?)', [$data['cityid']])->whereRaw('JSON_CONTAINS(department_arr_id,?)', [$data['department_id']])->pluck('id');
                 $sel_category = $query->whereRaw('JSON_CONTAINS(city_arr_id,?)', [$data['cityid']])->whereRaw('JSON_CONTAINS(department_arr_id,?)', [$data['department_id']])->pluck('id');
                 if (empty($sel_category)) {
                 if (empty($sel_category)) {
                     return Result::error("暂无此城市和职能部门下的导航", 0);
                     return Result::error("暂无此城市和职能部门下的导航", 0);
@@ -1449,9 +1465,8 @@ class WebsiteService implements WebsiteServiceInterface
                 $result['catid'] = $sel_category;
                 $result['catid'] = $sel_category;
             }
             }
             if (empty($result)) {
             if (empty($result)) {
-                return Result::error("暂无导航",0);
-            }  
-            
+                return Result::error("暂无导航", 0);
+            }
             // department_id
             // department_id
         } else {
         } else {
             return Result::error("参数错误", 0);
             return Result::error("参数错误", 0);
@@ -1465,9 +1480,14 @@ class WebsiteService implements WebsiteServiceInterface
      */
      */
     public function getWebsiteCategoryHead(array $data): array
     public function getWebsiteCategoryHead(array $data): array
     {
     {
-        $where = [];
+
         if (isset($data['website_id']) && !empty($data['website_id'])) {
         if (isset($data['website_id']) && !empty($data['website_id'])) {
-            array_push($where, ['website_id', '=', $data['website_id']]);
+            $website = Website::where('id', $data['website_id'])->where('status', 1)->first();
+            if (empty($website)) {
+                return Result::error("找不到网站", 0);
+            }
+        } else {
+            return Result::error("参数错误", 0);
         }
         }
         if (isset($data['catid']) && !empty($data['catid'])) {
         if (isset($data['catid']) && !empty($data['catid'])) {
             $fcatid = WebsiteCategory::where('website_id', $data['website_id'])->where('category_id', $data['catid'])->first();
             $fcatid = WebsiteCategory::where('website_id', $data['website_id'])->where('category_id', $data['catid'])->first();
@@ -1481,7 +1501,8 @@ class WebsiteService implements WebsiteServiceInterface
         }
         }
         return Result::success($result);
         return Result::success($result);
     }
     }
-     /*
+
+    /*
      * 获取某个栏目
      * 获取某个栏目
      * @param array $data
      * @param array $data
      * @return array
      * @return array
@@ -1493,7 +1514,7 @@ class WebsiteService implements WebsiteServiceInterface
             if (empty($website)) {
             if (empty($website)) {
                 return Result::error("暂无该网站", 0);
                 return Result::error("暂无该网站", 0);
             }
             }
-            $result = WebsiteCategory::where('website_id', $data['website_id'])->where('category_id', $data['category_id'])->select('category_id', 'name')->first();
+            $result = WebsiteCategory::where('website_id',$data['website_id'])->where('category_id',$data['category_id'])->select('category_id','alias')->first();
             // return Result::success($category);
             // return Result::success($category);
             if (empty($result)) {
             if (empty($result)) {
                 return Result::error("暂无此导航", 0);
                 return Result::error("暂无此导航", 0);
@@ -1508,7 +1529,6 @@ class WebsiteService implements WebsiteServiceInterface
     //20250212  网站标识
     //20250212  网站标识
     public function addWebsiteGroup(array $data): array
     public function addWebsiteGroup(array $data): array
     {
     {
-
         //判斷name是不是重复
         //判斷name是不是重复
         $websiteGroupInfo = WebsiteGroup::query()->where('name', $data['name'])->first();
         $websiteGroupInfo = WebsiteGroup::query()->where('name', $data['name'])->first();
         if (!empty($websiteGroupInfo)) {
         if (!empty($websiteGroupInfo)) {
@@ -2379,4 +2399,5 @@ class WebsiteService implements WebsiteServiceInterface
     }
     }
 
 
 // 自传建站---------------liu------------
 // 自传建站---------------liu------------
+
 }
 }

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


+ 1 - 0
runtime/hyperf.pid

@@ -0,0 +1 @@
+18444

+ 3 - 0
runtime/logs/hyperf.log

@@ -451,6 +451,7 @@
 [2025-02-21T16:00:22.301592+08:00] sql.INFO: [5.5] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-02-21T16:00:22.301592+08:00] sql.INFO: [5.5] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-02-21T16:00:23.285935+08:00] sql.INFO: [3.3] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-02-21T16:00:23.285935+08:00] sql.INFO: [3.3] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-02-21T16:00:24.041032+08:00] sql.INFO: [8.76] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-02-21T16:00:24.041032+08:00] sql.INFO: [8.76] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
+<<<<<<< HEAD
 [2025-03-03T17:58:51.683789+08:00] sql.INFO: [14.91] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-03-03T17:58:51.683789+08:00] sql.INFO: [14.91] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-03-03T17:58:53.402045+08:00] sql.INFO: [3.34] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-03-03T17:58:53.402045+08:00] sql.INFO: [3.34] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-03-03T17:58:54.583738+08:00] sql.INFO: [3.17] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-03-03T17:58:54.583738+08:00] sql.INFO: [3.17] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
@@ -475,3 +476,5 @@
 [2025-03-03T18:03:09.657222+08:00] sql.INFO: [3.51] select `ad_place`.* from `ad_place` left join `ad` on `ad`.`pid` = `ad_place`.`id` and `ad`.`fromtime` <= '2025-03-03 18:03:09' and `ad`.`totime` >= '2025-03-03 18:03:09' where (`website_id` = '2' and `ad_place`.`status` = '1' and `ad`.`status` = '1' and `ad_place`.`ad_tag` like '%INDEDX%') [] []
 [2025-03-03T18:03:09.657222+08:00] sql.INFO: [3.51] select `ad_place`.* from `ad_place` left join `ad` on `ad`.`pid` = `ad_place`.`id` and `ad`.`fromtime` <= '2025-03-03 18:03:09' and `ad`.`totime` >= '2025-03-03 18:03:09' where (`website_id` = '2' and `ad_place`.`status` = '1' and `ad`.`status` = '1' and `ad_place`.`ad_tag` like '%INDEDX%') [] []
 [2025-03-03T18:03:30.195167+08:00] sql.INFO: [14.04] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-03-03T18:03:30.195167+08:00] sql.INFO: [14.04] select * from `website` where json_contains(`website_url`, '"localhost:3000"') limit 1 [] []
 [2025-03-03T18:03:30.424665+08:00] sql.INFO: [3.38] select `ad_place`.* from `ad_place` left join `ad` on `ad`.`pid` = `ad_place`.`id` and `ad`.`status` = '1' and `ad`.`fromtime` <= '2025-03-03 18:03:30' and `ad`.`totime` >= '2025-03-03 18:03:30' where (`website_id` = '2' and `ad_place`.`status` = '1' and `ad_place`.`ad_tag` like '%INDEDX%') [] []
 [2025-03-03T18:03:30.424665+08:00] sql.INFO: [3.38] select `ad_place`.* from `ad_place` left join `ad` on `ad`.`pid` = `ad_place`.`id` and `ad`.`status` = '1' and `ad`.`fromtime` <= '2025-03-03 18:03:30' and `ad`.`totime` >= '2025-03-03 18:03:30' where (`website_id` = '2' and `ad_place`.`status` = '1' and `ad_place`.`ad_tag` like '%INDEDX%') [] []
+=======
+>>>>>>> bugfix_03_06_liu

+ 1 - 0
vendor/composer/autoload_classmap.php

@@ -46,6 +46,7 @@ return array(
     'App\\Listener\\ResumeExitCoordinatorListener' => $baseDir . '/app/Listener/ResumeExitCoordinatorListener.php',
     'App\\Listener\\ResumeExitCoordinatorListener' => $baseDir . '/app/Listener/ResumeExitCoordinatorListener.php',
     'App\\Model\\Ad' => $baseDir . '/app/Model/Ad.php',
     'App\\Model\\Ad' => $baseDir . '/app/Model/Ad.php',
     'App\\Model\\AdPlace' => $baseDir . '/app/Model/AdPlace.php',
     'App\\Model\\AdPlace' => $baseDir . '/app/Model/AdPlace.php',
+    'App\\Model\\AdSize' => $baseDir . '/app/Model/AdSize.php',
     'App\\Model\\Article' => $baseDir . '/app/Model/Article.php',
     'App\\Model\\Article' => $baseDir . '/app/Model/Article.php',
     'App\\Model\\ArticleData' => $baseDir . '/app/Model/ArticleData.php',
     'App\\Model\\ArticleData' => $baseDir . '/app/Model/ArticleData.php',
     'App\\Model\\Category' => $baseDir . '/app/Model/Category.php',
     'App\\Model\\Category' => $baseDir . '/app/Model/Category.php',

+ 1 - 0
vendor/composer/autoload_static.php

@@ -747,6 +747,7 @@ class ComposerStaticInita4fab8fe7069cf132d8088fb346f5c2a
         'App\\Listener\\ResumeExitCoordinatorListener' => __DIR__ . '/../..' . '/app/Listener/ResumeExitCoordinatorListener.php',
         'App\\Listener\\ResumeExitCoordinatorListener' => __DIR__ . '/../..' . '/app/Listener/ResumeExitCoordinatorListener.php',
         'App\\Model\\Ad' => __DIR__ . '/../..' . '/app/Model/Ad.php',
         'App\\Model\\Ad' => __DIR__ . '/../..' . '/app/Model/Ad.php',
         'App\\Model\\AdPlace' => __DIR__ . '/../..' . '/app/Model/AdPlace.php',
         'App\\Model\\AdPlace' => __DIR__ . '/../..' . '/app/Model/AdPlace.php',
+        'App\\Model\\AdSize' => __DIR__ . '/../..' . '/app/Model/AdSize.php',
         'App\\Model\\Article' => __DIR__ . '/../..' . '/app/Model/Article.php',
         'App\\Model\\Article' => __DIR__ . '/../..' . '/app/Model/Article.php',
         'App\\Model\\ArticleData' => __DIR__ . '/../..' . '/app/Model/ArticleData.php',
         'App\\Model\\ArticleData' => __DIR__ . '/../..' . '/app/Model/ArticleData.php',
         'App\\Model\\Category' => __DIR__ . '/../..' . '/app/Model/Category.php',
         'App\\Model\\Category' => __DIR__ . '/../..' . '/app/Model/Category.php',

+ 4 - 4
vendor/composer/installed.php

@@ -3,7 +3,7 @@
         'name' => 'hyperf/hyperf-skeleton',
         'name' => 'hyperf/hyperf-skeleton',
         'pretty_version' => 'dev-master',
         'pretty_version' => 'dev-master',
         'version' => 'dev-master',
         'version' => 'dev-master',
-        'reference' => 'e7ff6900d8f8f4b9d10127c877fb38eb0b465ec6',
+        'reference' => '93d496c9e9adb65c1b26df93c357713cf08a00f0',
         'type' => 'project',
         'type' => 'project',
         'install_path' => __DIR__ . '/../../',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
         'aliases' => array(),
@@ -457,7 +457,7 @@
         'hyperf/hyperf-skeleton' => array(
         'hyperf/hyperf-skeleton' => array(
             'pretty_version' => 'dev-master',
             'pretty_version' => 'dev-master',
             'version' => 'dev-master',
             'version' => 'dev-master',
-            'reference' => 'e7ff6900d8f8f4b9d10127c877fb38eb0b465ec6',
+            'reference' => '93d496c9e9adb65c1b26df93c357713cf08a00f0',
             'type' => 'project',
             'type' => 'project',
             'install_path' => __DIR__ . '/../../',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),
             'aliases' => array(),
@@ -1024,8 +1024,8 @@
         'psr/log-implementation' => array(
         'psr/log-implementation' => array(
             'dev_requirement' => false,
             'dev_requirement' => false,
             'provided' => array(
             'provided' => array(
-                0 => '1.0|2.0|3.0',
-                1 => '3.0.0',
+                0 => '3.0.0',
+                1 => '1.0|2.0|3.0',
             ),
             ),
         ),
         ),
         'psr/simple-cache' => array(
         'psr/simple-cache' => array(

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