Procházet zdrojové kódy

Merge branch 'web_sannong_fr'

15313670163 před 4 měsíci
rodič
revize
649fcd2623
1 změnil soubory, kde provedl 12 přidání a 7 odebrání
  1. 12 7
      app/JsonRpc/WebsiteService.php

+ 12 - 7
app/JsonRpc/WebsiteService.php

@@ -727,7 +727,12 @@ class WebsiteService implements WebsiteServiceInterface
         $pid = array_values(array_unique($pid->toArray()));
         // 构建查询语句
         $query = WebsiteCategory::where($website_id)
-            ->where('pid', $data['pid'])
+            ->when(isset($data['is_show']) && $data['is_show'] == 1 && $data['pid'] == 0, function ($query) use ($data) {
+                $query->where('is_show', $data['is_show']);
+            })
+            ->when(!isset($data['is_show']), function ($query) use ($data) {
+                $query->where('pid', $data['pid']);
+            })
             ->offset($data['placeid'])
             ->limit($data['num'])
             ->orderBy('sort')
@@ -2789,12 +2794,12 @@ class WebsiteService implements WebsiteServiceInterface
         }
         if (isset($data['pinyin']) && !empty($data['pinyin'])) {
             $result = WebsiteCategory::where('website_category.website_id', $data['website_id'])
-                ->where('website_category.aLIas_pinyin', $data['pinyin'])
-                ->leftJoin('website_category as pc', function ($join) use ($data) {
-                    $join->on('pc.pid', '=', 'website_category.category_id')
-                        ->where('pc.website_id', '=', $data['website_id']);
-                })
-                ->select('website_category.category_id', 'website_category.type', 'website_category.alias', DB::raw('CASE WHEN pc.category_id IS NOT NULL THEN 1 ELSE 0 END as children_count'))
+                ->where('website_category.path', $data['pinyin'])
+                // ->leftJoin('website_category as pc', function ($join) use ($data) {
+                //     $join->on('pc.pid', '=', 'website_category.category_id')
+                //         ->where('pc.website_id', '=', $data['website_id']);
+                // })
+                ->select('website_category.category_id','website_category.type', 'website_category.alias',)
                 ->first();
         }
         if (isset($data['foot_pinyin']) && !empty($data['foot_pinyin'])) {