增加医生端支付回调

This commit is contained in:
wucongxing 2023-03-06 17:17:47 +08:00
parent 34420b4445
commit 21027e3584
2 changed files with 19 additions and 2 deletions

View File

@ -43,7 +43,24 @@ class CallBackController extends AbstractController
// 医生端微信支付回调
public function doctorWxPayCallBack(): ResponseInterface
{
return $this->response->json([]);
try {
// 处理支付结果事件
$WechatPay = new WechatPay(2);
$app = $WechatPay->createApp();
$server = $app->getServer();
$message = $server->getRequestMessage();
if (empty($message)){
return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => "回调数据为空"], JSON_UNESCAPED_UNICODE))));
}
dump($message);
return $server->serve();
}catch (\Exception $e) {
return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => $e->getMessage()], JSON_UNESCAPED_UNICODE))));
}
}
// im回调

View File

@ -76,7 +76,7 @@ class UserController extends AbstractController
// 获取预支付交易会话标识
$total = 0.01 * 100;
$prepay = $WechatPay->getJsapiPrepayId("123457",$total,"o9gYG441zEAHuYoNX7lwFKiQBzKE");
$prepay = $WechatPay->getJsapiPrepayId("123459",$total,"o9gYG441zEAHuYoNX7lwFKiQBzKE");
if (empty($prepay)){
return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
}