feat:完善信息,增加需求指派功能

This commit is contained in:
henry
2022-01-24 15:35:43 +08:00
parent 295ca23dcc
commit 1c0d9dfb6b
12 changed files with 184 additions and 68 deletions

View File

@ -42,6 +42,12 @@ type (
*model2.ManageAgent
IDImage *model2.ManageAgentIDImage `json:"id_image"`
}
// AgentSelect 经纪人筛选信息
AgentSelect struct {
ID string `json:"id"`
Name string `json:"name"`
Mobile string `json:"mobile"`
}
// AgentParams 经纪人参数信息
AgentParams struct {
ID, TenantID uint64
@ -105,6 +111,35 @@ func (c *Agent) Instance(tenantID uint64, name string, status int, page, pageSiz
return &controller.ReturnPages{Data: list, Count: count}, nil
}
// Select 筛选信息
func (c *Agent) Select(tenantID uint64, keyword string) ([]*AgentSelect, error) {
mManageAgent := model.NewManageAgent()
where := make([]*model2.ModelWhere, 0)
if tenantID > 0 {
where = append(where, model2.NewWhere("tenant_id", tenantID))
}
if keyword != "" {
where = append(where, model2.NewWhereValue("(name LIKE '%"+keyword+"%') OR (mobile LIKE '%"+keyword+"%')"))
}
out, err := mManageAgent.Agent(where...)
if err != nil {
return nil, err
}
list := make([]*AgentSelect, len(out))
for k, v := range out {
list[k] = &AgentSelect{
ID: v.GetEncodeID(),
Name: v.Name,
Mobile: v.Mobile,
}
}
return list, nil
}
// Detail 详细信息
func (c *Agent) Detail(id uint64) (*AgentDetail, error) {
mManageAgent := model.NewManageAgent()