From 1450715c56233af15634a64a98534a5fa96b4f13 Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 21 Feb 2018 22:37:54 +0900 Subject: [PATCH] =?UTF-8?q?=EC=83=88=20=EB=A9=94=EC=8B=9C=EC=A7=80,=20?= =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EB=9D=BD/=EA=B1=B0?= =?UTF-8?q?=EC=A0=88=20=EB=8F=99=EC=9E=91=20=EB=B0=A9=EC=8B=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tmp_msg/fresh_result.json | 24 ++++++++++++++++ tmp_msg/msg.js | 9 +++++- tmp_msg/tmp_template.html | 2 +- tmp_msg/update_national_result.json | 44 ++++++++++++++++------------- tmp_msg/update_private_result.json | 9 ++++-- 5 files changed, 63 insertions(+), 25 deletions(-) diff --git a/tmp_msg/fresh_result.json b/tmp_msg/fresh_result.json index d2388f6a..75e07b2b 100644 --- a/tmp_msg/fresh_result.json +++ b/tmp_msg/fresh_result.json @@ -249,6 +249,30 @@ } ], "private":[ + { + "id":1206, + "time":"2018-02-10 22:04:04", + "isSender":false, + "src":{ + "id":21, + "nation_id":2, + "name":"Hide_Dx2", + "nation":"연구소2", + "color":"#ff0000" + }, + "dest":{ + "id":11, + "nation_id":1, + "name":"Hide_D", + "nation":"연구소", + "color":"#ffd700" + }, + "text":"연구소2로 망명 권유 서신2", + "option":{ + "used":false, + "action":"scout" + } + }, { "id":1205, "time":"2018-02-10 22:04:04", diff --git a/tmp_msg/msg.js b/tmp_msg/msg.js index f45be012..918f5722 100644 --- a/tmp_msg/msg.js +++ b/tmp_msg/msg.js @@ -127,14 +127,21 @@ function redrawMsg(deferred){ var msgHtml = TemplateEngine(messageTemplate, msg); - //만약 이전 메시지가 변경된 것인가 확인한다. + //만약 이전 메시지와 같은 id가 온 경우 덮어씌운다. + //NOTE:현 프로세스 상에서는 같은 id가 와선 안된다. var $existMsg = $('#msg_{0}'.format(msg.id)); var $msg = $(msgHtml); if($existMsg.length){ + console.log('메시지 충돌', $msg, $existMsg); $existMsg.html($msg.html()); $msg = $existMsg; } + if(msg.option && msg.option.parent){ + //parent는 삭제. + $('#msg_{0}'.format(msg.option.parent)).detach(); + } + $msg.find('button.prompt_yes').click(function(){ if(!confirm("수락하시겠습니까?")){ return false; diff --git a/tmp_msg/tmp_template.html b/tmp_msg/tmp_template.html index 6d1d0a61..a954bf97 100644 --- a/tmp_msg/tmp_template.html +++ b/tmp_msg/tmp_template.html @@ -29,7 +29,7 @@
<%e(text)%>
- <%if(this.option) {%> + <%if(this.option && this.option.action) {%>
diff --git a/tmp_msg/update_national_result.json b/tmp_msg/update_national_result.json index 2b8e6047..03a13809 100644 --- a/tmp_msg/update_national_result.json +++ b/tmp_msg/update_national_result.json @@ -3,6 +3,30 @@ "server":"d1af658a-f094-4303-9496-9a27a8180b0b", "sequence":1811, "national":[ + { + "id":1211, + "time":"2018-02-10 22:05:10", + "isSender":false, + "src":{ + "id":11, + "nation_id":1, + "name":"Hide_D", + "icon":"pic_781.jpg", + "nation":"연구소", + "color":"#ffd700" + }, + "dest":{ + "id":9001, + "nation_id":1, + "nation":"연구소", + "color":"#ffd700" + }, + "text":"외교를 거절해버렸당", + "opt":{ + "parent":1209 + } + + }, { "id":1210, "time":"2018-02-10 22:05:09", @@ -22,26 +46,6 @@ "color":"#ffd700" }, "text":"새롭게 추가된 나의 텍스트!" - }, - { - "id":1209, - "time":"2018-02-10 22:05:08", - "isSender":false, - "src":{ - "id":11, - "nation_id":1, - "name":"Hide_D", - "icon":"pic_781.jpg", - "nation":"연구소", - "color":"#ffd700" - }, - "dest":{ - "id":9001, - "nation_id":1, - "nation":"연구소", - "color":"#ffd700" - }, - "text":"외교를 거절해버렸당" } ], "public":[ diff --git a/tmp_msg/update_private_result.json b/tmp_msg/update_private_result.json index e1b69b10..142348d6 100644 --- a/tmp_msg/update_private_result.json +++ b/tmp_msg/update_private_result.json @@ -10,7 +10,7 @@ ], "private":[ { - "id":1205, + "id":1208, "time":"2018-02-10 22:06:00", "isSender":false, "src":{ @@ -27,10 +27,13 @@ "nation":"연구소", "color":"#ffd700" }, - "text":"연구소2로 망명 권유 서신을 거절" + "text":"연구소2로 망명 권유 서신을 거절", + "option":{ + "parent":1205 + } }, { - "id":1206, + "id":1207, "time":"2018-02-10 22:04:04", "isSender":false, "src":{