소스 검색

修改b端接口:获取全局表单列表的接口;

FengR 1 주 전
부모
커밋
c113e50b09
4개의 변경된 파일114개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      app/JsonRpc/FormService.php
  2. 34 0
      app/Model/GlobalTable.php
  3. 45 0
      app/Model/GlobalTableField.php
  4. 28 0
      app/Model/GlobalTableFieldType.php

+ 7 - 2
app/JsonRpc/FormService.php

@@ -111,8 +111,13 @@ class FormService implements FormServiceInterface
             $query = GlobalTable::query()
                 ->when(!empty($data['name']), function($q) use ($data) {
                     return $q->where('name', 'like', '%' . $data['name'] . '%');
-                });
-            
+                })
+                ->when(!empty($data['website_id']), function($q) use ($data) {
+                    return $q->where('website_id', $data['website_id']);
+                })
+                ->leftJoin('hyperf.website', 'hyperf.website.id', '=', 'global_table.website_id')
+                ->select('global_table.*', 'hyperf.website.website_name');
+
             // 分页参数
             $page = (int)($data['page'] ?? 1);
             $pageSize = (int)($data['pageSize'] ?? 10);

+ 34 - 0
app/Model/GlobalTable.php

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

+ 45 - 0
app/Model/GlobalTableField.php

@@ -0,0 +1,45 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class GlobalTableField extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'global_table_field';
+    /**
+     * The connection name for the model.
+     */
+    protected ?string $connection = 'global';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [
+        'table_id',
+        'field_name',
+        'title',
+        'field_type',   
+        'option',
+        'length',
+        'sort',
+        'is_check',
+        'admin_display',
+        'home_display',
+        'disable_del',
+        'regular'
+    ];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+
+}

+ 28 - 0
app/Model/GlobalTableFieldType.php

@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class GlobalTableFieldType extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'global_table_field_type';
+    /**
+     * The connection name for the model.
+     */
+    protected ?string $connection = 'global';
+
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+
+}