|
|
@@ -5,6 +5,7 @@ import ( |
|
|
|
"code.fnuoos.com/zhimeng/model.git/src/model" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" |
|
|
|
"reflect" |
|
|
|
"strings" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
@@ -118,3 +119,23 @@ func (a AgentDb) GetSuperAgentByUsername(username string) (agent *model.Agent, e |
|
|
|
} |
|
|
|
return agent, nil |
|
|
|
} |
|
|
|
func (a AgentDb) FindSuperAdminByAgebtId(agentId string, page, limit int) (list []model.Agent, total int64, err error) { |
|
|
|
sess := a.Db.Where("is_super_administrator=1").Desc("id").Limit(limit, (page-1)*limit) |
|
|
|
if agentId != "" { |
|
|
|
sess.In("agent_id", strings.Split(agentId, ",")) |
|
|
|
} |
|
|
|
total, err = sess.FindAndCount(&list) |
|
|
|
if err != nil { |
|
|
|
return nil, 0, err |
|
|
|
} |
|
|
|
return |
|
|
|
} |
|
|
|
func (a AgentDb) FindAllSuperAdmin() (list *[]model.Agent) { |
|
|
|
list = &[]model.Agent{} |
|
|
|
sess := a.Db.Where("is_super_administrator=1") |
|
|
|
err := sess.Find(list) |
|
|
|
if err != nil { |
|
|
|
return nil |
|
|
|
} |
|
|
|
return list |
|
|
|
} |