From a6ff79d14863523b08974abb4f34e89875c33358 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Mon, 31 Jul 2023 07:28:01 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20General=20=EC=83=9D=EC=84=B1=EC=9A=A9=20?= =?UTF-8?q?=EC=9D=B8=EC=9E=90=20=EC=88=98=EC=A0=95=20-=20General=20?= =?UTF-8?q?=ED=81=B4=EB=9E=98=EC=8A=A4=EB=8A=94=20=ED=95=AD=EC=83=81=20?= =?UTF-8?q?=EB=AA=A8=EB=93=A0=EA=B1=B8=20=EC=9A=94=EA=B5=AC=ED=95=A8=20-?= =?UTF-8?q?=20=EC=9E=A5=EA=B8=B0=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=B0=94?= =?UTF-8?q?=EB=9E=8C=EC=A7=81=20=ED=95=98=EC=A7=80=20=EC=95=8A=EC=9D=8C=20?= =?UTF-8?q?=20=20-=20new=20General=20=ED=98=B8=EC=B6=9C=EC=9D=B4=20?= =?UTF-8?q?=EA=B7=B8=EB=83=A5=20=EA=B0=80=EB=8A=A5=ED=95=B4=EC=84=A0=20?= =?UTF-8?q?=EC=95=88=20=EB=90=A0=20=EA=B2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Event/Action/ProcessIncome.php | 3 ++- hwe/sammo/Event/Action/RaiseDisaster.php | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hwe/sammo/Event/Action/ProcessIncome.php b/hwe/sammo/Event/Action/ProcessIncome.php index 7173070f..e90b39ca 100644 --- a/hwe/sammo/Event/Action/ProcessIncome.php +++ b/hwe/sammo/Event/Action/ProcessIncome.php @@ -39,7 +39,8 @@ class ProcessIncome extends \sammo\Event\Action $nationList = $db->query('SELECT name,nation,capital,gold,level,rate_tmp,bill,type from nation'); $cityListByNation = Util::arrayGroupBy($db->query('SELECT * FROM city'), 'nation'); - $generalRawListByNation = Util::arrayGroupBy($db->query('SELECT no,name,nation,gold,officer_level,dedication,city FROM general WHERE npc != 5'), 'nation'); + //FIXME: factory 형태로 바꿔야함 + $generalRawListByNation = Util::arrayGroupBy($db->query('SELECT %l FROM general WHERE npc != 5', Util::formatListOfBackticks(General::mergeQueryColumn()[0])), 'nation'); //국가별 처리 foreach ($nationList as $nation) { diff --git a/hwe/sammo/Event/Action/RaiseDisaster.php b/hwe/sammo/Event/Action/RaiseDisaster.php index da7cb8b0..793b279a 100644 --- a/hwe/sammo/Event/Action/RaiseDisaster.php +++ b/hwe/sammo/Event/Action/RaiseDisaster.php @@ -112,7 +112,12 @@ class RaiseDisaster extends \sammo\Event\Action $logger->flush(); if (!$isGood) { - $generalListByCity = Util::arrayGroupBy($db->query('SELECT no, name, nation, city, officer_level, injury, leadership, strength, intel, horse, weapon, book, item, crew, crewtype, atmos, train, special, special2 FROM general WHERE city IN %li', Util::squeezeFromArray($targetCityList, 'city')), 'city'); + //FIXME: factory 형태로 바꿔야함 + $generalListByCity = Util::arrayGroupBy($db->query( + 'SELECT %l FROM general WHERE city IN %li', + Util::formatListOfBackticks(General::mergeQueryColumn()[0]), + Util::squeezeFromArray($targetCityList, 'city')), + 'city'); //NOTE: 쿼리 1번이지만 복잡하기 vs 쿼리 여러번이지만 조금 더 깔끔하기 foreach ($targetCityList as $city) { $affectRatio = Util::valueFit($city['secu'] / $city['secu_max'] / 0.8, 0, 1);