支付逻辑测试
This commit is contained in:
@@ -58,7 +58,7 @@ class Wechat
|
||||
|
||||
$user = AppUser::where('openid', $user->getId())->find();
|
||||
|
||||
if (!$user) {
|
||||
if (! $user) {
|
||||
$user = AppUser::create([
|
||||
'nickname' => $user->getNickname(),
|
||||
'avatar' => $user->getAvatar(),
|
||||
@@ -80,6 +80,13 @@ class Wechat
|
||||
*/
|
||||
public function payment()
|
||||
{
|
||||
$userId = $GLOBALS['data']['userid'];
|
||||
if (empty($userId)) {
|
||||
return show("未登录!", NEED_LOGIN);
|
||||
}
|
||||
|
||||
$user = AppUser::find($userId);
|
||||
|
||||
$notifyUrl = Route::buildUrl('wechat/paid')
|
||||
->suffix(false)
|
||||
->domain(true);
|
||||
@@ -91,7 +98,7 @@ class Wechat
|
||||
'total_fee' => 100,
|
||||
'notify_url' => $notifyUrl,
|
||||
'trade_type' => 'JSAPI',
|
||||
'openid' => '$openid',
|
||||
'openid' => $user->openid,
|
||||
]);
|
||||
dump($unify);
|
||||
// $prepayId = $unify->prepay_id;
|
||||
|
||||
Reference in New Issue
Block a user