Переглянути джерело

新增接口:获取官网导航

FengR 1 місяць тому
батько
коміт
b879469e03

+ 31 - 1
app/JsonRpc/WebService.php

@@ -70,6 +70,7 @@ use App\Model\Message;
 use App\Model\ResearchTopic;
 use App\Model\RetopicUser;
 use App\Model\SinglePage;
+use App\Model\WebCateinfo;
 #[RpcService(name: "WebService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
 class WebService implements WebServiceInterface
 {
@@ -3979,5 +3980,34 @@ class WebService implements WebServiceInterface
     }
     return Result::success($child_cate);
   }
-
+  /**
+   * @param array $data
+   * @return array
+   */
+  public function getWebsiteTypeweb(array $data): array
+  {
+    $web = Website::where('id',$data['website_id'])->first();
+    if (empty($web)) {
+      return Result::error("暂无相关网站信息", 0);
+    }
+    unset($data['website_id']);
+    $where = ['status' => 1];
+    if (isset($data['province_id']) && !empty($data['province_id'])) {
+        $where['province_id'] = $data['province_id'];
+    }
+    if (isset($data['city_id']) && !empty($data['city_id'])) {
+        $where['city_id'] = $data['city_id'];
+    }
+    if (isset($data['county_id']) && !empty($data['county_id'])) {
+        $where['county_id'] = $data['county_id'];
+    }
+    if (isset($data['type_id']) && !empty($data['type_id'])) {
+        $where['type_id'] = $data['type_id'];
+    }
+    $web_cateinfo = WebCateinfo::where($where)->get()->all();
+    if (empty($web_cateinfo)) {
+      return Result::error("暂无相关官网导航相关信息!", 0);
+    }
+    return Result::success($web_cateinfo); 
+  }  
 }

+ 5 - 0
app/JsonRpc/WebServiceInterface.php

@@ -226,4 +226,9 @@ interface WebServiceInterface
      * @return array
      */
     public function getWebsiteApplyJoin(array $data): array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getWebsiteTypeweb(array $data): array;
 }

+ 29 - 0
app/Model/WebCateinfo.php

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