对取件码进行排序。
This commit is contained in:
parent
2a358bf82e
commit
34f7c2b9c0
@ -248,12 +248,15 @@ async def create_order(
|
||||
station = db.query(StationDB).filter(
|
||||
StationDB.id == package.station_id
|
||||
).first()
|
||||
|
||||
# 对package.pickup_codes中分割的取件码,进行排序
|
||||
sorted_pickup_codes = sorted(package.pickup_codes.split(","), key=lambda x: int(x.split("-")[0]))
|
||||
|
||||
db_package = ShippingOrderPackageDB(
|
||||
orderid=orderid,
|
||||
station_id=package.station_id,
|
||||
station_name=station.name,
|
||||
pickup_codes=package.pickup_codes
|
||||
pickup_codes=','.join(sorted_pickup_codes)
|
||||
)
|
||||
db.add(db_package)
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ class ShippingOrderDB(Base):
|
||||
address_detail = Column(String(100), nullable=False, default='') # 详细地址快照
|
||||
|
||||
# 取件图片
|
||||
pickup_images = Column(String(1000), nullable=True) # 取件图片URL,多个URL用逗号分隔
|
||||
pickup_images = Column(String(2000), nullable=True) # 取件图片URL,多个URL用逗号分隔
|
||||
pickup_images_count = Column(Integer, nullable=False, default=0) # 取件图片数量
|
||||
|
||||
pickup_code_count = Column(Integer, nullable=False, default=0) # 取件码数量
|
||||
|
||||
Loading…
Reference in New Issue
Block a user