mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
Merge branch 'v2-dev' of https://github.com/certd/certd into v2-dev
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.39.1](https://github.com/certd/certd/compare/v1.39.0...v1.39.1) (2026-03-09)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 支持迁移个人数据到企业项目中 ([c6ca832](https://github.com/certd/certd/commit/c6ca83273779ed84de1b23b5e477063af043d015))
|
||||
|
||||
# [1.39.0](https://github.com/certd/certd/compare/v1.38.12...v1.39.0) (2026-03-07)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/ui-server",
|
||||
"version": "1.39.0",
|
||||
"version": "1.39.1",
|
||||
"description": "fast-server base midway",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
@@ -50,20 +50,20 @@
|
||||
"@aws-sdk/client-route-53": "^3.964.0",
|
||||
"@aws-sdk/client-s3": "^3.964.0",
|
||||
"@aws-sdk/client-sts": "^3.990.0",
|
||||
"@certd/acme-client": "^1.39.0",
|
||||
"@certd/basic": "^1.39.0",
|
||||
"@certd/commercial-core": "^1.39.0",
|
||||
"@certd/acme-client": "^1.39.1",
|
||||
"@certd/basic": "^1.39.1",
|
||||
"@certd/commercial-core": "^1.39.1",
|
||||
"@certd/cv4pve-api-javascript": "^8.4.2",
|
||||
"@certd/jdcloud": "^1.39.0",
|
||||
"@certd/lib-huawei": "^1.39.0",
|
||||
"@certd/lib-k8s": "^1.39.0",
|
||||
"@certd/lib-server": "^1.39.0",
|
||||
"@certd/midway-flyway-js": "^1.39.0",
|
||||
"@certd/pipeline": "^1.39.0",
|
||||
"@certd/plugin-cert": "^1.39.0",
|
||||
"@certd/plugin-lib": "^1.39.0",
|
||||
"@certd/plugin-plus": "^1.39.0",
|
||||
"@certd/plus-core": "^1.39.0",
|
||||
"@certd/jdcloud": "^1.39.1",
|
||||
"@certd/lib-huawei": "^1.39.1",
|
||||
"@certd/lib-k8s": "^1.39.1",
|
||||
"@certd/lib-server": "^1.39.1",
|
||||
"@certd/midway-flyway-js": "^1.39.1",
|
||||
"@certd/pipeline": "^1.39.1",
|
||||
"@certd/plugin-cert": "^1.39.1",
|
||||
"@certd/plugin-lib": "^1.39.1",
|
||||
"@certd/plugin-plus": "^1.39.1",
|
||||
"@certd/plus-core": "^1.39.1",
|
||||
"@google-cloud/publicca": "^1.3.0",
|
||||
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.185",
|
||||
"@huaweicloud/huaweicloud-sdk-core": "^3.1.185",
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { BaseController, Constants } from '@certd/lib-server';
|
||||
import { Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { TransferService } from '../../../modules/sys/enterprise/service/transfer-service.js';
|
||||
|
||||
/**
|
||||
*/
|
||||
@Provide()
|
||||
@Controller('/api/enterprise/transfer')
|
||||
export class TransferController extends BaseController {
|
||||
@Inject()
|
||||
service: TransferService;
|
||||
|
||||
|
||||
getService(): TransferService {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
/**
|
||||
* 我自己的资源
|
||||
* @param body
|
||||
* @returns
|
||||
*/
|
||||
@Post('/selfResources', { summary: Constants.per.authOnly })
|
||||
async selfResources() {
|
||||
const userId = this.getUserId();
|
||||
const res = await this.service.getUserResources(userId);
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 迁移项目
|
||||
* @param body
|
||||
* @returns
|
||||
*/
|
||||
@Post('/doTransfer', { summary: Constants.per.authOnly })
|
||||
async doTransfer() {
|
||||
const {projectId} = await this.getProjectUserIdRead();
|
||||
const userId = this.getUserId();
|
||||
await this.service.transferAll(userId,projectId);
|
||||
return this.ok();
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import {SiteIpService} from "./site-ip-service.js";
|
||||
import {SiteIpEntity} from "../entity/site-ip.js";
|
||||
import {Cron} from "../../cron/cron.js";
|
||||
import { dnsContainer } from "./dns-custom.js";
|
||||
import { merge } from "lodash-es";
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Request, {allowDowngrade: true})
|
||||
@@ -164,6 +165,8 @@ export class SiteInfoService extends BaseService<SiteInfoEntity> {
|
||||
await this.update(updateData);
|
||||
|
||||
const setting = await this.userSettingsService.getSetting<UserSiteMonitorSetting>(site.userId,site.projectId, UserSiteMonitorSetting)
|
||||
|
||||
merge(site,updateData)
|
||||
//检查ip
|
||||
await this.checkAllIp(site,retryTimes,setting);
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
import { isEnterprise } from "@certd/lib-server";
|
||||
import { ApplicationContext, IMidwayContainer, Provide, Scope, ScopeEnum } from "@midwayjs/core";
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||
export class TransferService {
|
||||
@ApplicationContext()
|
||||
appCtx: IMidwayContainer;
|
||||
|
||||
|
||||
async getServices() {
|
||||
const getService = async (key: string) => {
|
||||
return await this.appCtx.getAsync(key);
|
||||
}
|
||||
const serviceNames = [
|
||||
"pipeline",
|
||||
"certInfo",
|
||||
"siteInfo",
|
||||
"domain",
|
||||
"cnameRecord",
|
||||
"group",
|
||||
"pipelineGroup",
|
||||
"notification",
|
||||
"subDomain",
|
||||
"template",
|
||||
"openKey",
|
||||
"siteIp",
|
||||
"access",
|
||||
"history",
|
||||
"historyLog",
|
||||
"storage",
|
||||
]
|
||||
|
||||
const services: any = {}
|
||||
for (const key of serviceNames) {
|
||||
services[key] = await getService(`${key}Service`);
|
||||
}
|
||||
return services;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户资源
|
||||
* @param userId
|
||||
* @returns
|
||||
*/
|
||||
async getUserResources(userId: number) {
|
||||
|
||||
const query = {
|
||||
userId,
|
||||
}
|
||||
|
||||
const services = await this.getServices();
|
||||
|
||||
const counts: any = {}
|
||||
let totalCount = 0;
|
||||
for (const key of Object.keys(services)) {
|
||||
const count = await services[key].repository.count({ where: query });
|
||||
counts[key] = count;
|
||||
totalCount += count;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
...counts,
|
||||
totalCount,
|
||||
}
|
||||
}
|
||||
|
||||
async transferAll(userId: number, projectId: number) {
|
||||
|
||||
if (!isEnterprise()) {
|
||||
throw new Error('当前非企业模式,不支持资源迁移到项目');
|
||||
}
|
||||
if (projectId === 0) {
|
||||
throw new Error('项目ID不能为0');
|
||||
}
|
||||
if (userId == null) {
|
||||
throw new Error('用户ID不能为空');
|
||||
}
|
||||
|
||||
const query = {
|
||||
userId,
|
||||
}
|
||||
const services = await this.getServices();
|
||||
for (const key of Object.keys(services)) {
|
||||
await services[key].repository.update(query, {
|
||||
userId: -1,
|
||||
projectId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+7
-3
@@ -1,4 +1,4 @@
|
||||
import { IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { IsTaskPlugin, Pager, PageSearch, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { AliyunAccess } from "../../../../plugin-lib/aliyun/access/index.js";
|
||||
import { CertApplyBasePlugin } from "../base.js";
|
||||
import { CertReader, createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
||||
@@ -34,8 +34,9 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
|
||||
helper: "订阅模式的证书订单Id",
|
||||
typeName: "CertApplyGetFormAliyun",
|
||||
component: {
|
||||
name: "RemoteAutoComplete",
|
||||
name: "RemoteSelect",
|
||||
vModel: "value",
|
||||
pager: true,
|
||||
},
|
||||
action: CertApplyGetFormAliyunPlugin.prototype.onGetOrderList.name,
|
||||
})
|
||||
@@ -126,6 +127,7 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
|
||||
|
||||
const client = await access.getClient("cas.aliyuncs.com");
|
||||
|
||||
const pager = new Pager(req)
|
||||
const res = await client.doRequest({
|
||||
// 接口名称
|
||||
action: "ListUserCertificateOrder",
|
||||
@@ -139,12 +141,14 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
|
||||
data: {
|
||||
query: {
|
||||
Status: "ISSUED",
|
||||
CurrentPage: pager.pageNo,
|
||||
ShowSize : pager.pageSize,
|
||||
},
|
||||
},
|
||||
});
|
||||
const list = res?.CertificateOrderList || [];
|
||||
if (!list || list.length === 0) {
|
||||
throw new Error("没有找到已签发的证书订单");
|
||||
return []
|
||||
}
|
||||
|
||||
return list.map((item: any) => {
|
||||
|
||||
Reference in New Issue
Block a user