From 3cc063d5b313ced7c05cc853bac8fda889dbf0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Wed, 8 Nov 2017 16:33:10 +0800 Subject: [PATCH] * Fix delete MySQL affair for socre module --- module/score/model.php | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/module/score/model.php b/module/score/model.php index 0b4d28892b..dd85dd50b6 100644 --- a/module/score/model.php +++ b/module/score/model.php @@ -212,31 +212,21 @@ class scoreModel extends model } } - $this->dao->begin(); - try - { - $user = $this->loadModel('user')->getById($account); + $user = $this->loadModel('user')->getById($account); - $data = new stdClass(); - $data->account = $account; - $data->module = $module; - $data->method = $method; - $data->desc = $desc; - $data->objectID = $objectID; - $data->before = $user->score; - $data->score = $rule['score']; - $data->after = $user->score + $rule['score']; - $data->time = empty($time) ? helper::now() : $time; - $this->dao->insert(TABLE_SCORE)->data($data)->exec(); + $data = new stdClass(); + $data->account = $account; + $data->module = $module; + $data->method = $method; + $data->desc = $desc; + $data->objectID = $objectID; + $data->before = $user->score; + $data->score = $rule['score']; + $data->after = $user->score + $rule['score']; + $data->time = empty($time) ? helper::now() : $time; + $this->dao->insert(TABLE_SCORE)->data($data)->exec(); - $this->dao->query("UPDATE " . TABLE_USER . " SET `score`=`score` + " . $rule['score'] . ",`scoreLevel`=`scoreLevel` + " . $rule['score'] . " WHERE `account`='" . $account . "'"); - - $this->dao->commit(); - } - catch(ErrorException $e) - { - $this->dao->rollBack(); - } + $this->dao->query("UPDATE " . TABLE_USER . " SET `score`=`score` + " . $rule['score'] . ",`scoreLevel`=`scoreLevel` + " . $rule['score'] . " WHERE `account`='" . $account . "'"); } /**