From 9c7e152361286d5baf92790cae27f9c619f9831a Mon Sep 17 00:00:00 2001 From: tamakyi Date: Sat, 19 Sep 2026 16:46:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=A8=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=AB=98=E5=BE=B7=E6=89=BE=E5=88=B0=E7=9A=84=20POI=20=E4=B8=8E?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E7=B1=BB=E5=88=AB=E6=A0=87=E5=87=BA?= =?UTF-8?q?=E7=9C=9F=E6=9C=BA=E7=94=A8=E8=BF=87=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原先没映射出建议的行就是一片空白,可高德其实早就说了「这里是什么」—— 「中国邮政 / 生活服务;邮局」「沙县小吃 / 餐饮服务;中餐厅」, 这种信息看着就能判断该填什么。现在多一列「高德参考」把它显示出来。 类别下拉带上中文,并标出哪几种是**真机确实用过**的: ZCATEGORY_ 那列存的就是这些 MKPOICategory 枚举串,那 12 种导回 rond 一定认得, 其余是 MapKit 支持但你的设备还没用过的,写错只会显示不出类别、不会坏数据。 --- internal/web/fillup.go | 33 +++++++++++++++++++----- internal/web/templates/admin/fillup.html | 13 +++++++--- internal/web/view.go | 9 +++++++ 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/internal/web/fillup.go b/internal/web/fillup.go index d83d641..3fb93af 100644 --- a/internal/web/fillup.go +++ b/internal/web/fillup.go @@ -20,8 +20,10 @@ import ( // fillupHint 是一次高德查询给出的建议(按地点 id 缓存在内存里,页面重载仍能看到)。 type fillupHint struct { - Act string - Cat string + Act string + Cat string + Type string // 高德给的原始类型(「餐饮服务;咖啡厅」),没映射上时给站长看 + Poi string // 最近的 POI 名字,同样只作参考 } var ( @@ -57,6 +59,8 @@ type FillupRow struct { ActID int64 // 建议命中现有活动时的 id;0 表示得新建 CatHint string // 建议的类别 Source string // 建议从哪来 + AmapType string // 高德给出的类型原文,供人工判断(可能没映射出建议) + AmapPoi string // 高德找到的最近 POI 名字 } func (r FillupRow) Missing() string { @@ -75,7 +79,7 @@ type FillupData struct { Page Rows []FillupRow Activities []activityOption // 下拉选项 - Categories []string // 类别下拉选项 + Categories []fillupCategory // 类别下拉选项 Total int WithHint int } @@ -149,6 +153,7 @@ func (s *Server) fillupRows(ctx context.Context, datasetID int64) ([]FillupRow, if out[i].NoCat && h.Cat != "" { out[i].CatHint = h.Cat } + out[i].AmapType, out[i].AmapPoi = h.Type, h.Poi } } sort.SliceStable(out, func(i, j int) bool { @@ -212,8 +217,16 @@ func (s *Server) activityOptions(ctx context.Context, datasetID int64) ([]activi return out, rows.Err() } +// fillupCategory 是类别下拉的一项。Label 用中文,并标出这一种真机到底用过没有—— +// ZCATEGORY_ 那列真机存的就是这些 MKPOICategory 枚举串,写错名字不会损坏数据, +// 但会显示不出类别,所以优先选「真机用过」的那几种。 +type fillupCategory struct { + Value string + Label string +} + // fillupCategories 是类别下拉的选项:真机用过的 12 种在前,其余常见 MapKit 类别在后。 -func fillupCategories() []string { +func fillupCategories() []fillupCategory { known := []string{ "MKPOICategoryRestaurant", "MKPOICategoryStore", "MKPOICategoryPublicTransport", "MKPOICategoryHotel", "MKPOICategoryLandmark", "MKPOICategoryFoodMarket", @@ -228,7 +241,14 @@ func fillupCategories() []string { "MKPOICategoryNationalPark", "MKPOICategoryAquarium", "MKPOICategoryAmusementPark", "MKPOICategoryGasStation", "MKPOICategoryCarRental", "MKPOICategoryMarina", } - return append(known, extra...) + out := make([]fillupCategory, 0, len(known)+len(extra)) + for _, c := range known { + out = append(out, fillupCategory{c, poiName(c) + "(真机用过)"}) + } + for _, c := range extra { + out = append(out, fillupCategory{c, poiName(c)}) + } + return out } // adminFillupApply 执行补全。表单里每行两个字段: @@ -411,9 +431,10 @@ func (s *Server) adminFillupAmap(w http.ResponseWriter, r *http.Request) { if n >= fillupAmapBatch { break } - _, typ, _, ok := s.amapAround(ctx, row.Lat, row.Lon) + poi, typ, _, ok := s.amapAround(ctx, row.Lat, row.Lon) var h fillupHint if ok { + h.Type, h.Poi = typ, poi h.Act = guessActivityFromAmapType(typ) h.Cat = guessCategoryFromAmapType(typ) if h.Act != "" || h.Cat != "" { diff --git a/internal/web/templates/admin/fillup.html b/internal/web/templates/admin/fillup.html index 1c2b78d..25d46dd 100644 --- a/internal/web/templates/admin/fillup.html +++ b/internal/web/templates/admin/fillup.html @@ -20,7 +20,9 @@
建议已经预填在框里,不满意的直接改或清空即可,留空就是不动。 活动按地点补:一次把该地点名下所有没设活动的到访一起填上,不会只改一条。 - 填了现有列表之外的名字,会自动建成新的活动类型。
+ 填了现有列表之外的名字,会自动建成新的活动类型。 + 类别下拉里标着「真机用过」的是导出回 rond 时一定能认的;
+ 右侧「高德参考」写的是高德在这个坐标上找到的 POI 与类型,猜不出活动时拿它作判断。
「用高德分析剩下的」每次处理 40 个、约 4 秒,结果会填进上面还没建议的行里,点多几次即可。
@@ -29,7 +31,7 @@ 地点城市待设到访缺什么 - 活动类别建议来源 + 活动类别建议来源高德参考 @@ -52,6 +54,11 @@ {{else}}—{{end}} {{if $row.Source}}{{$row.Source}}{{else}}—{{end}} + + {{if $row.AmapType}} + {{if $row.AmapPoi}}{{$row.AmapPoi}}
{{end}}{{$row.AmapType}}
+ {{else}}—{{end}} + {{end}} @@ -61,7 +68,7 @@ {{range .Activities}}{{end}} - {{range .Categories}}{{end}} + {{range .Categories}}{{end}}
diff --git a/internal/web/view.go b/internal/web/view.go index 6c1f898..918bd28 100644 --- a/internal/web/view.go +++ b/internal/web/view.go @@ -1268,6 +1268,15 @@ var poiNames = map[string]string{ "MKPOICategoryPharmacy": "药店", "MKPOICategoryHospital": "医院", "MKPOICategorySpa": "水疗", "MKPOICategoryAirport": "机场", "MKPOICategoryMarina": "码头", "MKPOICategoryPostOffice": "邮局", "MKPOICategoryMarina2": "码头", + + "MKPOICategoryBakery": "面包店", "MKPOICategoryLibrary": "图书馆", + "MKPOICategoryUniversity": "大学", "MKPOICategoryAquarium": "水族馆", + "MKPOICategoryFitnessCenter": "健身中心", "MKPOICategoryMovieTheater": "电影院", + "MKPOICategoryTheater": "剧院", "MKPOICategoryParking": "停车场", + "MKPOICategoryBank": "银行", "MKPOICategoryAtm": "取款机", + "MKPOICategoryPolice": "派出所", "MKPOICategoryCarRental": "租车", + "MKPOICategoryGasStation": "加油站", "MKPOICategoryAmusementPark": "游乐园", + "MKPOICategoryRestroom": "洗手间", "MKPOICategoryFireStation": "消防站", } func poiName(s string) string {