This commit is contained in:
hackrobot
2024-07-17 14:07:53 +08:00
parent 621b54d83e
commit 6642856bbb

View File

@@ -77,15 +77,38 @@ const Index = () => {
}
};
// 获取url中的wxid
const getWxidFromUrl = () => {
const urlParams = new URLSearchParams(window.location.search);
const wxid = urlParams.get("wxid");
setwxid(wxid);
// window.alert(wxid)
const urlwxid = urlParams.get("wxid");
if (!!urlwxid){
setwxid(urlwxid);
// 绑定wxid与openid到数据库
// 优先查询openid是否存在数据库
Taro.request({
method:'GET',
url: `/api/user/${openId}`, //仅为示例,并非真实的接口地址
// url: "https://pay.hackrobot.cn/api/payh5", //仅为示例,并非真实的接口地址
success: function (res) {
window.alert(res)
},
});
}
return wxid;
};
// 网页查看通知
const tgMessage = () => {
Taro.request({
method:'GET',
url: `/api/tgMessage?openid=${openId}`, //仅为示例,并非真实的接口地址
// url: "https://pay.hackrobot.cn/api/payh5", //仅为示例,并非真实的接口地址
success: function (res) {
console.log('访问提醒发送成功');
},
});
};
// 入群申请
useEffect(() => {
@@ -96,6 +119,7 @@ const Index = () => {
// window.alert(window.localStorage.getItem('openid'))
// 获取wxid参数
getWxidFromUrl();
tgMessage()
}, []);
const goBack = () => {