1
This commit is contained in:
parent
fac4bc321f
commit
0c8b76b479
@ -401,11 +401,18 @@ class Index extends Frontend
|
||||
}
|
||||
}
|
||||
|
||||
private function getAuthUrl($type, $view)
|
||||
private function getAuthUrl($type, $view, $state = '')
|
||||
{
|
||||
$component_token = $this->component_token();
|
||||
$preauthcode = $this->create_preauthcode();
|
||||
$redirect_uri = urlencode("https://ye4s.wms.gztbyc.com/index/index/authNotic");
|
||||
|
||||
// 回调地址需携带 auth 传入的 state:微信只额外回传 auth_code/expires_in,
|
||||
// 不带 state 时 authNotic 无法定位授权上下文
|
||||
$redirectUri = "https://ye4s.wms.gztbyc.com/index/index/authNotic";
|
||||
if (!empty($state)) {
|
||||
$redirectUri .= '?state=' . urlencode($state);
|
||||
}
|
||||
$redirect_uri = urlencode($redirectUri);
|
||||
|
||||
switch ($view) {
|
||||
case 'pc':
|
||||
@ -540,8 +547,8 @@ class Index extends Frontend
|
||||
$view = $this->request->get('view', 'pc'); // 默认PC端
|
||||
$appid = $this->request->get('appid', ''); // 可选:指定要授权的公众号appid
|
||||
|
||||
// 生成授权链接
|
||||
$authUrl = $this->getAuthUrl($type, $view);
|
||||
// 生成授权链接(把 state 带入回调地址,微信回跳 authNotic 时才能还原上下文)
|
||||
$authUrl = $this->getAuthUrl($type, $view, $state);
|
||||
|
||||
if (empty($authUrl)) {
|
||||
$this->error('获取授权链接失败,请检查配置');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user