路线地图/节点卡片/详情按出行方式显示不同图标(批 19)

出行方式(飞机/火车/游船/自驾/地铁…)原本在路线地图标记、节点卡片交通行、
节点详情「出行方式」行一律显示节点类型图标(赶路节点恒为 🚗),易让人误解。

- TravelModeController 新增 MODE_ICONS(mode_type → emoji 映射)
- ActivityController::show() 两路查询 LEFT JOIN travel_modes 取 mode_type,注入 modeIcons
- 路线地图标记 / 卡片交通行 / 详情出行方式行:优先用出行方式图标,
  未选出行方式时回退节点类型图标
This commit is contained in:
2026-09-24 20:08:17 +08:00
parent 28fb9f6112
commit 02f40b6d6f
6 changed files with 52 additions and 5 deletions
+8 -2
View File
@@ -314,18 +314,22 @@ class ActivityController
exit('活动不存在');
}
$stmt = $db->prepare('SELECT tn.*, nt.name AS node_type_name, nt.icon AS node_type_icon
$stmt = $db->prepare('SELECT tn.*, nt.name AS node_type_name, nt.icon AS node_type_icon,
tm.mode_type AS travel_mode_type
FROM trip_nodes tn
LEFT JOIN node_types nt ON nt.id = tn.node_type_id
LEFT JOIN travel_modes tm ON tm.id = tn.travel_mode_id
WHERE tn.activity_id = ? AND tn.node_category = "plan"
ORDER BY tn.start_time ASC');
$stmt->execute([$id]);
$planNodes = $stmt->fetchAll();
$this->attachCounts($db, $planNodes);
$stmt = $db->prepare('SELECT tn.*, nt.name AS node_type_name, nt.icon AS node_type_icon
$stmt = $db->prepare('SELECT tn.*, nt.name AS node_type_name, nt.icon AS node_type_icon,
tm.mode_type AS travel_mode_type
FROM trip_nodes tn
LEFT JOIN node_types nt ON nt.id = tn.node_type_id
LEFT JOIN travel_modes tm ON tm.id = tn.travel_mode_id
WHERE tn.activity_id = ? AND tn.node_category = "reality"
ORDER BY tn.start_time ASC');
$stmt->execute([$id]);
@@ -352,6 +356,8 @@ class ActivityController
'nodeMembers' => $nodeMembers,
// 路线地图:每个执行节点第一张图片附件 id(圆形标记用),一条 GROUP BY 防止 N+1
'nodeFirstImage' => Attachments::firstImageIdsForNodes(array_column($realityNodes, 'id')),
// 批 19:路线地图标记图标按出行方式映射(回退节点类型图标)
'modeIcons' => TravelModeController::MODE_ICONS,
'expenseSummary' => Expenses::summaryForActivity($id),
'commentTree' => Comments::tree(Comments::TARGET_ACTIVITY, $id),
'pageTitle' => $activity['title'],
+2
View File
@@ -316,6 +316,8 @@ class NodeController
'travel_mode_label' => $travelModeLabel,
'travel_mode_type' => $travelModeType,
]),
// 批 19:出行方式图标映射,节点详情「出行方式」行前展示
'modeIcons' => TravelModeController::MODE_ICONS,
'attachmentCount' => $attachmentCount,
'attachments' => $nodeAttachments,
'members' => Members::forNode($nodeId),
+19
View File
@@ -22,6 +22,25 @@ class TravelModeController
'other' => '其他',
];
/**
* 出行方式 → 地图/卡片上的图标(emoji)。
* 自驾两类仍用 🚗(本来就是开车);其余按交通工具区分,
* 避免路线地图上「一律汽车」让人误解(批 19)。未列入的 mode_type 回退到节点类型图标。
*/
public const MODE_ICONS = [
'drive_own' => '🚗',
'drive_rental' => '🚙',
'train' => '🚄',
'plane' => '✈️',
'bus' => '🚌',
'subway' => '🚇',
'taxi' => '🚕',
'bike' => '🚲',
'walk' => '🚶',
'ship' => '🚢',
'other' => '🔀',
];
public function index(): void
{
$this->requireLogin();