铁匠铺清除数量为0的订单数据

This commit is contained in:
meixiongfeng 2022-10-10 11:16:38 +08:00
parent a7777dc379
commit 5b624437d3

View File

@ -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 {