From 85f801df4d96594b36db99c2f450f855af21f621 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Thu, 21 Apr 2022 23:51:03 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20MapViewer=EC=99=80=20API=EC=9D=98=20?= =?UTF-8?q?=EB=B2=84=EC=A0=84=EC=9D=B4=20=EA=B0=99=EC=9D=84=20=EB=95=8C?= =?UTF-8?q?=EC=97=90=EB=A7=8C=20=EC=A7=80=EB=8F=84=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_map.php | 17 +++++++++-------- hwe/ts/components/MapViewer.vue | 10 +++++++++- hwe/ts/defs/index.ts | 3 +++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/hwe/func_map.php b/hwe/func_map.php index ea96ae56..0c8f3214 100644 --- a/hwe/func_map.php +++ b/hwe/func_map.php @@ -35,7 +35,7 @@ function getHistoryMap($year, $month, ?string $serverID=null){ $map = DB::db()->queryFirstField('SELECT map FROM ng_history WHERE server_id = %s AND year=%i and month=%i', $serverID, - $year, + $year, $month); if(!$map){ @@ -53,7 +53,7 @@ function getWorldMap($req){ if(is_array($req)){ $req = new MapRequest($req); } - + if($req->year && $req->month){ return getHistoryMap($req->year, $req->month, $req->serverID??null); } @@ -98,7 +98,7 @@ function getWorldMap($req){ $spyInfo = (object)null; if($myNation){ - $rawSpy = $db->queryFirstField('select `spy` from `nation` where `nation`=%i', + $rawSpy = $db->queryFirstField('select `spy` from `nation` where `nation`=%i', $myNation); if(strpos($rawSpy, '|') !== false || is_numeric($rawSpy)){ @@ -123,16 +123,16 @@ function getWorldMap($req){ $nationList = []; foreach($db->query('select `nation`, `name`, `color`, `capital` from `nation`') as $row){ $nationList[] = [ - Util::toInt($row['nation']), - $row['name'], - $row['color'], + Util::toInt($row['nation']), + $row['name'], + $row['color'], Util::toInt($row['capital']) ]; } if($myNation){ //굳이 타국 도시에 있는 아국 장수 리스트를 뽑을 이유가 없음. 일단 다 뽑자. - $shownByGeneralList = + $shownByGeneralList = array_map('\\sammo\\Util::toInt', $db->queryFirstColumn('select distinct `city` from `general` where `nation` = %i', $myNation)); @@ -143,7 +143,7 @@ function getWorldMap($req){ $cityList = []; foreach($db->query('select `city`, `level`, `state`, `nation`, `region`, `supply` from `city`') as $r){ - $cityList[] = + $cityList[] = array_map('\\sammo\\Util::toInt', [$r['city'], $r['level'], $r['state'], $r['nation'], $r['region'], $r['supply']]); } @@ -164,6 +164,7 @@ function getWorldMap($req){ 'shownByGeneralList' => $shownByGeneralList, 'myCity' => $myCity, 'myNation' => $myNation, + 'version' => 0, 'result' => true ]; } \ No newline at end of file diff --git a/hwe/ts/components/MapViewer.vue b/hwe/ts/components/MapViewer.vue index c75802dc..7013e813 100644 --- a/hwe/ts/components/MapViewer.vue +++ b/hwe/ts/components/MapViewer.vue @@ -1,5 +1,6 @@