setReadOnly(); $userID = Session::getUserID(); $db = DB::db(); increaseRefresh("부대편성", 1); $me = $db->queryFirstRow('SELECT no,nation,troop FROM general WHERE owner=%i', $userID); $troops = []; foreach ($db->query('SELECT troop_leader,name FROM troop WHERE nation = %i', $me['nation']) as $rawTroop) { $troops[$rawTroop['troop_leader']] = [ 'name' => $rawTroop['name'], 'users' => [] ]; } foreach ($db->query( 'SELECT no,name,turntime,troop,city FROM general WHERE troop!=0 AND nation = %i ORDER BY turntime ASC', $me['nation'] ) as $general) { if (!key_exists($general['troop'], $troops)) { trigger_error("올바르지 않은 부대 소속 {$general['no']}, {$general['name']} : {$general['troop']}"); continue; } $general['cityText'] = CityConst::byID($general['city'])->name; $troops[$general['troop']]['users'][] = $general; } if ($troops) { $troopLeaders = $db->query( 'SELECT no,name,picture,imgsvr,turntime,city,troop FROM general WHERE no IN %li', array_keys($troops) ); $generalTurnList = []; foreach ($db->queryAllLists( 'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC', array_column($troopLeaders, 'no') ) as [$generalID, $turnIdx, $brief]) { if (!key_exists($generalID, $generalTurnList)) { $generalTurnList[$generalID] = []; } $generalTurnList[$generalID][$turnIdx] = $brief; } foreach ($troopLeaders as $troopLeader) { $imageTemp = GetImageURL($troopLeader['imgsvr']); $troopLeader['pictureFullPath'] = "$imageTemp/{$troopLeader['picture']}"; $troopLeader['cityText'] = CityConst::byID($troopLeader['city'])->name; $turnText = []; foreach ($generalTurnList[$troopLeader['no']] as $rawTurnIdx => $brief) { if ($brief != '집합') { $brief = '~'; } $turnIdx = $rawTurnIdx + 1; $turnText[] = "{$turnIdx} : {$brief}"; } $troopLeader['turnText'] = join('
', $turnText); $troops[$troopLeader['troop']]['leader'] = $troopLeader; } } uasort($troops, function ($lhs, $rhs) { return $lhs['leader']['turntime'] <=> $rhs['leader']['turntime']; }) ?> <?= UniqueConst::$serverName ?>: 부대편성
부 대 편 성
$troop) { $troopLeader = $troop['leader']; $genlistText = []; $cityText = $troopLeader['cityText']; $cityID = $troopLeader['city']; $leaderID = $troopLeader['no']; foreach ($troop['users'] as $troopUser) { $spanClass = 'troopUser'; if ($troopUser['city'] !== $cityID) { $spanClass .= ' diffCity'; } if ($troopUser['no'] == $leaderID) { $spanClass .= ' leader'; } $genlistText[] = "{$troopUser['name']}【{$troopUser['cityText']}】"; } $genlistText = sprintf('%s (%d명)', join(', ', $genlistText), count($genlistText)); ?> $troop) { ?>
선 택 부 대 정 보 부 대 장 장 수 부대장행동

");background-size:64px;'> 
【턴】
 
");background-size:64px;'> 
【턴】

부 대 명