feat: 产品/客户/订单批量删除;接入 GeoLite2 城市库(地理分布/激活记录/审计日志显示归属地);仪表盘趋势图美化

This commit is contained in:
Logan.Li committed 2026-09-14 22:48:14 +08:00
1 parent 252ae14aef
commit 473dcd0aab
24 files changed
+431 -34

No files matched your search

@@ -8,6 +8,8 @@ import (
"strings"
"time"
"backend/utils"
"gorm.io/gorm"
)
@@ -208,7 +210,8 @@ func (s *AnalyticsService) GetProductDistribution() ([]dto.ProductDistribution,
return results, nil
}
// GetGeoDistribution 地理/网络分布(device_info.country 优先,否则按 IP 粗分) // Logan.Li
// GetGeoDistribution 地理分布:GeoLite2 城市库按 IP 识别(国家/省/市,中文优先),
// device_info 显式声明国家时优先;识别失败回退 公网/内网/未知 // Logan.Li
func (s *AnalyticsService) GetGeoDistribution() ([]dto.GeoDistribution, error) {
var acts []model.Activation
s.db.Where("status = ?", "active").Find(&acts)
@@ -261,6 +264,9 @@ func regionFromActivation(a model.Activation) string {
if ip == "" {
return "未知"
}
if loc := utils.LookupIPLocation(ip); loc != "" {
return loc
}
parsed := net.ParseIP(ip)
if parsed == nil {
return "未知"