refactor: Optimize user caching and token retrieval methods

This commit is contained in:
1808837298@qq.com
2025-02-19 15:12:26 +08:00
parent 83e161a1d4
commit 1ae0a38485
7 changed files with 21 additions and 8 deletions
+1 -1
View File
@@ -252,7 +252,7 @@ func PreConsumeTokenQuota(relayInfo *relaycommon.RelayInfo, quota int) error {
//if relayInfo.TokenUnlimited {
// return nil
//}
token, err := model.GetTokenById(relayInfo.TokenId)
token, err := model.GetTokenByKey(relayInfo.TokenKey, false)
if err != nil {
return err
}
+1 -1
View File
@@ -11,7 +11,7 @@ import (
func NotifyRootUser(t string, subject string, content string) {
user := model.GetRootUser().ToBaseUser()
_ = NotifyUser(&user, dto.NewNotify(t, subject, content, nil))
_ = NotifyUser(user, dto.NewNotify(t, subject, content, nil))
}
func NotifyUser(user *model.UserBase, data dto.Notify) error {