feat: 新增套餐激活码功能,通过CDK兑换套餐

This commit is contained in:
xiaojunnuo
2026-05-31 06:00:15 +08:00
parent dc1507a5ea
commit 81d6289a86
17 changed files with 947 additions and 65 deletions
@@ -38,6 +38,16 @@ export abstract class BaseService<T> {
return await dataSource.transaction(callback as any);
}
/**
* 如果 ctx 有 manager 则复用已有事务,否则开启新事务
*/
protected async transactionWithCtx<T>(ctx: ServiceContext, callback: (manager: EntityManager) => Promise<T>): Promise<T> {
if (ctx.manager) {
return await callback(ctx.manager);
}
return (await this.transaction(callback)) as T;
}
protected getRepo<E>(ctx: ServiceContext, entity: EntityTarget<E>): Repository<E> {
if (ctx.manager) {
return ctx.manager.getRepository(entity);