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'])) {