Skip to content

Commit

Permalink
opt: Add weight to RennigouOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
Cerallin committed Aug 8, 2024
1 parent 007567c commit a05fa62
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions custom_components/rennigou/rennigou.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ class RennigouOrder:
image_link: str
title: str
source_site: str
weight: int # 只有待发货订单有这个字段

type: str # 自发包裹/参团包裹,仅对待收货/已完成的订单有效

def __init__(self, order_data) -> None:
header = order_data["header"]
body = order_data["body"][0]
def __init__(self, order_data: dict) -> None:
header: dict = order_data["header"]
body: dict = order_data["body"][0]

self.id = order_data["id"]
self.id = order_data.get("id", 0)

self.timestamp = datetime.fromtimestamp(header["show_time"])
self.updated_at = datetime.fromtimestamp(body["update_time"])
Expand All @@ -41,6 +42,9 @@ def __init__(self, order_data) -> None:
self.title = body["product_title"]

self.source_site = body["source_site_name"]

self.weight = body.get("weight", 0)

self.type = "无"

def assign_type(self, type: str):
Expand Down

0 comments on commit a05fa62

Please sign in to comment.