|
@@ -150,8 +150,8 @@ class Weixin extends BaseController
|
|
|
$data['type'] = 'order';
|
|
|
$data['time'] = time();
|
|
|
Db::name('wx_notify')->insert($data);
|
|
|
- $app = Factory::payment(config('weixin')['wxPay']);
|
|
|
if ($from == 'weixin') {
|
|
|
+ $app = Factory::payment(config('weixin')['wxPay']);
|
|
|
$result = $app->order->unify([
|
|
|
'body' => '支付订单',
|
|
|
'out_trade_no' => $order['order_id'],
|
|
@@ -164,7 +164,9 @@ class Weixin extends BaseController
|
|
|
$jsConfig = $jssdk->bridgeConfig($result['prepay_id'], false);
|
|
|
$json['result'] = $jsConfig;
|
|
|
$json['type'] = 'WECHAT_PAY';
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ if ($from == 'h5') {
|
|
|
+ $app = Factory::payment(config('weixin')['wxPay']);
|
|
|
$result = $app->order->unify([
|
|
|
'body' => '支付订单',
|
|
|
'out_trade_no' => $order['order_id'],
|
|
@@ -177,6 +179,21 @@ class Weixin extends BaseController
|
|
|
$json['result'] = $jsConfig;
|
|
|
$json['type'] = 'WECHAT_H5_PAY';
|
|
|
}
|
|
|
+ if ($from == 'routine') {
|
|
|
+ $app = Factory::payment(config('weixin')['routinePay']);
|
|
|
+ $result = $app->order->unify([
|
|
|
+ 'body' => '支付订单',
|
|
|
+ 'out_trade_no' => $order['order_id'],
|
|
|
+ 'total_fee' => $order['all_price'] * 100,
|
|
|
+ 'notify_url' => 'https://www.boofly.cn/api/weixin/notify', // 支付结果通知网址,如果不设置则会使用配置里的默认地址
|
|
|
+ 'trade_type' => 'JSAPI', // 请对应换成你的支付方式对应的值类型
|
|
|
+ 'openid' => $request->user['routine_openid']
|
|
|
+ ]);
|
|
|
+ $jssdk = $app->jssdk;
|
|
|
+ $jsConfig = $jssdk->bridgeConfig($result['prepay_id'], false);
|
|
|
+ $json['result'] = $jsConfig;
|
|
|
+ $json['type'] = 'ROUTINE_PAY';
|
|
|
+ }
|
|
|
return app('json')->success($json);
|
|
|
}
|
|
|
|