From bfde5df0cd5a8dc8880c9913f9571ffa7bde2b57 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 6 Dec 2024 14:37:41 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=BC=BA=E9=99=B7=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=91=E5=BC=82=E6=AD=A5=E7=BB=91=E5=AE=9A=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E5=91=98=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sheep/platform/share.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sheep/platform/share.js b/sheep/platform/share.js index 9c76ba1d..21c530f0 100644 --- a/sheep/platform/share.js +++ b/sheep/platform/share.js @@ -168,12 +168,11 @@ const decryptSpm = (spm) => { shareParams.platform = platformMap[shareParamsArray[3] - 1]; shareParams.from = fromMap[shareParamsArray[4] - 1]; if (shareParams.shareId !== 0) { + // 记录分享者编号 + uni.setStorageSync('shareId', shareParams.shareId); // 已登录 绑定推广员 - if (user.isLogin) { + if (!!user.isLogin) { bindBrokerageUser(shareParams.shareId); - } else { - // 记录分享者编号 - uni.setStorageSync('shareId', shareParams.shareId); } } @@ -190,7 +189,11 @@ const bindBrokerageUser = async (val = undefined) => { if (!shareId) { return; } - await BrokerageApi.bindBrokerageUser({ bindUserId: shareId }); + const { data } = await BrokerageApi.bindBrokerageUser({ bindUserId: shareId }); + if (!data) { + return; + } + // 绑定成功后清除缓存 uni.removeStorageSync('shareId'); } catch (e) { console.error(e);