최근 메시지만 전송 받도록 수정.
This commit is contained in:
+18
-2
@@ -10,12 +10,16 @@
|
|||||||
/*임시용 끝*/
|
/*임시용 끝*/
|
||||||
|
|
||||||
#message_board section{
|
#message_board section{
|
||||||
width:498px;
|
overflow-y:auto;
|
||||||
|
overflow-x:hidden;
|
||||||
|
max-width:498px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg_plate{
|
.msg_plate{
|
||||||
width:100%;
|
width:100%;
|
||||||
border:groove 0.1em;
|
border-bottom:groove 0.1em;
|
||||||
|
border-left:groove 0.1em;
|
||||||
|
border-right:groove 0.1em;
|
||||||
height:64px;
|
height:64px;
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
word-break:break-all;
|
word-break:break-all;
|
||||||
@@ -36,6 +40,18 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.public_message{
|
||||||
|
height:667px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.private_message{
|
||||||
|
height:667px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.national_message{
|
||||||
|
height:1350px;
|
||||||
|
}
|
||||||
|
|
||||||
.msg_icon{
|
.msg_icon{
|
||||||
float:left;
|
float:left;
|
||||||
width:64px;
|
width:64px;
|
||||||
|
|||||||
+3
-9
@@ -287,22 +287,16 @@ if ($session->userGrade >= 5) {
|
|||||||
<div id="message_board">
|
<div id="message_board">
|
||||||
<div class="board_side">
|
<div class="board_side">
|
||||||
<div class="board_header bg0">전체 메시지(최고99자)</div>
|
<div class="board_header bg0">전체 메시지(최고99자)</div>
|
||||||
<section class="public_message">
|
<section class="public_message"></section>
|
||||||
|
|
||||||
</section>
|
|
||||||
<div class="board_header bg0">개인 메시지(최고99자)</div>
|
<div class="board_header bg0">개인 메시지(최고99자)</div>
|
||||||
<section class="private_message">
|
<section class="private_message"></section>
|
||||||
|
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="board_side">
|
<div class="board_side">
|
||||||
<section class="diplomacy_message">
|
<section class="diplomacy_message">
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<div class="board_header bg0">국가 메시지(최고99자)</div>
|
<div class="board_header bg0">국가 메시지(최고99자)</div>
|
||||||
<section class="national_message">
|
<section class="national_message"></section>
|
||||||
|
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear:left;"><?=allButton()?><?=banner()?></div>
|
<div style="clear:left;"><?=allButton()?><?=banner()?></div>
|
||||||
|
|||||||
@@ -27,21 +27,36 @@ if($nationID === null){
|
|||||||
$result = [];
|
$result = [];
|
||||||
$result['result'] = true;
|
$result['result'] = true;
|
||||||
|
|
||||||
$result['private'] = array_map(function(Message $msg){
|
$nextSequence = $reqSequence;
|
||||||
|
|
||||||
|
$result['private'] = array_map(function(Message $msg) use (&$nextSequence){
|
||||||
|
if($msg->id > $nextSequence){
|
||||||
|
$nextSequence = $msg->id;
|
||||||
|
}
|
||||||
return $msg->toArray();
|
return $msg->toArray();
|
||||||
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 10, $reqSequence));
|
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 10, $reqSequence));
|
||||||
|
|
||||||
$result['public'] = array_map(function(Message $msg){
|
$result['public'] = array_map(function(Message $msg)use (&$nextSequence){
|
||||||
|
if($msg->id > $nextSequence){
|
||||||
|
$nextSequence = $msg->id;
|
||||||
|
}
|
||||||
return $msg->toArray();
|
return $msg->toArray();
|
||||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 20, $reqSequence));
|
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 10, $reqSequence));
|
||||||
|
|
||||||
$result['national'] = array_map(function(Message $msg){
|
$result['national'] = array_map(function(Message $msg)use (&$nextSequence){
|
||||||
|
if($msg->id > $nextSequence){
|
||||||
|
$nextSequence = $msg->id;
|
||||||
|
}
|
||||||
return $msg->toArray();
|
return $msg->toArray();
|
||||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, 20, $reqSequence));
|
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, 20, $reqSequence));
|
||||||
|
|
||||||
$result['diplomacy']= array_map(function(Message $msg){
|
$result['diplomacy']= array_map(function(Message $msg)use (&$nextSequence){
|
||||||
|
if($msg->id > $nextSequence){
|
||||||
|
$nextSequence = $msg->id;
|
||||||
|
}
|
||||||
return $msg->toArray();
|
return $msg->toArray();
|
||||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 10, 0));
|
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 10, 0));
|
||||||
|
|
||||||
|
$result['sequence'] = $nextSequence;
|
||||||
|
|
||||||
Json::die($result);
|
Json::die($result);
|
||||||
@@ -21,7 +21,7 @@ if(!$v->validate()){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mailbox = (int)$post['mailbox'];
|
$mailbox = (int)$post['mailbox'];
|
||||||
$text = StringUtil::cutStringForWidth($post['text'], 100, '');
|
$text = StringUtil::cutStringForWidth($post['text'], 199, '');
|
||||||
|
|
||||||
$session = Session::requireGameLogin([
|
$session = Session::requireGameLogin([
|
||||||
'msgID'=>null
|
'msgID'=>null
|
||||||
|
|||||||
+16
-3
@@ -105,11 +105,24 @@ class Message
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function toArray():array{
|
public function toArray():array{
|
||||||
|
if($this->msgType === Message::MSGTYPE_PUBLIC){
|
||||||
|
$src = $this->src->toArray();
|
||||||
|
$dest = [];
|
||||||
|
}
|
||||||
|
else if($this->msgType === Message::MSGTYPE_NATIONAL || $this->msgType === Message::MSGTYPE_DIPLOMACY){
|
||||||
|
$src = $this->src->toArray();
|
||||||
|
$dest = $this->dest->toArray();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$src = $this->src->toArray();
|
||||||
|
$dest = $this->dest->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id'=>$this->id,
|
'id'=>$this->id,
|
||||||
'msgType'=>$this->msgType,
|
'msgType'=>$this->msgType,
|
||||||
'src'=>($this->src)?($this->src->toArray()):[],
|
'src'=>$src,
|
||||||
'dest'=>($this->dest)?($this->dest->toArray()):[],
|
'dest'=>$dest,
|
||||||
'text'=>$this->msg,
|
'text'=>$this->msg,
|
||||||
'option'=>$this->msgOption,
|
'option'=>$this->msgOption,
|
||||||
'time'=>$this->date->format('Y-m-d H:i:s')
|
'time'=>$this->date->format('Y-m-d H:i:s')
|
||||||
@@ -215,7 +228,7 @@ class Message
|
|||||||
|
|
||||||
return array_map(function ($row) {
|
return array_map(function ($row) {
|
||||||
return static::buildFromArray($row);
|
return static::buildFromArray($row);
|
||||||
}, $db->query('SELECT * FROM `message` WHERE %l %?', $where, $limitSql));
|
}, $db->query('SELECT * FROM `message` WHERE %l ORDER BY id DESC %? ', $where, $limitSql));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function sendRaw(int $mailbox):array{
|
protected function sendRaw(int $mailbox):array{
|
||||||
|
|||||||
@@ -66,4 +66,15 @@ class MessageTarget extends Target {
|
|||||||
'icon'=>$this->icon
|
'icon'=>$this->icon
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toArrayLight() : array{
|
||||||
|
//TODO: 이걸 꼭 연관 배열로 보낼 이유가 없다.
|
||||||
|
//TODO: 아이콘도 축약 가능하다.
|
||||||
|
return [
|
||||||
|
'name'=>$this->generalName,
|
||||||
|
'nation'=>$this->nationName,
|
||||||
|
'color'=>$this->color,
|
||||||
|
'icon'=>$this->icon
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user