diff --git a/hwe/sammo/API/Global/GeneralList.php b/hwe/sammo/API/Global/GeneralList.php index bf561ec9..cd29efa9 100644 --- a/hwe/sammo/API/Global/GeneralList.php +++ b/hwe/sammo/API/Global/GeneralList.php @@ -1,6 +1,6 @@ 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) { diff --git a/hwe/sammo/API/Global/GeneralListWithToken.php b/hwe/sammo/API/Global/GeneralListWithToken.php new file mode 100644 index 00000000..8dc6ff00 --- /dev/null +++ b/hwe/sammo/API/Global/GeneralListWithToken.php @@ -0,0 +1,31 @@ +, }, Global: { - GeneralList: GET as APICallT<{ - with_token?: boolean - }, GeneralListResponse>, + GeneralList: GET as APICallT, + GeneralListWithToken: GET as APICallT, GetConst: GET as APICallT, GetHistory: StrVar('serverID')( NumVar('year', diff --git a/hwe/ts/select_npc.ts b/hwe/ts/select_npc.ts index c3d13e47..03eb360d 100644 --- a/hwe/ts/select_npc.ts +++ b/hwe/ts/select_npc.ts @@ -101,9 +101,9 @@ const templateGeneralRow = <%specialDomesticWithTooltip%> / <%specialWarWithTooltip%>\ Lv <%explevel%>\ <%nation%>\ - <%experience%>\ - <%dedication%>\ - <%officerLevel%>\ + <%experienceStr%>\ + <%dedicationStr%>\ + <%officerLevelStr%>\ <%total%>\ <%leadership%>\ <%strength%>\ @@ -420,9 +420,7 @@ $(function ($) { $('#btn_load_general_list').on('click', async function () { try { - const result = await SammoAPI.Global.GeneralList({ - with_token: true, - }); + const result = await SammoAPI.Global.GeneralListWithToken(); printGeneralList(result); } catch (e) { console.error(e); diff --git a/package-lock.json b/package-lock.json index ffa99a27..77fed10b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5622,9 +5622,9 @@ "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==" }, "node_modules/follow-redirects": { - "version": "1.14.8", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", - "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==", + "version": "1.14.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", + "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==", "funding": [ { "type": "individual", @@ -14691,9 +14691,9 @@ "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==" }, "follow-redirects": { - "version": "1.14.8", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", - "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==" + "version": "1.14.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", + "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==" }, "fraction.js": { "version": "4.1.2",