feat(site): 方案 C - 「我常访问」个人榜(匿名 ID + localStorage 合并)
- NavClick 加 anon_id 字段(已为历史表自动迁移) - 后端静默下发 wk_anon cookie(uuid4,1 年,HttpOnly) - 点击埋点写入 anon_id;新增 GET /site/api/my-top 与 POST /site/api/my-clear - 首页服务端渲染「我常访问」区(时间衰减加权分),与「热门网址」共显 - 前端 localStorage 累计 + 与服务端榜取 max 合并;冷启动阈值 2 个网址 - 一键清除:清 localStorage + 服务端删该匿名 ID 的全部记录 - 移动端抽屉、顶部导航同步加「我常访问」入口 - 底部隐私说明更新
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
每条记录是用户点了一次某张 Nav 卡片跳出去的事件。
|
||||
- nav_id 关联 public_nav.id
|
||||
- anon_id 匿名访客 ID(后端静默下发的 cookie,不关联账号)
|
||||
- day YYYY-MM-DD 日期
|
||||
- ip 访客 IP(用于去重 / 隐私留存期控制)
|
||||
- clicked_at 点击时间
|
||||
@@ -16,6 +17,7 @@ class NavClick(db.Model):
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='记录ID')
|
||||
nav_id = db.Column(db.Integer, nullable=False, index=True, comment='被点击的导航ID')
|
||||
anon_id = db.Column(db.String(36), default='', index=True, comment='匿名访客ID')
|
||||
day = db.Column(db.String(10), default='', index=True, comment='日期 YYYY-MM-DD')
|
||||
ip = db.Column(db.String(64), default='', comment='访客IP')
|
||||
clicked_at = db.Column(db.DateTime, default=datetime.datetime.now, index=True, comment='点击时间')
|
||||
Reference in New Issue
Block a user