diff --git a/apps/admin/src/locales/en-US.json b/apps/admin/src/locales/en-US.json
index 5e14b6c..3f59061 100644
--- a/apps/admin/src/locales/en-US.json
+++ b/apps/admin/src/locales/en-US.json
@@ -806,8 +806,7 @@
"tianheVerifyOk": "Verified. On-chain identity saved",
"tianheManualHint": "Enter the saved User ID and User Key. The system verifies them with TiChain before saving (for reusing the existing wallet after reinstall/migration).",
"tianheManualUserIdPh": "e.g. artveris-platform",
- "tianheManualUserKeyPh": "The User Key you saved offline",
- "certificateEnabled": "On-demand certificates"
+ "tianheManualUserKeyPh": "The User Key you saved offline"
},
"profile": {
"title": "Personal Info",
diff --git a/apps/admin/src/locales/zh-CN.json b/apps/admin/src/locales/zh-CN.json
index 0ed4b2d..009940c 100644
--- a/apps/admin/src/locales/zh-CN.json
+++ b/apps/admin/src/locales/zh-CN.json
@@ -806,8 +806,7 @@
"tianheVerifyOk": "校验通过,链上身份已保存",
"tianheManualHint": "输入已保存的 User ID 与 User Key,系统将向天河链校验后保存(用于重装/迁移后复用既有钱包)。",
"tianheManualUserIdPh": "如 artveris-platform",
- "tianheManualUserKeyPh": "已离线保存的 User Key",
- "certificateEnabled": "扫码页按需出证"
+ "tianheManualUserKeyPh": "已离线保存的 User Key"
},
"profile": {
"title": "个人信息",
diff --git a/apps/admin/src/views/Settings.vue b/apps/admin/src/views/Settings.vue
index 48980dc..f0dce2e 100644
--- a/apps/admin/src/views/Settings.vue
+++ b/apps/admin/src/views/Settings.vue
@@ -93,9 +93,6 @@
-
-
-
@@ -320,7 +317,6 @@ const form = reactive({
backupRetentionCount: 10,
blockchainDriver: 'mock',
tianheEnv: 'test',
- certificateEnabled: true,
tianheBaseUrl: TIANHE_TEST_URL,
tianheAppId: '',
tianheAppKey: '',
@@ -366,7 +362,6 @@ async function load() {
form.backupRetentionCount = Number(s.backupRetentionCount || 10);
form.blockchainDriver = s.blockchainDriver || 'mock';
form.tianheEnv = s.tianheEnv || 'test';
- form.certificateEnabled = s.certificateEnabled !== 'false';
form.tianheBaseUrl = s.tianheBaseUrl || TIANHE_TEST_URL;
form.tianheAppId = s.tianheAppId || '';
form.tianheAppKey = s.tianheAppKey || '';
@@ -556,7 +551,6 @@ async function save() {
backupRetentionCount: String(form.backupRetentionCount),
blockchainDriver: form.blockchainDriver,
tianheEnv: form.tianheEnv,
- certificateEnabled: String(form.certificateEnabled),
tianheBaseUrl: form.tianheBaseUrl,
tianheAppId: form.tianheAppId,
tianheAppKey: form.tianheAppKey,
diff --git a/apps/api/prisma/migrations/20260920040000_remove_certificate_switch/migration.sql b/apps/api/prisma/migrations/20260920040000_remove_certificate_switch/migration.sql
new file mode 100644
index 0000000..f671eb0
--- /dev/null
+++ b/apps/api/prisma/migrations/20260920040000_remove_certificate_switch/migration.sql
@@ -0,0 +1,2 @@
+-- Certificates are requested explicitly by the consumer; no global pause switch.
+DELETE FROM `system_setting` WHERE `key` = 'certificateEnabled';
diff --git a/apps/api/src/blockchain/deposit-certificate.service.spec.ts b/apps/api/src/blockchain/deposit-certificate.service.spec.ts
index 14288e0..7f2ad76 100644
--- a/apps/api/src/blockchain/deposit-certificate.service.spec.ts
+++ b/apps/api/src/blockchain/deposit-certificate.service.spec.ts
@@ -2,7 +2,7 @@ import { DepositCertificateService } from './deposit-certificate.service';
import { DepositProvider } from './deposit.provider';
const settings = {
- certificateEnabled: 'true', blockchainDriver: 'tianhe',
+ blockchainDriver: 'tianhe',
tianheEnv: 'test', tianheAppId: 'app', tianheAppKey: 'key', tianheWalletAddress: '0x' + 'a'.repeat(40),
};
function fixture(state = 'PENDING') {
@@ -78,9 +78,9 @@ describe('Consumer certificate lifecycle', () => {
await expect(service.request('123456000001')).rejects.toThrow();
expect(prisma.$transaction).not.toHaveBeenCalled();
});
- it('ignores obsolete daily settings and claims an item without any quota transaction', async () => {
+ it('ignores the obsolete disabled switch and daily settings when claiming an item', async () => {
const { service, prisma, config } = fixture('NONE');
- config.getAllRaw.mockResolvedValue({ ...settings, certificateDailyLimit: '0', certificateDailyQuota: '2026-09-20:999999' } as any);
+ config.getAllRaw.mockResolvedValue({ ...settings, certificateEnabled: 'false', certificateDailyLimit: '0', certificateDailyQuota: '2026-09-20:999999' } as any);
await service.request('123456000001');
expect(prisma.blockchainProof.updateMany).toHaveBeenCalledWith(expect.objectContaining({
where: { id: 1, certificateState: 'NONE', status: 'ONCHAIN' },
diff --git a/apps/api/src/blockchain/deposit-certificate.service.ts b/apps/api/src/blockchain/deposit-certificate.service.ts
index f30d258..764f01d 100644
--- a/apps/api/src/blockchain/deposit-certificate.service.ts
+++ b/apps/api/src/blockchain/deposit-certificate.service.ts
@@ -61,7 +61,6 @@ export class DepositCertificateService {
const { code, proof } = await this.eligible(shortCode);
if (proof.certificateState === 'READY') return this.view(proof);
const settings = await this.settings.getAllRaw();
- if (settings.certificateEnabled === 'false') throw new BusinessException(ErrorCode.BAD_REQUEST, '证书生成暂时关闭');
if (proof.certificateState !== 'NONE') {
// An uncertain submission is never submitted again. User action only resumes queries.
if (proof.certificateState === 'UNKNOWN' && (!proof.certificateNextCheck || proof.certificateNextCheck <= new Date())) {
@@ -109,7 +108,6 @@ export class DepositCertificateService {
if (this.running) return;
this.running = true;
try {
- if ((await this.settings.get('certificateEnabled')) === 'false') return;
const now = new Date();
const rows = await this.prisma.blockchainProof.findMany({
where: { certificateState: { in: ACTIVE_STATES }, certificateNextCheck: { lte: now },
diff --git a/apps/api/src/settings/settings.service.ts b/apps/api/src/settings/settings.service.ts
index 8229b2c..6bac107 100644
--- a/apps/api/src/settings/settings.service.ts
+++ b/apps/api/src/settings/settings.service.ts
@@ -1,4 +1,4 @@
-import { BadRequestException, Injectable, Logger } from '@nestjs/common';
+import { Injectable, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { createCipheriv, createDecipheriv, createHash, randomBytes } from 'crypto';
import { PrismaService } from '../prisma/prisma.service';
@@ -29,7 +29,6 @@ const EDITABLE_KEYS = [
'storageMigrationFingerprint',
'storageMigrationCopied',
'blockchainDriver',
- 'certificateEnabled',
'tianheEnv',
'tianheBaseUrl',
'tianheAppId',
@@ -90,7 +89,6 @@ export class SettingsService {
ossAccessKeySecret: this.config.get('storage.oss.accessKeySecret') || '',
settingsEncryptionKey: this.config.get('settingsEncryptionKey') || '',
blockchainDriver: this.config.get('blockchain.driver') || 'mock',
- certificateEnabled: 'true',
tianheEnv: 'test',
tianheBaseUrl: this.config.get('blockchain.tianhe.baseUrl') || 'https://test.api.tichain.tianhecloud.com',
tianheAppId: this.config.get('blockchain.tianhe.appId') || '',
@@ -144,9 +142,6 @@ export class SettingsService {
}
async updateAtomic(values: Record): Promise {
- if (values.certificateEnabled !== undefined && !['true', 'false'].includes(String(values.certificateEnabled))) {
- throw new BadRequestException('Invalid certificate switch');
- }
const updates: Array<{ key: string; value: string }> = [];
for (const [key, value] of Object.entries(values)) {
if (!EDITABLE_KEYS.includes(key)) continue;
diff --git a/docs/消费者按需存证证书.md b/docs/消费者按需存证证书.md
index de3dbd2..877b4ad 100644
--- a/docs/消费者按需存证证书.md
+++ b/docs/消费者按需存证证书.md
@@ -34,7 +34,7 @@ NONE -> PENDING -> SUBMITTING -> WAITING -> CHECKING -> READY
## 成本控制
-后台“系统设置 → 区块链”保留“扫码页按需出证”开关,默认开启。按用户确认,不设置每日新增证书上限。升级迁移清理旧的每日限额与计数配置;同一实物仅成功生成一次,之后复用链接。关闭开关可暂停生成,已生成链接仍可读取。
+按用户确认,不设置出证总开关或每日新增证书上限。符合条件的实物由消费者点击后申请,同一实物仅成功生成一次,之后复用链接。升级迁移清理旧开关、每日限额与计数配置;旧备份中的这些配置也不再影响申请或任务处理。
公开 POST 每 IP 每分钟最多 5 次,状态 GET 每 IP 每分钟最多 60 次。任务内部提交、查询、出证是多个 API 请求,“一次生成”不表示仅一次 HTTP 调用。