Browse Source

门店列表ip异常定位处理;

wr_2024_invoice
wurong 5 months ago
parent
commit
a0cad315d8
  1. 8
      lib/retrofit/data/address.dart
  2. 1
      lib/union/union_page.dart
  3. 2
      lib/utils/location.dart

8
lib/retrofit/data/address.dart

@ -9,8 +9,8 @@ class Address {
String cityInfo; String cityInfo;
String id; String id;
bool isDefault; bool isDefault;
String latitude; dynamic latitude;
String longitude; dynamic longitude;
String mid; String mid;
String phone; String phone;
String province; String province;
@ -24,8 +24,8 @@ class Address {
..cityInfo = json['cityInfo'] as String ..cityInfo = json['cityInfo'] as String
..id = json['id'] as String ..id = json['id'] as String
..isDefault = json['isDefault'] as bool ..isDefault = json['isDefault'] as bool
..latitude = json['latitude'] as String ..latitude = json['latitude'] as dynamic
..longitude = json['longitude'] as String ..longitude = json['longitude'] as dynamic
..mid = json['mid'] as String ..mid = json['mid'] as String
..phone = json['phone'] as String ..phone = json['phone'] as String
..province = json['province'] as String ..province = json['province'] as String

1
lib/union/union_page.dart

@ -136,6 +136,7 @@ class UnionPageState extends State<UnionPage>
Address address = await LocationInstance.getInstance().getAddress(result.latitude, result.longitude); Address address = await LocationInstance.getInstance().getAddress(result.latitude, result.longitude);
if (address != null) { if (address != null) {
await saveLatLng(latLng, address.province, address.city, address.area); await saveLatLng(latLng, address.province, address.city, address.area);
areaName = address.city;
} }
LocationInstance.getInstance().stopLocation(); LocationInstance.getInstance().stopLocation();
} else { } else {

2
lib/utils/location.dart

@ -313,7 +313,7 @@ class LocationInstance {
Future<Address> getAddress(double lat, double lang) async { Future<Address> getAddress(double lat, double lang) async {
var result = await ApiService(Dio()).geocodeRegeo("$lat", "$lang"); var result = await ApiService(Dio()).geocodeRegeo("$lat", "$lang");
print("address_result: $result"); print("address_result: $result");
if (result["status"] == 1 && if (result["status"] == "1" &&
result["regeocode"] != null && result["regeocode"] != null &&
result["regeocode"]["addressComponent"] != null) { result["regeocode"]["addressComponent"] != null) {
Address address = Address.fromJson({ Address address = Address.fromJson({

Loading…
Cancel
Save