feat:完善项目信息
This commit is contained in:
@ -14,10 +14,10 @@ import (
|
||||
// Agent 经纪人入驻信息
|
||||
type Agent struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type AgentHandle func(session *session.Enterprise, local string) *Agent
|
||||
type AgentHandle func(session *session.Enterprise, tenantID uint64) *Agent
|
||||
|
||||
// Launch 经纪人入驻
|
||||
func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) error {
|
||||
@ -27,7 +27,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
|
||||
mManageAgent := model.NewManageAgent()
|
||||
// 查询相应的经纪人入驻信息
|
||||
isExist, err := model2.FirstField(mManageAgent.ManageAgent, []string{"id", "examine_status"},
|
||||
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
// 用户经纪人入驻信息
|
||||
mUserAgent := model.NewUserAgent()
|
||||
@ -49,7 +49,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
|
||||
}
|
||||
mManageAgent.ID = 0
|
||||
}
|
||||
mManageAgent.Local.Local = c.local
|
||||
mManageAgent.TenantID = c.tenantID
|
||||
mManageAgent.Name = params.Name
|
||||
mManageAgent.Mobile = params.Mobile
|
||||
mManageAgent.IDCard = other.IDCard
|
||||
@ -67,7 +67,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同身份证经纪人信息
|
||||
if err = model2.DeleteWhere(mManageAgent.ManageAgent, []*model2.ModelWhere{
|
||||
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageAgent.ManageAgent, tx); err != nil {
|
||||
@ -85,10 +85,10 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
|
||||
}
|
||||
|
||||
func NewAgent() AgentHandle {
|
||||
return func(session *session.Enterprise, local string) *Agent {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Agent {
|
||||
return &Agent{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user