1
This commit is contained in:
parent
ed825ebac3
commit
b48af6a792
@ -72,7 +72,7 @@ class EquipController{
|
|||||||
} else {
|
} else {
|
||||||
if ($row['active_time'] != 0) {
|
if ($row['active_time'] != 0) {
|
||||||
$active_time = 2;
|
$active_time = 2;
|
||||||
$equip_level = 8;
|
$equip_level = 10;
|
||||||
} else {
|
} else {
|
||||||
$active_time = 0;
|
$active_time = 0;
|
||||||
$equip_level = $row['equip_level'];
|
$equip_level = $row['equip_level'];
|
||||||
@ -126,7 +126,7 @@ class EquipController{
|
|||||||
':accountid' => $account_id,
|
':accountid' => $account_id,
|
||||||
':equip_id' => $equip_id,
|
':equip_id' => $equip_id,
|
||||||
':equip_level' => $e['equip_nextlevel'],
|
':equip_level' => $e['equip_nextlevel'],
|
||||||
':equip_experience_level' => 8,
|
':equip_experience_level' => 10,
|
||||||
':active_time' => 0,
|
':active_time' => 0,
|
||||||
));
|
));
|
||||||
if (!$ret) {
|
if (!$ret) {
|
||||||
|
@ -21,6 +21,7 @@ class teamController{
|
|||||||
$team_db = array(
|
$team_db = array(
|
||||||
'team_uuid' => $team_uuid,
|
'team_uuid' => $team_uuid,
|
||||||
'auto_fill' => $_REQUEST['auto_fill'],
|
'auto_fill' => $_REQUEST['auto_fill'],
|
||||||
|
'state' => 0,
|
||||||
'member_list' => array(
|
'member_list' => array(
|
||||||
array(
|
array(
|
||||||
'idx' => 1,
|
'idx' => 1,
|
||||||
@ -75,6 +76,7 @@ class teamController{
|
|||||||
'errmsg'=> '',
|
'errmsg'=> '',
|
||||||
'team_uuid' => $team_uuid,
|
'team_uuid' => $team_uuid,
|
||||||
'auto_fill' => $user_db['auto_fill'],
|
'auto_fill' => $user_db['auto_fill'],
|
||||||
|
'state' => $user_db['state'],
|
||||||
'member_list' => $member_list,
|
'member_list' => $member_list,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -83,19 +85,21 @@ class teamController{
|
|||||||
public function joinTeam()
|
public function joinTeam()
|
||||||
{
|
{
|
||||||
$team_uuid = $_REQUEST['team_uuid'];
|
$team_uuid = $_REQUEST['team_uuid'];
|
||||||
|
|
||||||
$r = $this->getRedis($team_uuid);
|
$r = $this->getRedis($team_uuid);
|
||||||
|
|
||||||
if (!$r){
|
if (!$r){
|
||||||
echo 'is null';
|
echo 'is null';
|
||||||
}else {
|
}else {
|
||||||
$user_db_str = $r->get(TEAMID_KEY.$team_uuid);
|
$user_db_str = $r->get(TEAMID_KEY.$team_uuid);
|
||||||
|
|
||||||
if (empty($user_db_str)){
|
if (empty($user_db_str)){
|
||||||
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
|
phpcommon\sendError(ERR_USER_BASE + 1,'session失效1');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$user_db = json_decode($user_db_str, true);
|
$user_db = json_decode($user_db_str, true);
|
||||||
if (empty($user_db)){
|
if (empty($user_db)){
|
||||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session失效');
|
phpcommon\sendError(ERR_USER_BASE + 1, 'session失效2');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$member_num = count($user_db['member_list']);
|
$member_num = count($user_db['member_list']);
|
||||||
@ -262,5 +266,42 @@ class teamController{
|
|||||||
'errmsg' => '',
|
'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' => '',
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user