关闭老系统的中药订单同步功能

This commit is contained in:
2025-08-29 09:15:16 +08:00
parent ec0f0a5b93
commit 788cfac9fe
2 changed files with 28 additions and 11 deletions

View File

@@ -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'];

View File

@@ -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();