update
This commit is contained in:
@@ -77,15 +77,38 @@ const Index = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 获取url中的wxid
|
||||||
const getWxidFromUrl = () => {
|
const getWxidFromUrl = () => {
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const wxid = urlParams.get("wxid");
|
const urlwxid = urlParams.get("wxid");
|
||||||
setwxid(wxid);
|
if (!!urlwxid){
|
||||||
// window.alert(wxid)
|
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;
|
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(() => {
|
useEffect(() => {
|
||||||
@@ -96,6 +119,7 @@ const Index = () => {
|
|||||||
// window.alert(window.localStorage.getItem('openid'))
|
// window.alert(window.localStorage.getItem('openid'))
|
||||||
// 获取wxid参数
|
// 获取wxid参数
|
||||||
getWxidFromUrl();
|
getWxidFromUrl();
|
||||||
|
tgMessage()
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user