feat: 套餐购买支持易支付、支付宝支付

This commit is contained in:
xiaojunnuo
2024-12-23 00:24:31 +08:00
parent 9c8c7a7812
commit faa28f88f9
69 changed files with 1073 additions and 407 deletions

View File

@@ -160,14 +160,17 @@ export class PipelineService extends BaseService<PipelineEntity> {
old = await this.info(bean.id);
}
const pipeline = JSON.parse(bean.content || '{}');
RunnableCollection.initPipelineRunnableType(pipeline);
const isUpdate = bean.id > 0 && old != null;
let domains = [];
RunnableCollection.each(pipeline.stages, (runnable: any) => {
if (runnable.runnableType === 'step' && runnable.type.startsWith('CertApply')) {
domains = runnable.input.domains || [];
}
});
if (pipeline.stages) {
RunnableCollection.each(pipeline.stages, (runnable: any) => {
if (runnable.runnableType === 'step' && runnable.type.startsWith('CertApply')) {
domains = runnable.input.domains || [];
}
});
}
if (!isUpdate) {
//如果是添加,校验数量
@@ -188,7 +191,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
await this.registerTriggerById(bean.id);
//保存域名信息到certInfo表
await this.certInfoService.updateDomains(pipeline.id, domains);
await this.certInfoService.updateDomains(pipeline.id, pipeline.userId || bean.userId, domains);
return bean;
}
@@ -622,4 +625,17 @@ export class PipelineService extends BaseService<PipelineEntity> {
async getUserPipelineCount(userId) {
return await this.repository.count({ where: { userId } });
}
async getSimplePipelines(pipelineIds: number[], userId?: number) {
return await this.repository.find({
select: {
id: true,
title: true,
},
where: {
id: In(pipelineIds),
userId,
},
});
}
}