From 788cfac9fe5c089ea56526e2f6ed9bec2618ffb6 Mon Sep 17 00:00:00 2001 From: lq Date: Fri, 29 Aug 2025 09:15:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=97=AD=E8=80=81=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=9A=84=E4=B8=AD=E8=8D=AF=E8=AE=A2=E5=8D=95=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/services/JacErpService.php | 16 +++++++++++++ .../v1/controllers/ExamineController.php | 23 ++++++++++--------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/common/services/JacErpService.php b/common/services/JacErpService.php index 49ef79b..618059b 100644 --- a/common/services/JacErpService.php +++ b/common/services/JacErpService.php @@ -44,6 +44,22 @@ class JacErpService public function syncOrder($params){ + + throw new Exception('暂时关闭老接口的同步功能'); + ds($params); + $response = (new Client(['http_errors' => false]))->post( + 'http://127.0.0.1/open-api/test-api/send-china-prescription?keys=kB0sE7tZ3yT0jI1sD4wL2lI0kN6jO8cV4tO1zQ8zA5pgG5iW6zV0oB8vD6qV5cS7wQ5tN4cO8bG9gY6yL3lA6g', + [ + 'headers' => ['Content-Type' => 'application/json', 'userid' => $this->config['userid'], 'secret' => $this->config['secret']], + \GuzzleHttp\RequestOptions::JSON =>$params + ] + ); + $result = json_decode($response->getBody(),true); + ds($result); + if ($result['code']) { + throw new Exception($result['message']); + } + return true; \Yii::info(__METHOD__."——同步订单至江奥川erp接口地址: ".$this->config['url'].'/tis-server/api/addTisApplyMaster'); $url = $this->config['url'].'/tis-server/api/addTisApplyMaster'; $params['hospital_code'] = $this->config['userid']; diff --git a/service/modules/v1/controllers/ExamineController.php b/service/modules/v1/controllers/ExamineController.php index 5ba5d2b..0281cd4 100644 --- a/service/modules/v1/controllers/ExamineController.php +++ b/service/modules/v1/controllers/ExamineController.php @@ -17,6 +17,7 @@ use common\models\oldDb\ProductOrder; use common\models\oldDb\Store; use common\models\oldDb\SystemNotice; use common\services\PrescriptionService; +use GuzzleHttp\Client; use yii\base\Exception; /** @@ -175,18 +176,18 @@ class ExamineController extends BasePharmacistController $form = new ProductRefundForm(); $form->refund(['user_id' =>$productOrder->user_id, 'order_id' => $productOrder->id], 'auto'); } - }else{ + } else { //中药处方订单同步江奥川erp - if($prescription->prescription_type == 1){ - $productOrder = ProductOrder::find()->where(['p_id' => $prescription->id, 'status' => 1])->one(); - if($productOrder){ - //触发订单支付事件,同步江奥川ERP - $event = new ProductOrderEvent(); - $event->order = $productOrder; - $event->sender = $this; - \Yii::$app->trigger(ProductOrder::EVENT_PAYED, $event); - } - } +// if($prescription->prescription_type == 1){ +// $productOrder = ProductOrder::find()->where(['p_id' => $prescription->id, 'status' => 1])->one(); +// if($productOrder){ +// //触发订单支付事件,同步江奥川ERP +// $event = new ProductOrderEvent(); +// $event->order = $productOrder; +// $event->sender = $this; +// \Yii::$app->trigger(ProductOrder::EVENT_PAYED, $event); +// } +// } } $systemNotice = new SystemNotice();