fix: 订阅模式登录验证、永久会员类型区分、动态代码HTTP返回值修复、侧边栏滚动位置保持
- 修复订阅模式登录时错误检查余额的问题 - 区分无限余额和永久订阅两种永久会员类型 - 修复动态代码HTTP请求返回值在JS中无法正确访问的问题 - 添加侧边栏滚动位置保持功能 - 移除developer角色相关代码,统一使用admin - 添加缺失的i18n翻译key
This commit is contained in:
@@ -456,11 +456,24 @@ func handleAppLogin(c *gin.Context) {
|
||||
log.Printf("[DEBUG] isTrialValid=%v, IsTrialUser=%v, TrialEndAt=%v, Balance=%f", isTrialValid, user.IsTrialUser, user.TrialEndAt, user.Balance)
|
||||
|
||||
if !isTrialValid {
|
||||
if appModel.BillingType != "free" && user.Balance <= 0 {
|
||||
log.Printf("[DEBUG] User %d has no balance remaining", user.ID)
|
||||
service.LogVerification(c, &appModel.ID, &user.ID, "login_failed", "登录失败: 余额不足 - "+req.Username, req.DeviceID, fmt.Errorf("余额不足,请充值后继续使用"))
|
||||
response.Error(c, 403, "余额不足,请充值后继续使用")
|
||||
return
|
||||
if appModel.BillingType != "free" {
|
||||
if user.Balance == -1 {
|
||||
log.Printf("[DEBUG] User %d is permanent member, allowing login", user.ID)
|
||||
} else if appModel.BillingType == "subscription" {
|
||||
if user.ExpiryAt == nil || user.ExpiryAt.Before(time.Now()) {
|
||||
log.Printf("[DEBUG] User %d subscription expired, ExpiryAt=%v", user.ID, user.ExpiryAt)
|
||||
service.LogVerification(c, &appModel.ID, &user.ID, "login_failed", "登录失败: 订阅已过期 - "+req.Username, req.DeviceID, fmt.Errorf("订阅已过期,请充值后继续使用"))
|
||||
response.Error(c, 403, "订阅已过期,请充值后继续使用")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if user.Balance <= 0 {
|
||||
log.Printf("[DEBUG] User %d has no balance remaining", user.ID)
|
||||
service.LogVerification(c, &appModel.ID, &user.ID, "login_failed", "登录失败: 余额不足 - "+req.Username, req.DeviceID, fmt.Errorf("余额不足,请充值后继续使用"))
|
||||
response.Error(c, 403, "余额不足,请充值后继续使用")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user