更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -12,7 +12,6 @@ import (
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// PlatformAnalyticsController 平台端数据统计(真实数据,不做任何模拟)
|
||||
type PlatformAnalyticsController struct {
|
||||
beego.Controller
|
||||
}
|
||||
@@ -23,14 +22,6 @@ func (c *PlatformAnalyticsController) analyticsFail(httpStatus, bizCode int, msg
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
// Users GET /platform/analytics/users
|
||||
//
|
||||
// 统计租户端(backend)真实的用户与租户数据:
|
||||
// - 用户:yz_system_tenant_user(不含已删除)
|
||||
// - 租户:yz_system_tenant(不含已删除)
|
||||
// - 活跃:yz_system_login_log 近 30 天成功登录的去重用户 / 今日登录次数
|
||||
//
|
||||
// 返回:总量、今日/本月新增、近 14 天新增趋势、各租户用户数分布。
|
||||
func (c *PlatformAnalyticsController) Users() {
|
||||
if _, err := requirePlatform(&c.Controller); err != nil {
|
||||
code := identity.Status(err)
|
||||
@@ -42,7 +33,7 @@ func (c *PlatformAnalyticsController) Users() {
|
||||
today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
||||
monthStart := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location())
|
||||
lastMonthStart := monthStart.AddDate(0, -1, 0)
|
||||
trendStart := today.AddDate(0, 0, -13) // 含今天共 14 天
|
||||
trendStart := today.AddDate(0, 0, -13)
|
||||
activeSince := now.AddDate(0, 0, -30)
|
||||
|
||||
userQuery := func() orm.QuerySeter {
|
||||
@@ -54,7 +45,6 @@ func (c *PlatformAnalyticsController) Users() {
|
||||
Filter("delete_time__isnull", true)
|
||||
}
|
||||
|
||||
// ===== 用户 =====
|
||||
totalUsers, _ := userQuery().Count()
|
||||
activeUsers, _ := userQuery().Filter("status", 1).Count()
|
||||
todayNewUsers, _ := userQuery().Filter("create_time__gte", today).Count()
|
||||
@@ -64,13 +54,11 @@ func (c *PlatformAnalyticsController) Users() {
|
||||
Filter("create_time__lt", monthStart).
|
||||
Count()
|
||||
|
||||
// ===== 租户 =====
|
||||
totalTenants, _ := tenantQuery().Count()
|
||||
activeTenants, _ := tenantQuery().Filter("status", 1).Count()
|
||||
todayNewTenants, _ := tenantQuery().Filter("create_time__gte", today).Count()
|
||||
monthNewTenants, _ := tenantQuery().Filter("create_time__gte", monthStart).Count()
|
||||
|
||||
// ===== 活跃用户(近 30 天成功登录)=====
|
||||
var loginLogs []models.SystemLoginLog
|
||||
_, _ = models.Orm.QueryTable(new(models.SystemLoginLog)).
|
||||
Filter("create_time__gte", activeSince).
|
||||
@@ -88,7 +76,6 @@ func (c *PlatformAnalyticsController) Users() {
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 近 14 天新增趋势 =====
|
||||
const trendDays = 14
|
||||
days := make([]string, trendDays)
|
||||
dayUsers := make([]int, trendDays)
|
||||
@@ -117,7 +104,6 @@ func (c *PlatformAnalyticsController) Users() {
|
||||
}
|
||||
}
|
||||
|
||||
// ===== 各租户用户数分布(Top 8 + 其他)=====
|
||||
var allUsers []models.SystemTenantUser
|
||||
_, _ = userQuery().All(&allUsers)
|
||||
countByTid := make(map[uint64]int, len(allUsers))
|
||||
@@ -172,7 +158,6 @@ func (c *PlatformAnalyticsController) Users() {
|
||||
})
|
||||
}
|
||||
|
||||
// ===== 环比(本月新增 vs 上月新增)=====
|
||||
growthPct := 0.0
|
||||
growthUp := true
|
||||
if lastMonthNewUsers > 0 {
|
||||
|
||||
Reference in new issue
Block a user