기본 갠메, 국메, 전메 동작
This commit is contained in:
@@ -11,7 +11,7 @@ class ServConfig
|
|||||||
public static $sharedIconPath = '_tK_sharedIconPath_';
|
public static $sharedIconPath = '_tK_sharedIconPath_';
|
||||||
public static $gameImagePath = "_tK_gameImagePath_";
|
public static $gameImagePath = "_tK_gameImagePath_";
|
||||||
|
|
||||||
public static function getSharedIconPath(string $filepath) : string
|
public static function getSharedIconPath(string $filepath='') : string
|
||||||
{
|
{
|
||||||
if($filepath){
|
if($filepath){
|
||||||
return static::$sharedIconPath."/{$filepath}";
|
return static::$sharedIconPath."/{$filepath}";
|
||||||
@@ -19,15 +19,12 @@ class ServConfig
|
|||||||
return static::$sharedIconPath;
|
return static::$sharedIconPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getUserIconPath(string $filepath) : string
|
public static function getUserIconPath(string $filepath='') : string
|
||||||
{
|
{
|
||||||
if($filepath){
|
return AppConf::getUserIconPathWeb($filepath);
|
||||||
return AppConf::getUserIconPathWeb()."/{$filepath}";
|
|
||||||
}
|
|
||||||
return AppConf::getUserIconPathWeb();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getGameImagePath(string $filepath) : string
|
public static function getGameImagePath(string $filepath='') : string
|
||||||
{
|
{
|
||||||
if($filepath){
|
if($filepath){
|
||||||
return static::$gameImagePath."/{$filepath}";
|
return static::$gameImagePath."/{$filepath}";
|
||||||
|
|||||||
+11
-11
@@ -73,18 +73,18 @@ $me['icon'] = GetImageURL($me['imgsvr'], $me['picture']);
|
|||||||
|
|
||||||
$srcNation = getNationStaticInfo($me['nation']);
|
$srcNation = getNationStaticInfo($me['nation']);
|
||||||
|
|
||||||
$src = new MessageTarget($me['no'], $me['name'], $me['nation'], $srcNation['name'], $srcNation['color'], $me['icon']);
|
$src = new MessageTarget($me['no'], $me['name'], $srcNation['nation'], $srcNation['name'], $srcNation['color'], $me['icon']);
|
||||||
|
|
||||||
// 전체 메세지
|
// 전체 메세지
|
||||||
if($mailbox == 9999) {
|
if($mailbox == Message::MAILBOX_PUBLIC) {
|
||||||
$msg = new Message(
|
$msg = new Message(
|
||||||
Message::MSGTYPE_PUBLIC,
|
Message::MSGTYPE_PUBLIC,
|
||||||
$src,
|
$src,
|
||||||
null,
|
$src,
|
||||||
$text,
|
$text,
|
||||||
$now,
|
$now,
|
||||||
$unlimited,
|
$unlimited,
|
||||||
null
|
[]
|
||||||
);
|
);
|
||||||
$msgID = $msg->send();
|
$msgID = $msg->send();
|
||||||
Json::die([
|
Json::die([
|
||||||
@@ -97,13 +97,13 @@ if($mailbox == 9999) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 국가 메세지
|
// 국가 메세지
|
||||||
if($destMailbox >= Message::MAILBOX_NATIONAL) {
|
if($mailbox >= Message::MAILBOX_NATIONAL) {
|
||||||
|
|
||||||
if($me['level'] < 5){
|
if($me['level'] < 5){
|
||||||
$destNationID = $me['nation_id'];
|
$destNationID = $me['nation_id'];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$destNationID = $destMailbox - Message::MAILBOX_NATIONAL;
|
$destNationID = $mailbox - Message::MAILBOX_NATIONAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$destNation = getNationStaticInfo($destNationID);
|
$destNation = getNationStaticInfo($destNationID);
|
||||||
@@ -117,7 +117,7 @@ if($destMailbox >= Message::MAILBOX_NATIONAL) {
|
|||||||
$text,
|
$text,
|
||||||
$now,
|
$now,
|
||||||
$unlimited,
|
$unlimited,
|
||||||
null
|
[]
|
||||||
);
|
);
|
||||||
$msgID = $msg->send();
|
$msgID = $msg->send();
|
||||||
Json::die([
|
Json::die([
|
||||||
@@ -128,7 +128,7 @@ if($destMailbox >= Message::MAILBOX_NATIONAL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 개인 메세지
|
// 개인 메세지
|
||||||
if($destMailbox > 0) {
|
if($mailbox > 0) {
|
||||||
$lastMsg = new \DateTime($session->lastMsg??'0000-00-00');
|
$lastMsg = new \DateTime($session->lastMsg??'0000-00-00');
|
||||||
|
|
||||||
$msg_interval = $now->getTimestamp() - $lastMsg->getTimestamp();
|
$msg_interval = $now->getTimestamp() - $lastMsg->getTimestamp();
|
||||||
@@ -143,9 +143,9 @@ if($destMailbox > 0) {
|
|||||||
|
|
||||||
$session->lastMsg = $now->format('Y-m-d H:i:s');
|
$session->lastMsg = $now->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`con`,`picture`,`imgsvr` WHERE `no`=%i',$destMailbox);
|
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`con`,`picture`,`imgsvr` FROM general WHERE `no`=%i',$mailbox);
|
||||||
|
|
||||||
if(!$destUser == null){
|
if(!$destUser){
|
||||||
Json::die([
|
Json::die([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'reason' => '존재하지 않는 유저입니다.',
|
'reason' => '존재하지 않는 유저입니다.',
|
||||||
@@ -171,7 +171,7 @@ if($destMailbox > 0) {
|
|||||||
$text,
|
$text,
|
||||||
$now,
|
$now,
|
||||||
$unlimited,
|
$unlimited,
|
||||||
null
|
[]
|
||||||
);
|
);
|
||||||
$msgID = $msg->send();
|
$msgID = $msg->send();
|
||||||
Json::die([
|
Json::die([
|
||||||
|
|||||||
+1
-1
@@ -339,7 +339,7 @@ function activateMessageForm(){
|
|||||||
dataType:'json',
|
dataType:'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
mailbox:targetMailbox,
|
mailbox:parseInt(targetMailbox),
|
||||||
text:text
|
text:text
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class Message
|
|||||||
$this->msgOption = $msgOption;
|
$this->msgOption = $msgOption;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSentInfo(int $mailbox, int $messageID) : this
|
public function setSentInfo(int $mailbox, int $messageID) : self
|
||||||
{
|
{
|
||||||
if(!Message::isValidMailBox($mailbox)){
|
if(!Message::isValidMailBox($mailbox)){
|
||||||
throw new \InvalidArgumentException('올바르지 않은 mailbox');
|
throw new \InvalidArgumentException('올바르지 않은 mailbox');
|
||||||
@@ -110,8 +110,8 @@ class Message
|
|||||||
'msgType'=>$this->msgType,
|
'msgType'=>$this->msgType,
|
||||||
'src'=>($this->src)?($this->src->toArray()):[],
|
'src'=>($this->src)?($this->src->toArray()):[],
|
||||||
'dest'=>($this->dest)?($this->dest->toArray()):[],
|
'dest'=>($this->dest)?($this->dest->toArray()):[],
|
||||||
'msg'=>$this->msg,
|
'text'=>$this->msg,
|
||||||
'msgOption'=>$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')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ class Message
|
|||||||
}, $db->query('SELECT * FROM `message` WHERE %l %?', $where, $limitSql));
|
}, $db->query('SELECT * FROM `message` WHERE %l %?', $where, $limitSql));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function sendRaw(int $mailbox){
|
protected function sendRaw(int $mailbox):array{
|
||||||
//NOTE:: 여기선 검증하지 않는다.
|
//NOTE:: 여기선 검증하지 않는다.
|
||||||
|
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ class Message
|
|||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$db->insert('message', [
|
$db->insert('message', [
|
||||||
'address' => $mailbox,
|
'mailbox' => $mailbox,
|
||||||
'type' => $this->msgType,
|
'type' => $this->msgType,
|
||||||
'src' => $src_id,
|
'src' => $src_id,
|
||||||
'dest' => $dest_id,
|
'dest' => $dest_id,
|
||||||
@@ -254,7 +254,7 @@ class Message
|
|||||||
return [$mailbox, $db->insertId()];
|
return [$mailbox, $db->insertId()];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendToSender() : int{
|
private function sendToSender():array{
|
||||||
if($this->sendCnt > 0){
|
if($this->sendCnt > 0){
|
||||||
throw new \RuntimeException('이미 전송한 메일입니다.');
|
throw new \RuntimeException('이미 전송한 메일입니다.');
|
||||||
}
|
}
|
||||||
@@ -267,7 +267,7 @@ class Message
|
|||||||
return [0, 0];
|
return [0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendToReceiver() : int{
|
private function sendToReceiver() : array{
|
||||||
if($this->sendCnt > 1 || $this->isInboxMail){
|
if($this->sendCnt > 1 || $this->isInboxMail){
|
||||||
throw new \RuntimeException('이미 전송한 메일입니다.');
|
throw new \RuntimeException('이미 전송한 메일입니다.');
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ class Message
|
|||||||
$this->isInboxMail = false;
|
$this->isInboxMail = false;
|
||||||
$this->id = $sendID;
|
$this->id = $sendID;
|
||||||
$this->msgOption['senderMessageID'] = $sendID;
|
$this->msgOption['senderMessageID'] = $sendID;
|
||||||
$this->$sendCnt = 1;
|
$this->sendCnt = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ class Message
|
|||||||
$this->isInboxMail = true;
|
$this->isInboxMail = true;
|
||||||
$this->id = $receiveID;
|
$this->id = $receiveID;
|
||||||
$this->msgOption['receiverMessageID'] = $receiveID;
|
$this->msgOption['receiverMessageID'] = $receiveID;
|
||||||
$this->$sendCnt = 2;
|
$this->sendCnt = 2;
|
||||||
|
|
||||||
return $receiveID;
|
return $receiveID;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user