Преглед на файлове

Merge branch 'web_sannong_fr' into dev

15313670163 преди 1 месец
родител
ревизия
5db312485e
променени са 1 файла, в които са добавени 21 реда и са изтрити 18 реда
  1. 21 18
      app/JsonRpc/WebsiteService.php

+ 21 - 18
app/JsonRpc/WebsiteService.php

@@ -513,27 +513,26 @@ class WebsiteService implements WebsiteServiceInterface
     public function getWebsiteAdvertisement(array $data): array
     {
         $where = [
-            'website_id' => $data['website_id'],
             'ad_place.status' => 1,
-            // 'ad.status' => 1,
         ];
         if (isset($data['ad_tag']) && !empty($data['ad_tag'])) {
             $now = Carbon::now()->format('Y-m-d H:i:s'); // 获取当前时间
-            $where[] = ['ad_place.ad_tag', 'like', '%' . $data['ad_tag'] . '%'];
-            $result = AdPlace::where($where)
-                ->leftJoin("ad", function ($join) use ($now) {
-                    $join->on("ad.pid", "=", "ad_place.id")
-                        ->where('ad.status', 1)
-                        ->where('ad.fromtime', '<=', $now)
-                        ->where('ad.totime', '>=', $now);
-                })
-                ->select("ad_place.*", 'ad.*', "ad_place.id as ad_place_id", "ad.name as ad_name")
-                ->get()->all();
-            if (empty($result)) {
-                return Result::error("此广告位不存在!", 0);
-            }
-        } else {
-            return Result::error("请选择广告位!", 0);
+            $where[] = ['ad_place.ad_tag','like','%'.$data['ad_tag'].'%'];
+            // return Result::success($where);
+            $result =  AdPlace::where($where)
+            ->leftJoin("ad", function ($join) use ($now) {
+                $join->on("ad.pid", "=", "ad_place.id")
+                     ->where('ad.status', 1)
+                     ->where('ad.fromtime', '<=', $now)
+                     ->where('ad.totime', '>=', $now);
+            })
+            ->select("ad_place.*",'ad.*',"ad_place.id as ad_place_id","ad.name as ad_name")
+            ->get()->all();
+            if(empty($result)){
+                return Result::error("此广告位不存在!",0);
+            } 
+        }else{
+            return Result::error("请选择广告位!",0);
         }
         return Result::success($result);
 
@@ -1482,13 +1481,17 @@ class WebsiteService implements WebsiteServiceInterface
         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);
+
+                return Result::error("暂无该网站",0); 
             }
             $category = WebsiteCategory::where('website_id',$data['website_id'])->where('category_id',$data['category_id'])->first();
             if (empty($category)) {
                 return Result::error("暂无此导航",0);
             }
             $category['children_count'] = WebsiteCategory::where('website_id',$data['website_id'])->where('pid',$data['category_id'])->count();
+            $parent = WebsiteCategory::where('website_id',$data['website_id'])->where('category_id',$category['pid'])->select('category_id as parent_id','alias as parent_name')->first();
+            $category['parent_id'] = $parent['parent_id']?? '';
+            $category['parent_name'] = $parent['parent_name']?? '';
             return Result::success($category);
         }else{
             return Result::error("参数错误",0);