From 1b9a372be9fa36770d789b921e1d12441336a715 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 16 Oct 2020 16:09:49 +0800 Subject: [PATCH] 1 --- webapp/controller/PassController.class.php | 53 ++++++++++++++++++++++ webapp/controller/ShopController.class.php | 11 ++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/webapp/controller/PassController.class.php b/webapp/controller/PassController.class.php index c41685c..1dc35cd 100644 --- a/webapp/controller/PassController.class.php +++ b/webapp/controller/PassController.class.php @@ -436,6 +436,18 @@ class PassController{ 'item_num' => $drop_multiply[1], )); $level = $ii; + $ret = $conn->execScript('UPDATE activity SET item_id=:item_id, item_num=:item_num, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':item_id' => $drop_multiply[0], + ':item_num' => $drop_multiply[1], + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } } } $addreward = new classes\AddReward(); @@ -461,5 +473,46 @@ class PassController{ 'diamond_nums' => $diamond_num )); } + + public function getSeaDoubleReward() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + $conn = $this->getMysql($account_id); + if (!$conn) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $row = $conn->execQueryOne('SELECT item_id, item_num FROM activity WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家'); + return; + } + //增加奖励 + $times = 2; + $addreward = new classes\AddReward(); + $addreward->addReward($row['item_id'], $row['item_num'] * $times, $account_id); + $coin_num = $addreward->getCoinNum($account_id); + $reward = array(); + array_push($reward, array( + 'item_id' => $row['item_id'], + 'item_num' => $row['item_num'] * $times, + )); + $diamond_num = $addreward->getDiamondNum($account_id); + echo json_encode(array( + 'errcode' => 0, + 'errmsg'=> '', + 'item_list' => $reward, + 'diamond_nums' => $diamond_num + )); + } } ?> diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 14dad99..51eb260 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -285,8 +285,15 @@ class ShopController{ return; } //增加奖励 - $p = $this->getParameter(REWARD_TIMES); - $times = $p['param_value'] - 1; + $isflag = 0; + if (isset($_REQUEST['type'])) { + $isflag = $_REQUEST['type']; + } + $times = 1; + if ($isflag == 0) { + $p = $this->getParameter(REWARD_TIMES); + $times = $p['param_value'] - 1; + } $addreward = new classes\AddReward(); $addreward->addReward($item_id, $item_num * $times, $account_id); $coin_num = $addreward->getCoinNum($account_id);