From 89ca8470d859abc625b26e5d46a18445b6cbbab3 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 8 Dec 2023 16:39:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=89=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 | 64 ++++++++++++------------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/app/Command/getProductCommand.php b/app/Command/getProductCommand.php index aa4a64c..9d61b2b 100644 --- a/app/Command/getProductCommand.php +++ b/app/Command/getProductCommand.php @@ -94,27 +94,29 @@ class getProductCommand extends HyperfCommand */ protected function handleData(array $item): bool { + if (empty($item['drugCode'])) { + return false; + } + + if (empty($item['drugPrice'])) { + return false; + } + + if (empty($item['thirdCode'])) { + return false; + } + + if (empty($item['thirdDrugCode'])) { + return false; + } + + if (empty($item['approvalNumber'])) { + return false; + } + try { Db::beginTransaction(); - if (empty($item['drugCode'])) { - 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)); - return false; - } - - if (empty($item['thirdCode'])) { - Db::rollBack(); -// $this->line("商品更新失败,缺少药品价格" . json_encode($item, JSON_UNESCAPED_UNICODE)); - return false; - } - $pharmacy_code = \Hyperf\Config\config("prescription_platform.pharmacy_code"); if (empty($pharmacy_code)) { $pharmacy_code = "JG-10009"; @@ -129,6 +131,8 @@ class getProductCommand extends HyperfCommand // 查询是否存在 $params = array(); $params['product_platform_code'] = $item['drugCode']; + $params['product_pharmacy_code'] = $item['thirdDrugCode']; + $params['license_number'] = $item['approvalNumber']; $product_platform = ProductPlatform::getOne($params); if (!empty($product_platform)) { // 已存在,更新 @@ -173,14 +177,6 @@ class getProductCommand extends HyperfCommand } } - // 批准文号 - if (isset($item['approvalNumber'])) { - if ($product_platform['license_number'] != $item['approvalNumber']) { - $product_platform_data['license_number'] = $item['approvalNumber']; - $product_data['license_number'] = $item['approvalNumber']; - } - } - // 生产厂家 if (isset($item['manufacturer'])) { if ($product_platform['manufacturer'] != $item['manufacturer']) { @@ -197,14 +193,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']) { @@ -271,9 +259,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'])) { @@ -281,9 +267,7 @@ class getProductCommand extends HyperfCommand } // 批准文号 - if (isset($item['approvalNumber'])) { - $data['license_number'] = $item['approvalNumber']; - } + $data['license_number'] = $item['approvalNumber']; // 生产厂家 if (isset($item['manufacturer'])) {