getAppToken($_GET['app_auth_code']); $_SESSION['alipay_app_token'] = $result['app_auth_token']; $openid_name = 'AppAuthToken'; $openid_content = $result['app_auth_token']; }catch(Exception $e){ sysmsg('支付宝获取授权Token失败!'.$e->getMessage()); } }elseif(isset($_GET['auth_code'])){ try{ $result = $oauth->getToken($_GET['auth_code']); if(!empty($result['user_id'])){ $user_id = $result['user_id']; $openid_name = '支付宝UID'; }else{ $user_id = $result['open_id']; $openid_name = '支付宝OpenId'; } $_SESSION['alipay_user_id'] = $user_id; $openid_content = $user_id; }catch(Exception $e){ sysmsg('支付宝快捷登录失败!'.$e->getMessage()); } }elseif(isset($_GET['act']) && $_GET['act']=='app_auth'){ $oauth->appOauth($redirect_uri); }elseif(isset($_GET['act']) && $_GET['act']=='app_auth_assign'){ [$pc_url, $app_url] = $oauth->appOauthAssign($redirect_uri, ['MOBILEAPP','WEBAPP','PUBLICAPP','TINYAPP','BASEAPP']); if(checkmobile()){ header("Location: $app_url"); }else{ header("Location: $pc_url"); } exit; }else{ $oauth->oauth($redirect_uri); } }else{ try{ $tools = new \WeChatPay\JsApiTool($wxinfo['appid'], $wxinfo['appsecret']); $openId = $tools->GetOpenid(); }catch(Exception $e){ sysmsg($e->getMessage()); } $_SESSION['openid'] = $openId; $openid_name = 'OpenId'; $openid_content = $openId; } include PAYPAGE_ROOT.'openid.php';