This commit is contained in:
wangwei01 2019-06-12 18:58:05 +08:00
parent 491b03cc27
commit 39069fa0cc
10 changed files with 123 additions and 73 deletions

View File

@ -121,8 +121,8 @@ CREATE TABLE `supplybox` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id', `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
`box_id` int(11) NOT NULL COMMENT '补给箱id', `box_id` int(11) NOT NULL COMMENT '补给箱id',
`box_num` int(11) NOT NULL COMMENT '补给箱数量', `buy_times` int(11) NOT NULL COMMENT '购买次数',
`buy_times` int(11) NOT NULL COMMENT '购买次数', `free_times` int(11) NOT NULL COMMENT '免费获得次数',
`last_buy_time` varchar(50) NOT NULL DEFAULT '最后一次购买', `last_buy_time` varchar(50) NOT NULL DEFAULT '最后一次购买',
`create_time` int(11) NOT NULL COMMENT '创建时间', `create_time` int(11) NOT NULL COMMENT '创建时间',
`modify_time` int(11) NOT NULL COMMENT '修改时间', `modify_time` int(11) NOT NULL COMMENT '修改时间',

View File

@ -15,9 +15,8 @@ define('QUEST_DAY_RANK', 71007);
define('QUEST_DAY_ALIVE', 71008); define('QUEST_DAY_ALIVE', 71008);
define('QUEST_DAY_HARM', 71009); define('QUEST_DAY_HARM', 71009);
define('QUEST_DAY_KILL', 71010); define('QUEST_DAY_KILL', 71010);
define('QUEST_DAY_GAME', 71011); define('QUEST_DAY_HELP', 71011);
define('QUEST_DAY_HELP', 71012); define('QUEST_DAY_COMPLETE', 71012);
define('QUEST_DAY_COMPLETE', 71013);
//成就 //成就
define('QUEST_SUM_LOGIN', 72001); define('QUEST_SUM_LOGIN', 72001);
define('QUEST_SUM_SHARE', 72002); define('QUEST_SUM_SHARE', 72002);
@ -34,8 +33,7 @@ define('QUEST_SUM_SNIPEKILL', 72012);
define('QUEST_SUM_RIFLEKILL', 72013); define('QUEST_SUM_RIFLEKILL', 72013);
define('QUEST_SUM_PISTOLKILL', 72014); define('QUEST_SUM_PISTOLKILL', 72014);
define('QUEST_SUM_SUBMACKILL', 72015); define('QUEST_SUM_SUBMACKILL', 72015);
define('QUEST_SUM_GAME', 72016); define('QUEST_SUM_HELP', 72016);
define('QUEST_SUM_HELP', 72017);
//活动 //活动
define('QUEST_ACTIVITY_LOGIN', 83001); define('QUEST_ACTIVITY_LOGIN', 83001);
define('QUEST_ACTIVITY_GAME', 83002); define('QUEST_ACTIVITY_GAME', 83002);
@ -67,6 +65,7 @@ define('DOUBLE_GOLD', 22); //免费金币翻倍率
define('DOUBLE_SIGN_IN', 23); //每日签到翻倍率 define('DOUBLE_SIGN_IN', 23); //每日签到翻倍率
define('DOUBLE_END_WAR', 24); //战斗结束翻倍率 define('DOUBLE_END_WAR', 24); //战斗结束翻倍率
define('DOUBLE_BOX', 25); //抽箱子奖励翻倍率 define('DOUBLE_BOX', 25); //抽箱子奖励翻倍率
define('FREE_DRESS_MAX_TIME', 30); //免费获取皮肤次数上限
require 'config_loader.php'; require 'config_loader.php';

View File

@ -141,6 +141,10 @@ class ActivityController{
':act_share_status' => $receive_status, ':act_share_status' => $receive_status,
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
return;
}
} }
//任务活动 //任务活动
$rows = $conn->execQuery('SELECT * FROM quest WHERE accountid=:accountid AND quest_type=:quest_type;', $rows = $conn->execQuery('SELECT * FROM quest WHERE accountid=:accountid AND quest_type=:quest_type;',
@ -217,6 +221,10 @@ class ActivityController{
':fragment_num' => $item_num + $rowSkin['fragment_num'], ':fragment_num' => $item_num + $rowSkin['fragment_num'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
return;
}
break; break;
} }
case 2: //活动皮肤兑换 case 2: //活动皮肤兑换

View File

@ -73,6 +73,9 @@ class EquipController{
':coin_num' => $rowCoin['coin_num'] - $e['equip_cost'], ':coin_num' => $rowCoin['coin_num'] - $e['equip_cost'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
}
return $e; return $e;
} }

View File

@ -63,7 +63,7 @@ class HangController{
$item_id = 10001; $item_id = 10001;
$p_num = $this->getParameter(GOLD); $p_num = $this->getParameter(GOLD);
$p_time_limit = $this->getParameter(TIME_LIMIT); $p_time_limit = $this->getParameter(TIME_LIMIT);
$num = time() - $row['hang_time'] / 5 * $p_num['param_value']; $num = floor((time() - $row['hang_time']) / 5 * $p_num['param_value']);
if ($num >= $p_time_limit['param_value']) { if ($num >= $p_time_limit['param_value']) {
$num = $p_time_limit['param_value'] / 5 * $p_num['param_value']; $num = $p_time_limit['param_value'] / 5 * $p_num['param_value'];
} }
@ -82,6 +82,10 @@ class HangController{
':coin_num' => $num + $row['coin_num'], ':coin_num' => $num + $row['coin_num'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
return;
}
} }
echo json_encode(array( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,
@ -128,7 +132,7 @@ class HangController{
} else { } else {
$p_num = $this->getParameter(GOLD); $p_num = $this->getParameter(GOLD);
$p_time_limit = $this->getParameter(TIME_LIMIT); $p_time_limit = $this->getParameter(TIME_LIMIT);
$num = time() - $row['hang_time'] / 5 * $p_num['param_value']; $num = floor((time() - $row['hang_time']) / 5 * $p_num['param_value']);
if ($num >= $p_time_limit['param_value']) { if ($num >= $p_time_limit['param_value']) {
$num = $p_time_limit['param_value'] / 5 * $p_num['param_value']; $num = $p_time_limit['param_value'] / 5 * $p_num['param_value'];
} }

View File

@ -87,6 +87,9 @@ class QuestController{
':create_time' => time(), ':create_time' => time(),
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
}
} }
} }
@ -114,7 +117,6 @@ class QuestController{
)); ));
if (!$ret) { if (!$ret) {
die(); die();
return;
} }
} }
@ -139,7 +141,6 @@ class QuestController{
)); ));
if (!$ret) { if (!$ret) {
die(); die();
return;
} }
} }
} }
@ -156,6 +157,9 @@ class QuestController{
':active_sum' => 0, ':active_sum' => 0,
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
}
} else if ($flag == 1) { } else if ($flag == 1) {
$ret = $conn->execScript('UPDATE active SET num_time=:num_time, active_num=:active_num, modify_time=:modify_time ' . $ret = $conn->execScript('UPDATE active SET num_time=:num_time, active_num=:active_num, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
@ -165,6 +169,9 @@ class QuestController{
':active_num' => 0, ':active_num' => 0,
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
}
} }
$ret = $conn->execScript('UPDATE quest SET quest_state=:quest_state, modify_time=:modify_time ' . $ret = $conn->execScript('UPDATE quest SET quest_state=:quest_state, modify_time=:modify_time ' .
' WHERE accountid=:accountid AND quest_type=:quest_type AND quest_id<:quest_id;', ' WHERE accountid=:accountid AND quest_type=:quest_type AND quest_id<:quest_id;',
@ -175,6 +182,9 @@ class QuestController{
':quest_state' => 0, ':quest_state' => 0,
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
}
} }
public function questInfo() public function questInfo()
@ -370,6 +380,10 @@ class QuestController{
':coin_num' => $item_num + $row1['coin_num'], ':coin_num' => $item_num + $row1['coin_num'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
return;
}
} }
} else { } else {
$q = $this->getQuest($quest_id); $q = $this->getQuest($quest_id);
@ -389,6 +403,10 @@ class QuestController{
':coin_num' => $reward + $row1['coin_num'], ':coin_num' => $reward + $row1['coin_num'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
return;
}
} }
if ($row['quest_type'] == 1) { if ($row['quest_type'] == 1) {
$active = $conn->execQueryOne('SELECT active_num, active_sum FROM active WHERE accountid=:accountid;', $active = $conn->execQueryOne('SELECT active_num, active_sum FROM active WHERE accountid=:accountid;',
@ -411,6 +429,10 @@ class QuestController{
':create_time' => time(), ':create_time' => time(),
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
return;
}
$this->updateActive($account_id, $q['active_value'], $q['active_value']); $this->updateActive($account_id, $q['active_value'], $q['active_value']);
} else { } else {
$active['active_num'] = $q['active_value'] + $active['active_num']; $active['active_num'] = $q['active_value'] + $active['active_num'];
@ -423,6 +445,10 @@ class QuestController{
':active_sum' => $active['active_sum'], ':active_sum' => $active['active_sum'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
return;
}
$this->updateActive($account_id, $active['active_num'], $active['active_sum']); $this->updateActive($account_id, $active['active_num'], $active['active_sum']);
} }
} }

View File

@ -246,13 +246,11 @@ class RoleController{
$quest->triggerQuest(QUEST_DAY_ALIVE, 1, (int)($alive_time / 1000 / 60), $account_id); $quest->triggerQuest(QUEST_DAY_ALIVE, 1, (int)($alive_time / 1000 / 60), $account_id);
$quest->triggerQuest(QUEST_DAY_HARM, 1, $harm, $account_id); $quest->triggerQuest(QUEST_DAY_HARM, 1, $harm, $account_id);
$quest->triggerQuest(QUEST_DAY_KILL, 1, $kills, $account_id); $quest->triggerQuest(QUEST_DAY_KILL, 1, $kills, $account_id);
$quest->triggerQuest(QUEST_DAY_GAME, 1, 1, $account_id);
$quest->triggerQuest(QUEST_DAY_HELP, 1, $rescue_member, $account_id); $quest->triggerQuest(QUEST_DAY_HELP, 1, $rescue_member, $account_id);
$quest->triggerQuest(QUEST_SUM_FIGHT, 2, 1, $account_id); $quest->triggerQuest(QUEST_SUM_FIGHT, 2, 1, $account_id);
$quest->triggerQuest(QUEST_SUM_ALIVE, 2, (int)($alive_time / 1000 / 60), $account_id); $quest->triggerQuest(QUEST_SUM_ALIVE, 2, (int)($alive_time / 1000 / 60), $account_id);
$quest->triggerQuest(QUEST_SUM_HARM, 2, $harm, $account_id); $quest->triggerQuest(QUEST_SUM_HARM, 2, $harm, $account_id);
$quest->triggerQuest(QUEST_SUM_KILL, 2, $kills, $account_id); $quest->triggerQuest(QUEST_SUM_KILL, 2, $kills, $account_id);
$quest->triggerQuest(QUEST_SUM_GAME, 2, 1, $account_id);
$quest->triggerQuest(QUEST_SUM_HELP, 2, $rescue_member, $account_id); $quest->triggerQuest(QUEST_SUM_HELP, 2, $rescue_member, $account_id);
$quest->triggerQuest(QUEST_SUM_SNIPEKILL, 2, $snipe_kill, $account_id); $quest->triggerQuest(QUEST_SUM_SNIPEKILL, 2, $snipe_kill, $account_id);
$quest->triggerQuest(QUEST_SUM_RIFLEKILL, 2, $rifle_kill, $account_id); $quest->triggerQuest(QUEST_SUM_RIFLEKILL, 2, $rifle_kill, $account_id);
@ -277,9 +275,9 @@ class RoleController{
$nowTime = phpcommon\getdayseconds(time()); $nowTime = phpcommon\getdayseconds(time());
$start_time = $array[0][0] * 3600 + $array[0][1] * 60 + $nowTime; $start_time = $array[0][0] * 3600 + $array[0][1] * 60 + $nowTime;
$end_time = $array[1][0] * 3600 + $array[1][1] * 60 + $nowTime; $end_time = $array[1][0] * 3600 + $array[1][1] * 60 + $nowTime;
//if (time() >= $start_time && time() < $start_time) { if (time() >= $start_time && time() < $start_time) {
$quest->triggerQuest(QUEST_ACTIVITY_GAME, 3, 1, $account_id); $quest->triggerQuest(QUEST_ACTIVITY_GAME, 3, 1, $account_id);
//} }
echo json_encode(array( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',
@ -431,6 +429,10 @@ class RoleController{
':coin_num' => $coin_num + $rowUser['coin_num'], ':coin_num' => $coin_num + $rowUser['coin_num'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
return;
}
echo json_encode(array( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,

View File

@ -184,10 +184,10 @@ class SignController{
':fragment_status' => 0, ':fragment_status' => 0,
':modify_time' => time() ':modify_time' => time()
)); ));
} if (!$ret) {
if (!$ret) { die();
die(); return;
return; }
} }
} }
} else { } else {
@ -227,6 +227,9 @@ class SignController{
':fragment_num' => $item_num + $rowSkin['fragment_num'], ':fragment_num' => $item_num + $rowSkin['fragment_num'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
}
} }
public function signReward() public function signReward()
@ -288,6 +291,10 @@ class SignController{
':coin_num' => $num + $row2['coin_num'], ':coin_num' => $num + $row2['coin_num'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
return;
}
} else if($item_id > 13000 && $item_id < 14000){ } else if($item_id > 13000 && $item_id < 14000){
$this->addReward($item_id, $num, $account_id); $this->addReward($item_id, $num, $account_id);
} }

View File

@ -98,12 +98,11 @@ class SupplyBoxController{
)); ));
foreach ($rows as $row) { foreach ($rows as $row) {
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['last_buy_time']) > 0) { if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['last_buy_time']) > 0) {
$ret = $conn->execScript('UPDATE supplybox SET buy_times=:buy_times, last_buy_time=:time, modify_time=:modify_time ' . $ret = $conn->execScript('UPDATE supplybox SET free_times=0, buy_times=0, last_buy_time=:time, modify_time=:modify_time ' .
' WHERE accountid=:accountid AND box_id=:box_id;', ' WHERE accountid=:accountid AND box_id=:box_id;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':box_id' => $row['box_id'], ':box_id' => $row['box_id'],
':buy_times' => 0,
':time' => time(), ':time' => time(),
':modify_time' => time() ':modify_time' => time()
)); ));
@ -114,8 +113,8 @@ class SupplyBoxController{
} }
array_push($box_list, array( array_push($box_list, array(
'box_id' => $row['box_id'], 'box_id' => $row['box_id'],
'box_num' => $row['box_num'], 'buy_times' => $row['buy_times'],
'buy_times' => $row['buy_times'] 'free_times' => $row['free_times']
)); ));
} }
} }
@ -170,12 +169,13 @@ class SupplyBoxController{
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个宝箱'); phpcommon\sendError(ERR_USER_BASE + 2, '没有这个宝箱');
return; return;
} else if ($free_open == 1) { } else if ($free_open == 1) {
$ret = $conn->execScript('INSERT INTO supplybox(accountid, box_id, box_num, buy_times, last_buy_time, create_time, modify_time) ' . $ret = $conn->execScript('INSERT INTO supplybox(accountid, box_id, buy_times, free_times, last_buy_time, create_time, modify_time) ' .
' VALUES(:accountid, :box_id, 0, 0, 0, :create_time, :modify_time) ' . ' VALUES(:accountid, :box_id, 0, 1, :last_buy_time, :create_time, :modify_time) ' .
' ON DUPLICATE KEY UPDATE accountid=:accountid, box_id=:box_id, box_num=0, buy_times=0, last_buy_time=0, modify_time=:modify_time;', ' ON DUPLICATE KEY UPDATE accountid=:accountid, box_id=:box_id, buy_times=0, free_times=1, last_buy_time=:last_buy_time, modify_time=:modify_time;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':box_id' => $box_id, ':box_id' => $box_id,
':last_buy_time' => time(),
':create_time' => time(), ':create_time' => time(),
':modify_time' => time() ':modify_time' => time()
)); ));
@ -185,18 +185,21 @@ class SupplyBoxController{
} }
} }
} }
if ($free_open == 0) { if ($free_open == 1) {
if ($row['box_num'] <= 0) { $p_times = $this->getParameter(FREE_DRESS_MAX_TIME);
phpcommon\sendError(ERR_USER_BASE + 3, '宝箱数量不足'); $p_times['param_value'];
if ($row['free_times'] >= $p_times['param_value']) {
phpcommon\sendError(ERR_USER_BASE + 3, '免费次数不足');
return; return;
} }
$box_num = $row['box_num'] - 1; $free_times = $row['free_times'] + 1;
$ret = $conn->execScript('UPDATE supplybox SET box_num=:box_num, modify_time=:modify_time ' . $ret = $conn->execScript('UPDATE supplybox SET free_times=:free_times, last_buy_time=:last_buy_time, modify_time=:modify_time ' .
' WHERE accountid=:accountid AND box_id=:box_id;', ' WHERE accountid=:accountid AND box_id=:box_id;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':box_id' => $box_id, ':box_id' => $box_id,
':box_num' => $box_num, ':free_times' => $free_times,
':last_buy_time' => time(),
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) { if (!$ret) {
@ -312,14 +315,12 @@ class SupplyBoxController{
':coin_num' => $row['coin_num'] - $s['price'], ':coin_num' => $row['coin_num'] - $s['price'],
':modify_time' => time() ':modify_time' => time()
)); ));
$ret = $conn->execScript('INSERT INTO supplybox(accountid, box_id, box_num, buy_times, last_buy_time, create_time, modify_time) ' . $ret = $conn->execScript('INSERT INTO supplybox(accountid, box_id, buy_times, free_times, last_buy_time, create_time, modify_time) ' .
' VALUES(:accountid, :box_id, :box_num, :buy_times, :last_buy_time, :create_time, :modify_time) ' . ' VALUES(:accountid, :box_id, 1, 0, :last_buy_time, :create_time, :modify_time) ' .
' ON DUPLICATE KEY UPDATE accountid=:accountid, box_id=:box_id, box_num=:box_num, buy_times=:buy_times, last_buy_time=0, modify_time=:modify_time;', ' ON DUPLICATE KEY UPDATE accountid=:accountid, box_id=:box_id, buy_times=1, free_times=0, last_buy_time=0, modify_time=:modify_time;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':box_id' => $box_id, ':box_id' => $box_id,
':box_num' => 1,
':buy_times' => 1,
':last_buy_time' => time(), ':last_buy_time' => time(),
':create_time' => time(), ':create_time' => time(),
':modify_time' => time() ':modify_time' => time()
@ -345,15 +346,12 @@ class SupplyBoxController{
':coin_num' => $row1['coin_num'] - ($s['price'] * pow($s['parameter'], ($row['buy_times']))), ':coin_num' => $row1['coin_num'] - ($s['price'] * pow($s['parameter'], ($row['buy_times']))),
':modify_time' => time() ':modify_time' => time()
)); ));
$buy_times = $row['buy_times'] + 1; $ret = $conn->execScript('UPDATE supplybox SET buy_times=:buy_times, last_buy_time=:time, modify_time=:modify_time ' .
$box_num = $row['box_num'] + 1;
$ret = $conn->execScript('UPDATE supplybox SET box_num=:box_num, buy_times=:buy_times, last_buy_time=:time, modify_time=:modify_time ' .
' WHERE accountid=:accountid AND box_id=:box_id;', ' WHERE accountid=:accountid AND box_id=:box_id;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':box_id' => $box_id, ':box_id' => $box_id,
':box_num' => $box_num, ':buy_times' => $row['buy_times'] + 1,
':buy_times' => $buy_times,
':time' => time(), ':time' => time(),
':modify_time' => time() ':modify_time' => time()
)); ));
@ -388,6 +386,9 @@ class SupplyBoxController{
':fragment_num' => $item_num + $rowSkin['fragment_num'], ':fragment_num' => $item_num + $rowSkin['fragment_num'],
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) {
die();
}
} }
public function supplyReward() public function supplyReward()
@ -429,7 +430,7 @@ class SupplyBoxController{
echo json_encode(array( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',
)); ));
} }
} }
?> ?>

View File

@ -93,29 +93,29 @@ class teamController{
$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失效1'); 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失效2'); phpcommon\sendError(ERR_USER_BASE + 1, 'session失效2');
return; return;
} }
$member_num = count($user_db['member_list']); $member_num = count($user_db['member_list']);
if ($member_num >= 4){ if ($member_num >= 4) {
phpcommon\sendError(ERR_USER_BASE + 2,'队伍人数已满'); phpcommon\sendError(ERR_USER_BASE + 2,'队伍人数已满');
return; return;
} }
$flag = 0; $flag = 0;
foreach ($user_db['member_list'] as $member) { foreach ($user_db['member_list'] as $member) {
if ($member['account_id'] == $_REQUEST['account_id']){ if ($member['account_id'] == $_REQUEST['account_id']) {
$flag = 1; $flag = 1;
break; break;
} }
} }
if ($flag == 1){ if ($flag == 1) {
phpcommon\sendError(ERR_USER_BASE + 3,'已在队伍中'); phpcommon\sendError(ERR_USER_BASE + 3,'已在队伍中');
return; return;
} }
@ -139,28 +139,28 @@ class teamController{
{ {
$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失效1'); 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失效2'); phpcommon\sendError(ERR_USER_BASE + 1,'session失效2');
return; return;
} }
$flag = 0; $flag = 0;
foreach ($user_db['member_list'] as $member) { foreach ($user_db['member_list'] as $member) {
if ($member['account_id'] == $_REQUEST['account_id']){ if ($member['account_id'] == $_REQUEST['account_id']) {
if($member['idx'] != 1){ if ($member['idx'] != 1) {
phpcommon\sendError(ERR_USER_BASE + 4,'你不是队长'); phpcommon\sendError(ERR_USER_BASE + 4,'你不是队长');
return; return;
} }
foreach ($user_db['member_list'] as $member) { foreach ($user_db['member_list'] as $member) {
if ($member['account_id'] == $_REQUEST['member_id']){ if ($member['account_id'] == $_REQUEST['member_id']) {
$flag = $member['idx'] - 1; $flag = $member['idx'] - 1;
break; break;
} }
@ -173,7 +173,7 @@ class teamController{
$user_db['member_list'] = array_values($user_db['member_list']); $user_db['member_list'] = array_values($user_db['member_list']);
$i = 1; $i = 1;
foreach ($user_db['member_list'] as &$memberlist){ foreach ($user_db['member_list'] as &$memberlist) {
$memberlist['idx'] = $i; $memberlist['idx'] = $i;
$i++; $i++;
} }
@ -192,22 +192,22 @@ class teamController{
$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失效1'); 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失效2'); phpcommon\sendError(ERR_USER_BASE + 1,'session失效2');
return; return;
} }
$flag = 0; $flag = 0;
foreach ($user_db['member_list'] as $member) { foreach ($user_db['member_list'] as $member) {
if ($member['account_id'] == $_REQUEST['account_id']){ if ($member['account_id'] == $_REQUEST['account_id']) {
$flag = $member['idx'] - 1; $flag = $member['idx'] - 1;
break; break;
} }
@ -216,7 +216,7 @@ class teamController{
$user_db['member_list'] = array_values($user_db['member_list']); $user_db['member_list'] = array_values($user_db['member_list']);
$i = 1; $i = 1;
foreach ($user_db['member_list'] as &$memberlist){ foreach ($user_db['member_list'] as &$memberlist) {
$memberlist['idx'] = $i; $memberlist['idx'] = $i;
$i++; $i++;
} }
@ -237,20 +237,20 @@ class teamController{
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失效1'); 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失效2'); phpcommon\sendError(ERR_USER_BASE + 1,'session失效2');
return; return;
} }
foreach ($user_db['member_list'] as $member) { foreach ($user_db['member_list'] as $member) {
if ($member['account_id'] == $_REQUEST['account_id']){ if ($member['account_id'] == $_REQUEST['account_id']) {
if($member['idx'] != 1){ if($member['idx'] != 1){
phpcommon\sendError(ERR_USER_BASE + 4,'你不是队长'); phpcommon\sendError(ERR_USER_BASE + 4,'你不是队长');
return; return;
@ -272,23 +272,23 @@ class teamController{
$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失效1'); 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失效2'); phpcommon\sendError(ERR_USER_BASE + 1,'session失效2');
return; return;
} }
foreach ($user_db['member_list'] as $member) { foreach ($user_db['member_list'] as $member) {
if ($member['account_id'] == $_REQUEST['account_id']){ if ($member['account_id'] == $_REQUEST['account_id']) {
if($member['idx'] != 1){ if($member['idx'] != 1) {
phpcommon\sendError(ERR_USER_BASE + 4,'你不是队长'); phpcommon\sendError(ERR_USER_BASE + 4,'你不是队长');
return; return;
} }