1
This commit is contained in:
parent
d398ad4a7f
commit
2c45eee1ee
@ -58,6 +58,8 @@ class MatchController{
|
|||||||
$join_time = 5;
|
$join_time = 5;
|
||||||
$room_state = 0;
|
$room_state = 0;
|
||||||
$downtime = 0;
|
$downtime = 0;
|
||||||
|
$tank_id = $this->getTankid($_REQUEST['account_id']);
|
||||||
|
$tank_skin = $this->getTankSkinid($_REQUEST['account_id']);
|
||||||
$room = $this->getRedis($room_uuid);
|
$room = $this->getRedis($room_uuid);
|
||||||
$room_db_str = $room->get($room_uuid);
|
$room_db_str = $room->get($room_uuid);
|
||||||
if (empty($room_db_str)) {
|
if (empty($room_db_str)) {
|
||||||
@ -71,6 +73,8 @@ class MatchController{
|
|||||||
'account_id' => $_REQUEST['account_id'],
|
'account_id' => $_REQUEST['account_id'],
|
||||||
'name' => $_REQUEST['name'],
|
'name' => $_REQUEST['name'],
|
||||||
'avatar_url' => $_REQUEST['avatar_url'],
|
'avatar_url' => $_REQUEST['avatar_url'],
|
||||||
|
'tank_id' => $tank_id,
|
||||||
|
'tankskin_id' => $tank_skin
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
$room -> set($room_uuid, json_encode($room_db));
|
$room -> set($room_uuid, json_encode($room_db));
|
||||||
@ -104,6 +108,8 @@ class MatchController{
|
|||||||
'account_id' => $_REQUEST['account_id'],
|
'account_id' => $_REQUEST['account_id'],
|
||||||
'name' => $_REQUEST['name'],
|
'name' => $_REQUEST['name'],
|
||||||
'avatar_url' => $_REQUEST['avatar_url'],
|
'avatar_url' => $_REQUEST['avatar_url'],
|
||||||
|
'tank_id' => $tank_id,
|
||||||
|
'tankskin_id' => $tank_skin
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
$room -> set($room_uuid, json_encode($room_db));
|
$room -> set($room_uuid, json_encode($room_db));
|
||||||
@ -122,10 +128,13 @@ class MatchController{
|
|||||||
$random = Rand(1, 100);
|
$random = Rand(1, 100);
|
||||||
$robot_id = 1000 + ($num - 1) * 100 + $random;
|
$robot_id = 1000 + ($num - 1) * 100 + $random;
|
||||||
$rob = $this->getRobot($robot_id, $num);
|
$rob = $this->getRobot($robot_id, $num);
|
||||||
|
$tank_id = Rand(1, 9) + 15000;
|
||||||
array_push ($room_db['member_list'], array(
|
array_push ($room_db['member_list'], array(
|
||||||
'account_id' => $rob['id'],
|
'account_id' => $rob['id'],
|
||||||
'name' => $rob['name'],
|
'name' => $rob['name'],
|
||||||
'avatar_url' => $rob['avatar_url'],
|
'avatar_url' => $rob['avatar_url'],
|
||||||
|
'tank_id' => $tank_id,
|
||||||
|
'tankskin_id' => 0
|
||||||
));
|
));
|
||||||
$room_db['last_join_time'] = time();
|
$room_db['last_join_time'] = time();
|
||||||
}
|
}
|
||||||
@ -135,6 +144,8 @@ class MatchController{
|
|||||||
'account_id' => $_REQUEST['account_id'],
|
'account_id' => $_REQUEST['account_id'],
|
||||||
'name' => $_REQUEST['name'],
|
'name' => $_REQUEST['name'],
|
||||||
'avatar_url' => $_REQUEST['avatar_url'],
|
'avatar_url' => $_REQUEST['avatar_url'],
|
||||||
|
'tank_id' => $tank_id,
|
||||||
|
'tankskin_id' => $tank_skin
|
||||||
));
|
));
|
||||||
$room_db['last_join_time'] = time();
|
$room_db['last_join_time'] = time();
|
||||||
}
|
}
|
||||||
@ -173,6 +184,8 @@ class MatchController{
|
|||||||
'account_id' => $member['account_id'],
|
'account_id' => $member['account_id'],
|
||||||
'name' => $member['name'],
|
'name' => $member['name'],
|
||||||
'avatar_url' => $member['avatar_url'],
|
'avatar_url' => $member['avatar_url'],
|
||||||
|
'tank_id' => $member['tank_id'],
|
||||||
|
'tankskin_id' => $member['tankskin_id'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,5 +249,38 @@ class MatchController{
|
|||||||
'errmsg'=> '',
|
'errmsg'=> '',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getTankid($accountid)
|
||||||
|
{
|
||||||
|
$conn = $this->getMysql($accountid);
|
||||||
|
$row = $conn->execQueryOne('SELECT tank_id FROM tank WHERE accountid=:account_id AND tank_status=0;',
|
||||||
|
array(
|
||||||
|
':account_id' => $accountid,
|
||||||
|
));
|
||||||
|
return $row['tank_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getTankSkinid($accountid)
|
||||||
|
{
|
||||||
|
$conn = $this->getMysql($accountid);
|
||||||
|
$row = $conn->execQueryOne('SELECT skin_id FROM skin WHERE accountid=:account_id AND skin_status=0;',
|
||||||
|
array(
|
||||||
|
':account_id' => $accountid,
|
||||||
|
));
|
||||||
|
return $row['skin_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMysql($account_id)
|
||||||
|
{
|
||||||
|
$mysql_conf = getMysqlConfig(crc32($account_id));
|
||||||
|
$conn = new phpcommon\Mysql(array(
|
||||||
|
'host' => $mysql_conf['host'],
|
||||||
|
'port' => $mysql_conf['port'],
|
||||||
|
'user' => $mysql_conf['user'],
|
||||||
|
'passwd' => $mysql_conf['passwd'],
|
||||||
|
'dbname' => 'gamedb2002_' . $mysql_conf['instance_id']
|
||||||
|
));
|
||||||
|
return $conn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user