短信验证调试成功
This commit is contained in:
@@ -4,6 +4,18 @@
|
||||
"private": true,
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./src/index.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"./user-log": {
|
||||
"types": "./dist/user-log.d.ts",
|
||||
"import": "./src/user-log.ts",
|
||||
"default": "./dist/user-log.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
|
||||
@@ -22,6 +22,21 @@ export interface ProductDto {
|
||||
carouselUrls?: string[];
|
||||
/** 详情长图(bizType=DETAIL 或 detailContent JSON) */
|
||||
detailImageUrls?: string[];
|
||||
detailContent?: ProductDetailContentDto | null;
|
||||
}
|
||||
|
||||
export interface ProductDetailFeatureDto {
|
||||
icon: string;
|
||||
title: string;
|
||||
desc: string;
|
||||
}
|
||||
|
||||
export interface ProductDetailContentDto {
|
||||
storyTitle?: string;
|
||||
storyText?: string;
|
||||
features?: ProductDetailFeatureDto[];
|
||||
/** 兜底详情图,优先 DETAIL 资源 */
|
||||
images?: string[];
|
||||
}
|
||||
|
||||
export interface ProductListQuery {
|
||||
|
||||
@@ -10,8 +10,15 @@ export interface AppConfig {
|
||||
wxMchId: string;
|
||||
/** OSS_ENABLED=true 且 AccessKey/Bucket 齐全时走阿里云直传 */
|
||||
ossEnabled: boolean;
|
||||
aliyunSmsSignName: string;
|
||||
aliyunSmsTemplateCode: string;
|
||||
aliyunSmsAccessKeyId: string;
|
||||
aliyunSmsAccessKeySecret: string;
|
||||
}
|
||||
|
||||
/** 总部客服电话(C 端联系客服) */
|
||||
export const CUSTOMER_SERVICE_PHONE = '400-888-1234';
|
||||
|
||||
export function loadAppConfig(env?: Record<string, string | undefined>): AppConfig {
|
||||
const e =
|
||||
env ??
|
||||
@@ -28,5 +35,9 @@ export function loadAppConfig(env?: Record<string, string | undefined>): AppConf
|
||||
wxAppId: e.WX_APP_ID ?? '',
|
||||
wxMchId: e.WX_MCH_ID ?? '',
|
||||
ossEnabled: e.OSS_ENABLED === 'true',
|
||||
aliyunSmsSignName: e.ALIYUN_SMS_SIGN_NAME ?? '',
|
||||
aliyunSmsTemplateCode: e.ALIYUN_SMS_TEMPLATE_CODE ?? '',
|
||||
aliyunSmsAccessKeyId: e.ALIYUN_SMS_ACCESS_KEY_ID ?? e.OSS_ACCESS_KEY_ID ?? '',
|
||||
aliyunSmsAccessKeySecret: e.ALIYUN_SMS_ACCESS_KEY_SECRET ?? e.OSS_ACCESS_KEY_SECRET ?? '',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,3 +9,4 @@ export * from './redeem';
|
||||
export * from './settlement';
|
||||
export * from './ops';
|
||||
export * from './ticket';
|
||||
export * from './user-log';
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
export type UserLogCategory =
|
||||
| 'login'
|
||||
| 'browse_product'
|
||||
| 'order'
|
||||
| 'pay'
|
||||
| 'wechat_auth'
|
||||
| 'browse_store'
|
||||
| 'redeem'
|
||||
| 'profile';
|
||||
|
||||
export const USER_LOG_EVENT_CATEGORIES: Record<UserLogCategory, readonly string[]> = {
|
||||
login: ['login_success', 'sms_login'],
|
||||
browse_product: ['home_view', 'product_click', 'product_detail_view'],
|
||||
order: ['order_confirm_view', 'order_submit'],
|
||||
pay: ['pay_success', 'pay_fail'],
|
||||
wechat_auth: ['wechat_login', 'wechat_phone', 'wechat_location', 'wechat_album'],
|
||||
browse_store: ['store_list_view', 'store_detail_view'],
|
||||
redeem: ['benefit_redeem_start', 'benefit_redeem_success'],
|
||||
profile: ['profile_update'],
|
||||
};
|
||||
|
||||
export const USER_LOG_CATEGORY_OPTIONS: Array<{ value: UserLogCategory | ''; label: string }> = [
|
||||
{ value: '', label: '全部' },
|
||||
{ value: 'login', label: '登录' },
|
||||
{ value: 'browse_product', label: '浏览商品' },
|
||||
{ value: 'order', label: '下单' },
|
||||
{ value: 'pay', label: '支付' },
|
||||
{ value: 'wechat_auth', label: '微信授权' },
|
||||
{ value: 'browse_store', label: '浏览门店' },
|
||||
{ value: 'redeem', label: '核销' },
|
||||
{ value: 'profile', label: '信息修改' },
|
||||
];
|
||||
|
||||
export function resolveUserLogCategory(eventName: string): UserLogCategory | null {
|
||||
for (const [category, events] of Object.entries(USER_LOG_EVENT_CATEGORIES) as Array<
|
||||
[UserLogCategory, readonly string[]]
|
||||
>) {
|
||||
if (events.includes(eventName)) return category;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function eventNamesForUserLogCategory(category: string): string[] | undefined {
|
||||
if (!category) return undefined;
|
||||
return [...(USER_LOG_EVENT_CATEGORIES[category as UserLogCategory] ?? [])];
|
||||
}
|
||||
|
||||
export interface UserLogRowDto {
|
||||
id: string;
|
||||
userId: string | null;
|
||||
userNo: string | null;
|
||||
phone: string | null;
|
||||
nickname: string | null;
|
||||
category: UserLogCategory | null;
|
||||
eventName: string;
|
||||
clientApp: string | null;
|
||||
refType: string | null;
|
||||
refId: string | null;
|
||||
extraJson: Record<string, unknown> | null;
|
||||
createdAt: string;
|
||||
}
|
||||
@@ -27,6 +27,7 @@ export const WECHAT_AUTH_REQUIRED = 'WECHAT_AUTH_REQUIRED';
|
||||
export type ClientRuntimeConfig = {
|
||||
mockPay: boolean;
|
||||
wechatPayEnabled: boolean;
|
||||
mockSms: boolean;
|
||||
};
|
||||
|
||||
export interface WechatLoginResult {
|
||||
|
||||
Reference in New Issue
Block a user