fix: 移除扫码页出证总开关
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -806,8 +806,7 @@
|
||||
"tianheVerifyOk": "校验通过,链上身份已保存",
|
||||
"tianheManualHint": "输入已保存的 User ID 与 User Key,系统将向天河链校验后保存(用于重装/迁移后复用既有钱包)。",
|
||||
"tianheManualUserIdPh": "如 artveris-platform",
|
||||
"tianheManualUserKeyPh": "已离线保存的 User Key",
|
||||
"certificateEnabled": "扫码页按需出证"
|
||||
"tianheManualUserKeyPh": "已离线保存的 User Key"
|
||||
},
|
||||
"profile": {
|
||||
"title": "个人信息",
|
||||
|
||||
@@ -93,9 +93,6 @@
|
||||
<n-form-item :label="t('pages.settings.blockchainDriver')">
|
||||
<n-select v-model:value="form.blockchainDriver" :options="blockchainDriverOptions" />
|
||||
</n-form-item>
|
||||
<n-form-item :label="t('pages.settings.certificateEnabled')">
|
||||
<n-switch v-model:value="form.certificateEnabled" />
|
||||
</n-form-item>
|
||||
<n-form-item :label="t('pages.settings.tianheEnv')">
|
||||
<n-select v-model:value="form.tianheEnv" :options="tianheEnvOptions" @update:value="onTianheEnvChange" />
|
||||
</n-form-item>
|
||||
@@ -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,
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Certificates are requested explicitly by the consumer; no global pause switch.
|
||||
DELETE FROM `system_setting` WHERE `key` = 'certificateEnabled';
|
||||
@@ -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' },
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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<string>('storage.oss.accessKeySecret') || '',
|
||||
settingsEncryptionKey: this.config.get<string>('settingsEncryptionKey') || '',
|
||||
blockchainDriver: this.config.get<string>('blockchain.driver') || 'mock',
|
||||
certificateEnabled: 'true',
|
||||
tianheEnv: 'test',
|
||||
tianheBaseUrl: this.config.get<string>('blockchain.tianhe.baseUrl') || 'https://test.api.tichain.tianhecloud.com',
|
||||
tianheAppId: this.config.get<string>('blockchain.tianhe.appId') || '',
|
||||
@@ -144,9 +142,6 @@ export class SettingsService {
|
||||
}
|
||||
|
||||
async updateAtomic(values: Record<string, string>): Promise<void> {
|
||||
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;
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ NONE -> PENDING -> SUBMITTING -> WAITING -> CHECKING -> READY
|
||||
|
||||
## 成本控制
|
||||
|
||||
后台“系统设置 → 区块链”保留“扫码页按需出证”开关,默认开启。按用户确认,不设置每日新增证书上限。升级迁移清理旧的每日限额与计数配置;同一实物仅成功生成一次,之后复用链接。关闭开关可暂停生成,已生成链接仍可读取。
|
||||
按用户确认,不设置出证总开关或每日新增证书上限。符合条件的实物由消费者点击后申请,同一实物仅成功生成一次,之后复用链接。升级迁移清理旧开关、每日限额与计数配置;旧备份中的这些配置也不再影响申请或任务处理。
|
||||
|
||||
公开 POST 每 IP 每分钟最多 5 次,状态 GET 每 IP 每分钟最多 60 次。任务内部提交、查询、出证是多个 API 请求,“一次生成”不表示仅一次 HTTP 调用。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user