Commit f18a83c1 by CaIon

fix: update user quote (close #161)

parent a8433823
...@@ -225,10 +225,11 @@ func (user *User) Update(updatePassword bool) error { ...@@ -225,10 +225,11 @@ func (user *User) Update(updatePassword bool) error {
} }
newUser := *user newUser := *user
DB.First(&user, user.Id) DB.First(&user, user.Id)
err = DB.Model(user).Updates(newUser).Error err = DB.Model(user).Select("*").Updates(newUser).Error
if err == nil { if err == nil {
if common.RedisEnabled { if common.RedisEnabled {
_ = common.RedisSet(fmt.Sprintf("user_group:%d", user.Id), user.Group, time.Duration(UserId2GroupCacheSeconds)*time.Second) _ = common.RedisSet(fmt.Sprintf("user_group:%d", user.Id), user.Group, time.Duration(UserId2GroupCacheSeconds)*time.Second)
_ = common.RedisSet(fmt.Sprintf("user_quota:%d", user.Id), strconv.Itoa(user.Quota), time.Duration(UserId2QuotaCacheSeconds)*time.Second)
} }
} }
return err return err
......
...@@ -223,19 +223,22 @@ const EditUser = (props) => { ...@@ -223,19 +223,22 @@ const EditUser = (props) => {
placeholder='此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改' placeholder='此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改'
readonly readonly
/> />
<div style={{ marginTop: 20 }}>
<Typography.Text>已绑定的邮箱账户</Typography.Text>
</div>
<Input <Input
name='telegram_id' name='email'
value={telegram_id} value={email}
autoComplete='new-password' autoComplete='new-password'
placeholder='此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改' placeholder='此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改'
readonly readonly
/> />
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<Typography.Text>已绑定的邮箱账户</Typography.Text> <Typography.Text>已绑定的Telegram账户</Typography.Text>
</div> </div>
<Input <Input
name='email' name='telegram_id'
value={email} value={telegram_id}
autoComplete='new-password' autoComplete='new-password'
placeholder='此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改' placeholder='此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改'
readonly readonly
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment