diff --git a/webapp/controller/SoloController.class.php b/webapp/controller/SoloController.class.php index c914339..995c9b5 100644 --- a/webapp/controller/SoloController.class.php +++ b/webapp/controller/SoloController.class.php @@ -328,6 +328,70 @@ class SoloController $this->levelaward(true); } + public function vidsettle() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + + $key = 'game2004api-vidsettle:' . $account_id; + $r = $this->getRedis($key); + if (!$r) { + phpcommon\sendError(ERR_USER_BASE + 1, '奖励不存在'); + return; + } + + $infostr = $r->get($key); + if (empty($infostr)) { + phpcommon\sendError(ERR_USER_BASE + 1, '奖励不存在 1'); + return; + } + + $infoobj = json_decode($infostr, true); + if ($infoobj['level'] != $_REQUEST['level'] || $infoobj['wave'] != $_REQUEST['wave']) { + phpcommon\sendError(ERR_USER_BASE + 1, '奖励不存在 2'); + return; + } + + $r->del($key); + + $item_list = $infoobj['item_list']; + $addreward = new classes\AddReward(); + $all_item_list = array(); + foreach ($item_list as $itemaward) { + $items = $addreward->addReward($itemaward['item_id'], $itemaward['item_num'], $account_id, 0, 0); + foreach ($items as $i) { + array_push($all_item_list, array( + 'item_id' => $i['item_id'], + 'item_num' => $i['item_num'], + 'time' => 0, + )); + } + } + + $coin_num = $addreward->getCoinNum($account_id); + $diamond_num = $addreward->getDiamondNum($account_id); + $adfree = $addreward->getAdfree($account_id); + $medals = $addreward->getMedals($account_id); + + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + 'level' => $_REQUEST['level'], + 'wave' => $_REQUEST['wave'], + 'coin_nums' => $coin_num, + 'diamond_nums' => $diamond_num, + 'adfree' => $adfree, + 'medals' => $medals, + 'item_list' => $item_list, + 'all_item_list' => $all_item_list, + )); + } + // 领取关卡宝箱 public function complete() { @@ -727,6 +791,7 @@ class SoloController } if ($itemstrs[0] == 10013) { $addexp += $itemstrs[1]; + continue; } $item_list[] = array( "item_id" => $itemstrs[0], @@ -745,6 +810,7 @@ class SoloController } if ($itemstrs[0] == 10013) { $addexp += $itemstrs[1]; + continue; } $item_list[] = array( "item_id" => $itemstrs[0], @@ -856,6 +922,22 @@ class SoloController } } + if ($isbattle) { + $key = 'game2004api-vidsettle:' . $account_id; + $r = $this->getRedis($key); + if ($r) { + $infoobj = array( + 'level' => $level, + 'wave' => $_REQUEST['wave'], + 'item_list' => $item_list, + ); + $infostr = json_encode($infoobj); + $r->set($key, $infostr); + $r->pexpire($key, 1000 * 86400); + error_log($key . ':' . $infostr); + } + } + $uplv_all_item_list = array(); foreach ($uplv_item_list as $itemaward) { $items = $addreward->addReward($itemaward['item_id'], $itemaward['item_num'], $account_id, 0, 0);