diff --git a/src/Controllers/ActivityController.php b/src/Controllers/ActivityController.php index a11efdc..1aa25d1 100644 --- a/src/Controllers/ActivityController.php +++ b/src/Controllers/ActivityController.php @@ -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'], diff --git a/src/Controllers/NodeController.php b/src/Controllers/NodeController.php index c2704ae..ad6754c 100644 --- a/src/Controllers/NodeController.php +++ b/src/Controllers/NodeController.php @@ -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), diff --git a/src/Controllers/TravelModeController.php b/src/Controllers/TravelModeController.php index 052968f..858e835 100644 --- a/src/Controllers/TravelModeController.php +++ b/src/Controllers/TravelModeController.php @@ -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(); diff --git a/templates/activities/_node_card.php b/templates/activities/_node_card.php index c7b997d..8b32c29 100644 --- a/templates/activities/_node_card.php +++ b/templates/activities/_node_card.php @@ -66,8 +66,15 @@ if ($cardCategory === 'plan') { + -
🚄
+
diff --git a/templates/activities/show.php b/templates/activities/show.php index 392fb33..62982cb 100644 --- a/templates/activities/show.php +++ b/templates/activities/show.php @@ -42,6 +42,7 @@ 查不到就保持缺省,不硬造位置。AMap 2.0 已由 layout.php 全局加载。 */ $routeNodes = []; $nodeFirstImage = $nodeFirstImage ?? []; +$modeIcons = $modeIcons ?? []; // 批 19:出行方式→图标映射,由控制器注入 foreach (($realityNodes ?? []) as $rn) { $s = json_decode_field($rn['start_location'] ?? null); $e = json_decode_field($rn['end_location'] ?? null); @@ -53,10 +54,17 @@ foreach (($realityNodes ?? []) as $rn) { continue; // 坐标和地名一个都没有的节点不上地图 } $imgId = (int)($nodeFirstImage[(int)$rn['id']] ?? 0); + // 批 19:标记图标优先用「出行方式」的图标;没选出行方式时回退到节点类型图标 + //(赶路节点没选方式 → 仍是 🚗;选了飞机/火车/游船等 → 显示对应交通工具图标,不再一律汽车)。 + $rnModeType = (string)($rn['travel_mode_type'] ?? ''); + $rnIcon = ($rnModeType !== '' && isset($modeIcons[$rnModeType])) + ? $modeIcons[$rnModeType] + : (string)($rn['node_type_icon'] ?: '📍'); + $routeNodes[] = [ 'id' => (int)$rn['id'], 'title' => (string)($rn['title'] ?: '(无标题节点)'), - 'icon' => (string)($rn['node_type_icon'] ?: '📍'), + 'icon' => $rnIcon, 'img' => $imgId > 0 ? media_att($imgId) : '', 'url' => url('nodes/show', ['id' => (int)$rn['id']]), 'sname' => $sname, // 出发地名:没有坐标时交给高德地理编码兜底 diff --git a/templates/nodes/show.php b/templates/nodes/show.php index 34a5e2f..ff115d4 100644 --- a/templates/nodes/show.php +++ b/templates/nodes/show.php @@ -87,7 +87,12 @@ if (!empty($node['duration_minutes'])) {
出行方式 - + +