LiuJ 2 ngày trước cách đây
mục cha
commit
0986d35113
3 tập tin đã thay đổi với 128 bổ sung58 xóa
  1. 74 58
      app/JsonRpc/WebsiteService.php
  2. 27 0
      app/Model/Company.php
  3. 27 0
      app/Model/Project.php

+ 74 - 58
app/JsonRpc/WebsiteService.php

@@ -33,6 +33,8 @@ use App\Model\Notice;
 use App\Model\Complaint;
 use App\Model\Order;
 use App\Model\WebsiteImg;
+use App\Model\Commpany;
+use App\Model\Project;
 use App\Model\ChatTopicsReply;
 use Hyperf\HttpServer\Contract\RequestInterface;
 
@@ -557,49 +559,50 @@ class WebsiteService implements WebsiteServiceInterface
             $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.name as place_name',
-                'ad_place.thumb',
-                'ad_place.ad_tag',
-                'ad_place.introduce',
-                'ad.name as ad_name',
-                'ad.image_src',
-                'ad.image_url',
-                'ad.image_alt')
-            ->get()->all();
-            
-        }else{
+                ->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.name as place_name',
+                    'ad_place.thumb',
+                    'ad_place.ad_tag',
+                    'ad_place.introduce',
+                    'ad.name as ad_name',
+                    'ad.image_src',
+                    'ad.image_url',
+                    'ad.image_alt'
+                )
+                ->get()->all();
+        } else {
             $now = Carbon::now()->format('Y-m-d H:i:s'); // 获取当前时间
             // return Result::success($where);
             $result =  AdPlace::where($where)
-            ->where('ad_place.website_id',$data['website_id'])
-            ->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.name as place_name',
-                'ad_place.thumb',
-                'ad_place.ad_tag',
-                'ad_place.introduce',
-                'ad.name as ad_name',
-                'ad.image_src',
-                'ad.image_url',
-                'ad.image_alt')
-            ->get()->all();
+                ->where('ad_place.website_id', $data['website_id'])
+                ->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.name as place_name',
+                    'ad_place.thumb',
+                    'ad_place.ad_tag',
+                    'ad_place.introduce',
+                    'ad.name as ad_name',
+                    'ad.image_src',
+                    'ad.image_url',
+                    'ad.image_alt'
+                )
+                ->get()->all();
             // return Result::error("请选择广告位!",0);
         }
-        if(empty($result)){
-                return Result::error("此广告位不存在!",0);
-            } 
+        if (empty($result)) {
+            return Result::error("此广告位不存在!", 0);
+        }
         return Result::success($result);
     }
 
@@ -2483,38 +2486,50 @@ class WebsiteService implements WebsiteServiceInterface
      */
     public function getWebsiteAllinfo(array $data): array
     {
-        $website = Website::where('id',$data['website_id'])->where('status',1)->first();
+        $website = Website::where('id', $data['website_id'])->where('status', 1)->first();
         if (empty($website)) {
-            return Result::error("暂无该网站",0); 
+            return Result::error("暂无该网站", 0);
         }
-        if(isset($data['website_id']) && !empty($data['website_id'])){
-            $website_head = Website::where('id',$data['website_id'])
-                ->where('status',1)
-                ->select('id', 'website_name', 'logo', 'title', 'keywords', 'description', 
-                'suffix', 'website_url','ad_key','api_url','login_url','weblog_url')
+        if (isset($data['website_id']) && !empty($data['website_id'])) {
+            $website_head = Website::where('id', $data['website_id'])
+                ->where('status', 1)
+                ->select(
+                    'id',
+                    'website_name',
+                    'logo',
+                    'title',
+                    'keywords',
+                    'description',
+                    'suffix',
+                    'website_url',
+                    'ad_key',
+                    'api_url',
+                    'login_url',
+                    'weblog_url'
+                )
                 ->first();
             if (empty($website_head)) {
-                return Result::error("找不到网站",0); 
+                return Result::error("找不到网站", 0);
             }
-        }else{
-            return Result::error("参数错误",0);
+        } else {
+            return Result::error("参数错误", 0);
         }
-        $website_foot['foot_info'] = WebsiteTemplateInfo::where('website_id',$data['website_id'])->first();
+        $website_foot['foot_info'] = WebsiteTemplateInfo::where('website_id', $data['website_id'])->first();
         if (empty($website_foot)) {
-            return Result::error("暂无底部基础信息",0);
+            return Result::error("暂无底部基础信息", 0);
         }
         $website_head['website_url'] = $website_head['website_url'] ? json_decode($website_head['website_url']) : [];
-        $result['website_head'] =$website_head;
+        $result['website_head'] = $website_head;
         $result['website_foot'] = $website_foot;
-        
+
         // return Result::success($result);
         // 1:图片 2:文字 3:底部
-        $result['website_foot']['foot_cate'] = FooterCategory::where('website_id',$data['website_id'])->get()->all();
-        $result['website_foot']['link_img'] = Link::where('website_id',$data['website_id'])->where('type',1)->where('status',1)->limit($data['link_imgnum'])->orderBy('sort')->get()->all(); 
-        $result['website_foot']['link_text'] = Link::where('website_id',$data['website_id'])->where('type',2)->where('status',1)->limit($data['link_textnum'])->orderBy('sort')->get()->all();
-        $result['website_foot']['link_foot'] = Link::where('website_id',$data['website_id'])->where('type',3)->where('status',1)->limit($data['link_footnum'])->orderBy('sort')->get()->all();
-        if(empty($result)){
-            return Result::error("暂无此网站信息",0);
+        $result['website_foot']['foot_cate'] = FooterCategory::where('website_id', $data['website_id'])->get()->all();
+        $result['website_foot']['link_img'] = Link::where('website_id', $data['website_id'])->where('type', 1)->where('status', 1)->limit($data['link_imgnum'])->orderBy('sort')->get()->all();
+        $result['website_foot']['link_text'] = Link::where('website_id', $data['website_id'])->where('type', 2)->where('status', 1)->limit($data['link_textnum'])->orderBy('sort')->get()->all();
+        $result['website_foot']['link_foot'] = Link::where('website_id', $data['website_id'])->where('type', 3)->where('status', 1)->limit($data['link_footnum'])->orderBy('sort')->get()->all();
+        if (empty($result)) {
+            return Result::error("暂无此网站信息", 0);
         }
         return Result::success($result);
     }
@@ -2641,6 +2656,7 @@ class WebsiteService implements WebsiteServiceInterface
         //根据pid取出所有的websiteCategory 中的id
         $list = WebsiteCategory::query()
             ->where('website_id', '=', $data['website_id'])
+            ->where('is_url', '!=', 1)
             ->where('pid', '=', $data['pid'])
             ->whereIn('category_id', $category_ids)
             ->get();

+ 27 - 0
app/Model/Company.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Company extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'company';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $guarded = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/Project.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Project extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'project';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}