mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-15 23:54:30 +00:00
fix: getTokenById return token nil, make panic (#1728)
* fix:getTokenById return token nil, make panic * chore: remove useless err check --------- Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
@@ -17,9 +17,11 @@ func GetSubscription(c *gin.Context) {
|
||||
if config.DisplayTokenStatEnabled {
|
||||
tokenId := c.GetInt(ctxkey.TokenId)
|
||||
token, err = model.GetTokenById(tokenId)
|
||||
expiredTime = token.ExpiredTime
|
||||
remainQuota = token.RemainQuota
|
||||
usedQuota = token.UsedQuota
|
||||
if err == nil {
|
||||
expiredTime = token.ExpiredTime
|
||||
remainQuota = token.RemainQuota
|
||||
usedQuota = token.UsedQuota
|
||||
}
|
||||
} else {
|
||||
userId := c.GetInt(ctxkey.Id)
|
||||
remainQuota, err = model.GetUserQuota(userId)
|
||||
|
Reference in New Issue
Block a user