fix: 简化天河链设置项
This commit is contained in:
@@ -200,3 +200,4 @@
|
|||||||
|
|
||||||
- 天河链测试存证接入(2026-07-06):根据语雀/Apifox 文档,当前平台先接 `POST /api/v2/nfr/upload` 数字商品元数据上链存储接口,默认测试域名 `https://test.api.tichain.tianhecloud.com`,正式域名 `https://api.tichain.tianhecloud.com`。系统设置新增区块链存证卡片,可切换 `mock/tianhe`、测试/正式/自定义环境,并配置 `appId/appKey/userId/userKey`;`BlockchainService` 每次上链动态读取系统设置并以 `.env` 兜底,无需重启即可切换。`AttestationService` 创建 proof 时保存本次作品/追溯码/批次/出库摘要到 `rawResponse.requestMeta`,`OnchainProcessor` 调 provider 时上传该 JSON 元数据文件,成功后保存天河链返回的哈希、存证链接、上链时间和原始响应,失败时保留错误信息。出库 ZIP 模板和导入流程不再包含“上链哈希/上链时间/区块高度”列,避免绕过链上接口手工登记。
|
- 天河链测试存证接入(2026-07-06):根据语雀/Apifox 文档,当前平台先接 `POST /api/v2/nfr/upload` 数字商品元数据上链存储接口,默认测试域名 `https://test.api.tichain.tianhecloud.com`,正式域名 `https://api.tichain.tianhecloud.com`。系统设置新增区块链存证卡片,可切换 `mock/tianhe`、测试/正式/自定义环境,并配置 `appId/appKey/userId/userKey`;`BlockchainService` 每次上链动态读取系统设置并以 `.env` 兜底,无需重启即可切换。`AttestationService` 创建 proof 时保存本次作品/追溯码/批次/出库摘要到 `rawResponse.requestMeta`,`OnchainProcessor` 调 provider 时上传该 JSON 元数据文件,成功后保存天河链返回的哈希、存证链接、上链时间和原始响应,失败时保留错误信息。出库 ZIP 模板和导入流程不再包含“上链哈希/上链时间/区块高度”列,避免绕过链上接口手工登记。
|
||||||
- 系统设置布局微调(2026-07-06):后台 `Settings.vue` 的基础设置区改为三列卡片:左侧平台设置,中间日志设置+备份策略,右侧区块链存证;避免区块链配置夹在日志和备份之间打断阅读,同时保持保存按钮在设置卡片组右上角。
|
- 系统设置布局微调(2026-07-06):后台 `Settings.vue` 的基础设置区改为三列卡片:左侧平台设置,中间日志设置+备份策略,右侧区块链存证;避免区块链配置夹在日志和备份之间打断阅读,同时保持保存按钮在设置卡片组右上角。
|
||||||
|
- 天河链用户身份临时策略(2026-07-06):天河链文档中的 `userId/userKey` 属于托管链上用户身份,不是平台截图里提供的商户 API 凭证。当前设置页先只展示 `App ID/App Key`,后端仍兼容 `.env` 或历史设置中的 `TIANHE_USER_ID/TIANHE_USER_KEY`;若未配置,则使用平台级默认 `userId=artveris-platform`,`userKey=sha256(artveris:tianhe:{appId}:{appKey})` 派生。后续需再讨论是继续平台级托管用户,还是按运营账号/机构/作品批次生成链上用户。
|
||||||
|
|||||||
@@ -456,9 +456,7 @@
|
|||||||
"tianheEnvCustom": "Custom",
|
"tianheEnvCustom": "Custom",
|
||||||
"tianheBaseUrl": "API URL",
|
"tianheBaseUrl": "API URL",
|
||||||
"tianheAppId": "App ID",
|
"tianheAppId": "App ID",
|
||||||
"tianheAppKey": "App Key",
|
"tianheAppKey": "App Key"
|
||||||
"tianheUserId": "User ID",
|
|
||||||
"tianheUserKey": "User Key"
|
|
||||||
},
|
},
|
||||||
"profile": {
|
"profile": {
|
||||||
"title": "Personal Info",
|
"title": "Personal Info",
|
||||||
|
|||||||
@@ -456,9 +456,7 @@
|
|||||||
"tianheEnvCustom": "自定义",
|
"tianheEnvCustom": "自定义",
|
||||||
"tianheBaseUrl": "接口地址",
|
"tianheBaseUrl": "接口地址",
|
||||||
"tianheAppId": "App ID",
|
"tianheAppId": "App ID",
|
||||||
"tianheAppKey": "App Key",
|
"tianheAppKey": "App Key"
|
||||||
"tianheUserId": "User ID",
|
|
||||||
"tianheUserKey": "User Key"
|
|
||||||
},
|
},
|
||||||
"profile": {
|
"profile": {
|
||||||
"title": "个人信息",
|
"title": "个人信息",
|
||||||
|
|||||||
@@ -111,16 +111,6 @@
|
|||||||
<n-input v-model:value="form.tianheAppKey" type="password" show-password-on="click" class="text-control" />
|
<n-input v-model:value="form.tianheAppKey" type="password" show-password-on="click" class="text-control" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-row">
|
|
||||||
<n-form-item :label="t('pages.settings.tianheUserId')">
|
|
||||||
<n-input v-model:value="form.tianheUserId" class="text-control" />
|
|
||||||
</n-form-item>
|
|
||||||
</div>
|
|
||||||
<div class="setting-row">
|
|
||||||
<n-form-item :label="t('pages.settings.tianheUserKey')">
|
|
||||||
<n-input v-model:value="form.tianheUserKey" type="password" show-password-on="click" class="text-control" />
|
|
||||||
</n-form-item>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</n-form>
|
</n-form>
|
||||||
@@ -184,8 +174,6 @@ const form = reactive({
|
|||||||
tianheBaseUrl: TIANHE_TEST_URL,
|
tianheBaseUrl: TIANHE_TEST_URL,
|
||||||
tianheAppId: '',
|
tianheAppId: '',
|
||||||
tianheAppKey: '',
|
tianheAppKey: '',
|
||||||
tianheUserId: '',
|
|
||||||
tianheUserKey: '',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
@@ -207,8 +195,6 @@ async function load() {
|
|||||||
form.tianheBaseUrl = s.tianheBaseUrl || TIANHE_TEST_URL;
|
form.tianheBaseUrl = s.tianheBaseUrl || TIANHE_TEST_URL;
|
||||||
form.tianheAppId = s.tianheAppId || '';
|
form.tianheAppId = s.tianheAppId || '';
|
||||||
form.tianheAppKey = s.tianheAppKey || '';
|
form.tianheAppKey = s.tianheAppKey || '';
|
||||||
form.tianheUserId = s.tianheUserId || '';
|
|
||||||
form.tianheUserKey = s.tianheUserKey || '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTianheEnvChange(value: string) {
|
function onTianheEnvChange(value: string) {
|
||||||
@@ -237,8 +223,6 @@ async function save() {
|
|||||||
tianheBaseUrl: form.tianheBaseUrl,
|
tianheBaseUrl: form.tianheBaseUrl,
|
||||||
tianheAppId: form.tianheAppId,
|
tianheAppId: form.tianheAppId,
|
||||||
tianheAppKey: form.tianheAppKey,
|
tianheAppKey: form.tianheAppKey,
|
||||||
tianheUserId: form.tianheUserId,
|
|
||||||
tianheUserKey: form.tianheUserKey,
|
|
||||||
});
|
});
|
||||||
setFavicon(appIconUrl);
|
setFavicon(appIconUrl);
|
||||||
window.dispatchEvent(new CustomEvent('artveris-settings-updated'));
|
window.dispatchEvent(new CustomEvent('artveris-settings-updated'));
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { TianheProvider } from './tianhe.provider';
|
|||||||
|
|
||||||
const TIANHE_TEST_URL = 'https://test.api.tichain.tianhecloud.com';
|
const TIANHE_TEST_URL = 'https://test.api.tichain.tianhecloud.com';
|
||||||
const TIANHE_PRODUCTION_URL = 'https://api.tichain.tianhecloud.com';
|
const TIANHE_PRODUCTION_URL = 'https://api.tichain.tianhecloud.com';
|
||||||
|
const DEFAULT_TIANHE_USER_ID = 'artveris-platform';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BlockchainService {
|
export class BlockchainService {
|
||||||
@@ -45,8 +46,20 @@ export class BlockchainService {
|
|||||||
baseUrl: configuredBaseUrl,
|
baseUrl: configuredBaseUrl,
|
||||||
appId: settings.tianheAppId || this.config.get<string>('blockchain.tianhe.appId') || '',
|
appId: settings.tianheAppId || this.config.get<string>('blockchain.tianhe.appId') || '',
|
||||||
appKey: settings.tianheAppKey || this.config.get<string>('blockchain.tianhe.appKey') || '',
|
appKey: settings.tianheAppKey || this.config.get<string>('blockchain.tianhe.appKey') || '',
|
||||||
userId: settings.tianheUserId || this.config.get<string>('blockchain.tianhe.userId') || '',
|
userId: this.tianheUserId(settings),
|
||||||
userKey: settings.tianheUserKey || this.config.get<string>('blockchain.tianhe.userKey') || '',
|
userKey: this.tianheUserKey(settings),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private tianheUserId(settings: Record<string, string>): string {
|
||||||
|
return settings.tianheUserId || this.config.get<string>('blockchain.tianhe.userId') || DEFAULT_TIANHE_USER_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private tianheUserKey(settings: Record<string, string>): string {
|
||||||
|
const configured = settings.tianheUserKey || this.config.get<string>('blockchain.tianhe.userKey');
|
||||||
|
if (configured) return configured;
|
||||||
|
const appId = settings.tianheAppId || this.config.get<string>('blockchain.tianhe.appId') || '';
|
||||||
|
const appKey = settings.tianheAppKey || this.config.get<string>('blockchain.tianhe.appKey') || '';
|
||||||
|
return createHash('sha256').update(`artveris:tianhe:${appId}:${appKey}`).digest('hex');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user