add plan activity config (#6139)

* activity points

* modal

* ui

* fix

* pref: zod schema

* perf: ad api with zod

* perf: plan year switch

* perf: plan

* i18n

* fix: hook

* fix: activity checker

* fix: i18n

* fix clear token

* fix

* back

* can close modal in pay

* ad token

* rename

* fix

* total points

* eng i18n

---------

Co-authored-by: archer <545436317@qq.com>
This commit is contained in:
heheer
2025-12-24 18:22:25 +08:00
committed by GitHub
parent e53242e8bc
commit 4fbe27f2df
52 changed files with 1541 additions and 284 deletions
+12
View File
@@ -0,0 +1,12 @@
import { UserPath } from './user';
import type { OpenAPIPath } from '../type';
import { WalletPath } from './wallet';
import { ApiKeyPath } from './openapi';
import { CustomDomainPath } from './customDomain';
export const SupportPath: OpenAPIPath = {
...UserPath,
...WalletPath,
...ApiKeyPath,
...CustomDomainPath
};
@@ -0,0 +1,6 @@
import { UserInformPath } from './inform';
import type { OpenAPIPath } from '../../type';
export const UserPath: OpenAPIPath = {
...UserInformPath
};
@@ -0,0 +1,61 @@
import type { OpenAPIPath } from '../../../type';
import {
SystemMsgModalResponseSchema,
OperationalAdResponseSchema,
ActivityAdResponseSchema
} from '../../../admin/support/user/inform/api';
import { TagsMap } from '../../../tag';
export const UserInformPath: OpenAPIPath = {
'/proApi/support/user/inform/getSystemMsgModal': {
get: {
summary: '获取系统弹窗内容',
description: '获取系统消息弹窗的内容',
tags: [TagsMap.userInform],
responses: {
200: {
description: '成功获取系统弹窗内容',
content: {
'application/json': {
schema: SystemMsgModalResponseSchema
}
}
}
}
}
},
'/proApi/support/user/inform/getOperationalAd': {
get: {
summary: '获取运营广告',
description: '获取运营广告的图片和链接',
tags: [TagsMap.userInform],
responses: {
200: {
description: '成功获取运营广告',
content: {
'application/json': {
schema: OperationalAdResponseSchema
}
}
}
}
}
},
'/proApi/support/user/inform/getActivityAd': {
get: {
summary: '获取活动广告',
description: '获取活动广告的图片和链接',
tags: [TagsMap.userInform],
responses: {
200: {
description: '成功获取活动广告',
content: {
'application/json': {
schema: ActivityAdResponseSchema
}
}
}
}
}
}
};
@@ -25,6 +25,32 @@ export const BillListResponseSchema = z.object({
});
export type GetBillListResponseType = z.infer<typeof BillListResponseSchema>;
// Bill detail
export const BillDetailQuerySchema = z.object({
billId: ObjectIdSchema.meta({ description: '订单 ID' })
});
export type BillDetailQueryType = z.infer<typeof BillDetailQuerySchema>;
export const BillDetailResponseSchema = BillSchema.safeExtend({
discountCouponName: z.string().optional(),
couponDetail: z
.object({
key: z.string(),
type: z.enum(CouponTypeEnum),
subscriptions: z.array(
z.object({
type: z.enum(SubTypeEnum),
durationDay: z.number(),
totalPoints: z.number().optional(),
level: z.enum(StandardSubLevelEnum).optional(),
extraDatasetSize: z.number().optional(),
customConfig: z.record(z.string(), z.any()).optional()
})
)
})
.optional()
});
export type BillDetailResponseType = z.infer<typeof BillDetailResponseSchema>;
// Create
export const CreateStandPlanBillSchema = z
.object({
@@ -88,30 +114,14 @@ export const CheckPayResultResponseSchema = z.object({
});
export type CheckPayResultResponseType = z.infer<typeof CheckPayResultResponseSchema>;
// Bill detail
export const BillDetailResponseSchema = BillSchema.safeExtend({
discountCouponName: z.string().optional(),
couponDetail: z
.object({
key: z.string(),
type: z.enum(CouponTypeEnum),
subscriptions: z.array(
z.object({
type: z.enum(SubTypeEnum),
durationDay: z.number(),
totalPoints: z.number().optional(),
level: z.enum(StandardSubLevelEnum).optional(),
extraDatasetSize: z.number().optional(),
customConfig: z.record(z.string(), z.any()).optional()
})
)
})
.optional()
});
export type BillDetailResponseType = z.infer<typeof BillDetailResponseSchema>;
// Cancel bill
export const CancelBillPropsSchema = z.object({
billId: ObjectIdSchema.meta({ description: '订单 ID' })
});
export type CancelBillPropsType = z.infer<typeof CancelBillPropsSchema>;
// Check pay result
export const CheckPayResultQuerySchema = z.object({
payId: ObjectIdSchema.meta({ description: '订单 ID' })
});
export type CheckPayResultQueryType = z.infer<typeof CheckPayResultQuerySchema>;
@@ -8,7 +8,9 @@ import {
CheckPayResultResponseSchema,
BillDetailResponseSchema,
BillListQuerySchema,
CancelBillPropsSchema
CancelBillPropsSchema,
CheckPayResultQuerySchema,
BillDetailQuerySchema
} from './api';
import { TagsMap } from '../../../tag';
import { ObjectIdSchema } from '../../../../common/type/mongo';
@@ -68,11 +70,7 @@ export const BillPath: OpenAPIPath = {
description: '检查订单的支付状态,用于轮询支付结果',
tags: [TagsMap.walletBill],
requestParams: {
query: z.object({
payId: ObjectIdSchema.meta({
description: '订单 ID'
})
})
query: CheckPayResultQuerySchema
},
responses: {
200: {
@@ -92,11 +90,7 @@ export const BillPath: OpenAPIPath = {
description: '根据订单 ID 获取订单详细信息,包括优惠券名称等',
tags: [TagsMap.walletBill],
requestParams: {
query: z.object({
billId: ObjectIdSchema.meta({
description: '订单 ID'
})
})
query: BillDetailQuerySchema
},
responses: {
200: {