From 08ede35dff96d161cb8cbd36e9784079b1d6fa7e Mon Sep 17 00:00:00 2001 From: Ching Date: Wed, 25 Sep 2024 23:12:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20=E4=BF=AE=E5=A4=8D=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=95=86=E5=93=81=E6=97=B6=E6=9D=A1=E7=A0=81=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=9C=89=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复创建商品时条码保存有误的问题,并添加了默认的数量为1.0的条码。 --- app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index ad17e05..034dbe7 100644 --- a/app.py +++ b/app.py @@ -115,6 +115,7 @@ def add_product(dict_good, location): data_barcode = { "product_id": int(response_grocy["created_object_id"]), "barcode": dict_good["gtin"], + "amount": 1.0, } grocy.add_generic(EntityType.PRODUCT_BARCODES, data_barcode) # add barcode, EAN-13, ex. 6921168593910 @@ -122,6 +123,7 @@ def add_product(dict_good, location): data_barcode = { "product_id": int(response_grocy["created_object_id"]), "barcode": dict_good["gtin"].lstrip("0"), + "amount": 1.0, } grocy.add_generic(EntityType.PRODUCT_BARCODES, data_barcode) @@ -425,7 +427,7 @@ def add_to_stream(): # 初始化 APScheduler 并添加定时任务 scheduler = BackgroundScheduler() -scheduler.add_job(func=consume_stream, trigger="interval", seconds=300) +scheduler.add_job(func=consume_stream, trigger="interval", seconds=10) scheduler.start() # 确保程序退出时停止定时任务