移除轮询
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user