fix: 전쟁 금지 설정 누락 부분 수정
This commit is contained in:
@@ -47,15 +47,24 @@ class SetBlockWar extends \sammo\BaseAPI
|
|||||||
return "권한이 부족합니다.";
|
return "권한이 부족합니다.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$nationID = $me['nation'];
|
$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', [
|
$db->update('nation', [
|
||||||
'war' => $value?1:0,
|
'war' => $value?1:0,
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
|
$nationStor->setValue('available_war_setting_cnt', $avilableCnt - 1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'result' => true
|
'result' => true,
|
||||||
|
'availableCnt' => $avilableCnt - 1,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,7 +268,7 @@
|
|||||||
<div class="align-self-center">전쟁 금지 설정</div>
|
<div class="align-self-center">전쟁 금지 설정</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8 d-grid">
|
<div class="col-8 d-grid">
|
||||||
<div class="align-self-center">10회(월 +2회, 최대10회)</div>
|
<div class="align-self-center">{{warSettingCnt.remain}} 회(월 +{{warSettingCnt.increase}}회, 최대{{warSettingCnt.max}}회)</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -314,6 +314,7 @@ import { SammoAPI } from "./SammoAPI";
|
|||||||
import { joinYearMonth } from "@/util/joinYearMonth";
|
import { joinYearMonth } from "@/util/joinYearMonth";
|
||||||
import { parseYearMonth } from "@/util/parseYearMonth";
|
import { parseYearMonth } from "@/util/parseYearMonth";
|
||||||
import MyToast from "@/components/MyToast.vue";
|
import MyToast from "@/components/MyToast.vue";
|
||||||
|
import { ValidResponse } from "./util/callSammoAPI";
|
||||||
|
|
||||||
type NationItem = NationStaticItem & {
|
type NationItem = NationStaticItem & {
|
||||||
cityCnt: number;
|
cityCnt: number;
|
||||||
@@ -322,6 +323,10 @@ type NationItem = NationStaticItem & {
|
|||||||
term: number | null;
|
term: number | null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type SetBlockWarResponse = ValidResponse & {
|
||||||
|
availableCnt: number;
|
||||||
|
}
|
||||||
declare const staticValues: {
|
declare const staticValues: {
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
nationMsg: string;
|
nationMsg: string;
|
||||||
@@ -559,6 +564,7 @@ export default defineComponent({
|
|||||||
type: "danger",
|
type: "danger",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
self.policy.secretLimit = oldSecretLimit;
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -568,7 +574,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
async function setBlockWar() {
|
async function setBlockWar() {
|
||||||
try {
|
try {
|
||||||
await SammoAPI.Nation.SetBlockWar({ value: self.policy.blockWar });
|
const result = await SammoAPI.Nation.SetBlockWar<SetBlockWarResponse>({ value: self.policy.blockWar });
|
||||||
|
self.warSettingCnt.remain = result.availableCnt;
|
||||||
toasts.value.push({
|
toasts.value.push({
|
||||||
title: "변경",
|
title: "변경",
|
||||||
content: "전쟁 금지 설정을 변경했습니다.",
|
content: "전쟁 금지 설정을 변경했습니다.",
|
||||||
@@ -581,6 +588,7 @@ export default defineComponent({
|
|||||||
type: "danger",
|
type: "danger",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
self.policy.blockWar = !self.policy.blockWar;
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -600,6 +608,7 @@ export default defineComponent({
|
|||||||
type: "danger",
|
type: "danger",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
self.policy.blockScout = !self.policy.blockScout;
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user