记录:使用 fastadmin 的epay插件进行调用微信H5支付时,默认情况下 返回格式化的跳转页面html代码。但前端若使用vue或uni-app来编写就不适用了。
直接返回支付跳转地址。
\addons\epay\library\Service.php中的submitOrder方法增加判断如下:
//使用重写的Response类、RedirectResponse、Collection类
if ($result instanceof \Symfony\Component\HttpFoundation\RedirectResponse) {
if ($type == 'wechat' && $method == 'wap') {
// 微信H5支付 不返回html,直接返回支付跳转地址
return $result->getTargetUrl();
} else {
$result = RedirectResponse::create($result->getTargetUrl());
}
} elseif ($result instanceof \Symfony\Component\HttpFoundation\Response) {
$result = Response::create($result->getContent());
} elseif ($result instanceof \Yansongda\Supports\Collection) {
$result = Collection::make($result->all());
}
return $result;