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(){