func_map.php에서 연관배열을 일반 배열로 착각한 버그 수정

func_map.php에서 result를 설정하지 않은 버그 수정

main.php에서 지도를 제대로 불러오도록 수정

map.js에서 국가가 재야인 경우 국가 tooltip을 띄우지 않도록 수정

b_CurrentCity.php의 도시 정보 값을 get으로도 받을 수 있도록 변경
This commit is contained in:
2018-02-02 00:55:02 +09:00
parent 0841950366
commit 438511972e
5 changed files with 56 additions and 31 deletions
+8 -8
View File
@@ -36,10 +36,10 @@ if($me['skin'] < 1) {
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr> <tr>
<td width=998> <td width=998>
<form name=cityselect method=post>도시선택 : <form name=cityselect method=get>도시선택 :
<select name=citylist size=1 style=color:white;background-color:black;width:798;> <select name=citylist size=1 style=color:white;background-color:black;width:798;>
<?php <?php
if(!array_key_exists('citylist', $_POST) && $_POST['citylist'] == '') { $_POST['citylist'] = $me['city']; } if(!array_key_exists('citylist', $_REQUEST) || $_REQUEST['citylist'] == '') { $_REQUEST['citylist'] = $me['city']; }
// 재야일때는 현재 도시만 // 재야일때는 현재 도시만
$valid = 0; $valid = 0;
@@ -49,7 +49,7 @@ if($me['level'] == 0) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
echo " echo "
<option value={$city['city']}"; <option value={$city['city']}";
if($city['city'] == $_POST['citylist']) { echo " selected"; $valid = 1; } if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】"; echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지"; if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국=="; elseif($me['nation'] == $city['nation']) echo "본국==";
@@ -65,7 +65,7 @@ if($me['level'] == 0) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
echo " echo "
<option value={$city['city']}"; <option value={$city['city']}";
if($city['city'] == $_POST['citylist']) { echo " selected"; $valid = 1; } if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】"; echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지"; if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국=="; elseif($me['nation'] == $city['nation']) echo "본국==";
@@ -82,7 +82,7 @@ if($me['level'] == 0) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
echo " echo "
<option value={$city['city']}"; <option value={$city['city']}";
if($city['city'] == $_POST['citylist']) { echo " selected"; $valid = 1; } if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】"; echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지"; if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국=="; elseif($me['nation'] == $city['nation']) echo "본국==";
@@ -108,7 +108,7 @@ if($myNation['level'] > 0) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
echo " echo "
<option value={$city['city']}"; <option value={$city['city']}";
if($city['city'] == $_POST['citylist']) { echo " selected"; $valid = 1; } if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; }
echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】"; echo ">==================================================【"._String::Fill($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지"; if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국=="; elseif($me['nation'] == $city['nation']) echo "본국==";
@@ -130,10 +130,10 @@ echo "
// 첩보된 도시까지만 허용 // 첩보된 도시까지만 허용
if($valid == 0 && $me['userlevel'] < 5) { if($valid == 0 && $me['userlevel'] < 5) {
$_POST['citylist'] = $me['city']; $_REQUEST['citylist'] = $me['city'];
} }
$query = "select * from city where city='{$_POST['citylist']}'"; // 도시 이름 목록 $query = "select * from city where city='{$_REQUEST['citylist']}'"; // 도시 이름 목록
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
+13 -5
View File
@@ -54,13 +54,19 @@ function getWorldMap($req){
$db = getDB(); $db = getDB();
list($startYear, $year, $month) = $db->queryFirstRow('select `startyear`, `year`, `month` from `game` where `no`=1'); $game = $db->queryFirstRow('select `startyear`, `year`, `month` from `game` where `no` = 1');
$startYear = $game['startyear'];
$year = $game['year'];
$month = $game['month'];
if($generalID && ($req->showMe || $req->neutralView)){ if($generalID && ($req->showMe || $req->neutralView)){
list($myCity, $myNation) $city = $db->queryFirstRow(
= $db->queryFirstRow(
'select `city`, `nation` from `general` where `user_id`=%i', 'select `city`, `nation` from `general` where `user_id`=%i',
$generalID); $generalID);
$myCity = $city['city'];
$myNation = $city['nation'];
if(!$req->showMe){ if(!$req->showMe){
$myCity = null; $myCity = null;
} }
@@ -99,7 +105,8 @@ function getWorldMap($req){
$cityList = []; $cityList = [];
foreach($db->query('select `city`, `level`, `state`, `nation`, `region`, `supply` from `city`') as $r){ foreach($db->query('select `city`, `level`, `state`, `nation`, `region`, `supply` from `city`') as $r){
$cityList[] = [$r['city'], $r['level'], $r['state'], $r['nation'], $r['region'], $r['supply']]; $cityList[] =
array_map('intval', [$r['city'], $r['level'], $r['state'], $r['nation'], $r['region'], $r['supply']]);
} }
return [ return [
@@ -111,6 +118,7 @@ function getWorldMap($req){
'spyList' => $spyList, 'spyList' => $spyList,
'shownByGeneralList' => $shownByGeneralList, 'shownByGeneralList' => $shownByGeneralList,
'myCity' => $myCity, 'myCity' => $myCity,
'myNation' => $myNation 'myNation' => $myNation,
'result' => true
]; ];
} }
+1 -9
View File
@@ -33,12 +33,4 @@ else{
$post['month'] = null; $post['month'] = null;
} }
returnJson(getWorldMap($post));
//TODO: DB를 받아오는 함수를 부른다. 부르는 함수는 func.php 쪽에 있는 것이 좋을 듯. 받아오는 방식은 map.php 참고.
//TODO: 결과값을 반환한다. 반환하는 양식은 tmp_map/result.json 참고
$request = new MapRequest($post);
returnJson(getWorldMap($request));
+20 -6
View File
@@ -391,7 +391,15 @@ function reloadWorldMap(option){
var $this = $(this); var $this = $(this);
var position = $this.parent().position(); var position = $this.parent().position();
$tooltip_city.html($this.data('text')); $tooltip_city.html($this.data('text'));
$tooltip_nation.html($this.data('nation'));
var nation_text = $this.data('nation');
if(nation_text){
$tooltip_nation.html(nation_text).show();
}
else{
$tooltip_nation.html('').hide();
}
$tooltip.css({'top': position.top + 25, 'left': position.left + 35}).show(); $tooltip.css({'top': position.top + 25, 'left': position.left + 35}).show();
var touchMode = $this.data('touchMode'); var touchMode = $this.data('touchMode');
@@ -432,7 +440,13 @@ function reloadWorldMap(option){
$tooltip_city.data('target', $this.data('id')); $tooltip_city.data('target', $this.data('id'));
$tooltip_city.html($this.data('text')); $tooltip_city.html($this.data('text'));
$tooltip_nation.html($this.data('nation')); var nation_text = $this.data('nation');
if(nation_text){
$tooltip_nation.html(nation_text).show();
}
else{
$tooltip_nation.html('').hide();
}
$tooltip.show(); $tooltip.show();
}); });
@@ -491,16 +505,16 @@ function reloadWorldMap(option){
//deferred mode of jQuery. != promise-then. //deferred mode of jQuery. != promise-then.
deferred = $.ajax({ deferred = $.ajax({
url: option.targetJson, url: option.targetJson,
type: 'POST', type: 'post',
dataType:'json',
contentType: 'application/json', contentType: 'application/json',
data: { data: JSON.stringify({
neutralView:option.neutralView, neutralView:option.neutralView,
year:option.year, year:option.year,
month:option.month, month:option.month,
showMe:option.showMe, showMe:option.showMe,
aux:option.aux aux:option.aux
}, })
dataType:'json'
}); });
deferred deferred
+14 -3
View File
@@ -58,13 +58,22 @@ $scenario = getScenario();
<head> <head>
<title>메인</title> <title>메인</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="../e_lib/jquery-3.2.1.min.js"></script> <script src="../e_lib/jquery-3.2.1.min.js"></script>
<script src="js/main.js"></script> <script src="js/main.js"></script>
<script src="js/base_map.js"></script>
<script src="js/map.js"></script>
<script>
$(function(){
reloadWorldMap({
hrefTemplate:'b_currentCity.php?citylist={0}'
});
});
</script>
<link href="css/normalize.css" rel="stylesheet"> <link href="css/normalize.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet"> <link href="css/common.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet"> <link href="css/main.css" rel="stylesheet">
<link rel=stylesheet href=css/common.css type=text/css> <link href="css/map.css" rel="stylesheet">
<?php require('analytics.php'); ?> <?php require('analytics.php'); ?>
</head> </head>
@@ -178,7 +187,9 @@ if($me['userlevel'] >= 5) {
</table> </table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0>
<tr> <tr>
<td width=698 height=520 colspan=2><iframe src='map.php?type=0&graphic=<?=$me['map'];?>' width=698 height=520 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td> <td width=698 height=520 colspan=2>
<?=getMapHtml()?>
</td>
<td width=298 rowspan=4><iframe name=commandlist src='commandlist.php' width=298 height=700 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td> <td width=298 rowspan=4><iframe name=commandlist src='commandlist.php' width=298 height=700 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td>
</tr> </tr>
<form name=form2 action=preprocessing.php method=post target=commandlist> <form name=form2 action=preprocessing.php method=post target=commandlist>