From 54ff3415384952bcc6f4be170a0d58aae793aa1d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 28 May 2019 10:27:56 +0800 Subject: [PATCH] 1 --- webapp/classes/Quest.php | 8 ++++-- webapp/controller/EquipController.class.php | 8 +++--- webapp/controller/RankController.class.php | 10 +++---- webapp/controller/RoleController.class.php | 30 +-------------------- 4 files changed, 16 insertions(+), 40 deletions(-) diff --git a/webapp/classes/Quest.php b/webapp/classes/Quest.php index 0a21458..04b9d3d 100644 --- a/webapp/classes/Quest.php +++ b/webapp/classes/Quest.php @@ -71,7 +71,9 @@ class Quest{ if ($row['quest_num'] + $quest_num >= $q['value']) { $quest_num = $q['value']; $quest_state = 1; - $this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id); + if ($quest_type == 1) { + $this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id); + } } else { $quest_num = $row['quest_num'] + $quest_num; $quest_state = 0; @@ -108,7 +110,9 @@ class Quest{ if ($quest_num >= $q['value']) { $quest_num = $q['value']; $quest_state = 1; - $this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id); + if ($quest_type == 1) { + $this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id); + } } } $ret = $conn->execScript('INSERT INTO quest(accountid, quest_id, quest_num, quest_type, quest_state) ' . diff --git a/webapp/controller/EquipController.class.php b/webapp/controller/EquipController.class.php index 6a69725..93c2d0f 100644 --- a/webapp/controller/EquipController.class.php +++ b/webapp/controller/EquipController.class.php @@ -39,20 +39,20 @@ class EquipController{ $e = $this->getEquip($equip_id); if (!$e) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个装备'); - return; + die(); } $conn = $this->getMysql($account_id); if (!$conn) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); - return; + die(); } $rowCoin = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id )); if ($rowCoin['coin_num'] < $e['equip_cost']) { - phpcommon\sendError(ERR_USER_BASE + 3, '金币不足'); - return; + phpcommon\sendError(ERR_USER_BASE + 3, '金币不足'); + die(); } $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' . ' WHERE accountid=:accountid;', diff --git a/webapp/controller/RankController.class.php b/webapp/controller/RankController.class.php index 59b69a9..2b7df20 100644 --- a/webapp/controller/RankController.class.php +++ b/webapp/controller/RankController.class.php @@ -52,7 +52,7 @@ class RankController{ $kill_db = json_decode($kill_rank_db); $i = 0; foreach ($kill_db as $kill) { - if ($i > 99) { + if ($i > 49) { break; } if ($kill_db[$i][0] == $account_id) { @@ -76,7 +76,7 @@ class RankController{ $alive_db = json_decode($alive_rank_db); $i = 0; foreach ($alive_db as $alive) { - if ($i > 99) { + if ($i > 49) { break; } if ($alive_db[$i][0] == $account_id) { @@ -100,7 +100,7 @@ class RankController{ $harm_db = json_decode($harm_rank_db); $i = 0; foreach ($harm_db as $harm) { - if ($i > 99) { + if ($i > 49) { break; } if ($harm_db[$i][0] == $account_id) { @@ -124,7 +124,7 @@ class RankController{ $rate_db = json_decode($rate_rank_db); $i = 0; foreach ($rate_db as $rate) { - if ($i > 99) { + if ($i > 49) { break; } if ($rate_db[$i][0] == $account_id) { @@ -148,7 +148,7 @@ class RankController{ $win_db = json_decode($win_rank_db); $i = 0; foreach ($win_db as $win) { - if ($i > 99) { + if ($i > 49) { break; } if ($win_db[$i][0] == $account_id) { diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 94e5da4..8163da6 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -110,35 +110,7 @@ class RoleController{ array( ':accountid' => $account_id )); - if (!$row) { - if ($rank == 1) { - $win_times = 1; - } else { - $win_times = 0; - } - $ret = $conn->execScript('INSERT INTO user(accountid, game_times, win_times, kills, harm, add_HP, alive_time, kill_his, alive_time_his, harm_his, add_HP_his, coin_num, integral) ' . - ' VALUES(:accountid, :game_times, :win_times, :kills, :harm, :add_HP, :alive_time, :kill_his, :alive_time_his, :harm_his, :add_HP_his, :coin_num, :integral);', - array( - ':accountid' => $account_id, - ':game_times' => 1, - ':win_times' => $win_times, - ':kills' => $kills, - ':harm' => $harm, - ':add_HP' => $add_HP, - ':alive_time' => $alive_time, - ':kill_his' => $kill_his, - ':alive_time_his' => $alive_time_his, - ':harm_his' => $harm_his, - ':add_HP_his' => $add_HP_his, - ':coin_num' => $coin_num, - ':integral' => $integral - - )); - if (!$ret) { - die(); - return; - } - } else { + if ($row) { if ($kill_his < $row['kill_his']) { $kill_his = $row['kill_his']; }