메시지 전송 시스템을 새 시스템에 맞게 수정
국가의 기본 정보를 중복 쿼리 없이 받아오는 함수 추가 - 해당 함수를 위해 국가색, 건국 등의 국가 정보가 바뀌는 경우 refresh 새 메시지 시스템 적용을 위해 메인 페이지 틀 변경
This commit is contained in:
+29
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user