add api handle for update user's max_calls attribute

This commit is contained in:
RockYang 2023-04-06 10:06:53 +08:00
parent 7e1e408b64
commit dd0130caf8

View File

@ -193,6 +193,7 @@ func (s *Server) SetUserHandle(c *gin.Context) {
c.JSON(http.StatusOK, types.BizVo{Code: types.Failed, Message: "Invalid args"})
return
} else if maxCalls > 0 {
user.MaxCalls = maxCalls
user.RemainingCalls += maxCalls - user.MaxCalls
if user.RemainingCalls < 0 {
user.RemainingCalls = 0