liugc 1 год назад
Родитель
Сommit
ab5ceceb41
2 измененных файлов с 47 добавлено и 0 удалено
  1. 16 0
      app/api/controller/IssueWorkController.php
  2. 31 0
      app/api/logic/IssueWorkLogic.php

+ 16 - 0
app/api/controller/IssueWorkController.php

@@ -77,4 +77,20 @@ class IssueWorkController extends BaseApiController
         $result = IssueWorkLogic::detail($params);
         return $this->data($result);
     }
+    /**
+     * 完结投诉
+     * @return \think\response\Json
+     */
+    public function complaintComplete()
+    {
+        $params = (new IssueWorkValidate())->post()->goCheck('detail', [
+            'user_id' => $this->userId,
+            'user_info' => $this->userInfo
+        ]);
+        $result = IssueWorkLogic::complaintComplete($params);
+        if (false === $result) {
+            return $this->fail(IssueWorkLogic::getError());
+        }
+        return $this->success('提交成功', [], 1, 1);
+    }
 }

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

@@ -133,4 +133,35 @@ class IssueWorkLogic extends BaseLogic
         }
         return $issue_work;
     }
+
+    /**
+     * @notes 完结投诉
+     * @param $params
+     * @return array|false
+     */
+    public static function complaintComplete($params)
+    {
+        try {
+            $issue = IssueWork::where(['user_id'=>$params['user_id'],'id'=>$params['id']])->findOrEmpty();
+            if($issue->isEmpty()){
+                throw new Exception('投诉不存在');
+            }
+            if($issue['responsible'] != 3){
+                throw new Exception('定责不可操作');
+            }
+            $issue->issue_approval = 4;
+            $issue->complaint_status = 2;
+            $issue->finished_time = time();
+            $issue->save();
+
+            $return = ReturnWork::where('service_work_id',$issue->service_work_id)->findOrEmpty();
+            if(!$return->isEmpty()){
+                $return->return_status = 4;
+            }
+            return [];
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
 }