update @兼容小程序 token校验

This commit is contained in:
huangzhen 2024-11-13 09:10:10 +08:00
parent 97a0832ad2
commit a518798413
1 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,8 @@ export async function channelJudge (channel: number, mode: number, judgeData?: a
// type 1 红包 2 直充/卡密 3 立减金
const { type, id, group_id, ids } = judgeData;
const idNew = group_id ? ids : [id];
let url = `${location.origin}${location.pathname}?key=${localStorage.getItem('key') || ''}&token=${localStorage.getItem('token')}`;
const token = localStorage.getItem('token') || '';
let url = `${location.origin}${location.pathname}?key=${localStorage.getItem('key') || ''}&token=${token}`;
if (id) { // 单品
url = url + `&id=${id}`;
}
@ -37,7 +38,7 @@ export async function channelJudge (channel: number, mode: number, judgeData?: a
if (channel === 1 && mode === 1) { // 支付宝-官方领取 区分商品类型1 红包 支付宝小程序3 立减金 支付宝授权
const ua = navigator.userAgent.toLowerCase();
if (type === 1) {
const aliPaysUrl = `${zfbAuthMiniUrl}&page=pages/exchange/exchange?${encodeURIComponent(`key=${window.btoa(localStorage.getItem('key') || '')}&ids=${window.btoa(JSON.stringify(idNew))}`)}`;
const aliPaysUrl = `${zfbAuthMiniUrl}&page=pages/exchange/exchange?${encodeURIComponent(`key=${window.btoa(localStorage.getItem('key') || '')}&ids=${window.btoa(JSON.stringify(idNew))}&token=${window.btoa(token)}`)}`;
if (isWx|| (ua.indexOf("android") > -1 && ua.indexOf("baiduboxapp") > -1) || ua.indexOf("windows") > -1) {
showConfirmDialog({
confirmButtonText: '复制',
@ -71,8 +72,9 @@ export async function channelJudge (channel: number, mode: number, judgeData?: a
}
} else if (channel === 2) { // 微信
if (!isWx) { // 非微信环境 默认 微信小程序
// 唤起小程序
// 唤起微信-小程序
const res = await GET_WXSCHEMA({
token: token,
id: idNew,
key: localStorage.getItem('key') || '',
type: type === 1 ? 1 : 2, // 该接口专用1-红包 2-立减金