diff --git a/app/Command/getProductCommand.php b/app/Command/getProductCommand.php index 1fb771c..4c0107a 100644 --- a/app/Command/getProductCommand.php +++ b/app/Command/getProductCommand.php @@ -101,12 +101,6 @@ 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)); @@ -116,7 +110,6 @@ 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)) { // 已存在,更新 @@ -185,6 +178,14 @@ 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']) { @@ -251,7 +252,9 @@ class getProductCommand extends HyperfCommand $data['product_platform_code'] = $item['drugCode']; // 第三方药店商品编码 - $data['product_pharmacy_code'] = $item['thirdDrugCode']; + if (isset($item['thirdDrugCode'])){ + $data['product_pharmacy_code'] = $item['thirdDrugCode']; + } // 商品规格 if (isset($item['specifications'])) {