diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index 28b3053..64dc75c 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -1643,7 +1643,7 @@ class ActivityController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - if ($row['cd_time'] < time() && $row['cd_time'] != 0) { + if ($row['cd_time'] > time()) { phpcommon\sendError(ERR_USER_BASE + 2, '冷却时间未到'); return; } @@ -1653,6 +1653,49 @@ class ActivityController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } + + $cost_strings = explode(":", $dr["onecost"]); + if (sizeof($cost_strings) > 1) { + if ($cost_strings[0] == 10003) { + $count = $cost_strings[1]; + + $row = $conn->execQueryOne( + 'SELECT diamond_num, first_gift, free_coin, free_diamond FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + ) + ); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + //扣除钻石 + if ($row['diamond_num'] < $count) { + phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足'); + return; + } + $ret = $conn->execScript( + 'UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':diamond_num' => $row['diamond_num'] - $count, + ':modify_time' => time() + ) + ); + if (!$ret) { + die(); + return; + } + } else { + phpcommon\sendError(ERR_USER_BASE + 3, '货币不足'); + return; + } + } else { + die(); + return; + } + $drop_id = $dr['one_drop']; $times = $dr['one_count']; $item_list = array();