移除轮询

This commit is contained in:
2026-07-17 11:32:34 +08:00
parent 2232ef6f3c
commit 9b788189fd
7 changed files with 753 additions and 718 deletions
+38
View File
@@ -0,0 +1,38 @@
package services
import "server/models"
// OperationLogUser 根据操作日志的租户范围解析操作人信息。
// tid 为空或为 0 时,日志来自平台管理员;否则来自租户用户。
func OperationLogUser(tid *uint64, userID uint64) (account, name string) {
if userID == 0 {
return "", ""
}
if tid != nil && *tid != 0 {
var user models.SystemTenantUser
if err := models.Orm.QueryTable(new(models.SystemTenantUser)).
Filter("tid", *tid).
Filter("uid", userID).
One(&user); err == nil {
if user.Account != nil {
account = *user.Account
}
if user.Name != nil {
name = *user.Name
}
}
return account, name
}
var user models.AdminUser
if err := models.Orm.QueryTable(new(models.AdminUser)).
Filter("id", userID).
One(&user); err == nil {
account = user.Account
if user.Name != nil {
name = *user.Name
}
}
return account, name
}