From af9df325f0a94b684576e4b4ba455e3b16881e78 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 20 May 2018 02:23:44 +0900 Subject: [PATCH] =?UTF-8?q?=ED=98=84=EC=9E=AC=EA=B9=8C=EC=A7=80=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=20=EB=B6=84=EB=9F=89=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_chiefcenter.php | 4 +--- hwe/b_dipcenter.php | 8 ++------ hwe/b_diplomacy.php | 4 ---- hwe/b_myKingdomInfo.php | 4 +--- hwe/b_myPage.php | 2 +- hwe/c_auction.php | 6 ++---- hwe/c_betting.php | 2 +- hwe/c_myBossInfo.php | 4 +--- hwe/c_vacation.php | 10 ++-------- hwe/c_vote.php | 6 +----- hwe/commandlist.php | 4 +--- hwe/func_process_chief.php | 2 +- hwe/process_war.php | 4 +--- 13 files changed, 15 insertions(+), 45 deletions(-) diff --git a/hwe/b_chiefcenter.php b/hwe/b_chiefcenter.php index fcaa6017..b2222b62 100644 --- a/hwe/b_chiefcenter.php +++ b/hwe/b_chiefcenter.php @@ -35,9 +35,7 @@ else { $btn = "hidden"; $btn2 = "hidden"; } $date = date('Y-m-d H:i:s'); // 명령 목록 -$query = "select year,month,turnterm from game limit 1"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$admin = MYDB_fetch_array($result); +$admin = $gameStor->getValues(['year','month','turnterm']); $query = " select nation,level, diff --git a/hwe/b_dipcenter.php b/hwe/b_dipcenter.php index 0076211f..280a4e78 100644 --- a/hwe/b_dipcenter.php +++ b/hwe/b_dipcenter.php @@ -68,9 +68,7 @@ if ($me['level'] >= 5) { 비 고 getValues(['year','month']); $query = "select nation,name,color,power,gennum from nation order by power desc"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); @@ -187,9 +185,7 @@ $query = "select nation,name,color,type,msg,gold,rice,bill,rate,scout,war,scoutm $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $nation = MYDB_fetch_array($result); -$query = "select gold_rate,rice_rate from game limit 1"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); -$admin = MYDB_fetch_array($result); +$admin = $gameStor->getValues(['gold_rate','rice_rate']); // 금 수지 $deadIncome = getDeadIncome($nation['nation'], $nation['type'], $admin['gold_rate']); diff --git a/hwe/b_diplomacy.php b/hwe/b_diplomacy.php index 3a451dfa..74182da8 100644 --- a/hwe/b_diplomacy.php +++ b/hwe/b_diplomacy.php @@ -13,10 +13,6 @@ $connect=$db->get(); increaseRefresh("중원정보", 1); -$query = "select turnterm from game limit 1"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$admin = MYDB_fetch_array($result); - $query = "select no,nation from general where owner='{$userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); diff --git a/hwe/b_myKingdomInfo.php b/hwe/b_myKingdomInfo.php index 918aff99..16f6d593 100644 --- a/hwe/b_myKingdomInfo.php +++ b/hwe/b_myKingdomInfo.php @@ -66,9 +66,7 @@ $query = "select sum(crew) as totcrew,sum(leader)*100 as maxcrew from general wh $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); -$query = "select gold_rate,rice_rate from game limit 1"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$admin = MYDB_fetch_array($result); +$admin = $gameStor->getValues(['gold_rate','rice_rate']); // 금 수지 $deadIncome = getDeadIncome($nation['nation'], $nation['type'], $admin['gold_rate']); diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index 1eaf4069..01b68b9d 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -57,7 +57,7 @@ if (($btn == "설정저장" || $detachNPC) && $me['myset'] > 0) { ], 'owner=%i', $userID); if($me['npc'] == 1 && $detachNPC){ - $turnterm = $db->queryFirstField('SELECT turnterm FROM game LIMIT 1'); + $turnterm = $gameStor->turnterm; if($turnterm < 10){ $targetKillTurn = 30 / $turnterm; diff --git a/hwe/c_auction.php b/hwe/c_auction.php index 454e7e13..b5648b74 100644 --- a/hwe/c_auction.php +++ b/hwe/c_auction.php @@ -39,9 +39,7 @@ $connect=$db->get(); increaseRefresh("입찰", 1); -$query = "select turnterm from game limit 1"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); -$admin = MYDB_fetch_array($result); +$turnterm = $gameStor->turnterm; $query = "select no,name,gold,rice,special from general where owner='{$userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); @@ -57,7 +55,7 @@ $bidCount = MYDB_num_rows($result); $btCount = $tradeCount + $bidCount; -$unit = $admin['turnterm'] * 60; +$unit = $turnterm * 60; $amount = Util::round($amount / 10) * 10; $cost = Util::round($cost / 10) * 10; diff --git a/hwe/c_betting.php b/hwe/c_betting.php index 312cec10..c8932466 100644 --- a/hwe/c_betting.php +++ b/hwe/c_betting.php @@ -42,7 +42,7 @@ $gameStor = KVStorage::getStorage($db, 'game_env'); increaseRefresh("베팅", 1); -$tournament = $db->queryFirstField('SELECT tournament FROM game LIMIT 1'); +$tournament = $gameStor->tournament; if($tournament != 6) { header('Location: b_betting.php'); exit(); diff --git a/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index 0c6d70cb..592694c4 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -21,9 +21,7 @@ $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); $connect=$db->get(); -$query = "select startyear,year,month,scenario from game limit 1"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$admin = MYDB_fetch_array($result); +$admin = $gameStor->getValues(['startyear','year','month','scenario']); $query = "select no,nation,level from general where owner='{$userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/hwe/c_vacation.php b/hwe/c_vacation.php index ea2ff873..e93dfb3a 100644 --- a/hwe/c_vacation.php +++ b/hwe/c_vacation.php @@ -9,16 +9,10 @@ $userID = Session::getUserID(); $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); -$connect=$db->get(); -$query = "select killturn from game limit 1"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$admin = MYDB_fetch_array($result); +$killturn = $gameStor->killturn; -$admin['killturn'] *= 3; - -$query = "update general set killturn='{$admin['killturn']}' where owner='{$userID}'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); +$db->update('general', ['killturn'=>$killturn*3], 'owner=%i', $userID); header('location:b_myPage.php'); diff --git a/hwe/c_vote.php b/hwe/c_vote.php index 8e445774..e501771b 100644 --- a/hwe/c_vote.php +++ b/hwe/c_vote.php @@ -48,11 +48,7 @@ else if($btn == "댓글" && $comment != "") { if($admin['votecomment'] != "") { $admin['votecomment'] .= "|"; } $admin['votecomment'] .= "{$nation['name']}:{$me['name']}:{$comment}"; - $query = "update game set votecomment='{$admin['votecomment']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - - - + $gameStor->votecomment = $admin['votecomment']; } if($session->userGrade < 5){ diff --git a/hwe/commandlist.php b/hwe/commandlist.php index cdc3f341..665d5065 100644 --- a/hwe/commandlist.php +++ b/hwe/commandlist.php @@ -74,9 +74,7 @@ function myCommandList() { $date = date('Y-m-d H:i:s'); // 명령 목록 - $query = "select year,month,turnterm from game limit 1"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $admin = MYDB_fetch_array($result); + $admin = $gameStor->getValues(['year','month','turnterm']); $query = "select no,turntime,term,turn0,turn1,turn2,turn3,turn4,turn5,turn6,turn7,turn8,turn9,turn10,turn11,turn12,turn13,turn14,turn15,turn16,turn17,turn18,turn19,turn20,turn21,turn22,turn23 from general where owner='{$userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index 084af3ae..70a4acb8 100644 --- a/hwe/func_process_chief.php +++ b/hwe/func_process_chief.php @@ -893,7 +893,7 @@ function process_64(&$general) { $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); $date = substr($general['turntime'],11,5); - list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1'); + list($year, $month, $turnterm) = $gameStor->getValuesAsArray(['year','month','turnterm']); if($general['level'] < 5 || $general['nation']==0) { pushGenLog($general, ["●{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date"]); diff --git a/hwe/process_war.php b/hwe/process_war.php index fd030597..0138ec80 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -13,9 +13,7 @@ function processWar($general, $city) { $date = substr($general['turntime'],11,5); - $query = "select * from game limit 1"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $game_env = MYDB_fetch_array($result); + $game_env = $gameStor->getAll(); $year = $game_env['year']; $month = $game_env['month'];