From a02787636f49803d588a9e63fa1aff0612f62176 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Wed, 17 May 2023 14:29:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E5=95=86?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/getProductCommand.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/Command/getProductCommand.php b/app/Command/getProductCommand.php index 88fbe71..8228455 100644 --- a/app/Command/getProductCommand.php +++ b/app/Command/getProductCommand.php @@ -101,6 +101,12 @@ class getProductCommand extends HyperfCommand return false; } + if (empty($item['thirdDrugCode'])) { + Db::rollBack(); + $this->line("商品更新失败,缺少第三方药房药品编码" . json_encode($item, JSON_UNESCAPED_UNICODE)); + return false; + } + if (empty($item['drugPrice'])) { Db::rollBack(); $this->line("商品更新失败,缺少药品价格" . json_encode($item, JSON_UNESCAPED_UNICODE)); @@ -110,6 +116,7 @@ class getProductCommand extends HyperfCommand // 查询是否存在 $params = array(); $params['product_platform_code'] = $item['drugCode']; + $params['product_pharmacy_code'] = $item['thirdDrugCode']; $product_platform = ProductPlatform::getOne($params); if (!empty($product_platform)) { // 已存在,更新 @@ -178,14 +185,6 @@ class getProductCommand extends HyperfCommand } } - // 第三方药店商品编码 - if (isset($item['thirdDrugCode'])) { - if ($product_platform['product_pharmacy_code'] != $item['thirdDrugCode']) { - $product_platform_data['product_pharmacy_code'] = $item['thirdDrugCode']; - $product_data['product_pharmacy_code'] = $item['thirdDrugCode']; - } - } - // 基本包装数量 if (isset($item['basicPackingCount'])) { if ($product_platform['packaging_count'] != $item['basicPackingCount']) { @@ -252,9 +251,7 @@ class getProductCommand extends HyperfCommand $data['product_platform_code'] = $item['drugCode']; // 第三方药店商品编码 - if (isset($item['thirdDrugCode'])) { - $data['product_pharmacy_code'] = $item['thirdDrugCode']; - } + $data['product_pharmacy_code'] = $item['thirdDrugCode']; // 商品规格 if (isset($item['specifications'])) {