diff --git a/.phan/config.php b/.phan/config.php
index 56676933..0d09cd0c 100644
--- a/.phan/config.php
+++ b/.phan/config.php
@@ -84,7 +84,6 @@ return [
'hwe/j_adjust_icon.php',
'hwe/j_autoreset.php',
'hwe/j_basic_info.php',
- 'hwe/j_betting.php',
'hwe/j_board_article_add.php',
'hwe/j_board_comment_add.php',
'hwe/j_board_get_articles.php',
diff --git a/hwe/b_betting.php b/hwe/b_betting.php
index 478dbdea..5408e310 100644
--- a/hwe/b_betting.php
+++ b/hwe/b_betting.php
@@ -17,40 +17,10 @@ TurnExecutionHelper::executeAllCommand();
$generalID = $session->generalID;
-$bettingID = $gameStor->lastTournamentBettingID ?? 0;
-if ($bettingID == 0) {
- //TODO: 좋은 방법 없나?
- die('아직 베팅이 열리지 않았습니다.');
-}
-$betting = new Betting($bettingID);
-$info = $betting->getInfo();
-
-$myBet = [];
-$globalBet = [];
-
-foreach ($db->queryAllLists(
- 'SELECT general_id, user_id, amount, betting_type FROM ng_betting WHERE betting_id = %i',
- $this->bettingID
-) as [$betGeneralID, $userID, $amount, $bettingTypeKey]) {
- $bettingKey = Json::decode($bettingTypeKey)[0];
- if ($betGeneralID == $generalID) {
- $myBet[$bettingKey] = $amount;
- }
-
- if (key_exists($bettingKey, $globalBet)) {
- $globalBet[$bettingKey] += $amount;
- } else {
- $globalBet[$bettingKey] = $amount;
- }
-}
-
$me = $db->queryFirstRow('SELECT no,tournament,con,turntime from general where owner=%i', $userID);
-$myBetTotal = array_sum($myBet);
-$globalBetTotal = array_sum($globalBet);
-
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'develcost']);
$con = checkLimit($me['con']);
@@ -60,34 +30,68 @@ if ($con >= 2) {
}
switch ($admin['tnmt_type']) {
- default:
- throw new \RuntimeException('Invalid tnmt_type');
case convertTournamentType('전력전'):
- $tnmt_type = "전력전";
+ $tnmt_type = "전력전";
+ $color = "cyan";
$tp = "total";
$tp2 = "종합";
$tp3 = "total";
break;
case convertTournamentType('통솔전'):
- $tnmt_type = "통솔전";
+ $tnmt_type = "통솔전";
+ $color = "cyan";
$tp = "leadership";
$tp2 = "통솔";
$tp3 = "leadership";
break;
case convertTournamentType('일기토'):
- $tnmt_type = "일기토";
+ $tnmt_type = "일기토";
+ $color = "cyan";
$tp = "strength";
$tp2 = "무력";
$tp3 = "strength";
break;
case convertTournamentType('설전'):
- $tnmt_type = "설전";
+ $tnmt_type = "설전";
+ $color = "cyan";
$tp = "intel";
$tp2 = "지력";
$tp3 = "intel";
break;
+ default:
+ throw new \RuntimeException('Invalid tnmt_type');
}
+$bettingID = $gameStor->lastTournamentBettingID ?? 0;
+$myBet = [];
+$globalBet = [];
+
+if ($bettingID != 0) {
+ $betting = $bettingID != 0 ? new Betting($bettingID) : null;
+ $info = $betting->getInfo();
+
+ foreach ($db->queryAllLists(
+ 'SELECT general_id, user_id, amount, betting_type FROM ng_betting WHERE betting_id = %i',
+ $bettingID
+ ) as [$betGeneralID, $userID, $amount, $bettingTypeKey]) {
+ $bettingKey = Json::decode($bettingTypeKey)[0];
+ if ($betGeneralID == $generalID) {
+ $myBet[$bettingKey] = $amount;
+ }
+
+ if (key_exists($bettingKey, $globalBet)) {
+ $globalBet[$bettingKey] += $amount;
+ } else {
+ $globalBet[$bettingKey] = $amount;
+ }
+ }
+} else {
+ $info = getDummyBettingInfo($tnmt_type);
+}
+
+$myBetTotal = array_sum($myBet);
+$globalBetTotal = array_sum($globalBet);
+
$str1 = getTournament($admin['tournament']);
$str2 = getTournamentTime();
if ($str2) {
@@ -114,6 +118,11 @@ if ($str3) {
= WebUtil::printCSS('../d_shared/common.css') ?>
= WebUtil::printDist('ts', ['common', 'betting']) ?>
+ = WebUtil::printStaticValues([
+ 'staticValues'=>[
+ 'bettingID'=> $bettingID
+ ]
+ ])?>
@@ -128,7 +137,7 @@ if ($str3) {
";
foreach (range(0, 15) as $i) {
- $key = $keyMap[$i];
+ $key = $keyMap[$i] ?? -1;
echo "
|
|