feat:完善入驻信息管理
This commit is contained in:
@ -16,49 +16,54 @@ type Instance struct {
|
||||
type InstanceHandle func(session *session.Enterprise, local string) *Instance
|
||||
|
||||
type InstanceInfo struct {
|
||||
Identity int `json:"identity"` // 所有身份
|
||||
ExamineIdentity map[int]model2.ExamineStatusKind `json:"examine_identity"` // 审核中信息
|
||||
SelectIdentity int `json:"select_identity"` // 当前选择的身份
|
||||
Identity int `json:"identity"` // 所有身份
|
||||
ExamineIdentity map[int]*InstanceExamineInfo `json:"examine_identity"` // 审核中信息
|
||||
SelectIdentity int `json:"select_identity"` // 当前选择的身份
|
||||
}
|
||||
|
||||
func (c *Instance) company() (bool, model2.ExamineStatusKind, error) {
|
||||
type InstanceExamineInfo struct {
|
||||
Status model2.ExamineStatusKind `json:"status"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
func (c *Instance) company() (bool, *model2.Examine, error) {
|
||||
mUserCompany := model.NewUserCompany()
|
||||
out, err := mUserCompany.Company(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
return out.ID > 0, out.Examine, err
|
||||
}
|
||||
|
||||
func (c *Instance) expert() (bool, model2.ExamineStatusKind, error) {
|
||||
func (c *Instance) expert() (bool, *model2.Examine, error) {
|
||||
mUserExpert := model.NewUserExpert()
|
||||
out, err := mUserExpert.Expert(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
return out.ID > 0, out.Examine, err
|
||||
}
|
||||
|
||||
func (c *Instance) research() (bool, model2.ExamineStatusKind, error) {
|
||||
func (c *Instance) research() (bool, *model2.Examine, error) {
|
||||
mUserResearch := model.NewUserResearch()
|
||||
out, err := mUserResearch.Research(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
return out.ID > 0, out.Examine, err
|
||||
}
|
||||
|
||||
func (c *Instance) laboratory() (bool, model2.ExamineStatusKind, error) {
|
||||
func (c *Instance) laboratory() (bool, *model2.Examine, error) {
|
||||
mUserLaboratory := model.NewUserLaboratory()
|
||||
out, err := mUserLaboratory.Laboratory(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
return out.ID > 0, out.Examine, err
|
||||
}
|
||||
|
||||
func (c *Instance) agent() (bool, model2.ExamineStatusKind, error) {
|
||||
func (c *Instance) agent() (bool, *model2.Examine, error) {
|
||||
mUserAgent := model.NewUserAgent()
|
||||
out, err := mUserAgent.Agent(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
return out.ID > 0, out.Examine, err
|
||||
}
|
||||
|
||||
func (c *Instance) Index() (*InstanceInfo, error) {
|
||||
out := &InstanceInfo{
|
||||
Identity: c.Identity,
|
||||
ExamineIdentity: make(map[int]model2.ExamineStatusKind, 0),
|
||||
ExamineIdentity: make(map[int]*InstanceExamineInfo, 0),
|
||||
SelectIdentity: c.SelectIdentity,
|
||||
}
|
||||
isExist := false
|
||||
var kind model2.ExamineStatusKind
|
||||
examine := new(model2.Examine)
|
||||
var err error
|
||||
|
||||
// 查询其他信息
|
||||
@ -67,15 +72,15 @@ func (c *Instance) Index() (*InstanceInfo, error) {
|
||||
continue
|
||||
}
|
||||
if k == config.TenantUserIdentityForCompany {
|
||||
isExist, kind, err = c.company()
|
||||
isExist, examine, err = c.company()
|
||||
} else if k == config.TenantUserIdentityForExpert {
|
||||
isExist, kind, err = c.expert()
|
||||
isExist, examine, err = c.expert()
|
||||
} else if k == config.TenantUserIdentityForResearch {
|
||||
isExist, kind, err = c.research()
|
||||
isExist, examine, err = c.research()
|
||||
} else if k == config.TenantUserIdentityForLaboratory {
|
||||
isExist, kind, err = c.laboratory()
|
||||
isExist, examine, err = c.laboratory()
|
||||
} else if k == config.TenantUserIdentityForAgent {
|
||||
isExist, kind, err = c.agent()
|
||||
isExist, examine, err = c.agent()
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -83,7 +88,10 @@ func (c *Instance) Index() (*InstanceInfo, error) {
|
||||
if !isExist {
|
||||
continue
|
||||
}
|
||||
out.ExamineIdentity[k] = kind
|
||||
out.ExamineIdentity[k] = &InstanceExamineInfo{
|
||||
Status: examine.ExamineStatus,
|
||||
Remark: examine.ExamineRemark,
|
||||
}
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user