chore: cache username

This commit is contained in:
CaIon
2024-01-11 18:39:21 +08:00
parent 64e9e9cc20
commit f07b9f8ab2
4 changed files with 40 additions and 8 deletions

View File

@@ -41,9 +41,10 @@ func RecordLog(userId int, logType int, content string) {
if logType == LogTypeConsume && !common.LogConsumeEnabled {
return
}
username, _ := CacheGetUsername(userId)
log := &Log{
UserId: userId,
Username: GetUsernameById(userId),
Username: username,
CreatedAt: common.GetTimestamp(),
Type: logType,
Content: content,
@@ -59,7 +60,7 @@ func RecordConsumeLog(ctx context.Context, userId int, channelId int, promptToke
if !common.LogConsumeEnabled {
return
}
username := GetUsernameById(userId)
username, _ := CacheGetUsername(userId)
log := &Log{
UserId: userId,
Username: username,