fix(sync): 修复数据同步 API 认证和响应解析
- 为 contribution/mining/trading 服务的 AdminController 添加 @Public 装饰器
- 修复 initialization.service.ts 中响应格式解析,支持 { data: { ... } } 格式
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6fedebf020
commit
05f98def6d
|
|
@ -704,7 +704,15 @@
|
||||||
"Bash(user \")",
|
"Bash(user \")",
|
||||||
"mcp__UIPro__getCodeFromUIProPlugin",
|
"mcp__UIPro__getCodeFromUIProPlugin",
|
||||||
"Bash(flutter create:*)",
|
"Bash(flutter create:*)",
|
||||||
"Bash(DATABASE_URL=\"postgresql://postgres:postgres@localhost:5432/rwa_auth?schema=public\" npx prisma migrate dev:*)"
|
"Bash(DATABASE_URL=\"postgresql://postgres:postgres@localhost:5432/rwa_auth?schema=public\" npx prisma migrate dev:*)",
|
||||||
|
"Bash(curl -s http://103.118.40.14:8001/routes/contribution-v2-api)",
|
||||||
|
"Bash(curl -s http://103.118.40.14:8001/services/contribution-service-v2)",
|
||||||
|
"Bash(ssh ceshi@103.39.231.231 \"cd /data/rwadurian/backend/api-gateway && git pull origin main && docker-compose restart kong\")",
|
||||||
|
"Bash(ssh ceshi@103.39.231.231 \"ls -la /data/ 2>/dev/null || ls -la / | grep -E ''data|home|opt''\")",
|
||||||
|
"Bash(TOKEN=\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJEMjUxMjI3MDAwMjIiLCJwaG9uZSI6IjE4OTI2NzYyNzIxIiwic291cmNlIjoiVjEiLCJpYXQiOjE3NjgxODM5NTIsImV4cCI6MTc2ODc4ODc1Mn0.Uq6TCFWHO64fD_MUP2IoBJzaXo99HDcp0H5s5A14EXQ\")",
|
||||||
|
"Bash(ssh ceshi@103.39.231.231 \"ssh ceshi@192.168.1.111 ''cd /home/durian/rwadurian && git pull && cd backend/services && ./deploy.sh rebuild auth-service''\")",
|
||||||
|
"Bash(git commit -m \"$\\(cat <<''EOF''\nfeat\\(mining-admin-web\\): 复用admin-web用户管理功能\n\n- 更新用户列表:添加头像、个人/团队认种、推荐人、状态徽章\n- 更新用户详情:添加头像、KYC状态、认种统计卡片\n- 新增引荐关系Tab:展示引荐人链和直推下级树\n- 新增认种信息Tab:认种汇总和认种分类账明细\n- 新增钱包信息Tab:钱包汇总和钱包分类账明细\n- 更新类型定义和API hooks\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
|
||||||
|
"Bash(ssh ceshi@14.215.128.96 \"cd /home/ceshi/rwadurian/frontend/mining-admin-web && git pull && ls -la deploy.sh\")"
|
||||||
],
|
],
|
||||||
"deny": [],
|
"deny": [],
|
||||||
"ask": []
|
"ask": []
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { Controller, Get } from '@nestjs/common';
|
import { Controller, Get } from '@nestjs/common';
|
||||||
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
||||||
import { PrismaService } from '../../infrastructure/persistence/prisma/prisma.service';
|
import { PrismaService } from '../../infrastructure/persistence/prisma/prisma.service';
|
||||||
|
import { Public } from '../../shared/guards/jwt-auth.guard';
|
||||||
|
|
||||||
@ApiTags('Admin')
|
@ApiTags('Admin')
|
||||||
@Controller('admin')
|
@Controller('admin')
|
||||||
|
|
@ -8,6 +9,7 @@ export class AdminController {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(private readonly prisma: PrismaService) {}
|
||||||
|
|
||||||
@Get('accounts/sync')
|
@Get('accounts/sync')
|
||||||
|
@Public()
|
||||||
@ApiOperation({ summary: '获取所有贡献值账户用于同步' })
|
@ApiOperation({ summary: '获取所有贡献值账户用于同步' })
|
||||||
async getAllAccountsForSync() {
|
async getAllAccountsForSync() {
|
||||||
const accounts = await this.prisma.contributionAccount.findMany({
|
const accounts = await this.prisma.contributionAccount.findMany({
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,8 @@ export class InitializationService {
|
||||||
throw new Error(`Failed to fetch users: ${response.statusText}`);
|
throw new Error(`Failed to fetch users: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { users } = await response.json();
|
const responseData = await response.json();
|
||||||
|
const users = responseData.data?.users || responseData.users || [];
|
||||||
let syncedCount = 0;
|
let syncedCount = 0;
|
||||||
|
|
||||||
for (const user of users) {
|
for (const user of users) {
|
||||||
|
|
@ -155,7 +156,8 @@ export class InitializationService {
|
||||||
throw new Error(`Failed to fetch accounts: ${response.statusText}`);
|
throw new Error(`Failed to fetch accounts: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { accounts } = await response.json();
|
const responseData = await response.json();
|
||||||
|
const accounts = responseData.data?.accounts || responseData.accounts || [];
|
||||||
let syncedCount = 0;
|
let syncedCount = 0;
|
||||||
|
|
||||||
for (const account of accounts) {
|
for (const account of accounts) {
|
||||||
|
|
@ -209,7 +211,8 @@ export class InitializationService {
|
||||||
throw new Error(`Failed to fetch accounts: ${response.statusText}`);
|
throw new Error(`Failed to fetch accounts: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { accounts } = await response.json();
|
const responseData = await response.json();
|
||||||
|
const accounts = responseData.data?.accounts || responseData.accounts || [];
|
||||||
let syncedCount = 0;
|
let syncedCount = 0;
|
||||||
|
|
||||||
for (const account of accounts) {
|
for (const account of accounts) {
|
||||||
|
|
@ -255,7 +258,8 @@ export class InitializationService {
|
||||||
throw new Error(`Failed to fetch accounts: ${response.statusText}`);
|
throw new Error(`Failed to fetch accounts: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { accounts } = await response.json();
|
const responseData = await response.json();
|
||||||
|
const accounts = responseData.data?.accounts || responseData.accounts || [];
|
||||||
let syncedCount = 0;
|
let syncedCount = 0;
|
||||||
|
|
||||||
for (const account of accounts) {
|
for (const account of accounts) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { Controller, Get } from '@nestjs/common';
|
import { Controller, Get } from '@nestjs/common';
|
||||||
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
||||||
import { PrismaService } from '../../infrastructure/persistence/prisma/prisma.service';
|
import { PrismaService } from '../../infrastructure/persistence/prisma/prisma.service';
|
||||||
|
import { Public } from '../../shared/guards/jwt-auth.guard';
|
||||||
|
|
||||||
@ApiTags('Admin')
|
@ApiTags('Admin')
|
||||||
@Controller('admin')
|
@Controller('admin')
|
||||||
|
|
@ -8,6 +9,7 @@ export class AdminController {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(private readonly prisma: PrismaService) {}
|
||||||
|
|
||||||
@Get('accounts/sync')
|
@Get('accounts/sync')
|
||||||
|
@Public()
|
||||||
@ApiOperation({ summary: '获取所有挖矿账户用于同步' })
|
@ApiOperation({ summary: '获取所有挖矿账户用于同步' })
|
||||||
async getAllAccountsForSync() {
|
async getAllAccountsForSync() {
|
||||||
const accounts = await this.prisma.miningAccount.findMany({
|
const accounts = await this.prisma.miningAccount.findMany({
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { Controller, Get } from '@nestjs/common';
|
import { Controller, Get } from '@nestjs/common';
|
||||||
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
||||||
import { PrismaService } from '../../infrastructure/persistence/prisma/prisma.service';
|
import { PrismaService } from '../../infrastructure/persistence/prisma/prisma.service';
|
||||||
|
import { Public } from '../../shared/guards/jwt-auth.guard';
|
||||||
|
|
||||||
@ApiTags('Admin')
|
@ApiTags('Admin')
|
||||||
@Controller('admin')
|
@Controller('admin')
|
||||||
|
|
@ -8,6 +9,7 @@ export class AdminController {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(private readonly prisma: PrismaService) {}
|
||||||
|
|
||||||
@Get('accounts/sync')
|
@Get('accounts/sync')
|
||||||
|
@Public()
|
||||||
@ApiOperation({ summary: '获取所有交易账户用于同步' })
|
@ApiOperation({ summary: '获取所有交易账户用于同步' })
|
||||||
async getAllAccountsForSync() {
|
async getAllAccountsForSync() {
|
||||||
const accounts = await this.prisma.tradingAccount.findMany({
|
const accounts = await this.prisma.tradingAccount.findMany({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue