feat, refac: 메시지 삭제
This commit is contained in:
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Message;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Message;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
|
use function sammo\getMailboxList;
|
||||||
|
|
||||||
|
class DeleteMessage extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('required', ['msgID']);
|
||||||
|
$v->rule('integer', 'msgID');
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
$this->args['msgID'] = (int)($this->args['msgID'] ?? -1);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$msgID = $this->args['msgID'];
|
||||||
|
|
||||||
|
$generalID = $session->generalID;
|
||||||
|
return Message::deleteMsg($msgID, $generalID);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -172,6 +172,9 @@ const apiRealPath = {
|
|||||||
}, InheritLogResponse>
|
}, InheritLogResponse>
|
||||||
},
|
},
|
||||||
Message: {
|
Message: {
|
||||||
|
DeleteMessage: PATCH as APICallT<{
|
||||||
|
msgID: number,
|
||||||
|
}>,
|
||||||
GetContactList: GET as APICallT<undefined, MabilboxListResponse>,
|
GetContactList: GET as APICallT<undefined, MabilboxListResponse>,
|
||||||
GetRecentMessage: GET as APICallT<{
|
GetRecentMessage: GET as APICallT<{
|
||||||
sequence?: number;
|
sequence?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user