This commit is contained in:
wucongxing 2023-03-06 17:25:13 +08:00
parent 9c9859a727
commit 13d14b1a55
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,7 @@ class CallBackController extends AbstractController
*/
public function patientWxPayCallBack(): ResponseInterface
{
dump(111);
try {
// 处理支付结果事件
$WechatPay = new WechatPay(1);
@ -36,6 +37,7 @@ class CallBackController extends AbstractController
return $server->serve();
}catch (\Exception $e) {
throw new BusinessException($e->getMessage());
return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => $e->getMessage()], JSON_UNESCAPED_UNICODE))));
}
}
@ -43,6 +45,7 @@ class CallBackController extends AbstractController
// 医生端微信支付回调
public function doctorWxPayCallBack(): ResponseInterface
{
dump(222);
try {
// 处理支付结果事件
$WechatPay = new WechatPay(2);
@ -59,6 +62,7 @@ class CallBackController extends AbstractController
return $server->serve();
}catch (\Exception $e) {
throw new BusinessException($e->getMessage());
return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => $e->getMessage()], JSON_UNESCAPED_UNICODE))));
}
}

View File

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