mirror of
https://github.com/certd/certd.git
synced 2026-05-16 05:07:32 +08:00
feat: 套餐购买支持易支付、支付宝支付
This commit is contained in:
@@ -3,7 +3,7 @@ import { pluginGroups, pluginRegistry } from '@certd/pipeline';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Singleton)
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class BuiltInPluginService {
|
||||
getList() {
|
||||
const collection = pluginRegistry.storage;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { HistoryLogEntity } from '../entity/history-log.js';
|
||||
* 证书申请
|
||||
*/
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Singleton)
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class HistoryLogService extends BaseService<HistoryLogEntity> {
|
||||
@InjectEntityModel(HistoryLogEntity)
|
||||
repository: Repository<HistoryLogEntity>;
|
||||
|
||||
@@ -16,7 +16,7 @@ import { logger } from '@certd/basic';
|
||||
* 证书申请
|
||||
*/
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Singleton)
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class HistoryService extends BaseService<HistoryEntity> {
|
||||
@InjectEntityModel(HistoryEntity)
|
||||
repository: Repository<HistoryEntity>;
|
||||
|
||||
@@ -9,7 +9,7 @@ import { EmailService } from '../../basic/service/email-service.js';
|
||||
import { isComm } from '@certd/plus-core';
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Singleton)
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class NotificationService extends BaseService<NotificationEntity> {
|
||||
@InjectEntityModel(NotificationEntity)
|
||||
repository: Repository<NotificationEntity>;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { PipelineGroupEntity } from '../entity/pipeline-group.js';
|
||||
import { merge } from 'lodash-es';
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Singleton)
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class PipelineGroupService extends BaseService<PipelineGroupEntity> {
|
||||
@InjectEntityModel(PipelineGroupEntity)
|
||||
repository: Repository<PipelineGroupEntity>;
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { StorageEntity } from '../entity/storage.js';
|
||||
/**
|
||||
*/
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Singleton)
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class StorageService extends BaseService<StorageEntity> {
|
||||
@InjectEntityModel(StorageEntity)
|
||||
repository: Repository<StorageEntity>;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { SysInstallInfo, SysSettingsService } from '@certd/lib-server';
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Singleton)
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class UrlService implements IUrlService {
|
||||
@Inject()
|
||||
sysSettingsService: SysSettingsService;
|
||||
|
||||
Reference in New Issue
Block a user