This commit is contained in:
2022-09-09 16:55:16 +08:00
parent 58ab2aa239
commit ad89890c2a

View File

@@ -80,16 +80,28 @@ class Wechat
*/ */
public function payment() public function payment()
{ {
$userId = $GLOBALS['data']['userid']; $clientToken = Request::get('token');
if (empty($userId)) { $orderId = Request::get('order_id');
return show("未登录!", NEED_LOGIN); if ($clientToken) {
$tk = json_decode(authcode($clientToken), true);
$userId = $tk['userid'];
}
$user = AppUser::findOrEmpty($userId);
if (! $user) {
exit('NO USER');
} }
$user = AppUser::find($userId); $order = \app\model\Order::find($orderId);
$notifyUrl = Route::buildUrl('wechat/paid') $notifyUrl = Route::buildUrl('wechat/paid')
->suffix(false) ->suffix(false)
->domain(true); ->domain(true);
dump($notifyUrl);
dd($order);
$config = Config::get('wechat.payment'); $config = Config::get('wechat.payment');
$payment = Factory::payment($config); $payment = Factory::payment($config);
$unify = $payment->order->unify([ $unify = $payment->order->unify([