实现用户dashboard统计

This commit is contained in:
刘祥超
2020-12-15 16:53:31 +08:00
parent e449935bf2
commit d52c83f906
4 changed files with 136 additions and 5 deletions

View File

@@ -464,7 +464,7 @@ func (this *ServerDAO) UpdateServerReverseProxy(serverId int64, config []byte) e
}
// 计算所有可用服务数量
func (this *ServerDAO) CountAllEnabledServersMatch(groupId int64, keyword string) (int64, error) {
func (this *ServerDAO) CountAllEnabledServersMatch(groupId int64, keyword string, userId int64) (int64, error) {
query := this.Query().
State(ServerStateEnabled)
if groupId > 0 {
@@ -475,6 +475,9 @@ func (this *ServerDAO) CountAllEnabledServersMatch(groupId int64, keyword string
query.Where("(name LIKE :keyword OR serverNames LIKE :keyword)").
Param("keyword", "%"+keyword+"%")
}
if userId > 0{
query.Attr("userId", userId)
}
return query.Count()
}