5adb3d621b
- 后端 Visit 模型(date+ip 唯一索引):POST /api/track 埋点(ClientIP upsert,pv+1),GET /api/admin/visits 每日 UV/PV 统计 - web 每会话上报一次访问(sessionStorage 防重),IP 由后端去重 - admin 访问统计页:侧边栏入口 + 今日/近N天 UV·PV 卡片 + 每日柱状趋势(自绘无依赖) + 7/30/90 天切换 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
11 lines
363 B
Go
11 lines
363 B
Go
package model
|
|
|
|
// Visit 用户端访问记录,按 (date, ip) 去重:每行代表某 IP 某天来过(UV);
|
|
// pv 记该 IP 当天访问次数。表名 sundynix_visit。
|
|
type Visit struct {
|
|
BaseModel
|
|
Date string `gorm:"size:10;uniqueIndex:uk_date_ip" json:"date"`
|
|
IP string `gorm:"size:64;uniqueIndex:uk_date_ip" json:"ip"`
|
|
PV int64 `json:"pv"`
|
|
}
|