Przeglądaj źródła

根据职能部门及地区获取二级导航

15313670163 2 miesięcy temu
rodzic
commit
6b2d740603

+ 63 - 0
app/JsonRpc/WebsiteService.php

@@ -1390,4 +1390,67 @@ class WebsiteService implements WebsiteServiceInterface
         }
         return Result::success($result);
     }
+    /*
+     * 搜索网站二级导航
+     * @param array $data
+     * @return array
+     * */
+    public function selectWebsiteCategory(array $data): array
+    {
+        if(isset($data['website_id']) &&!empty($data['website_id'])){
+            $website = Website::where('id',$data['website_id'])->where('status',1)->first(); 
+            if (empty($website)) {
+                return Result::error("暂无该网站",0); 
+            }
+            $category = WebsiteCategory::where('website_id',$data['website_id'])->where('pid',$data['pid'])->pluck('category_id')->all();
+            // return Result::success($category);
+            if (empty($category)) {
+                // return Result::error("暂无二级导航",0); 
+            }
+            $query = Category::whereIn('id', $category);
+            if (isset($data['cityid']) && !empty($data['cityid'])) {
+                $cityid = District::where('id', $data['cityid'])->first();
+                if (empty($cityid)) {
+                    return Result::error("暂无此城市", 0);
+                } else {
+                    $result = $query->whereRaw('JSON_CONTAINS(city_arr_id,?)', [$data['cityid']])->get();
+                    // $where[] = ['JSON_CONTAINS(city_arr_id, ?)', $data['cityid']];
+                    if (empty($result)) {
+                        return Result::error("暂无此城市下的二级导航", 0); 
+                    }
+                    $city = 1;
+                    // var_dump("城市====================",$result);
+                }
+            }
+            if (isset($data['department_id']) && !empty($data['department_id'])) {
+                $departmentid = Department::where('id', $data['department_id'])->first();
+                if (empty($departmentid)) {
+                    return Result::error("暂无此部门", 0);
+                } else {
+                    $result = $query->whereRaw('JSON_CONTAINS(department_arr_id,?)', [$data['department_id']])->get();
+                    if (empty($result)) {
+                        return Result::error("暂无此部门下的二级导航", 0);
+                    }
+                    // var_dump("职能部门*******************",$result);
+                    $department = 1;
+                }
+            }
+           if(!empty($city) && !empty($department)){
+            // var_dump("城市和职能部门----------------------",$result);
+                $result = $query->whereRaw('JSON_CONTAINS(city_arr_id,?)', [$data['cityid']])->whereRaw('JSON_CONTAINS(department_arr_id,?)', [$data['department_id']])->get();
+           }else{
+                $result = $query->get();
+           }
+            if (empty($result)) {
+                return Result::error("暂无二级导航",0);
+            }  
+            
+            // department_id
+        }else{
+            return Result::error("参数错误",0);
+        }
+        return Result::success($result);
+    }
+    
+    
 }

+ 1 - 0
app/JsonRpc/WebsiteServiceInterface.php

@@ -87,4 +87,5 @@ interface WebsiteServiceInterface
     public function getWebsiteFooterCategory(array $data): array;
     public function getWebsiteFooterCategoryList(array $data): array;
     public function getWebsiteFooterCategoryInfo(array $data): array;
+    public function selectWebsiteCategory(array $data): array;
 }

Plik diff jest za duży
+ 0 - 0
runtime/container/scan.cache


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików