diff --git a/doc/Team.py b/doc/Team.py index 1daadc3..7ac73a7 100644 --- a/doc/Team.py +++ b/doc/Team.py @@ -5,65 +5,74 @@ import _common class Team(object): def __init__(self): - self.apis_ = [ - { - 'desc': 'createTeam', - 'group': 'Team', - 'url': 'webapp/index.php?c=Team&a=createTeam', - 'params': [ - _common.ReqHead(), - ['node_id', 0, '节点id'], - ['map_id', 0, '地图id'], - ], - 'response': [ - _common.RspHead(), - ['team_info', _common.TeamInfo(), '队伍信息'], - ] - }, - { - 'desc': 'teamInfo', - 'group': 'Team', - 'url': 'webapp/index.php?c=Team&a=teamInfo', - 'params': [ - _common.ReqHead(), - ['team_uuid', '', '队伍唯一id'], - ], - 'response': [ - _common.RspHead(), - ['team_info', _common.TeamInfo(), '队伍信息'], - ] - }, - { - 'desc': 'joinTeam', - 'group': 'Team', - 'url': 'webapp/index.php?c=Team&a=joinTeam', - 'params': [ - _common.ReqHead(), - ], - 'response': [ - _common.RspHead(), - ] - }, - { - 'desc': 'leaveTeam', - 'group': 'Team', - 'url': 'webapp/index.php?c=Team&a=leaveTeam', - 'params': [ - _common.ReqHead(), - ], - 'response': [ - _common.RspHead(), - ] - }, - { - 'desc': 'startGame', - 'group': 'Team', - 'url': 'webapp/index.php?c=Team&a=startGame', - 'params': [ - _common.ReqHead(), - ], - 'response': [ - _common.RspHead(), - ] - }, + self.apis = [ + { + 'name': 'createTeam', + 'desc': '创建队伍', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=createTeam', + 'params': [ + _common.ReqHead(), + ['node_id', 0, '节点id'], + ['map_id', 0, '地图id'], + ], + 'response': [ + _common.RspHead(), + ['team_uuid', '', '队伍唯一id'], + ] + }, + { + 'name': 'teamInfo', + 'desc': '获取队伍信息', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=teamInfo', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ], + 'response': [ + _common.RspHead(), + ['team_info', _common.TeamInfo(), '队伍信息'], + ] + }, + { + 'name': 'joinTeam', + 'desc': '加入队伍', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=joinTeam', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ], + 'response': [ + _common.RspHead(), + ['team_uuid', '', '队伍唯一id'], + ] + }, + { + 'name': 'leaveTeam', + 'desc': '离开队伍', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=leaveTeam', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ], + 'response': [ + _common.RspHead(), + ] + }, + { + 'name': 'startGame', + 'desc': '开始游戏', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=startGame', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ], + 'response': [ + _common.RspHead(), + ] + }, ] diff --git a/doc/_common.py b/doc/_common.py index 67f33d0..8707cee 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -241,6 +241,7 @@ class SeasonCard(object): ['card_lv', 0, '手册等级'], ['card_exp', 0, '手册经验'], ['card_max_exp', 0, '手册经验上限'], + ['buy_level_price', 0, '等级价格(钻石)'], ['!gift_packages', [SeasonCardGiftPackage()], '礼包列表'], ['!received_level_rewards1', [0], '等级解锁的奖励已领取等级列表(普通手册)'], ['!received_level_rewards2', [0], '等级解锁的奖励已领取等级列表(精英)'], @@ -326,7 +327,6 @@ class TeamInfo(object): def __init__(self): self.fields = [ ['team_uuid', '', '队伍唯一id'], - ['map_id', 0, '地图id'], ['state', 0, '0:未开始 1:准备就绪(这时客户端进入长链接走组队逻辑)'], - ['member_list', [TeamMember()], '队伍成员列表(包含自己)'], + ['!member_list', [TeamMember()], '队伍成员列表(包含自己)'], ] diff --git a/webapp/controller/MissionController.class.php b/webapp/controller/MissionController.class.php index ae58c4b..236a2d7 100644 --- a/webapp/controller/MissionController.class.php +++ b/webapp/controller/MissionController.class.php @@ -81,6 +81,8 @@ class MissionController extends BaseAuthedController { } } $this->_rspData(array( + 'current_active_value' => 0, + 'max_active_value' => 0, 'mission_list1' => $missionDtoList1, 'mission_list2' => $missionDtoList2 )); diff --git a/webapp/controller/SeasonCardController.class.php b/webapp/controller/SeasonCardController.class.php index 4b4a4e8..0cef133 100644 --- a/webapp/controller/SeasonCardController.class.php +++ b/webapp/controller/SeasonCardController.class.php @@ -66,6 +66,7 @@ class SeasonCardController extends BaseAuthedController { public function info() { + $seasonCardMeta = mt\SeasonCard::get(1); $this->_rspData(array( 'info' => array( 'season_id' => $this->currSeasonMeta['id'], @@ -75,6 +76,7 @@ class SeasonCardController extends BaseAuthedController { 'card_exp' => $this->seasonDb ? $this->seasonDb['card_exp'] : 0, 'card_max_exp' => $this->seasonDb ? $this->seasonDb['card_exp'] : 1, 'gift_packages' => $this->getGiftPackages(), + 'buy_level_price' => $seasonCardMeta ? $seasonCardMeta['cost'] : 0, 'received_level_rewards1' => $this->getReceivedLevelRewards(SeasonCard::NORMAL_PACKAGE_ID), 'received_level_rewards2' => $this->getReceivedLevelRewards(SeasonCard::VIP_PACKAGE_ID), ) @@ -136,14 +138,21 @@ class SeasonCardController extends BaseAuthedController { $this->_rspErr(2, 'add_level越界'); return; } - $costItemId = V_ITEM_GOLD; + $costItemId = V_ITEM_DIAMOND; $costItemNum = mt\SeasonCard::calcCost($currCardMeta, $newCardMeta); $itemNum = $this->_getItemCount($costItemId, $this->userInfo); - if ($itemNum < $costItemId) { - $this->_rspErr(3, '金币不足'); + if ($itemNum < $costItemNum) { + $this->_rspErr(3, '钻石不足'); return; } + $this->_decItems(array( + array( + 'item_id' => $costItemId, + 'item_num' => $costItemNum + ) + )); Season::updateCardLv($this->currSeasonMeta['id'], $newLevel); + $this->propertyChgService->addUserChg(); $this->_rspData(array( 'award' => $this->awardService->toDto(), 'property_chg' => $this->propertyChgService->toDto(), diff --git a/webapp/controller/TeamController.class.php b/webapp/controller/TeamController.class.php index bc34196..ef69300 100644 --- a/webapp/controller/TeamController.class.php +++ b/webapp/controller/TeamController.class.php @@ -1,86 +1,32 @@ _getAccountId()) . $this->_getNowTime(); - $hiID = 0; - $hiFrameID = 0; - $sex = 2; - $map_id = 0; - $roomManager = 1; - $readyState = 1; - $selectHeroID = 0; - $selectHeroSkinID = 0; - if (isset($_REQUEST['map_id'])) { - $map_id = $_REQUEST['map_id']; - } - - if (isset($_REQUEST['rank'])) { - $rank = $_REQUEST['rank']; - } - - if (isset($_REQUEST['model'])) { - $model = $_REQUEST['model']; - } - if (isset($_REQUEST['hiID'])) { - $hiID = $_REQUEST['hiID']; - } - if (isset($_REQUEST['sex'])) { - $sex = $_REQUEST['sex']; - } - if (isset($_REQUEST['hiFrameID'])) { - $hiFrameID = $_REQUEST['hiFrameID']; - } - $account_id = $_REQUEST['account_id']; - $conn = $this->_getMysql($account_id); - $row = $conn->execQueryOne('SELECT game_times, win_times, kills, create_time FROM user WHERE account_id=:account_id;', - array( - 'account_id' => $account_id, - )); - - $team_db = array( - 'team_uuid' => $team_uuid, + $userDb = User::find($this->_getAccountId()); + $teamDb = array( + 'team_uuid' => $teamUuid, 'state' => 0, - 'model' => $model, - 'map_id' => $map_id, - 'member_list' => array( - array( - 'idx' => 1, - 'account_id' => $_REQUEST['account_id'], - 'name' => $_REQUEST['name'], - 'rank' => $rank, - 'game_times' => $row['game_times'], - 'win_times' => $row['win_times'], - 'kills' => $row['kills'], - 'create_time' => $row['create_time'], - 'roomManager' => $roomManager, - 'readyState' => $readyState, - 'hiID' => $hiID, - 'hiFrameID' => $hiFrameID, - 'sex' => $sex, - 'selectHeroID' => $selectHeroID, - "selectHeroSkinID" => $selectHeroSkinID - ) - )); + 'member_list' => array($userDb)); - $r = $this->_getRedis($team_uuid); - $r -> set(TEAMID_KEY . $team_uuid, json_encode($team_db)); - $r -> pexpire(TEAMID_KEY . $team_uuid, 1000*600); + $r = $this->_getRedis($teamUuid); + $r->set(TEAMID_KEY . $teamUuid, json_encode($teamDb)); + $r->pexpire(TEAMID_KEY . $teamUuid, 1000*600); echo json_encode (array( 'errcode' => 0, 'errmsg' => '', - 'team_uuid' => $team_uuid + 'team_uuid' => $teamUuid )); } @@ -89,13 +35,13 @@ class TeamController extends BaseAuthedController { if (!isset($_REQUEST['team_uuid'])) { return; } - $team_uuid = $_REQUEST['team_uuid']; - $r = $this->_getRedis($team_uuid); + $teamUuid = $_REQUEST['team_uuid']; + $r = $this->_getRedis($teamUuid); $account_id = $_REQUEST['account_id']; $sessionid = $_REQUEST['session_id']; - $user_db_str = $r->get(TEAMID_KEY . $team_uuid); + $user_db_str = $r->get(TEAMID_KEY . $teamUuid); if (empty($user_db_str)) { phpcommon\sendError(ERR_USER_BASE + 1,'session失效1'); return; @@ -126,7 +72,7 @@ class TeamController extends BaseAuthedController { echo json_encode(array( 'errcode' => 0, 'errmsg'=> '', - 'team_uuid' => $team_uuid, + 'team_uuid' => $teamUuid, 'state' => $user_db['state'], 'member_list' => $member_list, 'model' => $user_db['model'], @@ -139,11 +85,11 @@ class TeamController extends BaseAuthedController { if (!isset($_REQUEST['team_uuid'])) { return; } - $team_uuid = $_REQUEST['team_uuid']; + $teamUuid = $_REQUEST['team_uuid']; - $r = $this->_getRedis($team_uuid); + $r = $this->_getRedis($teamUuid); - $user_db_str = $r->get(TEAMID_KEY.$team_uuid); + $user_db_str = $r->get(TEAMID_KEY.$teamUuid); if (empty($user_db_str)) { phpcommon\sendError(ERR_USER_BASE + 1,'session失效1'); return; @@ -214,12 +160,12 @@ class TeamController extends BaseAuthedController { 'selectHeroID' => $selectHeroID, "selectHeroSkinID" => $selectHeroSkinID )); - $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r -> pexpire(TEAMID_KEY . $team_uuid, 1000 * 600); + $r->set(TEAMID_KEY . $teamUuid, json_encode($user_db)); + $r -> pexpire(TEAMID_KEY . $teamUuid, 1000 * 600); echo json_encode(array( 'errcode' => 0, 'errmsg' => '', - 'roomID' =>$team_uuid, + 'roomID' =>$teamUuid, 'data' =>$user_db )); } @@ -229,12 +175,12 @@ class TeamController extends BaseAuthedController { if (!isset($_REQUEST['team_uuid'])) { return; } - $team_uuid = $_REQUEST['team_uuid']; - $r = $this->_getRedis($team_uuid); + $teamUuid = $_REQUEST['team_uuid']; + $r = $this->_getRedis($teamUuid); if (!$r) { echo 'is null'; } else { - $user_db_str = $r->get(TEAMID_KEY . $team_uuid); + $user_db_str = $r->get(TEAMID_KEY . $teamUuid); if (empty($user_db_str)) { phpcommon\sendError(ERR_USER_BASE + 1,'session失效1'); return; @@ -260,8 +206,8 @@ class TeamController extends BaseAuthedController { $i++; } - $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r -> pexpire(TEAMID_KEY . $team_uuid, 1000 * 600); + $r->set(TEAMID_KEY . $teamUuid, json_encode($user_db)); + $r -> pexpire(TEAMID_KEY . $teamUuid, 1000 * 600); } echo json_encode(array( 'errcode' => 0, @@ -274,14 +220,14 @@ class TeamController extends BaseAuthedController { if (!isset($_REQUEST['team_uuid'])) { return; } - $team_uuid = $_REQUEST['team_uuid']; - $r = $this->_getRedis($team_uuid); + $teamUuid = $_REQUEST['team_uuid']; + $r = $this->_getRedis($teamUuid); $roomManager = $_REQUEST['roomManager']; if (!$r) { echo 'is null'; } else { - $user_db_str = $r->get(TEAMID_KEY . $team_uuid); + $user_db_str = $r->get(TEAMID_KEY . $teamUuid); if (empty($user_db_str)) { phpcommon\sendError(ERR_USER_BASE + 1,'session失效1'); return; @@ -314,10 +260,10 @@ class TeamController extends BaseAuthedController { } $i++; } - $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r -> pexpire(TEAMID_KEY . $team_uuid, 1000 * 600); + $r->set(TEAMID_KEY . $teamUuid, json_encode($user_db)); + $r -> pexpire(TEAMID_KEY . $teamUuid, 1000 * 600); if (count($user_db['member_list']) == 0) { - $r->del(TEAMID_KEY . $team_uuid, json_encode($user_db)); + $r->del(TEAMID_KEY . $teamUuid, json_encode($user_db)); } } echo json_encode(array( @@ -331,13 +277,13 @@ class TeamController extends BaseAuthedController { if (!isset($_REQUEST['team_uuid'])) { return; } - $team_uuid = $_REQUEST['team_uuid']; - $r = $this->_getRedis($team_uuid); + $teamUuid = $_REQUEST['team_uuid']; + $r = $this->_getRedis($teamUuid); if (!$r){ echo 'is null'; } else { - $user_db_str = $r->get(TEAMID_KEY . $team_uuid); + $user_db_str = $r->get(TEAMID_KEY . $teamUuid); if (empty($user_db_str)) { phpcommon\sendError(ERR_USER_BASE + 1,'session失效1'); @@ -358,8 +304,8 @@ class TeamController extends BaseAuthedController { } $user_db['auto_fill'] = $_REQUEST['auto_fill']; $user_db['map_id'] = $_REQUEST['map_id']; - $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r -> pexpire(TEAMID_KEY . $team_uuid, 1000 * 600); + $r->set(TEAMID_KEY . $teamUuid, json_encode($user_db)); + $r -> pexpire(TEAMID_KEY . $teamUuid, 1000 * 600); } echo json_encode(array( 'errcode' => 0, @@ -372,14 +318,14 @@ class TeamController extends BaseAuthedController { if (!isset($_REQUEST['team_uuid'])) { return; } - $team_uuid = $_REQUEST['team_uuid']; + $teamUuid = $_REQUEST['team_uuid']; //error_log("剔除玩家==="); - $r = $this->_getRedis($team_uuid); + $r = $this->_getRedis($teamUuid); if (!$r) { echo 'is null'; } else { - $user_db_str = $r->get(TEAMID_KEY . $team_uuid); + $user_db_str = $r->get(TEAMID_KEY . $teamUuid); if (empty($user_db_str)) { phpcommon\sendError(ERR_USER_BASE + 1,'session失效1'); @@ -399,8 +345,8 @@ class TeamController extends BaseAuthedController { } } $user_db['state'] = $_REQUEST['state']; - $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r->pexpire(TEAMID_KEY . $team_uuid, 10 * 1000); + $r->set(TEAMID_KEY . $teamUuid, json_encode($user_db)); + $r->pexpire(TEAMID_KEY . $teamUuid, 10 * 1000); } echo json_encode(array( 'errcode' => 0, diff --git a/webapp/mt/SeasonCard.php b/webapp/mt/SeasonCard.php index feb28de..d2b63eb 100644 --- a/webapp/mt/SeasonCard.php +++ b/webapp/mt/SeasonCard.php @@ -19,7 +19,7 @@ class SeasonCard { public static function calcCost($currMeta, $newMeta) { $cost = 0; - $nextMeta = self::get($currMeta['lv']); + $nextMeta = self::get($currMeta['lv'] + 1); while ($nextMeta && $nextMeta['lv'] <= $newMeta['lv']) { $cost += $nextMeta['cost']; $nextMeta = self::get($nextMeta['lv'] + 1);