refactor(api): 升级 trading-service API 前缀至 v2
将 trading-service 的 API 版本从 v1 升级到 v2,统一 2.0 系统架构: **trading-service:** - main.ts: 全局前缀 api/v1 → api/v2 - Dockerfile: 健康检查路径 /api/v1/health → /api/v2/health - transfer.service.ts: 更新调用 mining-service 的 API 路径 - /api/v1/mining/accounts/.../transfer-out → /api/v2/... - /api/v1/mining/accounts/.../transfer-in → /api/v2/... 此变更使 trading-service 正式成为 2.0 系统的一部分, 与 auth-service、contribution-service、mining-service、 mining-admin-service、mining-wallet-service 保持一致。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6d619c0a02
commit
f790d2bbe5
|
|
@ -45,6 +45,6 @@ ENV TZ=Asia/Shanghai
|
||||||
EXPOSE 3022
|
EXPOSE 3022
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||||
CMD curl -f http://localhost:3022/api/v1/health || exit 1
|
CMD curl -f http://localhost:3022/api/v2/health || exit 1
|
||||||
|
|
||||||
CMD ["/app/start.sh"]
|
CMD ["/app/start.sh"]
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ export class TransferService {
|
||||||
transferNo: string,
|
transferNo: string,
|
||||||
): Promise<{ success: boolean; txId?: string; message?: string }> {
|
): Promise<{ success: boolean; txId?: string; message?: string }> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${this.miningServiceUrl}/api/v1/mining/accounts/${accountSequence}/transfer-out`, {
|
const response = await fetch(`${this.miningServiceUrl}/api/v2/mining/accounts/${accountSequence}/transfer-out`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ amount, transferNo }),
|
body: JSON.stringify({ amount, transferNo }),
|
||||||
|
|
@ -203,7 +203,7 @@ export class TransferService {
|
||||||
transferNo: string,
|
transferNo: string,
|
||||||
): Promise<{ success: boolean; txId?: string; message?: string }> {
|
): Promise<{ success: boolean; txId?: string; message?: string }> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${this.miningServiceUrl}/api/v1/mining/accounts/${accountSequence}/transfer-in`, {
|
const response = await fetch(`${this.miningServiceUrl}/api/v2/mining/accounts/${accountSequence}/transfer-in`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ amount, transferNo }),
|
body: JSON.stringify({ amount, transferNo }),
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ async function bootstrap() {
|
||||||
credentials: true,
|
credentials: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
app.setGlobalPrefix('api/v1');
|
app.setGlobalPrefix('api/v2');
|
||||||
|
|
||||||
const config = new DocumentBuilder()
|
const config = new DocumentBuilder()
|
||||||
.setTitle('Trading Service API')
|
.setTitle('Trading Service API')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue