Kaynağa Gözat

获取城市列表

whitefang 1 yıl önce
ebeveyn
işleme
afda6bf381

+ 15 - 2
app/api/controller/IssueWorkController.php

@@ -1,7 +1,8 @@
 <?php
 namespace app\api\controller;
 
-use app\api\logic\works\IssueWorkLogic;
+use app\api\lists\IssueWorkLists;
+use app\api\logic\IssueWorkLogic;
 use app\api\validate\IssueWorkValidate;
 use app\common\model\dict\DictData;
 
@@ -12,9 +13,21 @@ use app\common\model\dict\DictData;
  */
 class IssueWorkController extends BaseApiController
 {
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/10 15:06
+     */
+    public function lists()
+    {
+        return $this->dataLists(new IssueWorkLists());
+    }
+
+
     /**
      * 获取投诉分类
-     * @return void
+     * @return \think\response\Json
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException

+ 63 - 0
app/api/lists/IssueWorkLists.php

@@ -0,0 +1,63 @@
+<?php
+namespace app\api\lists;
+use app\common\model\works\IssueWork;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * IssueWork列表
+ * Class IssueWorkLists
+ * @package app\adminapi\listsworks
+ */
+class IssueWorkLists extends BaseApiDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/07/10 15:06
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['work_sn', 'service_work_id', 'master_worker_id', 'issue_approval', 'complaint_status', 'responsible', 'complaint_details', 'finished_time', 'approval_admin_id', 'approval_time', 'create_time', 'update_time'],
+
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/07/10 15:06
+     */
+    public function lists(): array
+    {
+        return IssueWork::where($this->searchWhere)
+            ->where('user_id',$this->userId)
+            ->field(['id', 'work_sn', 'service_work_id', 'master_worker_id', 'issue_approval', 'complaint_status', 'responsible', 'complaint_details', 'complaint_images', 'finished_time', 'approval_admin_id', 'approval_time', 'create_time', 'update_time'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/07/10 15:06
+     */
+    public function count(): int
+    {
+        return IssueWork::where($this->searchWhere)->where('user_id',$this->userId)->count();
+    }
+
+}

+ 1 - 0
app/api/logic/IssueWorkLogic.php

@@ -42,6 +42,7 @@ class IssueWorkLogic extends BaseLogic
                 'master_worker_id' => $params['master_worker_id'],
                 'complaint_details' => $params['complaint_details'],
                 'complaint_images' => !empty($params['complaint_images']) ? $params['complaint_images'] : '',
+                'user_id'=>$params['user_id']
             ]);
 
             Db::commit();