새 메시지 시스템 준비

This commit is contained in:
2018-02-04 05:37:41 +09:00
parent df63869a29
commit 001d7037c5
8 changed files with 90 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
{
"result":true,
"sequence":1122
}
+53
View File
@@ -0,0 +1,53 @@
<?php
require('../twe/lib.php');
use utilphp\util as util;
/*
원래대로라면 json을 돌려주는게 맞지만
refresh를 반영해야하므로 php로 중계해서 반환함!
*/
function relayJson($filepath, $noCache = true, $die = true){
//NOTE: $filepath 경로 주의
header('Content-Type: application/json');
if($noCache){
header('Expires: Sun, 01 Jan 2014 00:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
}
echo file_get_contents($filepath);
if($die){
die();
}
}
$jsonPost = parseJsonPost();
$reqSequence = toInt(util::array_get($jsonPost['sequence'], 0), true);
if($reqSequence === null){
$reqSequence = 0;
}
//서버가 돌아가는게 아니니까 흉내만 내자.
switch($reqSequence){
case 0:
relayJson('fresh_result.json');
break;
case 1122:
relayJson('update_private_result.json');
break;
case 1366:
relayJson('update_public_result.json');
break;
case 1811:
relayJson('update_national_result.json');
break;
}
//???
relayJson('fresh_result.json');
View File
+21
View File
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>JSON 지도</title>
<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="msg.js"></script>
<link href="../twe/css/normalize.css" rel="stylesheet">
<link href="../twe/css/common.css" rel="stylesheet">
<link href="msg.css" ref="stylesheet">
<script>
</script>
</head>
<body style="background-color: black;">
</body>
</html>
View File
+4
View File
@@ -0,0 +1,4 @@
{
"result":true,
"sequence":1357
}
+4
View File
@@ -0,0 +1,4 @@
{
"result":true,
"sequence":1366
}
+4
View File
@@ -0,0 +1,4 @@
{
"result":true,
"sequence":1811
}