fix: NPC 빙의 장수 목록 안보이는 버그 수정

- API/Global/GeneralList를 WithToken과 분리
This commit is contained in:
2022-04-20 22:33:46 +09:00
parent ec10949c64
commit 5eaafaeee6
5 changed files with 46 additions and 24 deletions
+3 -9
View File
@@ -1,6 +1,6 @@
<?php
namespace sammo\API\List\Nation;
namespace sammo\API\Global;
use sammo\DB;
use sammo\General;
@@ -27,14 +27,9 @@ use function sammo\increaseRefresh;
class GeneralList extends \sammo\BaseAPI
{
static $withToken = false;
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v
->rule('boolean', 'with_token');
if (!$v->validate()) {
return $v->errorStr();
}
return null;
}
@@ -46,7 +41,6 @@ class GeneralList extends \sammo\BaseAPI
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$db = DB::db();
$withToken = $this->args['with_token']??false;
$gameStor = KVStorage::getStorage($db, 'game_env');
$userID = $session->userID;
@@ -148,7 +142,7 @@ class GeneralList extends \sammo\BaseAPI
];
if ($withToken) {
if (static::$withToken) {
$now = (new \DateTimeImmutable())->format('Y-m-d H:i:s');
$tokens = [];
foreach ($db->query('SELECT * FROM select_npc_token WHERE `valid_until`>=%s', $now) as $token) {
@@ -0,0 +1,31 @@
<?php
namespace sammo\API\Global;
use sammo\DB;
use sammo\General;
use sammo\Json;
use sammo\KVStorage;
use sammo\RootDB;
use sammo\Session;
use sammo\Util;
use sammo\Validator;
use function sammo\calcLeadershipBonus;
use function sammo\checkLimit;
use function sammo\checkSecretPermission;
use function sammo\getDed;
use function sammo\getDedLevelText;
use function sammo\getExpLevel;
use function sammo\getGenChar;
use function sammo\getGeneralSpecialDomesticName;
use function sammo\getGeneralSpecialWarName;
use function sammo\getHonor;
use function sammo\getNationStaticInfo;
use function sammo\getOfficerLevelText;
use function sammo\increaseRefresh;
class GeneralListWithToken extends GeneralList
{
static $withToken = true;
}