fix: GetNationInfo Full mode

This commit is contained in:
2023-03-09 02:20:20 +09:00
parent 555b4c9cc6
commit 8f0057ff51
2 changed files with 10 additions and 3 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ class GetNationInfo extends \sammo\BaseAPI
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('boolean', 'full');
$v->rule('in', 'full', ['true', 'false']);
if (!$v->validate()) {
return $v->errorStr();
@@ -70,7 +70,7 @@ class GetNationInfo extends \sammo\BaseAPI
$gameEnv = $gameStor->getValues(['year', 'month', 'startyear']);
$nation = $db->queryFirstRow(
'SELECT nation, `name`, color, capital, gennum, gold, rice, bill, rate, secretlimit, chief_set, scout, war, strategic_cmd_limit, surlimit, tech, `power`, `level`, `type` FROM nation WHERE id = %i',
'SELECT nation, `name`, color, capital, gennum, gold, rice, bill, rate, secretlimit, chief_set, scout, war, strategic_cmd_limit, surlimit, tech, `power`, `level`, `type` FROM nation WHERE nation = %i',
$nationID
);
$nationStor = \sammo\KVStorage::getStorage($db, $nationID, 'nation_env');
+8 -1
View File
@@ -154,10 +154,17 @@ export type NationInfoFull = ValidResponse & {
nation: NationItem;
isFull: true,
impossibleStrategicCommandLists: [string, number][];
nationNotice: string,
nationNotice: NationNotice,
troops: Record<number, string>;
}
export type NationNotice = {
date: string,
msg: string,
author: string,
authorID: number,
}
export type NationInfoResponse =
| (ValidResponse & {
nation: NationStaticItem;