From b48af6a7927631df6e8df0531b5c4023797f48e0 Mon Sep 17 00:00:00 2001 From: wangwei01 Date: Tue, 23 Apr 2019 10:10:46 +0800 Subject: [PATCH] 1 --- webapp/controller/EquipController.class.php | 4 +- webapp/controller/TeamController.class.php | 45 ++++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/webapp/controller/EquipController.class.php b/webapp/controller/EquipController.class.php index 39782d4..d886d8e 100644 --- a/webapp/controller/EquipController.class.php +++ b/webapp/controller/EquipController.class.php @@ -72,7 +72,7 @@ class EquipController{ } else { if ($row['active_time'] != 0) { $active_time = 2; - $equip_level = 8; + $equip_level = 10; } else { $active_time = 0; $equip_level = $row['equip_level']; @@ -126,7 +126,7 @@ class EquipController{ ':accountid' => $account_id, ':equip_id' => $equip_id, ':equip_level' => $e['equip_nextlevel'], - ':equip_experience_level' => 8, + ':equip_experience_level' => 10, ':active_time' => 0, )); if (!$ret) { diff --git a/webapp/controller/TeamController.class.php b/webapp/controller/TeamController.class.php index 60c73e0..860e825 100644 --- a/webapp/controller/TeamController.class.php +++ b/webapp/controller/TeamController.class.php @@ -21,6 +21,7 @@ class teamController{ $team_db = array( 'team_uuid' => $team_uuid, 'auto_fill' => $_REQUEST['auto_fill'], + 'state' => 0, 'member_list' => array( array( 'idx' => 1, @@ -75,6 +76,7 @@ class teamController{ 'errmsg'=> '', 'team_uuid' => $team_uuid, 'auto_fill' => $user_db['auto_fill'], + 'state' => $user_db['state'], 'member_list' => $member_list, )); } @@ -83,19 +85,21 @@ class teamController{ public function joinTeam() { $team_uuid = $_REQUEST['team_uuid']; + $r = $this->getRedis($team_uuid); if (!$r){ echo 'is null'; }else { $user_db_str = $r->get(TEAMID_KEY.$team_uuid); + if (empty($user_db_str)){ - phpcommon\sendError(ERR_USER_BASE + 1,'session失效'); + phpcommon\sendError(ERR_USER_BASE + 1,'session失效1'); return; } $user_db = json_decode($user_db_str, true); if (empty($user_db)){ - phpcommon\sendError(ERR_USER_BASE + 1, 'session失效'); + phpcommon\sendError(ERR_USER_BASE + 1, 'session失效2'); return; } $member_num = count($user_db['member_list']); @@ -262,5 +266,42 @@ class teamController{ 'errmsg' => '', )); } + + public function startGame() + { + $team_uuid = $_REQUEST['team_uuid']; + $r = $this->getRedis($team_uuid); + + if (!$r){ + echo 'is null'; + }else{ + $user_db_str = $r->get(TEAMID_KEY . $team_uuid); + + if (empty($user_db_str)){ + phpcommon\sendError(ERR_USER_BASE + 1,'session失效1'); + return; + } + $user_db = json_decode($user_db_str, true); + if (empty($user_db)){ + phpcommon\sendError(ERR_USER_BASE + 1,'session失效2'); + return; + } + foreach ($user_db['member_list'] as $member) { + if ($member['account_id'] == $_REQUEST['account_id']){ + if($member['idx'] != 1){ + phpcommon\sendError(ERR_USER_BASE + 4,'你不是队长'); + return; + } + } + } + $user_db['state'] = $_REQUEST['state']; + $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); + $r->pexpire(TEAMID_KEY . $team_uuid, 1000 * 3600); + } + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + )); + } } ?>