Compare commits
2
Commits
f37ef24cf0
...
6007b2c34b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6007b2c34b | ||
|
|
d8e4adb0b5 |
@@ -359,10 +359,18 @@ def sd_format_item(item):
|
||||
create_time = item.get("gmtCreated", "")
|
||||
parcel_list = item.get("parcelList", [])
|
||||
if parcel_list and isinstance(parcel_list, list):
|
||||
qty = sum(p.get("totalQty", 0) for p in parcel_list)
|
||||
def safe_int(val):
|
||||
try:
|
||||
return int(val)
|
||||
except (ValueError, TypeError):
|
||||
return 0
|
||||
|
||||
qty = sum(safe_int(p.get("totalQty", 0)) for p in parcel_list)
|
||||
else:
|
||||
qty = 0
|
||||
|
||||
|
||||
|
||||
return [
|
||||
to_chinese_country(country),
|
||||
to_chinese_country(country),
|
||||
|
||||
Reference in New Issue
Block a user