|
|
|
@ -44,6 +44,13 @@ class SharePayController extends Controller |
|
|
|
$order->pay_user_id = $this->user_id; |
|
|
|
$order->save(); |
|
|
|
|
|
|
|
//如果已经付定金或首付款,则仅支付尾款 TODO 还有定金支付
|
|
|
|
/*if ($order->status == Status::PAY_EARNEST) { |
|
|
|
$price = $order->price - $order->paid_money; |
|
|
|
} else { |
|
|
|
$price = $this->calc($order->price, $order->num, $order->pay_type, $ap); |
|
|
|
}*/ |
|
|
|
|
|
|
|
$config = config('wechat.payment.default'); |
|
|
|
$config = array_merge($config, [ |
|
|
|
'app_id' => 'wxb35ef055a4dd8ad4', |
|
|
|
@ -56,7 +63,7 @@ class SharePayController extends Controller |
|
|
|
$result = $app->order->unify([ |
|
|
|
'body' => $order->title, |
|
|
|
'out_trade_no' => $order->order_no . '-' . $order->status, //后面加status,主要是为了方便微信支付回调时区分定金(首付款)和尾款支付
|
|
|
|
'total_fee' => 1, //TODO 测试暂时注释 round($price * 100), //支付金额单位为分
|
|
|
|
'total_fee' => round($order->price * 100), //支付金额单位为分
|
|
|
|
'notify_url' => route('wxpay_notify', ['agent_id' => $this->agent_id]), // 支付结果通知网址,如果不设置则会使用配置里的默认地址
|
|
|
|
'trade_type' => 'JSAPI', |
|
|
|
'openid' => $openid, |
|
|
|
|