From 789111e629919b3381c24ada01639378c4d8bd92 Mon Sep 17 00:00:00 2001 From: Ching Date: Sun, 9 Feb 2025 18:18:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(models):=20=E4=BC=98=E5=8C=96scanlog?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=95=86=E5=93=81=E5=90=8D=E5=AD=97=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/models.py b/models.py index 82d3b6d..3fb0d9a 100644 --- a/models.py +++ b/models.py @@ -39,7 +39,11 @@ class ScanLog(BaseModel): try: product = BarcodeDB.get(BarcodeDB.barcode == self.barcode) product_info = json.loads(product.product_info) - name = product_info.get('name') + name_key = ['goodsName', 'goods_name', 'name'] + for key in name_key: + if key in product_info: + name = product_info.get(key) + break except BarcodeDB.DoesNotExist: pass