From 0b34ad756e9b895f77ef3bb37aff677ec4c18975 Mon Sep 17 00:00:00 2001 From: ztt <835303992@qq.com> Date: Thu, 29 Feb 2024 10:11:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E6=94=B6=E8=AE=A2=E5=8D=95=E6=94=B9?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Recovery.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/api/controller/Recovery.php b/app/api/controller/Recovery.php index 909b7b2c..b6325d42 100644 --- a/app/api/controller/Recovery.php +++ b/app/api/controller/Recovery.php @@ -134,11 +134,17 @@ class Recovery extends Controller if (empty($params['order_id']) || empty($params['recovery_id']) || empty($params['status'])) { return $this->renderError('缺少必要参数'); } - $model = new RecoveryOrder(); - $res = $model->save(['order_status' => $params['status']]); - if ($res) { - return $this->renderSuccess('更新成功'); + + $model = (new RecoveryOrder())::detail($params['order_id']); + if ($model) { + if($params['status'] == RecoveryStatusEnum::ALREADY || $params['status'] == RecoveryStatusEnum::FINISN) { + $res = $model->save(['order_status' => $params['status']]); + if ($res) { + return $this->renderSuccess('更新成功'); + } + } } + return $this->renderError('更新失败'); }