xueyiming пре 1 недеља
родитељ
комит
b49078e099

+ 4 - 1
app/api/routes.py

@@ -56,16 +56,19 @@ MONTHLY_ELEMENT_DEMAND_EXPORT_COLUMNS: list[tuple[str, str]] = [
 HOT_CONTENT_DEMAND_EXPORT_COLUMNS: list[tuple[str, str]] = [
     ("来源", "source"),
     ("热点标题", "hot_title"),
+    ("词条", "item_text"),
     ("类型", "point_category"),
     ("需求类型", "item_type_label"),
-    ("匹配需求", "matched_demand"),
     ("是否成为需求", "is_as_demand_label"),
+    ("匹配需求", "matched_demand"),
     ("创建时间", "record_created_at"),
     ("贡献分", "contribution_score"),
     ("最高微信指数词", "wxindex_keyword"),
     ("待选微信指数词", "all_hot_keywords"),
     ("微信指数热度", "wxindex_latest_score"),
     ("微信指数趋势", "wxindex_trend"),
+    ("事件性得分", "event_sense_score"),
+    ("老年性得分", "senior_fit_score"),
 ]
 
 

+ 10 - 0
app/services/hot_content_demand_export_service.py

@@ -24,6 +24,7 @@ SELECT
     e.id,
     e.source,
     e.hot_title,
+    e.item_text,
     e.point_category,
     e.matched_demand,
     e.is_as_demand,
@@ -32,6 +33,8 @@ SELECT
     e.all_hot_keywords,
     e.wxindex_latest_score,
     e.wxindex_trend,
+    e.event_sense_score,
+    e.senior_fit_score,
     e.item_type,
     r.created_at AS record_created_at
 FROM hot_content_demand_exports e
@@ -145,6 +148,7 @@ def _row_to_dict(row: dict[str, Any]) -> dict[str, object]:
         "id": int(row["id"]),
         "source": str(row.get("source") or ""),
         "hot_title": str(row.get("hot_title") or ""),
+        "item_text": str(row.get("item_text") or ""),
         "point_category": str(row.get("point_category") or ""),
         "item_type": str(row.get("item_type") or ""),
         "item_type_label": _item_type_label(row.get("item_type")),
@@ -156,6 +160,12 @@ def _row_to_dict(row: dict[str, Any]) -> dict[str, object]:
         "all_hot_keywords": str(row.get("all_hot_keywords") or ""),
         "wxindex_latest_score": float(row.get("wxindex_latest_score") or 0),
         "wxindex_trend": str(row.get("wxindex_trend") or ""),
+        "event_sense_score": float(row["event_sense_score"])
+        if row.get("event_sense_score") is not None
+        else None,
+        "senior_fit_score": float(row["senior_fit_score"])
+        if row.get("senior_fit_score") is not None
+        else None,
         "item_type": str(row.get("item_type") or ""),
         "record_created_at": record_created_at,
     }

+ 54 - 12
frontend/src/App.tsx

@@ -23,6 +23,7 @@ import type { SortOrder } from "antd/es/table/interface";
 import dayjs from "dayjs";
 import type { Dayjs } from "dayjs";
 import HotContentSourcePage from "./HotContentSourcePage";
+import EllipsisCell from "./EllipsisCell";
 
 type DemandPoolItem = {
   id: number;
@@ -1293,6 +1294,7 @@ type HotContentDemandExportItem = {
   id: number;
   source: string;
   hot_title: string;
+  item_text: string;
   point_category: string;
   item_type: string;
   item_type_label: string;
@@ -1304,7 +1306,8 @@ type HotContentDemandExportItem = {
   all_hot_keywords: string;
   wxindex_latest_score: number;
   wxindex_trend: string;
-  item_type: string;
+  event_sense_score: number | null;
+  senior_fit_score: number | null;
   record_created_at: string;
 };
 
@@ -1484,6 +1487,7 @@ function HotContentDemandExportPanel({ active }: { active: boolean }) {
         width: 100,
         ellipsis: true,
         fixed: "left",
+        render: (v: string) => <EllipsisCell value={v} />,
       },
       {
         title: "热点标题",
@@ -1491,12 +1495,22 @@ function HotContentDemandExportPanel({ active }: { active: boolean }) {
         width: 220,
         ellipsis: true,
         fixed: "left",
+        render: (v: string) => <EllipsisCell value={v} />,
+      },
+      {
+        title: "词条",
+        dataIndex: "item_text",
+        width: 160,
+        ellipsis: true,
+        fixed: "left",
+        render: (v: string) => <EllipsisCell value={v} />,
       },
       {
         title: "类型",
         dataIndex: "point_category",
         width: 100,
         fixed: "left",
+        render: (v: string) => <EllipsisCell value={v} />,
       },
       {
         title: "需求类型",
@@ -1505,13 +1519,6 @@ function HotContentDemandExportPanel({ active }: { active: boolean }) {
         align: "center",
         fixed: "left",
       },
-      {
-        title: "匹配需求",
-        dataIndex: "matched_demand",
-        width: 200,
-        ellipsis: true,
-        fixed: "left",
-      },
       {
         title: "是否成为需求",
         dataIndex: "is_as_demand_label",
@@ -1519,6 +1526,13 @@ function HotContentDemandExportPanel({ active }: { active: boolean }) {
         align: "center",
         fixed: "left",
       },
+      {
+        title: "匹配需求",
+        dataIndex: "matched_demand",
+        width: 200,
+        ellipsis: true,
+        render: (v: string) => <EllipsisCell value={v} />,
+      },
       {
         title: "创建时间",
         dataIndex: "record_created_at",
@@ -1532,8 +1546,20 @@ function HotContentDemandExportPanel({ active }: { active: boolean }) {
         render: (v: number | null) =>
           v === null || v === undefined ? "-" : Number(v).toFixed(2),
       },
-      { title: "最高微信指数词", dataIndex: "wxindex_keyword", width: 160, ellipsis: true },
-      { title: "待选微信指数词", dataIndex: "all_hot_keywords", width: 200, ellipsis: true },
+      {
+        title: "最高微信指数词",
+        dataIndex: "wxindex_keyword",
+        width: 160,
+        ellipsis: true,
+        render: (v: string) => <EllipsisCell value={v} />,
+      },
+      {
+        title: "待选微信指数词",
+        dataIndex: "all_hot_keywords",
+        width: 200,
+        ellipsis: true,
+        render: (v: string) => <EllipsisCell value={v} />,
+      },
       {
         title: "微信指数热度",
         dataIndex: "wxindex_latest_score",
@@ -1541,7 +1567,23 @@ function HotContentDemandExportPanel({ active }: { active: boolean }) {
         align: "right",
         render: (v: number) => Number(v ?? 0).toLocaleString(),
       },
-      { title: "微信指数趋势", dataIndex: "wxindex_trend", width: 110 },
+      { title: "微信指数趋势", dataIndex: "wxindex_trend", width: 110, render: (v: string) => <EllipsisCell value={v} /> },
+      {
+        title: "事件性得分",
+        dataIndex: "event_sense_score",
+        width: 110,
+        align: "right",
+        render: (v: number | null) =>
+          v === null || v === undefined ? "-" : Number(v).toFixed(2),
+      },
+      {
+        title: "老年性得分",
+        dataIndex: "senior_fit_score",
+        width: 110,
+        align: "right",
+        render: (v: number | null) =>
+          v === null || v === undefined ? "-" : Number(v).toFixed(2),
+      },
     ],
     [],
   );
@@ -1658,7 +1700,7 @@ function HotContentDemandExportPanel({ active }: { active: boolean }) {
               columns={columns}
               dataSource={data.items}
               pagination={false}
-              scroll={{ x: 1690 }}
+              scroll={{ x: 2100 }}
               rowClassName={(_, index) => (index % 2 === 0 ? "row-even" : "row-odd")}
             />
           </div>

+ 20 - 0
frontend/src/EllipsisCell.tsx

@@ -0,0 +1,20 @@
+import { Tooltip } from "antd";
+
+type EllipsisCellProps = {
+  value: unknown;
+};
+
+export default function EllipsisCell({ value }: EllipsisCellProps) {
+  const text = value === null || value === undefined || value === "" ? "-" : String(value);
+  const node = <span className="table-cell-ellipsis">{text}</span>;
+
+  if (text === "-") {
+    return node;
+  }
+
+  return (
+    <Tooltip title={text} placement="topLeft" mouseEnterDelay={0.3}>
+      {node}
+    </Tooltip>
+  );
+}

+ 7 - 0
frontend/src/styles.css

@@ -381,6 +381,13 @@ body {
   border-inline-end: none !important;
 }
 
+.table-cell-ellipsis {
+  display: block;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
 .panel-section--table .ant-table-tbody > tr > td {
   border-bottom: none !important;
 }