Browse Source

删除获取静态资源详情的接口;修改获取静态资源列表、添加静态资源的接口

15313670163 1 week ago
parent
commit
9b8dbbf802
2 changed files with 12 additions and 23 deletions
  1. 12 22
      app/JsonRpc/WebsiteService.php
  2. 0 1
      app/JsonRpc/WebsiteServiceInterface.php

+ 12 - 22
app/JsonRpc/WebsiteService.php

@@ -2533,14 +2533,19 @@ class WebsiteService implements WebsiteServiceInterface
     {
         // return Result::success($data);
         $where = [];
-        if(isset($data['keyword']) &&!empty($data['keyword'])){
-            $where = ['img_alias' => $data['keyword'],'name' => ['like', '%'. $data['keyword']. '%']];
+        if(isset($data['img_alias']) &&!empty($data['img_alias'])){
+            array_push($where, ['img_alias', 'like', '%'. $data['img_alias']. '%']);
         }
         if(isset($data['type']) &&!empty($data['type'])){
-            $where = ['type' => $data['type']];
+            array_push($where, ['type', '=', $data['type']]);
         }
-        if(isset($data['website_id']) &&!empty($data['website_id'])){
-            $where = ['website_id' => $data['website_id']];
+        if(isset($data['website_name']) &&!empty($data['website_name'])){
+            $website = Website::where('website_name','like','%'.$data['website_name'].'%')->first();
+            if(empty($website)){
+                return Result::error("没有查找到相关数据", 0);
+            }else{
+                array_push($where, ['website_id', '=', $website['id']]);
+            }
         }
         // return Result::success($where);
         $query = WebsiteImg::when(!empty($where), function ($query) use ($where) {
@@ -2567,8 +2572,8 @@ class WebsiteService implements WebsiteServiceInterface
         // $file = $data['img_url']->file('image');
         // $size = $file->getSize();
         $img_data = [
-            'website_id' => $data['website_id'],
-            'img_alias' => $data['img_alias'],
+            'website_id' => $data['website_id'] ?? 0,
+            'img_alias' => $data['img_alias'] ?? '',
             'img_url' => $data['img_url'],
             'img_size' => $data['img_size'],
         ];
@@ -2621,20 +2626,5 @@ class WebsiteService implements WebsiteServiceInterface
         }
         return Result::success($result);
     }
-    /**
-     * 获取网站模板下的板块信息
-     * @param array $data
-     */
-    public function getStaticResourceInfo(array $data): array
-    {
-        $where = [
-            'id' => $data['id'],
-        ];
-        $result = WebsiteImg::where($where)->first();
-        if (empty($result)) {
-            return Result::error("没有查找到相关数据", 0);
-        }
-        return Result::success($result);
-    }
     // --自助建站-----------20250522fr----------------------end
 }

+ 0 - 1
app/JsonRpc/WebsiteServiceInterface.php

@@ -143,5 +143,4 @@ interface WebsiteServiceInterface
     public function getStaticResourceList(array $data): array;
     public function addStaticResource(array $data): array;
     public function delStaticResource(array $data): array;
-    public function getStaticResourceInfo(array $data): array;
 }