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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
// Company 公司企业入驻信息
|
||||
type Company struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type CompanyHandle func(session *session.Enterprise, local string) *Company
|
||||
type CompanyHandle func(session *session.Enterprise, tenantID uint64) *Company
|
||||
|
||||
type CompanyInfo struct {
|
||||
ID string `json:"id"`
|
||||
@ -58,7 +58,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
mManageCompany := model.NewManageCompany()
|
||||
// 查询相应的企业入驻信息
|
||||
isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "examine_status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
// 过滤用户其他公司入驻信息
|
||||
mUserCompany := model.NewUserCompany()
|
||||
@ -80,7 +80,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
}
|
||||
mManageCompany.ID = 0
|
||||
}
|
||||
mManageCompany.Local.Local = c.local
|
||||
mManageCompany.TenantID = c.tenantID
|
||||
mManageCompany.InviterID = inviterID
|
||||
mManageCompany.Kind = model2.ManageCompanyKind(other.Kind)
|
||||
mManageCompany.Name = params.Name
|
||||
@ -100,7 +100,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同编码公司信息
|
||||
if err = model2.DeleteWhere(mManageCompany.ManageCompany, []*model2.ModelWhere{
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil {
|
||||
@ -118,10 +118,10 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
}
|
||||
|
||||
func NewCompany() CompanyHandle {
|
||||
return func(session *session.Enterprise, local string) *Company {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Company {
|
||||
return &Company{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
// Expert 专家入驻信息
|
||||
type Expert struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type ExpertHandle func(session *session.Enterprise, local string) *Expert
|
||||
type ExpertHandle func(session *session.Enterprise, tenantID uint64) *Expert
|
||||
|
||||
// Launch 发起入驻
|
||||
func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) error {
|
||||
@ -28,7 +28,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
mManageExpert := model.NewManageExpert()
|
||||
// 查询相应专家入驻信息
|
||||
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "examine_status"},
|
||||
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
mUserExpert := model.NewUserExpert()
|
||||
|
||||
@ -49,7 +49,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
}
|
||||
mUserExpert.ID = 0
|
||||
}
|
||||
mManageExpert.Local.Local = c.local
|
||||
mManageExpert.TenantID = c.tenantID
|
||||
mManageExpert.ResearchID = other.ResearchID
|
||||
mManageExpert.LaboratoryID = other.LaboratoryID
|
||||
mManageExpert.Image.Image = params.Image
|
||||
@ -73,7 +73,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同编码公司信息
|
||||
if err = model2.DeleteWhere(mManageExpert.ManageExpert, []*model2.ModelWhere{
|
||||
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageExpert.ManageExpert, tx); err != nil {
|
||||
@ -91,10 +91,10 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
}
|
||||
|
||||
func NewExpert() ExpertHandle {
|
||||
return func(session *session.Enterprise, local string) *Expert {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Expert {
|
||||
return &Expert{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ import (
|
||||
// Laboratory 实验室入驻信息
|
||||
type Laboratory struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type LaboratoryHandle func(session *session.Enterprise, local string) *Laboratory
|
||||
type LaboratoryHandle func(session *session.Enterprise, tenantID uint64) *Laboratory
|
||||
|
||||
// Launch 实验室入驻
|
||||
func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLaboratory) error {
|
||||
@ -27,7 +27,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
// 查询相应专家入驻信息
|
||||
isExist, err := model2.FirstField(mManageLaboratory.ManageLaboratory, []string{"id", "examine_status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
mUserLaboratory := model.NewUserLaboratory()
|
||||
|
||||
@ -48,7 +48,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
}
|
||||
mManageLaboratory.ID = 0
|
||||
}
|
||||
mManageLaboratory.Local.Local = c.local
|
||||
mManageLaboratory.TenantID = c.tenantID
|
||||
mManageLaboratory.ResearchID = other.ResearchID
|
||||
mManageLaboratory.Image.Image = params.Image
|
||||
mManageLaboratory.Name = params.Name
|
||||
@ -66,7 +66,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同编码公司信息
|
||||
if err = model2.DeleteWhere(mManageLaboratory.ManageLaboratory, []*model2.ModelWhere{
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageLaboratory.ManageLaboratory, tx); err != nil {
|
||||
@ -84,10 +84,10 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
}
|
||||
|
||||
func NewLaboratory() LaboratoryHandle {
|
||||
return func(session *session.Enterprise, local string) *Laboratory {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Laboratory {
|
||||
return &Laboratory{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ import (
|
||||
// Research 研究机构入驻信息
|
||||
type Research struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type ResearchHandle func(session *session.Enterprise, local string) *Research
|
||||
type ResearchHandle func(session *session.Enterprise, tenantID uint64) *Research
|
||||
|
||||
// Launch 研究机构入驻
|
||||
func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch) error {
|
||||
@ -27,7 +27,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
mManageResearch := model.NewManageResearch()
|
||||
// 查询相应专家入驻信息
|
||||
isExist, err := model2.FirstField(mManageResearch.ManageResearch, []string{"id", "examine_status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
mUserResearch := model.NewUserResearch()
|
||||
|
||||
@ -48,7 +48,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
}
|
||||
mManageResearch.ID = 0
|
||||
}
|
||||
mManageResearch.Local.Local = c.local
|
||||
mManageResearch.TenantID = c.tenantID
|
||||
mManageResearch.Image.Image = params.Image
|
||||
mManageResearch.Name = params.Name
|
||||
mManageResearch.Code = params.Code
|
||||
@ -64,7 +64,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同编码公司信息
|
||||
if err = model2.DeleteWhere(mManageResearch.ManageResearch, []*model2.ModelWhere{
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageResearch.ManageResearch, tx); err != nil {
|
||||
@ -82,10 +82,10 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
}
|
||||
|
||||
func NewResearch() ResearchHandle {
|
||||
return func(session *session.Enterprise, local string) *Research {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Research {
|
||||
return &Research{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user