From a44f6c7c3523f793cd4a00d76c32e4b64187c775 Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 10 Dec 2025 08:23:03 -0800 Subject: [PATCH] fix(mobile): send provinceName/cityName instead of codes to API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit API expects provinceName and cityName (strings) but frontend was sending provinceCode and cityCode (numbers), causing 400 error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../lib/core/services/planting_service.dart | 14 +++++++------- .../presentation/pages/planting_location_page.dart | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/mobile-app/lib/core/services/planting_service.dart b/frontend/mobile-app/lib/core/services/planting_service.dart index f277f7c4..67f7dd2c 100644 --- a/frontend/mobile-app/lib/core/services/planting_service.dart +++ b/frontend/mobile-app/lib/core/services/planting_service.dart @@ -142,21 +142,21 @@ class PlantingService { /// 选择省市 /// /// [orderNo] 订单号 - /// [provinceCode] 省份代码 - /// [cityCode] 城市代码 + /// [provinceName] 省份名称 + /// [cityName] 城市名称 Future selectProvinceCity( String orderNo, - String provinceCode, - String cityCode, + String provinceName, + String cityName, ) async { try { - debugPrint('[PlantingService] 选择省市: orderNo=$orderNo, province=$provinceCode, city=$cityCode'); + debugPrint('[PlantingService] 选择省市: orderNo=$orderNo, province=$provinceName, city=$cityName'); final response = await _apiClient.post( '/planting/orders/$orderNo/select-province-city', data: { - 'provinceCode': provinceCode, - 'cityCode': cityCode, + 'provinceName': provinceName, + 'cityName': cityName, }, ); diff --git a/frontend/mobile-app/lib/features/planting/presentation/pages/planting_location_page.dart b/frontend/mobile-app/lib/features/planting/presentation/pages/planting_location_page.dart index af095daa..e798f6df 100644 --- a/frontend/mobile-app/lib/features/planting/presentation/pages/planting_location_page.dart +++ b/frontend/mobile-app/lib/features/planting/presentation/pages/planting_location_page.dart @@ -126,8 +126,8 @@ class _PlantingLocationPageState extends ConsumerState { // 1. 选择省市 await plantingService.selectProvinceCity( widget.orderNo, - _selectedProvinceCode!, - _selectedCityCode!, + _selectedProvinceName!, + _selectedCityName!, ); // 2. 确认省市选择