fix(pre-planting): 修复前后端 API 路径不匹配导致预种页面打不开

后端 PrePlantingController 缺少 eligibility 端点,前端请求 404 导致
Future.wait 整体失败,页面显示"加载数据失败"。

修复:
1. 后端: 在 PrePlantingController 添加 GET eligibility 端点
2. 前端: createOrder 路径从 /orders 改为 /purchase(匹配后端)
3. 前端: signMergeContract 路径从 /merges/:no/sign 改为 /sign-contract

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-26 23:07:47 -08:00
parent 20a73a8d43
commit e328c75fc1
2 changed files with 15 additions and 7 deletions

View File

@ -66,6 +66,13 @@ export class PrePlantingController {
return { success: true };
}
@Get('eligibility')
@ApiOperation({ summary: '查询当前用户预种购买资格' })
@ApiResponse({ status: HttpStatus.OK, description: '资格信息' })
async getEligibility(@Req() req: AuthenticatedRequest) {
return this.prePlantingService.getEligibility(req.user.accountSequence);
}
@Get('position')
@ApiOperation({ summary: '获取预种持仓信息' })
@ApiResponse({ status: HttpStatus.OK, description: '持仓信息' })

View File

@ -10,14 +10,14 @@ import '../network/api_client.dart';
//
// === API ===
// planting-service PrePlantingModule
// - GET /pre-planting/config public controller
// - GET /pre-planting/eligibility
// - GET /pre-planting/position
// - GET /pre-planting/config
// - POST /pre-planting/orders
// - POST /pre-planting/orders/:no/pay
// - GET /pre-planting/orders
// - GET /pre-planting/merges
// - GET /pre-planting/merges/:id
// - POST /pre-planting/merges/:id/sign
// - GET /pre-planting/merges/:no
// - POST /pre-planting/purchase
// - POST /pre-planting/sign-contract
//
// === PlantingService ===
// PlantingService 15831 USDT/
@ -386,7 +386,7 @@ class PrePlantingService {
if (cityName != null) data['cityName'] = cityName;
final response = await _apiClient.post(
'/pre-planting/orders',
'/pre-planting/purchase',
data: data,
);
@ -496,7 +496,8 @@ class PrePlantingService {
try {
debugPrint('[PrePlantingService] 签署合并合同: mergeNo=$mergeNo');
final response = await _apiClient.post(
'/pre-planting/merges/$mergeNo/sign',
'/pre-planting/sign-contract',
data: {'mergeNo': mergeNo},
);
if (response.statusCode == 200) {