diff --git a/webapp/controller/HangController.class.php b/webapp/controller/HangController.class.php index 0a50d40..6a427dd 100644 --- a/webapp/controller/HangController.class.php +++ b/webapp/controller/HangController.class.php @@ -57,6 +57,12 @@ class HangController{ if ($weight != 0) { $num = $num * 3; } + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_num' => $num + )); } echo json_encode(array( 'errcode' => 0, diff --git a/webapp/controller/QuestController.class.php b/webapp/controller/QuestController.class.php index 7d2d718..4b50568 100644 --- a/webapp/controller/QuestController.class.php +++ b/webapp/controller/QuestController.class.php @@ -346,6 +346,14 @@ class QuestController{ 'item_id' => $item_id, 'item_num' => $item_num, )); + if ($item_id == 10001) { + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_num' => $item_num + )); + } } else { $q = $this->getQuest($quest_id); if (!$q) { @@ -353,7 +361,12 @@ class QuestController{ return; } $reward = $q['gold']; - error_log($reward); + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_num' => $reward + )); } if ($row['quest_type'] == 1) { $active = $conn->execQueryOne('SELECT active_num, active_sum FROM active WHERE accountid=:accountid;', diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index cda349b..985354b 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -89,6 +89,8 @@ class RoleController{ $harm_his = $harm; $alive_time_his = $alive_time; $add_HP_his = $add_HP; + $coin_num = $_REQUEST['coin_num']; + if (!$conn) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; @@ -150,6 +152,12 @@ class RoleController{ die(); return; } + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_num' => $coin_num + )); //刷新任务 $quest = new classes\Quest(); $quest->triggerQuest(71003, 1, 1, $account_id); diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index aa3b467..41c0c7d 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -63,6 +63,12 @@ class SignController{ $s = $this->getSign($sign_days + 90000); $item_id = $s['item_id']; $num = $s['num']; + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_num' => $num + )); $quest = new classes\Quest(); $quest->triggerQuest(71001, 1, 1, $account_id); $quest->triggerQuest(72001, 2, 1, $account_id); @@ -86,6 +92,12 @@ class SignController{ $s = $this->getSign($sign_days % 7 + 90000); $item_id = $s['item_id']; $num = $s['num']; + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_num' => $num + )); $quest = new classes\Quest(); $quest->triggerQuest(71001, 1, 1, $account_id); $quest->triggerQuest(72001, 2, 1, $account_id); diff --git a/webapp/controller/SupplyBoxController.class.php b/webapp/controller/SupplyBoxController.class.php index 4367174..aec74c2 100644 --- a/webapp/controller/SupplyBoxController.class.php +++ b/webapp/controller/SupplyBoxController.class.php @@ -186,6 +186,14 @@ class SupplyBoxController{ 'item_id' => $item_id, 'item_num' => $item_num, )); + if ($item_id == 10001) { + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_num' => $item_num + )); + } $quest = new classes\Quest(); $quest->triggerQuest(71004, 1, 1, $account_id); $quest->triggerQuest(72004, 2, 1, $account_id); @@ -237,13 +245,13 @@ class SupplyBoxController{ } else { if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['last_buy_time']) > 0) { $ret = $conn->execScript('UPDATE supplybox SET buy_times=:buy_times, last_buy_time=:time ' . - ' WHERE accountid=:accountid AND box_id=:box_id;', - array( - ':accountid' => $account_id, - ':box_id' => $box_id, - ':buy_times' => 0, - ':time' => time() - )); + ' WHERE accountid=:accountid AND box_id=:box_id;', + array( + ':accountid' => $account_id, + ':box_id' => $box_id, + ':buy_times' => 0, + ':time' => time() + )); if (!$ret) { die(); return;