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);