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