diff --git a/app.py b/app.py index 782f8d1..ad17e05 100644 --- a/app.py +++ b/app.py @@ -121,7 +121,7 @@ def add_product(dict_good, location): if dict_good["gtin"].startswith("0"): data_barcode = { "product_id": int(response_grocy["created_object_id"]), - "barcode": dict_good["gtin"].strip("0"), + "barcode": dict_good["gtin"].lstrip("0"), } grocy.add_generic(EntityType.PRODUCT_BARCODES, data_barcode) @@ -382,13 +382,13 @@ def consume_stream(): logger.info(f"Skip non-numeric barcode: {msg['data']}") continue - _, status_code = handle_add_product(msg['data'], '') + resp, status_code = handle_add_product(msg['data'], '') if status_code == 200: # 消费完成后确认消息 r.xack(STREAM_KEY, CONSUMER_GROUP, msg_id) bark_push('商品添加成功', '条形码 %s' % msg['data']) else: - logger.error(f"Failed to process message: {msg['data']}") + logger.error(f"Failed to process message: {msg['data']} {resp}") bark_push('商品添加失败', '条形码 %s' % msg['data']) except Exception as e: