Browse Source

提交代码,解决用户增长趋势问题

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/3538/head
zouap 2 years ago
parent
commit
dac7cab477
2 changed files with 1 additions and 8 deletions
  1. +1
    -1
      models/user_business_analysis.go
  2. +0
    -7
      routers/user/auth.go

+ 1
- 1
models/user_business_analysis.go View File

@@ -1391,7 +1391,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time,
useMetrics.TotalActivateRegistUser = getMapKeyStringValue("TotalActivateRegistUser", userMetrics)
useMetrics.TotalHasActivityUser = getMapKeyStringValue("TotalHasActivityUser", userMetrics)
useMetrics.CurrentDayRegistUser = getMapKeyStringValue("CurrentDayRegistUser", userMetrics)
count, err = sess.Where("type=0").Count(new(User))
count, err = sess.Where("type=0 and created_unix<=" + fmt.Sprint(end_unix)).Count(new(User))
if err != nil {
log.Info("query user error. return.")
}


+ 0
- 7
routers/user/auth.go View File

@@ -326,7 +326,6 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) {
return
}
models.SaveLoginInfoToDb(ctx.Req.Request, u)
log.Info("here333")
// If this user is enrolled in 2FA, we can't sign the user in just yet.
// Instead, redirect them to the 2FA authentication page.
_, err = models.GetTwoFactorByUID(u.ID)
@@ -338,7 +337,6 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) {
}
return
}
log.Info("here444")
// User needs to use 2FA, save data and redirect to 2FA page.
if err := ctx.Session.Set("twofaUid", u.ID); err != nil {
ctx.ServerError("UserSignIn: Unable to set twofaUid in session", err)
@@ -370,7 +368,6 @@ func SignInCloudBrainPost(ctx *context.Context, form auth.SignInForm) {

// SignInPost response for sign in request
func SignInPost(ctx *context.Context, form auth.SignInForm) {
log.Info("here99999")
ctx.Data["PageIsLogin"] = true
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login"
ctx.Data["ActivityTpl"] = getActivityTpl()
@@ -750,7 +747,6 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR

// Register last login
u.SetLastLogin()
log.Info("77777_2222")
if err := models.UpdateUserCols(u, "last_login_unix"); err != nil {
ctx.ServerError("UpdateUserCols", err)
return setting.AppSubURL + "/dashboard"
@@ -762,16 +758,13 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR
ctx.RedirectToFirst(redirectToCourse)
return redirectToCourse
}
log.Info("77777_777")
if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) {
log.Info("77777_8888")
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true)
if obeyRedirect {
ctx.RedirectToFirst(redirectTo)
}
return redirectTo
}
log.Info("77777_99999")
if obeyRedirect {
ctx.Redirect(setting.AppSubURL + "/dashboard")
}


Loading…
Cancel
Save