支付逻辑测试

This commit is contained in:
2022-09-09 14:46:20 +08:00
parent f9f3ea21c3
commit a15297de92

View File

@@ -80,6 +80,13 @@ class Wechat
*/ */
public function payment() public function payment()
{ {
$userId = $GLOBALS['data']['userid'];
if (empty($userId)) {
return show("未登录!", NEED_LOGIN);
}
$user = AppUser::find($userId);
$notifyUrl = Route::buildUrl('wechat/paid') $notifyUrl = Route::buildUrl('wechat/paid')
->suffix(false) ->suffix(false)
->domain(true); ->domain(true);
@@ -91,7 +98,7 @@ class Wechat
'total_fee' => 100, 'total_fee' => 100,
'notify_url' => $notifyUrl, 'notify_url' => $notifyUrl,
'trade_type' => 'JSAPI', 'trade_type' => 'JSAPI',
'openid' => '$openid', 'openid' => $user->openid,
]); ]);
dump($unify); dump($unify);
// $prepayId = $unify->prepay_id; // $prepayId = $unify->prepay_id;