From a583a9fddae5c5fa34c6c768eef4dc1d423fa0ad Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Thu, 7 Dec 2023 14:03:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=A4=84=E6=96=B9=E5=B9=B3=E5=8F=B0=E5=95=86=E5=93=81=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8D=AF=E5=BA=97=E7=BC=96=E7=A0=81=E8=AF=86?= =?UTF-8?q?=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Command/getProductCommand.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/app/Command/getProductCommand.php b/app/Command/getProductCommand.php index e303f7c..aa4a64c 100644 --- a/app/Command/getProductCommand.php +++ b/app/Command/getProductCommand.php @@ -43,7 +43,7 @@ class getProductCommand extends HyperfCommand $page = 1; $page_size = 100; $result = $prescription->getProd(1, 100); - if (!empty($result['rows'])){ + if (!empty($result['rows'])) { foreach ($result['rows'] as $item) { // 执行入库 $this->handleData($item); @@ -55,7 +55,7 @@ class getProductCommand extends HyperfCommand for ($i = 2; $i < $count; $i++) { try { $result = $prescription->getProd($i, $page_size); - if (!isset($result['rows'])){ + if (!isset($result['rows'])) { continue; } @@ -63,7 +63,7 @@ class getProductCommand extends HyperfCommand // 执行入库 $this->handleData($item); } - }catch (\Exception $e){ + } catch (\Exception $e) { $this->line("部分商品更新失败:" . $e->getMessage()); } } @@ -109,6 +109,23 @@ class getProductCommand extends HyperfCommand 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"; + } + + // 非药店编码 + if ($pharmacy_code != $item['thirdCode']) { + Db::rollBack(); + return false; + } + // 查询是否存在 $params = array(); $params['product_platform_code'] = $item['drugCode']; @@ -254,7 +271,7 @@ class getProductCommand extends HyperfCommand $data['product_platform_code'] = $item['drugCode']; // 第三方药店商品编码 - if (isset($item['thirdDrugCode'])){ + if (isset($item['thirdDrugCode'])) { $data['product_pharmacy_code'] = $item['thirdDrugCode']; }