Przeglądaj źródła

修改获取广告及修改搜索栏目的接口

15313670163 2 miesięcy temu
rodzic
commit
e35e1bf8d6
2 zmienionych plików z 18 dodań i 14 usunięć
  1. 18 14
      app/JsonRpc/WebsiteService.php
  2. 0 0
      runtime/container/scan.cache

+ 18 - 14
app/JsonRpc/WebsiteService.php

@@ -1392,10 +1392,10 @@ class WebsiteService implements WebsiteServiceInterface
             if (empty($website)) {
             if (empty($website)) {
                 return Result::error("暂无该网站",0); 
                 return Result::error("暂无该网站",0); 
             }
             }
-            $category = WebsiteCategory::where('website_id',$data['website_id'])->where('pid',$data['pid'])->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'])) {
@@ -1403,11 +1403,12 @@ class WebsiteService implements WebsiteServiceInterface
                 if (empty($cityid)) {
                 if (empty($cityid)) {
                     return Result::error("暂无此城市", 0);
                     return Result::error("暂无此城市", 0);
                 } else {
                 } else {
-                    $result = $query->whereRaw('JSON_CONTAINS(city_arr_id,?)', [$data['cityid']])->get();
+                    $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($result)) {
-                        return Result::error("暂无此城市下的二级导航", 0); 
+                    if (empty($city_category)) {
+                        return Result::error("暂无此城市下的导航", 0); 
                     }
                     }
+                    $result['catid'] = $city_category;
                     $city = 1;
                     $city = 1;
                     // var_dump("城市====================",$result);
                     // var_dump("城市====================",$result);
                 }
                 }
@@ -1417,22 +1418,25 @@ class WebsiteService implements WebsiteServiceInterface
                 if (empty($departmentid)) {
                 if (empty($departmentid)) {
                     return Result::error("暂无此部门", 0);
                     return Result::error("暂无此部门", 0);
                 } else {
                 } else {
-                    $result = $query->whereRaw('JSON_CONTAINS(department_arr_id,?)', [$data['department_id']])->get();
-                    if (empty($result)) {
-                        return Result::error("暂无此部门下的二级导航", 0);
+                    $depart_category = $query->whereRaw('JSON_CONTAINS(department_arr_id,?)', [$data['department_id']])->pluck('id');
+                    if (empty($depart_category)) {
+                        return Result::error("暂无此部门下的导航", 0);
                     }
                     }
+                    $result['catid'] = $depart_category;
                     // var_dump("职能部门*******************",$result);
                     // var_dump("职能部门*******************",$result);
                     $department = 1;
                     $department = 1;
                 }
                 }
             }
             }
            if(!empty($city) && !empty($department)){
            if(!empty($city) && !empty($department)){
             // var_dump("城市和职能部门----------------------",$result);
             // 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();
-           }
+                $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)) {
+                    return Result::error("暂无此城市和职能部门下的导航", 0);
+                }
+                $result['catid'] = $sel_category;
+            }
             if (empty($result)) {
             if (empty($result)) {
-                return Result::error("暂无二级导航",0);
+                return Result::error("暂无导航",0);
             }  
             }  
             
             
             // department_id
             // department_id
@@ -1469,7 +1473,7 @@ class WebsiteService implements WebsiteServiceInterface
         return Result::success($result);
         return Result::success($result);
     }
     }
      /*
      /*
-     * 搜索网站二级导航
+     * 获取某个栏目
      * @param array $data
      * @param array $data
      * @return array
      * @return 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