修改我的医生
This commit is contained in:
parent
a5fb1d46e7
commit
81a47d72e0
@ -52,21 +52,21 @@ class CallBackController extends AbstractController
|
||||
{
|
||||
try {
|
||||
// 处理支付结果事件
|
||||
$WechatPay = new WechatPay(1,1);
|
||||
$WechatPay = new WechatPay(1, 1);
|
||||
$app = $WechatPay->createApp();
|
||||
$server = $app->getServer();
|
||||
|
||||
$message = $server->getRequestMessage();
|
||||
if (empty($message)){
|
||||
if (empty($message)) {
|
||||
return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => "问诊微信支付回调数据为空"], JSON_UNESCAPED_UNICODE))));
|
||||
}
|
||||
|
||||
// 验证推送消息签名
|
||||
$app->getValidator()->validate($app->getRequest());
|
||||
|
||||
Log::getInstance()->info("问诊微信支付回调数据:" . json_encode($message->toArray(),JSON_UNESCAPED_UNICODE));
|
||||
Log::getInstance()->info("问诊微信支付回调数据:" . json_encode($message->toArray(), JSON_UNESCAPED_UNICODE));
|
||||
|
||||
if (empty($message['out_trade_no'])){
|
||||
if (empty($message['out_trade_no'])) {
|
||||
Log::getInstance()->info("问诊微信支付回调数据处理失败,缺少外部订单号");
|
||||
return $server->serve();
|
||||
}
|
||||
@ -75,13 +75,13 @@ class CallBackController extends AbstractController
|
||||
$params = array();
|
||||
$params['inquiry_no'] = $message['out_trade_no'];
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)){
|
||||
if (empty($order_inquiry)) {
|
||||
Log::getInstance()->info("问诊微信支付回调数据处理失败,无订单数据");
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 验证订单状态
|
||||
if ($order_inquiry['inquiry_status'] != 1){
|
||||
if ($order_inquiry['inquiry_status'] != 1) {
|
||||
// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
Log::getInstance()->info("问诊微信支付回调数据处理失败,订单状态当前为" . $order_inquiry['inquiry_status']);
|
||||
return $server->serve();
|
||||
@ -91,38 +91,38 @@ class CallBackController extends AbstractController
|
||||
|
||||
// 修改支付状态
|
||||
$data = array();
|
||||
if ($message['trade_state'] == "SUCCESS"){
|
||||
if ($message['trade_state'] == "SUCCESS") {
|
||||
// 支付成功
|
||||
$data['inquiry_pay_status'] = 2;
|
||||
$data['pay_time'] = date('Y-m-d H:i:s',strtotime($message['success_time']));// 支付时间
|
||||
if ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3){
|
||||
$data['pay_time'] = date('Y-m-d H:i:s', strtotime($message['success_time']));// 支付时间
|
||||
if ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3) {
|
||||
// 专家-公益
|
||||
$data['inquiry_status'] = 3;// 3:待接诊
|
||||
}elseif ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4){
|
||||
} elseif ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4) {
|
||||
// 快速-购药
|
||||
$data['inquiry_status'] = 2;// 2:待分配
|
||||
}
|
||||
}elseif($message['trade_state'] == "CLOSED"){
|
||||
} elseif ($message['trade_state'] == "CLOSED") {
|
||||
// 已关闭
|
||||
$data['inquiry_pay_status'] = 6;
|
||||
}elseif($message['trade_state'] == "REVOKED"){
|
||||
} elseif ($message['trade_state'] == "REVOKED") {
|
||||
// 已撤销(付款码支付)
|
||||
$data['inquiry_pay_status'] = 7;
|
||||
}elseif($message['trade_state'] == "USERPAYING"){
|
||||
} elseif ($message['trade_state'] == "USERPAYING") {
|
||||
// 用户支付中(付款码支付)
|
||||
$data['inquiry_pay_status'] = 3;
|
||||
}elseif($message['trade_state'] == "PAYERROR"){
|
||||
} elseif ($message['trade_state'] == "PAYERROR") {
|
||||
// 支付失败(其他原因,如银行返回失败)
|
||||
$data['inquiry_pay_status'] = 4;
|
||||
}
|
||||
|
||||
$data['escrow_trade_no'] = $message['transaction_id'];
|
||||
$data['updated_at'] = date('Y-m-d H:i:s',time());
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
OrderInquiry::edit($params,$data);
|
||||
}catch (\Exception $e) {
|
||||
OrderInquiry::edit($params, $data);
|
||||
} catch (\Exception $e) {
|
||||
// 验证失败
|
||||
Log::getInstance()->error("问诊微信支付回调数据处理失败:" . $e->getMessage());
|
||||
return $this->wxPayErrorReturn($e->getMessage());
|
||||
@ -132,8 +132,8 @@ class CallBackController extends AbstractController
|
||||
Log::getInstance()->info("问诊微信支付回调数据处理成功,开始分配医生/发送问诊消息");
|
||||
|
||||
try {
|
||||
if ($message['trade_state'] == "SUCCESS"){
|
||||
if ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4){
|
||||
if ($message['trade_state'] == "SUCCESS") {
|
||||
if ($order_inquiry['inquiry_type'] == 2 || $order_inquiry['inquiry_type'] == 4) {
|
||||
Log::getInstance()->info("加入分配医生队列");
|
||||
|
||||
// 快速-购药
|
||||
@ -150,7 +150,7 @@ class CallBackController extends AbstractController
|
||||
}
|
||||
|
||||
Log::getInstance()->info("加入分配医生队列成功");
|
||||
}elseif ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3){
|
||||
} elseif ($order_inquiry['inquiry_type'] == 1 || $order_inquiry['inquiry_type'] == 3) {
|
||||
// 专家-公益,发送im消息
|
||||
Log::getInstance()->info("开始发送im消息");
|
||||
|
||||
@ -158,23 +158,23 @@ class CallBackController extends AbstractController
|
||||
$params = array();
|
||||
$params['doctor_id'] = $order_inquiry['doctor_id'];
|
||||
$user_doctor = UserDoctor::getOne($params);
|
||||
if (empty($user_doctor)){
|
||||
if (empty($user_doctor)) {
|
||||
Log::getInstance()->info("医生数据错误");
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 发送IM消息-等待医生接诊
|
||||
$imService = new ImService();
|
||||
$imService->waitDoctorInquiry($order_inquiry,$user_doctor['user_id'],$order_inquiry['user_id']);
|
||||
$imService->waitDoctorInquiry($order_inquiry, $user_doctor['user_id'], $order_inquiry['user_id']);
|
||||
|
||||
// 发送站内、订阅失败发送短信消息-医生有新问诊
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush = new MessagePush($user_doctor['user_id'], $order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->doctorHaveNewInquiry();
|
||||
|
||||
Log::getInstance()->info("发送im消息成功");
|
||||
}
|
||||
}
|
||||
}catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// 验证失败
|
||||
Log::getInstance()->error("问诊微信支付回调数据处理成功,分配医生/发送问诊消息失败:" . $e->getMessage());
|
||||
return $server->serve();
|
||||
@ -198,12 +198,12 @@ class CallBackController extends AbstractController
|
||||
|
||||
try {
|
||||
// 处理支付结果事件
|
||||
$WechatPay = new WechatPay(1,1);
|
||||
$WechatPay = new WechatPay(1, 1);
|
||||
$app = $WechatPay->createApp();
|
||||
$server = $app->getServer();
|
||||
|
||||
$message = $server->getRequestMessage();
|
||||
if (empty($message)){
|
||||
if (empty($message)) {
|
||||
Db::rollBack();
|
||||
return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => "回调数据为空"], JSON_UNESCAPED_UNICODE))));
|
||||
}
|
||||
@ -211,9 +211,9 @@ class CallBackController extends AbstractController
|
||||
// 验证推送消息签名
|
||||
$app->getValidator()->validate($app->getRequest());
|
||||
|
||||
Log::getInstance()->info("微信退款回调数据:" . json_encode($message->toArray(),JSON_UNESCAPED_UNICODE));
|
||||
Log::getInstance()->info("微信退款回调数据:" . json_encode($message->toArray(), JSON_UNESCAPED_UNICODE));
|
||||
|
||||
if (empty($message['out_trade_no'])){
|
||||
if (empty($message['out_trade_no'])) {
|
||||
Log::getInstance()->info("微信退款回调数据错误");
|
||||
return $server->serve();
|
||||
}
|
||||
@ -222,13 +222,13 @@ class CallBackController extends AbstractController
|
||||
$params = array();
|
||||
$params['inquiry_no'] = $message['out_trade_no'];
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)){
|
||||
if (empty($order_inquiry)) {
|
||||
Log::getInstance()->info("非法订单");
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 验证订单状态
|
||||
if ($order_inquiry['inquiry_status'] == 1){
|
||||
if ($order_inquiry['inquiry_status'] == 1) {
|
||||
// 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
Log::getInstance()->info("订单状态错误:当前为" . $order_inquiry['inquiry_status']);
|
||||
return $server->serve();
|
||||
@ -242,25 +242,25 @@ class CallBackController extends AbstractController
|
||||
}
|
||||
|
||||
// 验证订单支付状态
|
||||
if (in_array($order_inquiry['inquiry_pay_status'],[1,3,4,5,6,7])) {
|
||||
if (in_array($order_inquiry['inquiry_pay_status'], [1, 3, 4, 5, 6, 7])) {
|
||||
// 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
Log::getInstance()->error("队列执行失败原因:订单未支付");
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 退款状态
|
||||
if ($message['refund_status'] == "SUCCESS"){
|
||||
if ($message['refund_status'] == "SUCCESS") {
|
||||
// 退款成功
|
||||
$inquiry_refund_status = 3;
|
||||
}elseif ($message['refund_status'] == "CLOSED"){
|
||||
} elseif ($message['refund_status'] == "CLOSED") {
|
||||
// 退款关闭
|
||||
$inquiry_refund_status = 5;
|
||||
}elseif ($message['refund_status'] == "ABNORMAL"){
|
||||
} elseif ($message['refund_status'] == "ABNORMAL") {
|
||||
// 退款异常
|
||||
$inquiry_refund_status = 6;
|
||||
}
|
||||
|
||||
if (empty($inquiry_refund_status)){
|
||||
if (empty($inquiry_refund_status)) {
|
||||
// 错误,无退款状态
|
||||
Log::getInstance()->error("队列执行失败原因:订单未支付");
|
||||
return $this->wxPayErrorReturn("退款状态错误");
|
||||
@ -272,7 +272,7 @@ class CallBackController extends AbstractController
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
OrderInquiry::edit($params,$data);
|
||||
OrderInquiry::edit($params, $data);
|
||||
|
||||
// 修改退款订单
|
||||
$data = array();
|
||||
@ -281,13 +281,13 @@ class CallBackController extends AbstractController
|
||||
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_inquiry['order_inquiry_id'];
|
||||
OrderInquiryRefund::edit($params,$data);
|
||||
OrderInquiryRefund::edit($params, $data);
|
||||
|
||||
// 恢复优惠卷
|
||||
if ($inquiry_refund_status == 3){
|
||||
if ($inquiry_refund_status == 3) {
|
||||
if (!empty($order_inquiry['coupon_amount_total']) && $order_inquiry['coupon_amount_total'] > 0) {
|
||||
$InquiryService = new InquiryService();
|
||||
$InquiryService->returnInquiryCoupon($order_inquiry['order_inquiry_id'],$order_inquiry['user_id']);
|
||||
$InquiryService->returnInquiryCoupon($order_inquiry['order_inquiry_id'], $order_inquiry['user_id']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,25 +302,25 @@ class CallBackController extends AbstractController
|
||||
Log::getInstance()->info("微信退款回调处理成功,推送消息");
|
||||
|
||||
// 发送推送消息
|
||||
if ($inquiry_refund_status == 3){
|
||||
if ($inquiry_refund_status == 3) {
|
||||
try {
|
||||
// 发送站内、订阅、短信消息-问诊服务退款成功
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'], $order_inquiry['order_inquiry_id']);
|
||||
|
||||
// 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||
if ($order_inquiry['cancel_reason'] == 1){
|
||||
if ($order_inquiry['cancel_reason'] == 1) {
|
||||
$MessagePush->refundInquirySuccess(1);
|
||||
} elseif ($order_inquiry['cancel_reason'] == 2){
|
||||
} elseif ($order_inquiry['cancel_reason'] == 2) {
|
||||
$MessagePush->refundInquirySuccess(3);
|
||||
} elseif ($order_inquiry['cancel_reason'] == 3){
|
||||
} elseif ($order_inquiry['cancel_reason'] == 3) {
|
||||
$MessagePush->refundInquirySuccess(2);
|
||||
}
|
||||
|
||||
// 发送站内消息-优惠卷退还
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'],$order_inquiry['order_inquiry_id']);
|
||||
$MessagePush = new MessagePush($order_inquiry['user_id'], $order_inquiry['order_inquiry_id']);
|
||||
$MessagePush->patientRefundCoupon();
|
||||
|
||||
}catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// 验证失败
|
||||
Log::getInstance()->error("微信退款回调处理成功,推送消息失败:" . $e->getMessage());
|
||||
return $server->serve();
|
||||
@ -339,26 +339,26 @@ class CallBackController extends AbstractController
|
||||
{
|
||||
try {
|
||||
// 处理支付结果事件
|
||||
$WechatPay = new WechatPay(1,2);
|
||||
$WechatPay = new WechatPay(1, 2);
|
||||
$app = $WechatPay->createApp();
|
||||
$server = $app->getServer();
|
||||
|
||||
$message = $server->getRequestMessage();
|
||||
|
||||
if (empty($message)){
|
||||
if (empty($message)) {
|
||||
return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => "药品微信支付回调数据为空"], JSON_UNESCAPED_UNICODE))));
|
||||
}
|
||||
|
||||
// 验证推送消息签名
|
||||
$app->getValidator()->validate($app->getRequest());
|
||||
|
||||
Log::getInstance()->info("药品微信支付回调数据:" . json_encode($message->toArray(),JSON_UNESCAPED_UNICODE));
|
||||
Log::getInstance()->info("药品微信支付回调数据:" . json_encode($message->toArray(), JSON_UNESCAPED_UNICODE));
|
||||
|
||||
if (empty($message['out_trade_no'])){
|
||||
if (empty($message['out_trade_no'])) {
|
||||
Log::getInstance()->info("药品微信支付回调数据处理失败,缺少外部订单号");
|
||||
return $server->serve();
|
||||
}
|
||||
}catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// 验证失败
|
||||
Log::getInstance()->error("药品微信支付回调数据处理失败:" . $e->getMessage());
|
||||
return $this->wxPayErrorReturn($e->getMessage());
|
||||
@ -373,14 +373,14 @@ class CallBackController extends AbstractController
|
||||
$params = array();
|
||||
$params['order_product_no'] = $message['out_trade_no'];
|
||||
$order_product = OrderProduct::getOne($params);
|
||||
if (empty($order_product)){
|
||||
if (empty($order_product)) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->info("药品微信支付回调数据处理失败,无订单数据");
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 验证订单状态
|
||||
if ($order_product['order_product_status'] != 1){
|
||||
if ($order_product['order_product_status'] != 1) {
|
||||
Db::rollBack();
|
||||
// 订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)
|
||||
Log::getInstance()->info("药品微信支付回调数据处理失败,订单状态当前为" . $order_product['order_product_status']);
|
||||
@ -391,38 +391,38 @@ class CallBackController extends AbstractController
|
||||
|
||||
// 修改支付状态
|
||||
$data = array();
|
||||
if ($message['trade_state'] == "SUCCESS"){
|
||||
if ($message['trade_state'] == "SUCCESS") {
|
||||
// 支付成功
|
||||
$data['order_product_status'] = 2;
|
||||
$data['pay_status'] = 2;// 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
$data['pay_time'] = date('Y-m-d H:i:s',strtotime($message['success_time']));// 支付时间
|
||||
$data['pay_time'] = date('Y-m-d H:i:s', strtotime($message['success_time']));// 支付时间
|
||||
|
||||
}elseif($message['trade_state'] == "CLOSED"){
|
||||
} elseif ($message['trade_state'] == "CLOSED") {
|
||||
// 已关闭
|
||||
$data['pay_status'] = 6;
|
||||
}elseif($message['trade_state'] == "REVOKED"){
|
||||
} elseif ($message['trade_state'] == "REVOKED") {
|
||||
// 已撤销(付款码支付)
|
||||
$data['pay_status'] = 7;
|
||||
}elseif($message['trade_state'] == "USERPAYING"){
|
||||
} elseif ($message['trade_state'] == "USERPAYING") {
|
||||
// 用户支付中(付款码支付)
|
||||
$data['pay_status'] = 3;
|
||||
}elseif($message['trade_state'] == "PAYERROR"){
|
||||
} elseif ($message['trade_state'] == "PAYERROR") {
|
||||
// 支付失败(其他原因,如银行返回失败)
|
||||
$data['pay_status'] = 4;
|
||||
}
|
||||
|
||||
$data['escrow_trade_no'] = $message['transaction_id'];
|
||||
$data['updated_at'] = date('Y-m-d H:i:s',time());
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', time());
|
||||
|
||||
$params = array();
|
||||
$params['order_product_id'] = $order_product['order_product_id'];
|
||||
OrderProduct::edit($params,$data);
|
||||
OrderProduct::edit($params, $data);
|
||||
|
||||
// 获取订单商品订单列表
|
||||
$params = array();
|
||||
$params['order_product_id'] = $order_product['order_product_id'];
|
||||
$order_product_item = OrderProductItem::getList($params);
|
||||
if (empty($order_product_item)){
|
||||
if (empty($order_product_item)) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->info("药品微信支付回调数据处理失败,未查询到对应订单商品订单列表");
|
||||
return $server->serve();
|
||||
@ -452,12 +452,12 @@ class CallBackController extends AbstractController
|
||||
|
||||
try {
|
||||
// 处理支付结果事件
|
||||
$WechatPay = new WechatPay(1,1);
|
||||
$WechatPay = new WechatPay(1, 1);
|
||||
$app = $WechatPay->createApp();
|
||||
$server = $app->getServer();
|
||||
|
||||
$message = $server->getRequestMessage();
|
||||
if (empty($message)){
|
||||
if (empty($message)) {
|
||||
Db::rollBack();
|
||||
return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => "回调数据为空"], JSON_UNESCAPED_UNICODE))));
|
||||
}
|
||||
@ -465,9 +465,9 @@ class CallBackController extends AbstractController
|
||||
// 验证推送消息签名
|
||||
$app->getValidator()->validate($app->getRequest());
|
||||
|
||||
Log::getInstance()->info("微信退款回调数据:" . json_encode($message->toArray(),JSON_UNESCAPED_UNICODE));
|
||||
Log::getInstance()->info("微信退款回调数据:" . json_encode($message->toArray(), JSON_UNESCAPED_UNICODE));
|
||||
|
||||
if (empty($message['out_trade_no'])){
|
||||
if (empty($message['out_trade_no'])) {
|
||||
Log::getInstance()->info("药品微信退款回调数据处理失败,缺少外部订单号");
|
||||
return $server->serve();
|
||||
}
|
||||
@ -476,14 +476,14 @@ class CallBackController extends AbstractController
|
||||
$params = array();
|
||||
$params['order_product_no'] = $message['out_trade_no'];
|
||||
$order_product = OrderProduct::getOne($params);
|
||||
if (empty($order_product)){
|
||||
if (empty($order_product)) {
|
||||
Db::rollBack();
|
||||
Log::getInstance()->info("药品微信退款回调数据处理失败,无订单数据");
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 验证订单状态
|
||||
if ($order_product['order_product_status'] == 1){
|
||||
if ($order_product['order_product_status'] == 1) {
|
||||
// 订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)
|
||||
Log::getInstance()->info("药品微信退款回调数据处理失败,订单状态错误:当前为" . $order_product['order_product_status']);
|
||||
return $server->serve();
|
||||
@ -497,25 +497,25 @@ class CallBackController extends AbstractController
|
||||
}
|
||||
|
||||
// 验证订单支付状态
|
||||
if (in_array($order_product['pay_status'],[1,3,4,5,6,7])) {
|
||||
if (in_array($order_product['pay_status'], [1, 3, 4, 5, 6, 7])) {
|
||||
// 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
Log::getInstance()->error("药品微信退款回调数据处理失败:订单未支付");
|
||||
return $server->serve();
|
||||
}
|
||||
|
||||
// 退款状态
|
||||
if ($message['refund_status'] == "SUCCESS"){
|
||||
if ($message['refund_status'] == "SUCCESS") {
|
||||
// 退款成功
|
||||
$refund_status = 3;
|
||||
}elseif ($message['refund_status'] == "CLOSED"){
|
||||
} elseif ($message['refund_status'] == "CLOSED") {
|
||||
// 退款关闭
|
||||
$refund_status = 5;
|
||||
}elseif ($message['refund_status'] == "ABNORMAL"){
|
||||
} elseif ($message['refund_status'] == "ABNORMAL") {
|
||||
// 退款异常
|
||||
$refund_status = 6;
|
||||
}
|
||||
|
||||
if (empty($refund_status)){
|
||||
if (empty($refund_status)) {
|
||||
// 错误,无退款状态
|
||||
Log::getInstance()->error("药品微信退款回调数据处理失败:订单未支付");
|
||||
return $this->wxPayErrorReturn("退款状态错误");
|
||||
@ -527,7 +527,7 @@ class CallBackController extends AbstractController
|
||||
|
||||
$params = array();
|
||||
$params['order_product_id'] = $order_product['order_product_id'];
|
||||
OrderProduct::edit($params,$data);
|
||||
OrderProduct::edit($params, $data);
|
||||
|
||||
// 修改退款订单
|
||||
$data = array();
|
||||
@ -536,7 +536,7 @@ class CallBackController extends AbstractController
|
||||
|
||||
$params = array();
|
||||
$params['order_product_id'] = $order_product['order_product_id'];
|
||||
OrderProductRefund::edit($params,$data);
|
||||
OrderProductRefund::edit($params, $data);
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
@ -554,14 +554,14 @@ class CallBackController extends AbstractController
|
||||
$params = array();
|
||||
$params['patient_id'] = $order_product['patient_id'];
|
||||
$user_patient = UserPatient::getOne($params);
|
||||
if (empty($user_patient)){
|
||||
if (empty($user_patient)) {
|
||||
Log::getInstance()->error("微信退款回调处理成功,推送消息失败:推送用户数据错误");
|
||||
}
|
||||
|
||||
// 发送站内、订阅、短信消息-药品订单退款成功
|
||||
$MessagePush = new MessagePush($user_patient['user_id']);
|
||||
$MessagePush->refundProductSuccess($order_product['order_product_id']);
|
||||
}catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// 验证失败
|
||||
Log::getInstance()->error("微信退款回调处理成功,推送消息失败:" . $e->getMessage());
|
||||
return $server->serve();
|
||||
@ -599,47 +599,47 @@ class CallBackController extends AbstractController
|
||||
{
|
||||
$request_params = $this->request->all();
|
||||
try {
|
||||
Log::getInstance()->info("Im回调数据:" . json_encode($request_params,JSON_UNESCAPED_UNICODE));
|
||||
Log::getInstance()->info("Im回调数据:" . json_encode($request_params, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
if (empty($request_params['RequestTime']) || empty($request_params['Sign'])){
|
||||
if (empty($request_params['RequestTime']) || empty($request_params['Sign'])) {
|
||||
Log::getInstance()->error("Im回调数据处理失败:缺少时间时间戳/签名字段");
|
||||
return $this->ImErrorReturn("缺少时间时间戳/签名字段");
|
||||
}
|
||||
|
||||
// 鉴定回调签名
|
||||
$imService = new ImService();
|
||||
$result = $imService->validateSign($request_params['RequestTime'],$request_params['Sign']);
|
||||
if (!$result){
|
||||
$result = $imService->validateSign($request_params['RequestTime'], $request_params['Sign']);
|
||||
if (!$result) {
|
||||
Log::getInstance()->error("Im回调数据处理失败:回调签名不匹配");
|
||||
return $this->ImErrorReturn("回调签名不匹配");
|
||||
}
|
||||
|
||||
// 验证消息内容
|
||||
if (empty($request_params['MsgBody'])){
|
||||
if (empty($request_params['MsgBody'])) {
|
||||
Log::getInstance()->error("Im回调数据处理失败:消息内容错误");
|
||||
return $this->ImErrorReturn("消息内容错误,缺少MsgBody");
|
||||
}
|
||||
|
||||
// 验证消息内容类型
|
||||
if (empty($request_params['MsgBody'][0]['MsgType'])){
|
||||
if (empty($request_params['MsgBody'][0]['MsgType'])) {
|
||||
Log::getInstance()->error("Im回调数据处理失败:缺少MsgType");
|
||||
return $this->ImErrorReturn("消息内容错误,缺少MsgType");
|
||||
}
|
||||
|
||||
// 验证消息内容详情
|
||||
if (empty($request_params['MsgBody'][0]['MsgContent'])){
|
||||
if (empty($request_params['MsgBody'][0]['MsgContent'])) {
|
||||
Log::getInstance()->error("Im回调数据处理失败:缺少MsgContent");
|
||||
return $this->ImErrorReturn("消息内容错误,缺少MsgContent");
|
||||
}
|
||||
|
||||
// 验证接收方user_id
|
||||
if (empty($request_params['To_Account'])){
|
||||
if (empty($request_params['To_Account'])) {
|
||||
Log::getInstance()->error("Im回调数据处理失败:接收用户错误");
|
||||
return $this->ImErrorReturn("消息内容错误,接收用户错误");
|
||||
}
|
||||
|
||||
// 验证消息唯一id
|
||||
if (empty($request_params['MsgKey'])){
|
||||
if (empty($request_params['MsgKey'])) {
|
||||
Log::getInstance()->error("Im回调数据处理失败:消息唯一标识错误");
|
||||
return $this->ImErrorReturn("消息内容错误,消息唯一标识错误");
|
||||
}
|
||||
@ -648,29 +648,29 @@ class CallBackController extends AbstractController
|
||||
$params = array();
|
||||
$params['message_key'] = $request_params['MsgKey'];
|
||||
$message = MessageIm::getExists($params);
|
||||
if ($message){
|
||||
if ($message) {
|
||||
// 消息重复
|
||||
Log::getInstance()->info("Im回调数据处理失败:消息重复");
|
||||
return $this->ImSuccessReturn();
|
||||
}
|
||||
|
||||
// 处理发送结果
|
||||
if ($request_params['SendMsgResult'] == 0){
|
||||
if ($request_params['SendMsgResult'] == 0) {
|
||||
// im中0表示成功
|
||||
$message_send_result = 1;
|
||||
}
|
||||
|
||||
// 验证自定义消息内容
|
||||
$is_system = 0;// 是否系统操作发送(0:否 1:是)
|
||||
if (!empty($request_params['CloudCustomData'])){
|
||||
$cloud_custom_data = json_decode($request_params['CloudCustomData'],true);
|
||||
if (!empty($request_params['CloudCustomData'])) {
|
||||
$cloud_custom_data = json_decode($request_params['CloudCustomData'], true);
|
||||
|
||||
if (!empty($cloud_custom_data['order_inquiry_id'])){
|
||||
if (!empty($cloud_custom_data['order_inquiry_id'])) {
|
||||
// 获取订单数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $cloud_custom_data['order_inquiry_id'];
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (empty($order_inquiry)){
|
||||
if (empty($order_inquiry)) {
|
||||
Log::getInstance()->error("Im回调数据处理失败:非法订单");
|
||||
return $this->ImErrorReturn("消息内容错误,非法订单");
|
||||
}
|
||||
@ -678,8 +678,8 @@ class CallBackController extends AbstractController
|
||||
$order_inquiry_id = $cloud_custom_data['order_inquiry_id'];
|
||||
}
|
||||
|
||||
if (!empty($cloud_custom_data['is_system'])){
|
||||
if ($cloud_custom_data['is_system'] == 1){
|
||||
if (!empty($cloud_custom_data['is_system'])) {
|
||||
if ($cloud_custom_data['is_system'] == 1) {
|
||||
// 系统发送
|
||||
$is_system = 1;
|
||||
}
|
||||
@ -688,7 +688,7 @@ class CallBackController extends AbstractController
|
||||
|
||||
// 入库
|
||||
$data = array();
|
||||
if (!empty($request_params['From_Account'])){
|
||||
if (!empty($request_params['From_Account'])) {
|
||||
// 系统发送时不带参数
|
||||
$data['from_user_id'] = $request_params['From_Account'];
|
||||
}
|
||||
@ -701,15 +701,15 @@ class CallBackController extends AbstractController
|
||||
$data['message_type'] = $request_params['MsgBody'][0]['MsgType'];
|
||||
|
||||
$data['is_system'] = $is_system;
|
||||
if (!empty($order_inquiry_id)){
|
||||
if (!empty($order_inquiry_id)) {
|
||||
$data['order_inquiry_id'] = $order_inquiry_id;
|
||||
}
|
||||
|
||||
$message_content = $request_params['MsgBody'][0]['MsgContent'];
|
||||
$data['message_content'] = json_encode($message_content,JSON_UNESCAPED_UNICODE);
|
||||
$data['message_content'] = json_encode($message_content, JSON_UNESCAPED_UNICODE);
|
||||
$data['message_custom_content'] = $request_params['CloudCustomData'] ?? "";
|
||||
$message = MessageIm::addMessage($data);
|
||||
if (empty($message)){
|
||||
if (empty($message)) {
|
||||
Log::getInstance()->error("Im回调数据处理失败:存储数据库失败");
|
||||
return $this->wxPayErrorReturn("存储数据库失败");
|
||||
}
|
||||
@ -771,24 +771,24 @@ class CallBackController extends AbstractController
|
||||
{
|
||||
$request_params = $this->request->all();
|
||||
try {
|
||||
Log::getInstance()->info("处方平台物流回调数据:" . json_encode($request_params,JSON_UNESCAPED_UNICODE));
|
||||
Log::getInstance()->info("处方平台物流回调数据:" . json_encode($request_params, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
if (!isset($request_params['sign']) ){
|
||||
if (!isset($request_params['sign'])) {
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:缺少签名结果");
|
||||
return $this->platformLogisticsErrorReturn("缺少签名结果");
|
||||
}
|
||||
|
||||
if (!isset($request_params['nonce']) ){
|
||||
if (!isset($request_params['nonce'])) {
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:缺少随机数");
|
||||
return $this->platformLogisticsErrorReturn("缺少随机数");
|
||||
}
|
||||
|
||||
if (!isset($request_params['timestamp']) ){
|
||||
if (!isset($request_params['timestamp'])) {
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:缺少签名时间戳");
|
||||
return $this->platformLogisticsErrorReturn("缺少签名时间戳");
|
||||
}
|
||||
|
||||
if (!isset($request_params['paramJsonStr']) ){
|
||||
if (!isset($request_params['paramJsonStr'])) {
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:缺少数据体");
|
||||
return $this->platformLogisticsErrorReturn("缺少数据体");
|
||||
}
|
||||
@ -801,7 +801,7 @@ class CallBackController extends AbstractController
|
||||
$sign_params['nonce'] = $request_params['nonce'];
|
||||
$sign_params['clientSecret'] = config('prescription_platform.client_secret');
|
||||
$sign = md5(http_build_query($sign_params, '', '&'));
|
||||
if ($sign != $request_params['sign']){
|
||||
if ($sign != $request_params['sign']) {
|
||||
Log::getInstance()->error("处方平台物流回调数据处理失败:签名错误");
|
||||
Log::getInstance()->error("系统签名:" . $sign);
|
||||
Log::getInstance()->error("处方平台签名:" . $sign);
|
||||
@ -809,8 +809,8 @@ class CallBackController extends AbstractController
|
||||
return $this->platformLogisticsErrorReturn("签名错误");
|
||||
}
|
||||
|
||||
$param_json_str = json_decode($request_params['paramJsonStr'],true);
|
||||
if (empty($param_json_str)){
|
||||
$param_json_str = json_decode($request_params['paramJsonStr'], true);
|
||||
if (empty($param_json_str)) {
|
||||
// 数据体为空,直接返回成功,不进行验证签名
|
||||
Log::getInstance()->info("处方平台物流回调数据处理成功:数据体解析为空");
|
||||
return $this->platformLogisticsSuccessReturn();
|
||||
@ -873,10 +873,79 @@ class CallBackController extends AbstractController
|
||||
{
|
||||
$request_params = $this->request->all();
|
||||
try {
|
||||
Log::getInstance()->info("处方平台物流回调数据:" . json_encode($request_params, JSON_UNESCAPED_UNICODE));
|
||||
dump($request_params);
|
||||
}catch (\Exception $e){
|
||||
Log::getInstance()->info("快递100订阅回调数据:" . json_encode($request_params, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
// 检测回调数据
|
||||
if (!isset($request_params['sign']) || !isset($request_params['param'])) {
|
||||
return $this->LogisticsFailReturn("缺少推送参数:sign/param");
|
||||
}
|
||||
|
||||
// 检测签名
|
||||
$sign = strtoupper(md5( $request_params['param'] . config('kuaidi100.salt') ));
|
||||
if ($sign != $request_params['sign']){
|
||||
return $this->LogisticsFailReturn("签名验证错误");
|
||||
}
|
||||
|
||||
// 转换编码
|
||||
$data = json_decode($request_params['param'],true);
|
||||
if (empty($data)){
|
||||
return $this->LogisticsFailReturn("转换json失败");
|
||||
}
|
||||
|
||||
// 检测消息体
|
||||
if (!isset($request_params['param']['lastResult'])){
|
||||
return $this->LogisticsFailReturn("缺少推送参数:lastResult");
|
||||
}
|
||||
|
||||
// 检测订单号
|
||||
if (!isset($request_params['param']['lastResult']['nu'])){
|
||||
return $this->LogisticsFailReturn("缺少推送参数:nu");
|
||||
}
|
||||
|
||||
// 检测快递公司编码
|
||||
if (!isset($request_params['param']['lastResult']['com'])){
|
||||
return $this->LogisticsFailReturn("缺少推送参数:com");
|
||||
}
|
||||
|
||||
// 检测内容
|
||||
if (!isset($request_params['param']['lastResult']['data'])){
|
||||
return $this->LogisticsFailReturn("缺少推送参数:data");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 运单签收状态(0在途 1揽收 2疑难 3签收 4退签 5派件 8清关 14拒签)
|
||||
$logistics_status = [0,1,2,3,4,5,8,14];
|
||||
// if ()
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 快递100订阅回调失败
|
||||
* @param string $message
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
protected function LogisticsFailReturn(string $message): ResponseInterface
|
||||
{
|
||||
return $this->response
|
||||
->withStatus(200)
|
||||
->withBody(
|
||||
new SwooleStream(
|
||||
strval(
|
||||
json_encode([
|
||||
'result' => false,
|
||||
'returnCode' => "500",
|
||||
'message' => $message,
|
||||
], JSON_UNESCAPED_UNICODE)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -31,6 +31,7 @@ use App\Services\UserDoctorService;
|
||||
use App\Utils\Log;
|
||||
use Extend\Alibaba\Oss;
|
||||
use Extend\Ca\Ca;
|
||||
use Extend\Kuaidi100\Kuaidi;
|
||||
use Extend\Prescription\Prescription;
|
||||
use Extend\RegulatoryPlatform\regulatoryPlatform;
|
||||
use Extend\TencentIm\RecentContact;
|
||||
@ -59,7 +60,8 @@ class TestController extends AbstractController
|
||||
// $this->test_1();
|
||||
// $this->test_11();
|
||||
// $this->test_12();
|
||||
$this->test_13();
|
||||
// $this->test_13();
|
||||
$this->test_14();
|
||||
}
|
||||
|
||||
// 获取云证书-首次
|
||||
@ -770,4 +772,15 @@ class TestController extends AbstractController
|
||||
return success();
|
||||
}
|
||||
|
||||
// 快递订阅
|
||||
public function test_14(){
|
||||
// $Kuaidi = new Kuaidi();
|
||||
// $result = $Kuaidi->subscribe("78674717911499","zhongtong","15201255314");
|
||||
// dump($result);
|
||||
|
||||
$a = '{"status":"polling","message":"","lastResult":{"message":"ok","nu":"YT6074326614455","ischeck":"0","com":"yuantong","status":"200","state":"1","data":[{"time":"2023-02-02 09:57:03","context":"【长沙市】 【长沙东站】(07**-55**234) 的 长沙东站司法分部(135****1234) 已接单","ftime":"2023-02-02 09:57:03","areaCode":"CN430100000000","areaName":"湖南,长沙市","status":"揽收","location":null,"areaCenter":null,"areaPinYin":null,"statusCode":null}],"loop":false}}';
|
||||
|
||||
$b = strtoupper(md5( $a . config('kuaidi100.salt') ));
|
||||
dump($b);
|
||||
}
|
||||
}
|
||||
@ -30,6 +30,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $logistics_fee 运费金额
|
||||
* @property string $logistics_no 物流编号
|
||||
* @property string $logistics_company_code 快递公司编码
|
||||
* @property int $sub_logistics_status 快递推送订阅状态(0:未订阅/无需订阅 1:已订阅 2:订阅失败)
|
||||
* @property string $delivery_time 发货时间
|
||||
* @property string $pay_time 支付时间
|
||||
* @property string $remarks 订单备注
|
||||
@ -70,7 +71,7 @@ class OrderProduct extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_product_id', 'order_inquiry_id', 'order_prescription_id', 'doctor_id', 'patient_id', 'family_id', 'order_product_no', 'escrow_trade_no', 'order_product_status', 'pay_channel', 'pay_status', 'is_delete', 'cancel_reason', 'amount_total', 'payment_amount_total', 'logistics_fee', 'logistics_no', 'logistics_company_code', 'delivery_time', 'pay_time', 'remarks', 'refund_status', 'cancel_time', 'cancel_remarks', 'report_pre_status', 'report_pre_time', 'report_pre_fail_reason', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'address', 'address_mask', 'consignee_name', 'consignee_name_mask', 'consignee_tel', 'consignee_tel_mask', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['order_product_id', 'order_inquiry_id', 'order_prescription_id', 'doctor_id', 'patient_id', 'family_id', 'order_product_no', 'escrow_trade_no', 'order_product_status', 'pay_channel', 'pay_status', 'is_delete', 'cancel_reason', 'amount_total', 'payment_amount_total', 'logistics_fee', 'logistics_no', 'logistics_company_code', 'sub_logistics_status', 'delivery_time', 'pay_time', 'remarks', 'refund_status', 'cancel_time', 'cancel_remarks', 'report_pre_status', 'report_pre_time', 'report_pre_fail_reason', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'address', 'address_mask', 'consignee_name', 'consignee_name_mask', 'consignee_tel', 'consignee_tel_mask', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_product_id";
|
||||
|
||||
|
||||
70
app/Model/OrderProductLogistic.php
Normal file
70
app/Model/OrderProductLogistic.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $logistics_id 主键id
|
||||
* @property int $order_product_id 药品订单id
|
||||
* @property int $logistics_status 运单签收状态(0在途 1揽收 2疑难 3签收 4退签 5派件 8清关 14拒签)
|
||||
* @property string $logistics_no 物流编号
|
||||
* @property string $company_name 快递公司名称
|
||||
* @property string $company_code 快递公司编码
|
||||
* @property string $logistics_content 内容
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderProductLogistic extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_product_logistics';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['logistics_id', 'order_product_id', 'logistics_status', 'logistics_no', 'company_name', 'company_code', 'logistics_content', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "logistics_id";
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据-多
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否存在
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public static function getExists(array $params): bool
|
||||
{
|
||||
return self::where($params)->exists();
|
||||
}
|
||||
}
|
||||
@ -531,7 +531,7 @@ class PatientDoctorService extends BaseService
|
||||
// 职称
|
||||
$data['user_doctor']['doctor_title_name'] = empty($data['user_doctor']['doctor_title']) ? "" : DoctorTitleCode::getMessage($data['user_doctor']['doctor_title']);
|
||||
|
||||
$result['data'] = $data;
|
||||
$result['data'][] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,8 @@ class Auth
|
||||
"/callback/platform/logistics" => "post", // 处方平台物流回调
|
||||
"/callback/logistics" => "post", // 快递100订阅回调
|
||||
|
||||
"/test/test_13" => "get", // 测试
|
||||
"/test/test_13" => "get", // 测试退款
|
||||
"/test" => "get", // 测试
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -99,5 +99,6 @@ return [
|
||||
"key" => env('LOGISTICS_KEY', 'Mpjjgebe8764'),
|
||||
"customer" => env('LOGISTICS_CUSTOMER', 'EA3A55C09C524BDB72AE31231721B20F'),
|
||||
"api_url" => env('LOGISTICS_APP_URL', 'https://poll.kuaidi100.com/poll/query.do'),
|
||||
"salt" => env('LOGISTICS_SALT', 'gdxz2023.d'),
|
||||
],
|
||||
];
|
||||
|
||||
@ -600,8 +600,11 @@ Router::get('/case', [InquiryController::class, 'getPatientInquiryCase']);
|
||||
|
||||
// 测试使用
|
||||
Router::addGroup('/test', function () {
|
||||
Router::get('', [TestController::class, 'test_14']);
|
||||
|
||||
// 模拟退款
|
||||
Router::get('/test_13', [TestController::class, 'test_13']);
|
||||
|
||||
});
|
||||
|
||||
// 地址管理
|
||||
|
||||
@ -44,7 +44,16 @@ class Kuaidi
|
||||
}
|
||||
|
||||
|
||||
public function subscribe(string $logistics_no,string $logistics_company_code,string $phone){
|
||||
/**
|
||||
* 订阅快递推送
|
||||
* @param string $logistics_no
|
||||
* @param string $logistics_company_code
|
||||
* @param string $order_product_id
|
||||
* @param string $phone
|
||||
* @return mixed
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function subscribe(string $logistics_no,string $logistics_company_code,string $phone = ""){
|
||||
$param = [
|
||||
'company' => $logistics_company_code, // 快递公司编码
|
||||
'number' => $logistics_no, // 快递单号
|
||||
@ -52,12 +61,13 @@ class Kuaidi
|
||||
'parameters' => array (
|
||||
'callbackurl' => 'http://dev.hospital.applets.igandanyiyuan.com/callback/logistics', // 回调地址
|
||||
'resultv2' => '1', // 行政区域解析
|
||||
'phone' => $phone // 手机号
|
||||
'phone' => $phone, // 手机号
|
||||
'salt' => config('kuaidi100.salt'), // 签名用字符串
|
||||
)
|
||||
];
|
||||
|
||||
$option = [
|
||||
"json" => [
|
||||
"form_params" => [
|
||||
"schema" => "json",
|
||||
"param" => json_encode($param, JSON_UNESCAPED_UNICODE),
|
||||
],
|
||||
@ -73,21 +83,22 @@ class Kuaidi
|
||||
throw new BusinessException($response->getBody()->getContents());
|
||||
}
|
||||
$body = json_decode($response->getBody(), true);
|
||||
dump($body);
|
||||
|
||||
if (empty($body)) {
|
||||
// 返回值为空
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
|
||||
if ($body['result_code'] != 0) {
|
||||
if ($body['returnCode'] != 200) {
|
||||
// 请求失败
|
||||
if (!empty($body['result_msg'])) {
|
||||
throw new BusinessException($body['result_msg']);
|
||||
if (!empty($body['message'])) {
|
||||
throw new BusinessException($body['message']);
|
||||
}
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
|
||||
return $body['body'];
|
||||
return $body;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -73,6 +73,7 @@ REG_PLAT_APP_URL=https://202.61.88.184:19200/
|
||||
LOGISTICS_KEY=Mpjjgebe8764
|
||||
LOGISTICS_CUSTOMER=EA3A55C09C524BDB72AE31231721B20F
|
||||
LOGISTICS_APP_URL=https://poll.kuaidi100.com/poll/query.do
|
||||
LOGISTICS_SALT=gdxz2023.d
|
||||
">.env
|
||||
|
||||
#nginx_upstrame="/Users/wucongxing/Desktop/test/hospital-upstream.conf"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user