From 5b624437d31d9598bdcc6778a2e9a81a73702af1 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 10 Oct 2022 11:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=93=81=E5=8C=A0=E9=93=BA=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E4=B8=BA0=E7=9A=84=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/smithy/model_smithy.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/smithy/model_smithy.go b/modules/smithy/model_smithy.go index ba7a4cd20..cc2193556 100644 --- a/modules/smithy/model_smithy.go +++ b/modules/smithy/model_smithy.go @@ -98,8 +98,8 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) { // 计算出需要的时间 _smithycfg := this.module.configure.GetSmithyConfigData(desktype, skillLv) // 美食家配置表 - iCount := int(order.Count) - for i := 0; i < iCount; i++ { + + for i := 0; i < int(order.Count); i++ { curTime += szTime[order.DeskType] order.Count-- if order.Count == 0 { @@ -148,6 +148,14 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) { break } } + // 清除数量为0 的订单 + pos := 0 + for _, order := range smithy.Orders { + if order.Count == 0 { + pos++ + } + } + smithy.Orders = append(smithy.Orders[:0], smithy.Orders[pos:]...) if nextDay { smithy.OrderCostTime += nextDayTime for _, order := range smithy.Orders {