修改 增加微信授权代码

This commit is contained in:
xiaobao
2025-09-22 09:12:34 +08:00
parent 9cad03d6f9
commit 6afa715613
2 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1 @@
SorHpSKNT1SolXOr

View File

@@ -1224,6 +1224,24 @@
if (parts.length === 2) return parts.pop().split(';').shift();
return null;
}
function gotoWeiXin() {
const appid = "wx549f4ae0f85eb3ea";
// 回调地址(必须和公众号后台配置的网页授权域名一致)
const redirect_uri = encodeURIComponent("http://ai.satabot.com/");
// 授权方式:snsapi_base(静默) 或 snsapi_userinfo(需要用户确认)
const scope = "snsapi_userinfo";
// 自定义参数,授权后会原样返回
const state = "123";
// 拼接完整的授权链接
const authUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`;
// 跳转到微信授权
window.location.href = authUrl;
}
getSessionList();
function getSessionList() {