Merge branch 'dev_new_ljy' into dev

This commit is contained in:
ljy
2026-07-10 01:54:39 +08:00
7 changed files with 88 additions and 28 deletions
+5 -2
View File
@@ -1,4 +1,4 @@
import type { PartnerMe } from '@dukang/shared-types';
import type { PartnerMe, PartnerStaffRole } from '@dukang/shared-types';
import { isOnAppPath, toAppPath } from '@dukang/weixin-sdk';
export const apiBase = '/api/v1';
@@ -6,7 +6,10 @@ export const apiBase = '/api/v1';
const LAST_PHONE = 'partnerLastPhone';
const PARTNER_PROFILE = 'partnerProfile';
export type PartnerSessionProfile = Pick<PartnerMe, 'id' | 'name' | 'phone' | 'companyName'>;
export type PartnerSessionProfile = Pick<PartnerMe, 'id' | 'name' | 'phone' | 'companyName'> & {
isPrimary?: PartnerMe['isPrimary'];
staffRole?: PartnerStaffRole;
};
export type PartnerAuthPayload = {
accessToken: string;
+5 -2
View File
@@ -2,7 +2,7 @@ import type { ClientRuntimeConfig, WechatLoginResult } from '@dukang/shared-type
import { isWxAuthorizeEnabled } from '@dukang/shared-types';
import { WECHAT_INAPP_REQUIRED_MSG } from '@dukang/weixin-sdk';
import { isWechatEnv, weixinSdk } from './weixin';
import { request, saveAuth } from './api';
import { request, saveAuth, type PartnerSessionProfile } from './api';
export type PartnerProfile = {
id: string;
@@ -37,7 +37,10 @@ export async function checkNeedsWechatAuth(profile: PartnerProfile | null): Prom
/** 处理微信登录/绑定结果,返回是否已拿到 token 可进入首页 */
export function handlePartnerWechatLoginResult(result: WechatLoginResult): boolean {
if (!result.accessToken) return false;
saveAuth({ accessToken: result.accessToken });
saveAuth({
accessToken: result.accessToken,
partner: result.partner as PartnerSessionProfile | undefined,
});
return true;
}