forked from devsam/core
feat, refact: 메시지 연락 리스트 수신
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\API\Message;
|
||||
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
|
||||
use function sammo\getMailboxList;
|
||||
|
||||
class GetContactList extends \sammo\BaseAPI{
|
||||
public function validateArgs(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getRequiredSessionMode(): int
|
||||
{
|
||||
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
{
|
||||
if(!$session->generalID){
|
||||
return [
|
||||
"nation"=>[]
|
||||
];
|
||||
}
|
||||
|
||||
//NOTE: 모든 국가, 모든 장수에 대해서 같은 결과라면 캐싱 가능하지 않을까?
|
||||
|
||||
return [
|
||||
"nation"=>getMailboxList()
|
||||
];
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -32,7 +32,7 @@ GetRecentRecordResponse,
|
||||
import type { CachedMapResult, GeneralListResponse, ItemTypeKey, MapResult } from "./defs";
|
||||
import type { VoteDetailResult, VoteListResult } from "./defs/API/Vote";
|
||||
import type { ActiveResourceAuctionList, OpenAuctionResponse, UniqueItemAuctionDetail, UniqueItemAuctionList } from "./defs/API/Auction";
|
||||
import type { MsgResponse, MsgType } from "./defs/API/Message";
|
||||
import type { MabilboxListResponse, MsgResponse, MsgType } from "./defs/API/Message";
|
||||
|
||||
const apiRealPath = {
|
||||
Auction: {
|
||||
@@ -172,6 +172,7 @@ const apiRealPath = {
|
||||
}, InheritLogResponse>
|
||||
},
|
||||
Message: {
|
||||
GetContactList: GET as APICallT<undefined, MabilboxListResponse>,
|
||||
GetRecentMessage: GET as APICallT<{
|
||||
sequence?: number;
|
||||
}, MsgResponse>,
|
||||
|
||||
@@ -49,4 +49,19 @@ export type MsgResponse = {
|
||||
nationID: number;
|
||||
generalName: string;
|
||||
sequence: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type MailboxItem = {
|
||||
id: number,
|
||||
mailbox: number,
|
||||
color: string,
|
||||
name: string,
|
||||
nationID: number,
|
||||
//nation: string,
|
||||
general: [number, string, number][]
|
||||
}
|
||||
|
||||
export type MabilboxListResponse = {
|
||||
result: true,
|
||||
nation: MailboxItem[]
|
||||
}
|
||||
Reference in New Issue
Block a user