From 79cfbfe83b0d86b9d83d949266be728f9e8f1a9a Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 31 Dec 2021 23:22:20 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A0=84=EC=9F=81=20=EA=B8=88=EC=A7=80?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EB=88=84=EB=9D=BD=20=EB=B6=80=EB=B6=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/API/Nation/SetBlockWar.php | 13 +++++++++++-- hwe/ts/PageNationStratFinan.vue | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/hwe/sammo/API/Nation/SetBlockWar.php b/hwe/sammo/API/Nation/SetBlockWar.php index 46e0815b..78153cf3 100644 --- a/hwe/sammo/API/Nation/SetBlockWar.php +++ b/hwe/sammo/API/Nation/SetBlockWar.php @@ -47,15 +47,24 @@ class SetBlockWar extends \sammo\BaseAPI return "권한이 부족합니다."; } - $nationID = $me['nation']; + $nationStor = KVStorage::getStorage($db, $nationID, 'nation_env'); + + + $avilableCnt = $nationStor->getValue('available_war_setting_cnt') ?? 0; + if ($avilableCnt <= 0){ + return "잔여 횟수가 부족합니다."; + } + $db->update('nation', [ 'war' => $value?1:0, ], 'nation=%i', $nationID); + $nationStor->setValue('available_war_setting_cnt', $avilableCnt - 1); return [ - 'result' => true + 'result' => true, + 'availableCnt' => $avilableCnt - 1, ]; } } diff --git a/hwe/ts/PageNationStratFinan.vue b/hwe/ts/PageNationStratFinan.vue index ce0b5f33..2524f03b 100644 --- a/hwe/ts/PageNationStratFinan.vue +++ b/hwe/ts/PageNationStratFinan.vue @@ -268,7 +268,7 @@
전쟁 금지 설정
-
10회(월 +2회, 최대10회)
+
{{warSettingCnt.remain}} 회(월 +{{warSettingCnt.increase}}회, 최대{{warSettingCnt.max}}회)
@@ -314,6 +314,7 @@ import { SammoAPI } from "./SammoAPI"; import { joinYearMonth } from "@/util/joinYearMonth"; import { parseYearMonth } from "@/util/parseYearMonth"; import MyToast from "@/components/MyToast.vue"; +import { ValidResponse } from "./util/callSammoAPI"; type NationItem = NationStaticItem & { cityCnt: number; @@ -322,6 +323,10 @@ type NationItem = NationStaticItem & { term: number | null; }; }; + +type SetBlockWarResponse = ValidResponse & { + availableCnt: number; +} declare const staticValues: { editable: boolean; nationMsg: string; @@ -559,6 +564,7 @@ export default defineComponent({ type: "danger", }); } + self.policy.secretLimit = oldSecretLimit; console.error(e); } } @@ -568,7 +574,8 @@ export default defineComponent({ async function setBlockWar() { try { - await SammoAPI.Nation.SetBlockWar({ value: self.policy.blockWar }); + const result = await SammoAPI.Nation.SetBlockWar({ value: self.policy.blockWar }); + self.warSettingCnt.remain = result.availableCnt; toasts.value.push({ title: "변경", content: "전쟁 금지 설정을 변경했습니다.", @@ -581,6 +588,7 @@ export default defineComponent({ type: "danger", }); } + self.policy.blockWar = !self.policy.blockWar; console.error(e); } } @@ -600,6 +608,7 @@ export default defineComponent({ type: "danger", }); } + self.policy.blockScout = !self.policy.blockScout; console.error(e); } }