Эх сурвалжийг харах

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

15313670163 2 сар өмнө
parent
commit
e35e1bf8d6

+ 18 - 14
app/JsonRpc/WebsiteService.php

@@ -1392,10 +1392,10 @@ class WebsiteService implements WebsiteServiceInterface
             if (empty($website)) {
                 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);
             if (empty($category)) {
-                return Result::error("暂无二级导航",0); 
+                return Result::error("暂无导航",0); 
             }
             $query = Category::whereIn('id', $category);
             if (isset($data['cityid']) && !empty($data['cityid'])) {
@@ -1403,11 +1403,12 @@ class WebsiteService implements WebsiteServiceInterface
                 if (empty($cityid)) {
                     return Result::error("暂无此城市", 0);
                 } 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']];
-                    if (empty($result)) {
-                        return Result::error("暂无此城市下的二级导航", 0); 
+                    if (empty($city_category)) {
+                        return Result::error("暂无此城市下的导航", 0); 
                     }
+                    $result['catid'] = $city_category;
                     $city = 1;
                     // var_dump("城市====================",$result);
                 }
@@ -1417,22 +1418,25 @@ class WebsiteService implements WebsiteServiceInterface
                 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);
+                    $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);
                     $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();
-           }
+                $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)) {
-                return Result::error("暂无二级导航",0);
+                return Result::error("暂无导航",0);
             }  
             
             // department_id
@@ -1469,7 +1473,7 @@ class WebsiteService implements WebsiteServiceInterface
         return Result::success($result);
     }
      /*
-     * 搜索网站二级导航
+     * 获取某个栏目
      * @param array $data
      * @return array
      * */

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
runtime/container/scan.cache


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно