feat:完善项目信息

This commit is contained in:
henry
2022-01-13 18:07:40 +08:00
parent 27cb063a6c
commit 7492c67378
25 changed files with 96 additions and 130 deletions

View File

@ -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,
}
}
}