From 9a72912fa1502bbc562791383ac408d343f2d259 Mon Sep 17 00:00:00 2001 From: yangduo Date: Wed, 18 Dec 2024 14:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=B9=B8=E8=BF=90=E5=AE=9D=E7=AE=B1?= =?UTF-8?q?=20=E9=92=BB=E7=9F=B3=E6=8A=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ActivityController.class.php | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) 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();