补全页显示高德找到的 POI 与类型,类别标出真机用过的
原先没映射出建议的行就是一片空白,可高德其实早就说了「这里是什么」—— 「中国邮政 / 生活服务;邮局」「沙县小吃 / 餐饮服务;中餐厅」, 这种信息看着就能判断该填什么。现在多一列「高德参考」把它显示出来。 类别下拉带上中文,并标出哪几种是**真机确实用过**的: ZCATEGORY_ 那列存的就是这些 MKPOICategory 枚举串,那 12 种导回 rond 一定认得, 其余是 MapKit 支持但你的设备还没用过的,写错只会显示不出类别、不会坏数据。
This commit is contained in:
+27
-6
@@ -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 != "" {
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
<div class="card-sub">
|
||||
建议已经预填在框里,<strong>不满意的直接改或清空</strong>即可,留空就是不动。
|
||||
活动按<strong>地点</strong>补:一次把该地点名下所有没设活动的到访一起填上,不会只改一条。
|
||||
填了现有列表之外的名字,会自动建成新的活动类型。<br>
|
||||
填了现有列表之外的名字,会自动建成新的活动类型。
|
||||
类别下拉里标着「真机用过」的是导出回 rond 时一定能认的;<br>
|
||||
右侧「高德参考」写的是高德在这个坐标上找到的 POI 与类型,猜不出活动时拿它作判断。<br>
|
||||
「用高德分析剩下的」每次处理 40 个、约 4 秒,结果会填进上面还没建议的行里,点多几次即可。
|
||||
</div>
|
||||
<form method="post" action="/admin/fillup/apply">
|
||||
@@ -29,7 +31,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>地点</th><th>城市</th><th class="num">待设到访</th><th>缺什么</th>
|
||||
<th>活动</th><th>类别</th><th>建议来源</th>
|
||||
<th>活动</th><th>类别</th><th>建议来源</th><th>高德参考</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -52,6 +54,11 @@
|
||||
{{else}}<span class="muted">—</span>{{end}}
|
||||
</td>
|
||||
<td data-label="建议来源">{{if $row.Source}}{{$row.Source}}{{else}}<span class="muted">—</span>{{end}}</td>
|
||||
<td data-label="高德参考">
|
||||
{{if $row.AmapType}}
|
||||
<span style="font-size:12.5px">{{if $row.AmapPoi}}{{$row.AmapPoi}}<br>{{end}}<span class="muted">{{$row.AmapType}}</span></span>
|
||||
{{else}}<span class="muted">—</span>{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
@@ -61,7 +68,7 @@
|
||||
{{range .Activities}}<option value="{{.Name}}"></option>{{end}}
|
||||
</datalist>
|
||||
<datalist id="fill-cat">
|
||||
{{range .Categories}}<option value="{{.}}"></option>{{end}}
|
||||
{{range .Categories}}<option value="{{.Value}}" label="{{.Label}}"></option>{{end}}
|
||||
</datalist>
|
||||
<div class="row" style="margin-top:12px">
|
||||
<button class="btn primary" type="submit">执行补全</button>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user