|
@@ -912,6 +912,7 @@ func ManageUser(c *gin.Context) {
|
|
|
}
|
|
}
|
|
|
user.Role = common.RoleCommonUser
|
|
user.Role = common.RoleCommonUser
|
|
|
case "add_quota":
|
|
case "add_quota":
|
|
|
|
|
+ adminName := c.GetString("username")
|
|
|
switch req.Mode {
|
|
switch req.Mode {
|
|
|
case "add":
|
|
case "add":
|
|
|
if req.Value <= 0 {
|
|
if req.Value <= 0 {
|
|
@@ -923,7 +924,7 @@ func ManageUser(c *gin.Context) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
model.RecordLog(user.Id, model.LogTypeManage,
|
|
model.RecordLog(user.Id, model.LogTypeManage,
|
|
|
- fmt.Sprintf("管理员增加用户额度 %s", logger.LogQuota(req.Value)))
|
|
|
|
|
|
|
+ fmt.Sprintf("管理员(%s)增加用户额度 %s", adminName, logger.LogQuota(req.Value)))
|
|
|
case "subtract":
|
|
case "subtract":
|
|
|
if req.Value <= 0 {
|
|
if req.Value <= 0 {
|
|
|
common.ApiErrorI18n(c, i18n.MsgUserQuotaChangeZero)
|
|
common.ApiErrorI18n(c, i18n.MsgUserQuotaChangeZero)
|
|
@@ -934,7 +935,7 @@ func ManageUser(c *gin.Context) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
model.RecordLog(user.Id, model.LogTypeManage,
|
|
model.RecordLog(user.Id, model.LogTypeManage,
|
|
|
- fmt.Sprintf("管理员减少用户额度 %s", logger.LogQuota(req.Value)))
|
|
|
|
|
|
|
+ fmt.Sprintf("管理员(%s)减少用户额度 %s", adminName, logger.LogQuota(req.Value)))
|
|
|
case "override":
|
|
case "override":
|
|
|
oldQuota := user.Quota
|
|
oldQuota := user.Quota
|
|
|
if err := model.DB.Model(&model.User{}).Where("id = ?", user.Id).Update("quota", req.Value).Error; err != nil {
|
|
if err := model.DB.Model(&model.User{}).Where("id = ?", user.Id).Update("quota", req.Value).Error; err != nil {
|
|
@@ -942,7 +943,7 @@ func ManageUser(c *gin.Context) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
model.RecordLog(user.Id, model.LogTypeManage,
|
|
model.RecordLog(user.Id, model.LogTypeManage,
|
|
|
- fmt.Sprintf("管理员覆盖用户额度从 %s 为 %s", logger.LogQuota(oldQuota), logger.LogQuota(req.Value)))
|
|
|
|
|
|
|
+ fmt.Sprintf("管理员(%s)覆盖用户额度从 %s 为 %s", adminName, logger.LogQuota(oldQuota), logger.LogQuota(req.Value)))
|
|
|
default:
|
|
default:
|
|
|
common.ApiErrorI18n(c, i18n.MsgInvalidParams)
|
|
common.ApiErrorI18n(c, i18n.MsgInvalidParams)
|
|
|
return
|
|
return
|