|
|
@@ -98,7 +98,17 @@ const app = new OpenAPIHono()
|
|
|
const { provinceId, cityId, districtId, keyword, page, pageSize } = c.req.valid('query');
|
|
|
|
|
|
// 模拟地点数据
|
|
|
- const mockLocations = [
|
|
|
+ const mockLocations: Array<{
|
|
|
+ id: number;
|
|
|
+ name: string;
|
|
|
+ address: string;
|
|
|
+ province: string;
|
|
|
+ city: string;
|
|
|
+ district: string;
|
|
|
+ latitude: number;
|
|
|
+ longitude: number;
|
|
|
+ type: '火车站' | '汽车站' | '机场' | '景点' | '酒店' | '其他';
|
|
|
+ }> = [
|
|
|
{
|
|
|
id: 1,
|
|
|
name: '北京南站',
|
|
|
@@ -194,7 +204,7 @@ const app = new OpenAPIHono()
|
|
|
|
|
|
if (provinceId) {
|
|
|
// 根据省份ID筛选(这里简化处理,实际应该根据省份名称映射)
|
|
|
- const provinceMap = {
|
|
|
+ const provinceMap: Record<number, string> = {
|
|
|
1: '北京市',
|
|
|
9: '上海市'
|
|
|
};
|
|
|
@@ -206,7 +216,7 @@ const app = new OpenAPIHono()
|
|
|
|
|
|
if (cityId) {
|
|
|
// 根据城市ID筛选
|
|
|
- const cityMap = {
|
|
|
+ const cityMap: Record<number, string> = {
|
|
|
11: '北京市',
|
|
|
31: '上海市'
|
|
|
};
|
|
|
@@ -218,7 +228,7 @@ const app = new OpenAPIHono()
|
|
|
|
|
|
if (districtId) {
|
|
|
// 根据区县ID筛选
|
|
|
- const districtMap = {
|
|
|
+ const districtMap: Record<number, string> = {
|
|
|
110105: '朝阳区',
|
|
|
310101: '黄浦区'
|
|
|
};
|
|
|
@@ -251,7 +261,7 @@ const app = new OpenAPIHono()
|
|
|
}
|
|
|
},
|
|
|
message: '搜索地点成功'
|
|
|
- }, 200);
|
|
|
+ } as const, 200);
|
|
|
} catch (error) {
|
|
|
console.error('搜索地点失败:', error);
|
|
|
return c.json({
|