checkpoint: 冻结资金开工前龙先生小程序本地备份(不推远程)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,6 +9,7 @@ const DEFAULT_CLUB_ID = CONFIG_CLUB_ID || 'xq';
|
||||
|
||||
export const CLUB_API = {
|
||||
wechatLogin: '/jituan/auth/wechat-login',
|
||||
refreshWxBind: '/jituan/auth/refresh-wx-bind',
|
||||
dashouRegister: '/jituan/auth/dashou-register',
|
||||
clubList: '/jituan/club/list',
|
||||
};
|
||||
|
||||
@@ -10,6 +10,30 @@ import { CLUB_API, getClubId, setClubId, buildClubHeaders } from './club-context
|
||||
|
||||
const app = getApp();
|
||||
|
||||
/** 有 token 时静默刷新当前小程序 openid 绑定(支付 AppID 对齐) */
|
||||
function silentRefreshWxBind(app) {
|
||||
const token = getSessionToken(app);
|
||||
if (!token) return;
|
||||
wx.login({
|
||||
success: (loginRes) => {
|
||||
if (!loginRes.code || !app.globalData.apiBaseUrl) return;
|
||||
wx.request({
|
||||
url: app.globalData.apiBaseUrl + CLUB_API.refreshWxBind,
|
||||
method: 'POST',
|
||||
data: {
|
||||
code: loginRes.code,
|
||||
club_id: getClubId(app),
|
||||
app_id: app.globalData.appId || '',
|
||||
},
|
||||
header: buildClubHeaders({
|
||||
'content-type': 'application/json',
|
||||
Authorization: 'Bearer ' + token,
|
||||
}),
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function ensureLogin(options = {}) {
|
||||
const silent = options.silent !== false;
|
||||
const page = options.page || null;
|
||||
@@ -17,6 +41,7 @@ export function ensureLogin(options = {}) {
|
||||
if (token) {
|
||||
backfillUserProfileCache(app);
|
||||
restoreStaffContextAfterAuth();
|
||||
silentRefreshWxBind(app);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ export const ICON_KEYS = {
|
||||
FIGHTER_RECHARGE_ADVANTAGE_2: 'fighter_recharge_advantage_2',
|
||||
FIGHTER_RECHARGE_ADVANTAGE_3: 'fighter_recharge_advantage_3',
|
||||
FIGHTER_RECHARGE_ADVANTAGE_4: 'fighter_recharge_advantage_4',
|
||||
FIGHTER_COMPLAINT_RECORD: 'fighter_complaint_record',
|
||||
FIGHTER_ORDER_PENDING: 'fighter_order_pending',
|
||||
FIGHTER_ORDER_SETTLING: 'fighter_order_settling',
|
||||
FIGHTER_ORDER_DONE: 'fighter_order_done',
|
||||
|
||||
Reference in New Issue
Block a user