feat: BaseAPI의 launch()에 타입 지정
- APIRecoveryType이 명시
This commit is contained in:
@@ -5,6 +5,7 @@ namespace sammo\API\Global;
|
||||
use sammo\Session;
|
||||
use sammo\DB;
|
||||
use DateTimeInterface;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\TurnExecutionHelper;
|
||||
use sammo\UniqueConst;
|
||||
|
||||
@@ -20,7 +21,7 @@ class ExecuteEngine extends \sammo\BaseAPI
|
||||
return static::NO_SESSION;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$reqServerID = $this->args['serverID'] ?? null;
|
||||
if($reqServerID && $reqServerID !== UniqueConst::$serverID){
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace sammo\API\Global;
|
||||
|
||||
use sammo\DB;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Json;
|
||||
use sammo\KVStorage;
|
||||
use sammo\RootDB;
|
||||
@@ -33,7 +34,7 @@ class GeneralList extends \sammo\BaseAPI
|
||||
return static::REQ_LOGIN;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
@@ -6,6 +6,7 @@ use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use Nette\Caching\Cache;
|
||||
use sammo\APICacheResult;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\GameConst;
|
||||
use sammo\MapRequest;
|
||||
use sammo\TimeUtil;
|
||||
@@ -44,7 +45,7 @@ class GetCachedMap extends \sammo\BaseAPI
|
||||
return static::NO_SESSION;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
if (!class_exists('\\sammo\\UniqueConst')) {
|
||||
return '서버 초기화되지 않음';
|
||||
|
||||
@@ -9,6 +9,7 @@ use Nette\Caching\Cache;
|
||||
use RuntimeException;
|
||||
use sammo\APICacheResult;
|
||||
use sammo\CityConst;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\GameConst;
|
||||
use sammo\GameUnitConst;
|
||||
use sammo\Json;
|
||||
@@ -279,7 +280,7 @@ class GetConst extends \sammo\BaseAPI
|
||||
];
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$cacheDir = $this->rootPath . '/data/file_cache';
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace sammo\API\Global;
|
||||
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
|
||||
use function sammo\getCurrentHistory;
|
||||
|
||||
@@ -19,7 +20,7 @@ class GetCurrentHistory extends \sammo\BaseAPI
|
||||
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$history = getCurrentHistory();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace sammo\API\Global;
|
||||
|
||||
use sammo\DB;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Json;
|
||||
use sammo\KVStorage;
|
||||
use sammo\Session;
|
||||
@@ -22,7 +23,7 @@ class GetDiplomacy extends \sammo\BaseAPI
|
||||
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
|
||||
$userID = $session->userID;
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace sammo\API\Global;
|
||||
use LDTO\DTO;
|
||||
use sammo\APICacheResult;
|
||||
use sammo\BaseAPI;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\GlobalMenu;
|
||||
use sammo\Session;
|
||||
|
||||
@@ -19,7 +20,7 @@ class GetGlobalMenu extends BaseAPI
|
||||
return null;
|
||||
}
|
||||
|
||||
function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
if ($reqEtag !== null) {
|
||||
$version = GlobalMenu::version;
|
||||
|
||||
@@ -6,6 +6,7 @@ use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\APICacheResult;
|
||||
use sammo\DB;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Json;
|
||||
use sammo\UniqueConst;
|
||||
use sammo\Util;
|
||||
@@ -127,7 +128,7 @@ class GetHistory extends \sammo\BaseAPI
|
||||
return $cachedHash;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$checkCache = $this->checkCached($reqEtag);
|
||||
if ($checkCache) {
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace sammo\API\Global;
|
||||
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\MapRequest;
|
||||
use sammo\Validator;
|
||||
|
||||
@@ -27,7 +28,7 @@ class GetMap extends \sammo\BaseAPI
|
||||
return static::REQ_LOGIN | static::REQ_READ_ONLY;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
return getWorldMap(new MapRequest([
|
||||
'neutralView' => !!($this->args['neutralView'] ?? false),
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace sammo\API\Global;
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
|
||||
use function sammo\getAllNationStaticInfo;
|
||||
use function sammo\getNationStaticInfo;
|
||||
@@ -21,7 +22,7 @@ class GetNationList extends \sammo\BaseAPI
|
||||
return static::REQ_LOGIN | static::REQ_READ_ONLY;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace sammo\API\Global;
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\KVStorage;
|
||||
use sammo\Util;
|
||||
use sammo\Validator;
|
||||
@@ -72,7 +73,7 @@ class GetRecentRecord extends \sammo\BaseAPI
|
||||
return $history;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user