메시지 전송 시스템을 새 시스템에 맞게 수정

국가의 기본 정보를 중복 쿼리 없이 받아오는 함수 추가
  - 해당 함수를 위해 국가색, 건국 등의 국가 정보가 바뀌는 경우 refresh
새 메시지 시스템 적용을 위해 메인 페이지 틀 변경
This commit is contained in:
2018-02-22 02:04:54 +09:00
parent 2fb005ec6d
commit 34cd58d8f3
15 changed files with 180 additions and 226 deletions
+29 -1
View File
@@ -252,6 +252,17 @@ function LogText($prefix, $variable){
fclose($fp);
}
function ArrayToDict($arr, $keyName){
$result = [];
foreach($arr as $obj){
$key = $obj[$keyName];
$result[$key] = $obj;
}
return $result;
}
function dictToArray($dict, $keys){
$result = [];
@@ -288,6 +299,14 @@ function isDict(&$array){
function eraseNullValue(&$dict, $depth=512){
//TODO:Test 추가
if($dict === null){
return null;
}
if(is_array($dict) && empty($dict)){
return null;
}
if($depth <= 0){
return $dict;
}
@@ -297,10 +316,19 @@ function eraseNullValue(&$dict, $depth=512){
unset($dict[$key]);
}
else if(isDict($value)){
$dict[$key] = eraseNullKey($value, $depth - 1);
$newValue = eraseNullKey($value, $depth - 1);
if($newValue === null){
unset($dict[$key]);
}
else{
$dict[$key] = $newValue;
}
}
}
return $dict;
}