From bf469e33ee287c8adf21ef60ed6f43f315122b0a Mon Sep 17 00:00:00 2001 From: leon <916117771@qq.com> Date: Wed, 22 Apr 2026 00:21:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(timetask):=20=E4=BF=AE=E5=A4=8D=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E8=AE=B0=E5=BD=95=E6=9B=B4=E6=96=B0=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=93=8D=E5=BA=94=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将成功响应移动到数据库更新操作之后 - 确保在捕获异常之前返回正确的成功状态 - 避免在错误处理分支中执行成功响应逻辑 --- application/timetask/controller/Index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/timetask/controller/Index.php b/application/timetask/controller/Index.php index d889285..9391b16 100644 --- a/application/timetask/controller/Index.php +++ b/application/timetask/controller/Index.php @@ -37,12 +37,13 @@ class Index extends Api Db::name('history')->where('expect', $item['expect'])->update($insert_data); } } + $this->success('获取成功'); } catch (\Exception $e) { $this->error($e->getMessage()); } - $this->success('获取成功'); + } else { $this->error('获取失败'); }