提交 34320b00 authored 作者: 袁静春's avatar 袁静春

提交:修改周边搜索代码;

上级 c2fa7d00
...@@ -29,7 +29,7 @@ class _MyAppState extends State<MyApp> { ...@@ -29,7 +29,7 @@ class _MyAppState extends State<MyApp> {
// var result1 = await ClxMapPoiSearch.instance.aroundSearch(31.230378, 121.473658); // var result1 = await ClxMapPoiSearch.instance.aroundSearch(31.230378, 121.473658);
// print("------ result1: $result1"); // print("------ result1: $result1");
var result2 = await ClxMapPoiSearch.instance.aroundSearchAll("卫生间", city: "南京",); var result2 = await ClxMapPoiSearch.instance.aroundSearchAll("停车场", city: "南京",);
print("------ result2: $result2"); print("------ result2: $result2");
} }
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
NSString *keywords = arguments[@"keywords"]; NSString *keywords = arguments[@"keywords"];
NSString *city = arguments[@"city"]; NSString *city = arguments[@"city"];
if ((latitude != nil && [latitude intValue] != 0) && (longitude != nil && [longitude intValue] != 0)) { if (![latitude isKindOfClass:[NSNull class]] && ![longitude isKindOfClass:[NSNull class]]) {
NSLog(@"aroundSearchAll 经纬度不为0 - latitude:%@, longitude:%@", latitude, longitude); NSLog(@"aroundSearchAll 经纬度不为0 - latitude:%@, longitude:%@", latitude, longitude);
AMapPOIAroundSearchRequest *request = [[AMapPOIAroundSearchRequest alloc] init]; AMapPOIAroundSearchRequest *request = [[AMapPOIAroundSearchRequest alloc] init];
...@@ -119,10 +119,10 @@ ...@@ -119,10 +119,10 @@
request.page = 1; request.page = 1;
request.offset = 20; request.offset = 20;
request.radius = 1000; request.radius = 1000;
if (keywords != nil && [keywords isKindOfClass:[NSNull class]]) { if (![keywords isKindOfClass:[NSNull class]]) {
request.keywords = keywords; request.keywords = keywords;
} }
if (city != nil && ![city isKindOfClass:[NSNull class]]) { if (![city isKindOfClass:[NSNull class]]) {
request.city = city; request.city = city;
} }
[self.search AMapPOIAroundSearch:request]; [self.search AMapPOIAroundSearch:request];
...@@ -130,7 +130,12 @@ ...@@ -130,7 +130,12 @@
NSLog(@"aroundSearchAll 经纬度为0 - latitude:%@, longitude:%@", latitude, longitude); NSLog(@"aroundSearchAll 经纬度为0 - latitude:%@, longitude:%@", latitude, longitude);
AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init]; AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init];
request.keywords = keywords; if (![keywords isKindOfClass:[NSNull class]]) {
request.keywords = keywords;
}
if (![city isKindOfClass:[NSNull class]]) {
request.city = city;
}
request.cityLimit = YES; request.cityLimit = YES;
request.page = 1; request.page = 1;
request.offset = 20; request.offset = 20;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论