From b1b06d9c827a8ce63a3fec269f3d70e7a9aa9b9c Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 15 May 2020 00:23:10 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B2=A0=ED=8C=85=EC=9E=A5=20=EC=88=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_tournament.php | 6 ++++++ hwe/c_tournament.php | 19 ++++++++++++++++--- hwe/js/betting.js | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/hwe/b_tournament.php b/hwe/b_tournament.php index 64c037ad..b666c31d 100644 --- a/hwe/b_tournament.php +++ b/hwe/b_tournament.php @@ -415,6 +415,9 @@ for ($i=0; $i < 8; $i++) { foreach($generalList as $k=>$general) { printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']); } + foreach(Util::range(count($generalList), 4) as $idx){ + printRow($idx, '', '', '', '', '', '', '', '', '', ''); + } echo " "; @@ -439,6 +442,9 @@ for ($i=0; $i < 8; $i++) { foreach($generalList as $k=>$general) { printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']); } + foreach(Util::range(count($generalList), 8) as $idx){ + printRow($idx, '', '', '', '', '', '', '', '', '', ''); + } echo " "; diff --git a/hwe/c_tournament.php b/hwe/c_tournament.php index b55eb4b9..259c98f4 100644 --- a/hwe/c_tournament.php +++ b/hwe/c_tournament.php @@ -122,7 +122,13 @@ if($btn == "자동개최설정") { $grpCount = count($occupied); if($grpCount < 8) { - $grp = Util::choiceRandom(array_keys($occupied)); + $notFullGrp = []; + foreach(Util::range(8) as $grpIdx){ + if(!($occupied[$grpIdx]??false)){ + $notFullGrp[] = $grpIdx; + } + } + $grp = Util::choiceRandom($notFullGrp); $grpMemberCount = $db->queryFirstField('SELECT count(*) FROM tournament WHERE grp=%i', $grp); $db->insert('tournament', [ 'no'=>$general['no'], @@ -150,8 +156,15 @@ if($btn == "자동개최설정") { } } elseif($btn == "랜덤전부투입") { - $code = []; + $grpIn = []; + foreach($db->queryAllLists('SELECT grp, count(*) FROM tournament WHERE 0 <= grp AND grp < 8 GROUP BY grp') as [$grpIdx, $cnt]){ + $grpIn[$grpIdx] = $cnt; + + } + $code = []; + foreach(Util::range(8) as $grpIdx){ + $cnt = $grpIn[$grpIdx]??0; foreach(Util::range($cnt, 8) as $grpNo){ $code[] = $grpIdx * 10 + $grpNo; } @@ -184,7 +197,7 @@ if($btn == "자동개최설정") { } $db->update('general', [ 'tournament'=>1, - ], 'no=%li', array_column($generals, 'no')); + ], 'no IN %li', Util::squeezeFromArray($generals, 'no')); $gameStor->tournament = 2; $gameStor->phase = 0; diff --git a/hwe/js/betting.js b/hwe/js/betting.js index b12d5641..165a1fe9 100644 --- a/hwe/js/betting.js +++ b/hwe/js/betting.js @@ -2,7 +2,7 @@ jQuery(function($){ $('.submitBtn').click(function(){ var $this = $(this); var target = parseInt($this.data('target')); - var amount = $('target_{0}'.format(target)).val(); + var amount = $('#target_{0}'.format(target)).val(); $.post({ url:'j_betting.php',