Commit ac59430d authored by 邱阿朋's avatar 邱阿朋

fix(gui): 修正价格类型判断及日志推送

- 修正价格判断条件,支持int和float两种类型
- 推送消息完成后增加日志打印提示
- 优化代码可读性,规范异常数据处理流程
parent 478b94ef
...@@ -176,7 +176,7 @@ class AmazonPriceScraper: ...@@ -176,7 +176,7 @@ class AmazonPriceScraper:
country = self.country_var.get() country = self.country_var.get()
for _, item_row in data.iterrows(): for _, item_row in data.iterrows():
price = item_row.get('Price', 0) price = item_row.get('Price', 0)
if not isinstance(price, float) or not isinstance(price, int): if not isinstance(price, (int, float)):
continue continue
push_data = { push_data = {
...@@ -188,6 +188,8 @@ class AmazonPriceScraper: ...@@ -188,6 +188,8 @@ class AmazonPriceScraper:
client.close() client.close()
self.log("推送消息完成")
def start_scraping(self): def start_scraping(self):
if not self.asins: if not self.asins:
self.log("请先选择包含ASIN的Excel文件") self.log("请先选择包含ASIN的Excel文件")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment