From 7d3070ccf506532e8943505a85221331b11809b6 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Sat, 30 Jul 2022 12:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BF=E7=BA=A7=E9=81=93=E8=B7=AF=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=B7=A5=E7=A8=8B=E4=B8=80=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/overview/building.js | 17 ++++++++++++++++- api/log/development.log | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/api/app/lib/controllers/overview/building.js b/api/app/lib/controllers/overview/building.js index aa822134..2b413cd3 100644 --- a/api/app/lib/controllers/overview/building.js +++ b/api/app/lib/controllers/overview/building.js @@ -191,6 +191,17 @@ async function roadState (ctx) { } else { roadState.townProject[townName] = 1 } + + if (p.type == 'road' && p.done) { + if (roadState.townRoad[townName]) { + if (roadState.townRoad[townName].roadCount) { + roadState.townRoad[townName].roadCount += 1 + } else { + roadState.townRoad[townName].roadCount = roadState.townRoad[townName].roadCode.size + roadState.townRoad[townName].roadCount += 1 + } + } + } } } @@ -202,7 +213,11 @@ async function roadState (ctx) { roadState.buildedRoad += roadCode.size for (let t of Object.keys(roadState.townRoad)) { - roadState.townRoad[t].roadCount = roadState.townRoad[t].roadCode.size + if (roadState.townRoad[t].roadCount) { + + } else { + roadState.townRoad[t].roadCount = roadState.townRoad[t].roadCode.size + } delete roadState.townRoad[t].roadCode } diff --git a/api/log/development.log b/api/log/development.log index 58b473fe..5c96f980 100644 --- a/api/log/development.log +++ b/api/log/development.log @@ -10659,3 +10659,12 @@ headers: {} 2022-07-28 21:48:22.652 - debug: [FS-LOGGER] Init. 2022-07-28 21:48:22.760 - info: [FS-ATTACHMENT] Inject attachment mw into router. 2022-07-28 21:48:22.760 - info: [FS-AUTH] Inject auth and api mv into router. +2022-07-30 11:38:34.527 - debug: [FS-LOGGER] Init. +2022-07-30 11:38:34.600 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2022-07-30 11:38:34.600 - info: [FS-AUTH] Inject auth and api mv into router. +2022-07-30 11:40:20.216 - debug: [FS-LOGGER] Init. +2022-07-30 11:40:20.300 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2022-07-30 11:40:20.300 - info: [FS-AUTH] Inject auth and api mv into router. +2022-07-30 12:38:46.294 - debug: [FS-LOGGER] Init. +2022-07-30 12:38:46.394 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2022-07-30 12:38:46.394 - info: [FS-AUTH] Inject auth and api mv into router.