From 08e90b58e9661e00fec4fb4245767104f60f353f Mon Sep 17 00:00:00 2001 From: knowpia <9812993@qq.com> Date: Wed, 14 Sep 2022 13:44:31 +0800 Subject: [PATCH] fix bug --- app/controller/Help.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controller/Help.php b/app/controller/Help.php index cccfefb..f11058f 100644 --- a/app/controller/Help.php +++ b/app/controller/Help.php @@ -30,7 +30,7 @@ class Help $data['sha'] = sha1(json_encode($data)); Db::startTrans(); -// try { + try { $info = Db::name("app_help_log")->where("sha", $data['sha'])->find(); if (!empty($info)) { return show("你今天已经为他助力过,谢谢!"); @@ -49,15 +49,15 @@ class Help Db::name("app_help")->where(["id" => $appHelp['id']])->inc("count", 1)->update(); } - Db::name("student")->where(["id" => $info['id']])->inc("hot", 1)->update(); - Db::name("student")->where(["id" => $info['id']])->inc("mhot_count", 1)->update(); + Db::name("student")->where(["id" => $student_id])->inc("hot", 1)->update(); + Db::name("student")->where(["id" => $student_id])->inc("mhot_count", 1)->update(); Db::commit(); return show("助力成功!", SUCCESS_CODE, []); -// }catch (\Exception $e) { -// Db::rollback(); -// return show("助力失败!"); -// } + }catch (\Exception $e) { + Db::rollback(); + return show("助力失败!"); + } } public function lists(){