perf:减少PublishVideo中的数据库查询

This commit is contained in:
Amnesia
2026-03-21 11:19:09 +08:00
parent 05c846c295
commit 14d8694b2a
2 changed files with 16 additions and 2 deletions

View File

@@ -124,3 +124,17 @@ func GetAccountID(c *gin.Context) (uint, error) {
return accountID, nil
}
func GetUsername(c *gin.Context) (string, error) {
val, exists := c.Get("username")
if !exists {
return "", errors.New("username not found")
}
username, ok := val.(string)
if !ok {
return "", errors.New("username has invalid type")
}
return username, nil
}