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:
parent
20a73a8d43
commit
e328c75fc1
|
|
@ -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: '持仓信息' })
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue