fix bug.
This commit is contained in:
parent
556c8773d6
commit
0fb3a28070
@ -46,7 +46,8 @@ def calculate_price(price_request: OrderPriceCalculateRequest,user: UserDB,db: S
|
||||
"""
|
||||
# 计算所有包裹中的取件码总数
|
||||
package_count = sum(
|
||||
len(package.pickup_codes.split(','))
|
||||
# 如果package.pickup_codes是空字符串,则取0
|
||||
0 if len(package.pickup_codes.split(',')) == 0 else len(package.pickup_codes.split(','))
|
||||
for package in price_request.packages
|
||||
if package.pickup_codes
|
||||
)
|
||||
@ -188,7 +189,8 @@ async def create_order(
|
||||
|
||||
# 创建订单包裹
|
||||
for package in order.price_request.packages:
|
||||
|
||||
# 如果包裹有取件码,则创建包裹
|
||||
if len(package.pickup_codes) > 0:
|
||||
station = db.query(StationDB).filter(
|
||||
StationDB.id == package.station_id
|
||||
).first()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user