feat:完善入驻信息管理

This commit is contained in:
henry
2021-12-03 10:08:23 +08:00
parent 199e6f0669
commit d9cbdd2486
26 changed files with 208 additions and 126 deletions

View File

@ -31,8 +31,8 @@ func (c *RegisterParams) checkCaptcha() (bool, error) {
func (c *RegisterParams) checkUserExist(mUserInstance *model2.UserInstance, local string) (bool, error) { func (c *RegisterParams) checkUserExist(mUserInstance *model2.UserInstance, local string) (bool, error) {
var count int64 var count int64
if err := model2.Count(mUserInstance, &count, model2.NewWhere("mobile", c.Mobile), if err := model2.Count(mUserInstance, &count, model2.NewWhere("mobile", c.Mobile)); //model2.NewWhere("local", local)
model2.NewWhere("local", local)); err != nil { err != nil {
return false, err return false, err
} }
return count <= 0, nil return count <= 0, nil
@ -60,7 +60,6 @@ func (c *Register) Launch(params *RegisterParams) (*InstanceLoginReturn, error)
} else if !pass { } else if !pass {
return nil, errors.New("当前手机号码已注册") return nil, errors.New("当前手机号码已注册")
} }
mUserInstance.Local.Local = c.local
mUserInstance.Source = model2.UserInstanceSourceForLocal mUserInstance.Source = model2.UserInstanceSourceForLocal
mUserInstance.Password = utils.GetRandomString(12) mUserInstance.Password = utils.GetRandomString(12)
mUserInstance.Mobile = params.Mobile mUserInstance.Mobile = params.Mobile

View File

@ -1,11 +1,17 @@
package settled package settled
import ( import (
"SciencesServer/app/api/enterprise/model"
"SciencesServer/app/basic/config" "SciencesServer/app/basic/config"
model2 "SciencesServer/app/common/model"
"SciencesServer/app/session" "SciencesServer/app/session"
"SciencesServer/serve/orm"
"errors"
"gorm.io/gorm"
"time"
) )
// Company 经纪人入驻信息 // Agent 经纪人入驻信息
type Agent struct { type Agent struct {
*session.Enterprise *session.Enterprise
local string local string
@ -15,7 +21,62 @@ type AgentHandle func(session *session.Enterprise, local string) *Agent
// Launch 经纪人入驻 // Launch 经纪人入驻
func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) error { func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) error {
return nil if c.Identity&config.TenantUserIdentityForAgent > 0 {
return errors.New("操作错误,不可重复申请入驻")
}
mManageAgent := model.NewManageAgent()
// 查询相应的经纪人入驻信息
isExist, err := model2.FirstField(mManageAgent.ManageAgent, []string{"id", "status"},
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("local", c.local))
// 用户经纪人入驻信息
mUserAgent := model.NewUserAgent()
if err != nil {
return err
} else if isExist {
// 审核中
if mManageAgent.Examine.ExamineStatus == model2.ExamineStatusForOngoing {
return errors.New("操作错误,当前该企业信息审核中,不可入驻")
}
// 审核通过
if mManageAgent.Examine.ExamineStatus == model2.ExamineStatusForAgree {
// 筛选企业条件
if err = params.filter(config.TenantUserIdentityForAgent,
model2.NewWhere("agent_id", mManageAgent.ID)); err != nil {
return err
}
}
mManageAgent.ID = 0
}
mManageAgent.Local.Local = c.local
mManageAgent.Name = params.Name
mManageAgent.Mobile = params.Mobile
mManageAgent.IDCard = other.IDCard
mManageAgent.SetIndustryAttribute(params.Industrys)
mManageAgent.SetKeywordAttribute(params.Keywords)
mManageAgent.WorkExperience = other.WorkExperience
mManageAgent.WorkPlace = other.WorkPlace
mManageAgent.SetCredentialImageAttribute(other.CredentialImages)
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 {
return err
}
if err = model2.Create(mManageAgent.ManageAgent, tx); err != nil {
return err
}
if err := model2.UpdatesWhere(mUserAgent.UserAgent, map[string]interface{}{
"invalid_status": model2.InvalidStatusForYes, "updated_at": time.Now(),
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
return err
}
mUserAgent.UID = c.UID
mUserAgent.AgentID = mManageAgent.ID
return model2.Create(mUserAgent.UserAgent, tx)
})
} }
func NewAgent() AgentHandle { func NewAgent() AgentHandle {

View File

@ -36,11 +36,11 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
return err return err
} else if isExist { } else if isExist {
// 审核中 // 审核中
if mManageCompany.Status == model2.ExamineStatusForOngoing { if mManageCompany.Examine.ExamineStatus == model2.ExamineStatusForOngoing {
return errors.New("操作错误,当前该企业信息审核中,不可入驻") return errors.New("操作错误,当前该企业信息审核中,不可入驻")
} }
// 审核通过 // 审核通过
if mManageCompany.Status == model2.ExamineStatusForAgree { if mManageCompany.Examine.ExamineStatus == model2.ExamineStatusForAgree {
// 筛选企业条件 // 筛选企业条件
if err = params.filter(config.TenantUserIdentityForCompany, if err = params.filter(config.TenantUserIdentityForCompany,
model2.NewWhere("company_id", mManageCompany.ID)); err != nil { model2.NewWhere("company_id", mManageCompany.ID)); err != nil {
@ -72,7 +72,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
return err return err
} }
if err := model2.UpdatesWhere(mUserCompany.UserCompany, map[string]interface{}{ if err := model2.UpdatesWhere(mUserCompany.UserCompany, map[string]interface{}{
"status": model2.InvalidStatusForYes, "updated_at": time.Now(), "invalid_status": model2.InvalidStatusForYes, "updated_at": time.Now(),
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil { }, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
return err return err
} }

View File

@ -36,13 +36,13 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
return err return err
} else if isExist { } else if isExist {
// 审核中 // 审核中
if mManageExpert.Status == model2.ExamineStatusForOngoing { if mManageExpert.Examine.ExamineStatus == model2.ExamineStatusForOngoing {
return errors.New("操作错误,当前该专家信息审核中,不可入驻") return errors.New("操作错误,当前该专家信息审核中,不可入驻")
} }
// 审核通过 // 审核通过
if mManageExpert.Status == model2.ExamineStatusForAgree { if mManageExpert.Examine.ExamineStatus == model2.ExamineStatusForAgree {
// 筛选企业条件 // 筛选企业条件
if err = params.filter(config.TenantUserIdentityForCompany, if err = params.filter(config.TenantUserIdentityForExpert,
model2.NewWhere("expert_id", mManageExpert.ID)); err != nil { model2.NewWhere("expert_id", mManageExpert.ID)); err != nil {
return err return err
} }
@ -80,7 +80,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
return err return err
} }
if err := model2.UpdatesWhere(mUserExpert.UserExpert, map[string]interface{}{ if err := model2.UpdatesWhere(mUserExpert.UserExpert, map[string]interface{}{
"status": model2.InvalidStatusForYes, "updated_at": time.Now(), "invalid_status": model2.InvalidStatusForYes, "updated_at": time.Now(),
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil { }, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
return err return err
} }

View File

@ -35,13 +35,13 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
return err return err
} else if isExist { } else if isExist {
// 审核中 // 审核中
if mManageLaboratory.Status == model2.ExamineStatusForOngoing { if mManageLaboratory.Examine.ExamineStatus == model2.ExamineStatusForOngoing {
return errors.New("操作错误,当前该实验室信息审核中,不可入驻") return errors.New("操作错误,当前该实验室信息审核中,不可入驻")
} }
// 审核通过 // 审核通过
if mManageLaboratory.Status == model2.ExamineStatusForAgree { if mManageLaboratory.Examine.ExamineStatus == model2.ExamineStatusForAgree {
// 筛选企业条件 // 筛选企业条件
if err = params.filter(config.TenantUserIdentityForCompany, if err = params.filter(config.TenantUserIdentityForLaboratory,
model2.NewWhere("laboratory_id", mManageLaboratory.ID)); err != nil { model2.NewWhere("laboratory_id", mManageLaboratory.ID)); err != nil {
return err return err
} }
@ -73,7 +73,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
return err return err
} }
if err := model2.UpdatesWhere(mUserLaboratory.UserLaboratory, map[string]interface{}{ if err := model2.UpdatesWhere(mUserLaboratory.UserLaboratory, map[string]interface{}{
"status": model2.InvalidStatusForYes, "updated_at": time.Now(), "invalid_status": model2.InvalidStatusForYes, "updated_at": time.Now(),
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil { }, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
return err return err
} }

View File

@ -35,13 +35,13 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
return err return err
} else if isExist { } else if isExist {
// 审核中 // 审核中
if mManageResearch.Status == model2.ExamineStatusForOngoing { if mManageResearch.Examine.ExamineStatus == model2.ExamineStatusForOngoing {
return errors.New("操作错误,当前该研究机构信息审核中,不可入驻") return errors.New("操作错误,当前该研究机构信息审核中,不可入驻")
} }
// 审核通过 // 审核通过
if mManageResearch.Status == model2.ExamineStatusForAgree { if mManageResearch.Examine.ExamineStatus == model2.ExamineStatusForAgree {
// 筛选企业条件 // 筛选企业条件
if err = params.filter(config.TenantUserIdentityForCompany, if err = params.filter(config.TenantUserIdentityForResearch,
model2.NewWhere("research_id", mManageResearch.ID)); err != nil { model2.NewWhere("research_id", mManageResearch.ID)); err != nil {
return err return err
} }
@ -71,7 +71,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
return err return err
} }
if err := model2.UpdatesWhere(mUserResearch.UserResearch, map[string]interface{}{ if err := model2.UpdatesWhere(mUserResearch.UserResearch, map[string]interface{}{
"status": model2.InvalidStatusForYes, "updated_at": time.Now(), "invalid_status": model2.InvalidStatusForYes, "updated_at": time.Now(),
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil { }, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
return err return err
} }

View File

@ -43,7 +43,7 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
mSysPatent := model.NewSysPatent() mSysPatent := model.NewSysPatent()
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{ where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
Where: model2.NewWhere("shelf", model2.ShelfStatusForUp), Where: model2.NewWhere("shelf_status", model2.ShelfStatusForUp),
Order: model2.NewOrder("id", model2.OrderModeToDesc), Order: model2.NewOrder("id", model2.OrderModeToDesc),
}} }}

View File

@ -120,7 +120,7 @@ func (c *Instance) Form(params *InstanceParams) error {
func (c *Instance) Shelf(id uint64, status int) error { func (c *Instance) Shelf(id uint64, status int) error {
mTechnologyInstance := model.NewTechnologyInstance() mTechnologyInstance := model.NewTechnologyInstance()
mTechnologyInstance.ID = id mTechnologyInstance.ID = id
isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "uid", "shelf", "status"}) isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "uid", "shelf_status", "status"})
if err != nil { if err != nil {
return err return err
@ -130,11 +130,11 @@ func (c *Instance) Shelf(id uint64, status int) error {
return errors.New("操作错误,无权限操作") return errors.New("操作错误,无权限操作")
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree { } else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
return errors.New("操作错误,当前状态不允许处理上下架") return errors.New("操作错误,当前状态不允许处理上下架")
} else if mTechnologyInstance.ShelfStatus.Shelf == model2.ShelfStatusKind(status) { } else if mTechnologyInstance.Shelf.ShelfStatus == model2.ShelfStatusKind(status) {
return errors.New("操作错误,状态异常") return errors.New("操作错误,状态异常")
} }
if err = model2.Updates(mTechnologyInstance.TechnologyInstance, map[string]interface{}{ if err = model2.Updates(mTechnologyInstance.TechnologyInstance, map[string]interface{}{
"shelf": status, "updated_at": time.Now(), "shelf_status": status, "updated_at": time.Now(),
}); err != nil { }); err != nil {
return err return err
} }

View File

@ -24,8 +24,8 @@ type (
// PatentInfo 专利信息 // PatentInfo 专利信息
PatentInfo struct { PatentInfo struct {
*sys.PatentInfo *sys.PatentInfo
Shelf model2.ShelfStatusKind ShelfStatus model2.ShelfStatusKind
Status model2.SysParentStatus Status model2.SysParentStatus
} }
// PatentDetailInfo 专利详细信息 // PatentDetailInfo 专利详细信息
PatentDetailInfo struct { PatentDetailInfo struct {
@ -176,7 +176,7 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
ID: v.GetEncodeID(), Title: v.Title, ApplyCode: v.ApplyCode, ApplyName: v.ApplyName, ID: v.GetEncodeID(), Title: v.Title, ApplyCode: v.ApplyCode, ApplyName: v.ApplyName,
ApplyAt: v.ApplyAt, Inventor: v.Inventor, ApplyAt: v.ApplyAt, Inventor: v.Inventor,
}, },
Shelf: v.Shelf, Status: v.Status, ShelfStatus: v.ShelfStatus, Status: v.Status,
}) })
} }
return &controller.ReturnPages{Data: list, Count: count}, nil return &controller.ReturnPages{Data: list, Count: count}, nil

View File

@ -149,7 +149,7 @@ func (c *Product) Shelf(id uint64, status int) error {
mTechnologyProduct := model.NewTechnologyProduct() mTechnologyProduct := model.NewTechnologyProduct()
mTechnologyProduct.ID = id mTechnologyProduct.ID = id
isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "uid", "status"}) isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "uid", "shelf_status", "status"})
if err != nil { if err != nil {
return err return err
@ -157,11 +157,11 @@ func (c *Product) Shelf(id uint64, status int) error {
return errors.New("操作错误,产品信息不存在或已被删除") return errors.New("操作错误,产品信息不存在或已被删除")
} else if mTechnologyProduct.UID != c.UID { } else if mTechnologyProduct.UID != c.UID {
return errors.New("无权限操作") return errors.New("无权限操作")
} else if mTechnologyProduct.ShelfStatus.Shelf == model2.ShelfStatusKind(status) { } else if mTechnologyProduct.ShelfStatus == model2.ShelfStatusKind(status) {
return errors.New("操作错误,无需变更上下架状态") return errors.New("操作错误,无需变更上下架状态")
} }
return model2.Updates(mTechnologyProduct.TechnologyProduct, map[string]interface{}{ return model2.Updates(mTechnologyProduct.TechnologyProduct, map[string]interface{}{
"shelf": status, "updated_at": time.Now(), "shelf_status": status, "updated_at": time.Now(),
}) })
} }

View File

@ -112,7 +112,7 @@ func (c *Project) Shelf(id uint64, status int) error {
mSysPatent.ID = mUserPatent.PatentID mSysPatent.ID = mUserPatent.PatentID
return model2.Updates(mSysPatent.SysPatent, map[string]interface{}{ return model2.Updates(mSysPatent.SysPatent, map[string]interface{}{
"shelf": status, "updated_at": time.Now(), "shelf_status": status, "updated_at": time.Now(),
}) })
} }

View File

@ -5,10 +5,7 @@ import (
"SciencesServer/app/basic/config" "SciencesServer/app/basic/config"
model2 "SciencesServer/app/common/model" model2 "SciencesServer/app/common/model"
"SciencesServer/app/session" "SciencesServer/app/session"
"SciencesServer/serve/orm"
"errors" "errors"
"gorm.io/gorm"
"time"
) )
// Settled 入驻 // Settled 入驻
@ -80,62 +77,62 @@ func (c *Settled) filter(identity int, where ...*model2.ModelWhere) (bool, error
return mSysIdentity.IsExamine == model2.SysIdentityExamineForYes, nil return mSysIdentity.IsExamine == model2.SysIdentityExamineForYes, nil
} }
// Company 公司企业 //// Company 公司企业
func (c *Settled) Company(params *SettledParams, inviterID uint64, other *config.IdentityForCompany) error { //func (c *Settled) Company(params *SettledParams, inviterID uint64, other *config.IdentityForCompany) error {
mManageCompany := model.NewManageCompany() // mManageCompany := model.NewManageCompany()
//
isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "status"}, // isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "status"},
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local), // model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local),
model2.NewWhere("status", model2.ExamineStatusForRefuse)) // model2.NewWhere("status", model2.ExamineStatusForRefuse))
//
isExamine := true // isExamine := true
//
if err != nil { // if err != nil {
return err // return err
} else if isExist { // } else if isExist {
if mManageCompany.Status == model2.ExamineStatusForOngoing { // if mManageCompany.ExamineStatus == model2.ExamineStatusForOngoing {
return errors.New("操作错误,当前企业信息审核中,不可入驻") // return errors.New("操作错误,当前企业信息审核中,不可入驻")
} // }
// 筛选企业条件 // // 筛选企业条件
if isExamine, err = c.filter(config.TenantUserIdentityForCompany, model2.NewWhere("company_id", mManageCompany.ID)); err != nil { // if isExamine, err = c.filter(config.TenantUserIdentityForCompany, model2.NewWhere("company_id", mManageCompany.ID)); err != nil {
return err // return err
} // }
} // }
mManageCompany.Local.Local = c.local // mManageCompany.Local.Local = c.local
mManageCompany.InviterID = inviterID // mManageCompany.InviterID = inviterID
mManageCompany.Name = params.Name // mManageCompany.Name = params.Name
mManageCompany.Code = params.Code // mManageCompany.Code = params.Code
mManageCompany.Image = model2.Image{Image: params.Image} // mManageCompany.Image = model2.Image{Image: params.Image}
mManageCompany.Area = model2.Area{ // mManageCompany.Area = model2.Area{
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address, // Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
} // }
mManageCompany.WebUrl = other.WebUrl // mManageCompany.Url = other.Url
mManageCompany.SetIndustryAttribute(params.Industrys) // mManageCompany.SetIndustryAttribute(params.Industrys)
mManageCompany.SetKeywordAttribute(params.Keywords) // mManageCompany.SetKeywordAttribute(params.Keywords)
mManageCompany.Introduce = params.Introduce // mManageCompany.Introduce = params.Introduce
//
if isExamine { // if isExamine {
mManageCompany.Status = model2.ExamineStatusForAgree // mManageCompany.ExamineStatus = model2.ExamineStatusForAgree
} // }
return orm.GetDB().Transaction(func(tx *gorm.DB) error { // return orm.GetDB().Transaction(func(tx *gorm.DB) error {
if mManageCompany.ID <= 0 { // if mManageCompany.ID <= 0 {
if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil { // if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil {
return err // return err
} // }
} // }
// 过滤用户其他公司入驻信息 // // 过滤用户其他公司入驻信息
mUserCompany := model.NewUserCompany() // mUserCompany := model.NewUserCompany()
//
if err := model2.UpdatesWhere(mUserCompany.UserCompany, map[string]interface{}{ // if err := model2.UpdatesWhere(mUserCompany.UserCompany, map[string]interface{}{
"status": model2.InvalidStatusForYes, "updated_at": time.Now(), // "status": model2.InvalidStatusForYes, "updated_at": time.Now(),
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil { // }, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
return err // return err
} // }
mUserCompany.UID = c.UID // mUserCompany.UID = c.UID
mUserCompany.CompanyID = mManageCompany.ID // mUserCompany.CompanyID = mManageCompany.ID
return model2.Create(mUserCompany.UserCompany, tx) // return model2.Create(mUserCompany.UserCompany, tx)
}) // })
} //}
// //
//// Expert 专家 //// Expert 专家

View File

@ -19,9 +19,8 @@ type Examine struct {
type ExamineHandle func(session *service.Session, local string) *Examine type ExamineHandle func(session *service.Session, local string) *Examine
type ExamineManageInfo struct { type ExamineManageInfo struct {
IModel model2.IModel IModel model2.IModel
TenantID uint64 // 租户ID UIDs []uint64 // 用户表UUID
UID uint64 // 用户表UUID
} }
// examineHandle 审核处理 // examineHandle 审核处理
@ -50,11 +49,11 @@ func examineCompany(id uint64) (*ExamineManageInfo, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} else if mManageCompany.Status != model2.ExamineStatusForOngoing { } else if mManageCompany.Examine.ExamineStatus != model2.ExamineStatusForOngoing {
return nil, errors.New("当前入住信息已审核") return nil, errors.New("当前入住信息已审核")
} }
return &ExamineManageInfo{ return &ExamineManageInfo{
IModel: mManageCompany.ManageCompany, UID: mManageCompany.UID, IModel: mManageCompany.ManageCompany,
}, nil }, nil
} }
@ -65,11 +64,11 @@ func examineExpert(id uint64) (*ExamineManageInfo, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} else if mManageExpert.Status != model2.ExamineStatusForOngoing { } else if mManageExpert.Examine.ExamineStatus != model2.ExamineStatusForOngoing {
return nil, errors.New("当前入住信息已审核") return nil, errors.New("当前入住信息已审核")
} }
return &ExamineManageInfo{ return &ExamineManageInfo{
IModel: mManageExpert.ManageExpert, UID: mManageExpert.UID, IModel: mManageExpert.ManageExpert,
}, nil }, nil
} }
@ -80,11 +79,11 @@ func examineResearch(id uint64) (*ExamineManageInfo, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} else if mManageResearch.Status != model2.ExamineStatusForOngoing { } else if mManageResearch.Examine.ExamineStatus != model2.ExamineStatusForOngoing {
return nil, errors.New("当前入住信息已审核") return nil, errors.New("当前入住信息已审核")
} }
return &ExamineManageInfo{ return &ExamineManageInfo{
IModel: mManageResearch.ManageResearch, UID: mManageResearch.UID, IModel: mManageResearch.ManageResearch,
}, nil }, nil
} }
@ -95,11 +94,11 @@ func examineLaboratory(id uint64) (*ExamineManageInfo, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} else if mManageLaboratory.Status != model2.ExamineStatusForOngoing { } else if mManageLaboratory.Examine.ExamineStatus != model2.ExamineStatusForOngoing {
return nil, errors.New("当前入住信息已审核") return nil, errors.New("当前入住信息已审核")
} }
return &ExamineManageInfo{ return &ExamineManageInfo{
IModel: mManageLaboratory.ManageLaboratory, UID: mManageLaboratory.UID, IModel: mManageLaboratory.ManageLaboratory,
}, nil }, nil
} }
@ -134,19 +133,20 @@ func (c *Examine) Launch(id uint64, identity, status int) error {
isExist := true isExist := true
if isExist, err = model2.FirstField(mUserIdentity.UserIdentity, []string{"id", "uid"}, model2.NewWhere("uid", data.UID), if isExist, err = model2.FirstField(mUserIdentity.UserIdentity, []string{"id", "uid"},
model2.NewWhere("uid", 0),
model2.NewWhere("identity", identity)); err != nil { model2.NewWhere("identity", identity)); err != nil {
return err return err
} }
if !isExist { if !isExist {
mUserIdentity.UID = data.UID //mUserIdentity.UID = data.UID
mUserIdentity.Identity = identity mUserIdentity.Identity = identity
} }
// 更新账户身份信息 // 更新账户身份信息
mUserInstance := model.NewUserInstance() mUserInstance := model.NewUserInstance()
if _, err = model2.FirstField(mUserInstance.UserInstance, []string{"id", "uuid", "identity"}, if _, err = model2.FirstField(mUserInstance.UserInstance, []string{"id", "uuid", "identity"},
model2.NewWhere("uuid", data.UID)); err != nil { model2.NewWhere("uuid", 0)); err != nil {
return err return err
} }
if err = model2.Updates(mUserInstance.UserInstance, map[string]interface{}{ if err = model2.Updates(mUserInstance.UserInstance, map[string]interface{}{

View File

@ -41,11 +41,13 @@ type (
} }
// IdentityForAgent 经纪人 // IdentityForAgent 经纪人
IdentityForAgent struct { IdentityForAgent struct {
ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
Url string `json:"url" form:"url"` // 实验室网站 IDCard string `json:"id_card" form:"id_card" binding:"required"` // 身份证号
Longitude float64 `json:"longitude" form:"longitude"` // 经度 WorkExperience string `json:"work_experience" form:"work_experience" binding:"required"` // 工作经历
Latitude float64 `json:"latitude" form:"latitude"` // 纬度 WorkPlace string `json:"work_place" form:"work_place" binding:"required"` // 工作地点
Researchs []string `json:"researchs" form:"researchs"` // 研究方向 CredentialImages []string `json:"credential_images" form:"credential_images"` // 资格证书
Longitude float64 `json:"longitude" form:"longitude"` // 经度
Latitude float64 `json:"latitude" form:"latitude"` // 纬度
} }
) )

View File

@ -74,6 +74,16 @@ func initModel() {
// 日志管理 // 日志管理
&synchronized{iModel: model.NewSysUserRole()}, &synchronized{iModel: model.NewSysUserRole()},
&synchronized{iModel: model.NewSysLog()}, &synchronized{iModel: model.NewSysUserLoginLog()}, &synchronized{iModel: model.NewSysLog()}, &synchronized{iModel: model.NewSysUserLoginLog()},
// 用户管理
&synchronized{iModel: model.NewUserInstance()}, &synchronized{iModel: model.NewUserIdentity()},
&synchronized{iModel: model.NewUserPatent()}, &synchronized{iModel: model.NewUserBank()},
&synchronized{iModel: model.NewUserCompany()}, &synchronized{iModel: model.NewUserExpert()},
&synchronized{iModel: model.NewUserLaboratory()}, &synchronized{iModel: model.NewUserResearch()},
&synchronized{iModel: model.NewUserAgent()},
// 入驻管理
&synchronized{iModel: model.NewManageCompany()}, &synchronized{iModel: model.NewManageExpert()},
&synchronized{iModel: model.NewManageLaboratory()}, &synchronized{iModel: model.NewManageResearch()},
&synchronized{iModel: model.NewManageAgent()},
) )
} }
func initCacheMode() { func initCacheMode() {

View File

@ -72,9 +72,9 @@ const (
AccountStatusForDisable AccountStatusForDisable
) )
// ShelfStatus 上下架状态 // Shelf 上下架状态
type ShelfStatus struct { type Shelf struct {
Shelf ShelfStatusKind `gorm:"column:shelf;type:tinyint(1);default:0;comment:上下架状态1上架2下架" json:"shelf"` ShelfStatus ShelfStatusKind `gorm:"column:shelf_status;type:tinyint(1);default:0;comment:上下架状态1上架2下架" json:"shelf_status"`
} }
type ShelfStatusKind int type ShelfStatusKind int
@ -86,9 +86,9 @@ const (
ShelfStatusForDown ShelfStatusForDown
) )
// ExamineStatus 审核状态 // Examine 审核状态
type ExamineStatus struct { type Examine struct {
Status ExamineStatusKind `gorm:"column:status;type:tinyint(1);default:0;comment:审核状态0审核中1审核通过2审核拒绝" json:"status"` ExamineStatus ExamineStatusKind `gorm:"column:examine_status;type:tinyint(1);default:0;comment:审核状态0审核中1审核通过2审核拒绝" json:"examine_status"`
ExamineRemark string `gorm:"column:examine_remark;type:varchar(255);default:null;comment:审核备注" json:"examine_remark"` ExamineRemark string `gorm:"column:examine_remark;type:varchar(255);default:null;comment:审核备注" json:"examine_remark"`
} }
@ -106,7 +106,7 @@ const (
// InvalidStatus 失效状态 // InvalidStatus 失效状态
type InvalidStatus struct { type InvalidStatus struct {
Status ExamineStatusKind `gorm:"column:status;type:tinyint(1);default:0;comment:失效状态0未失效1已失效" json:"status"` InvalidStatus ExamineStatusKind `gorm:"column:invalid_status;type:tinyint(1);default:0;comment:失效状态0未失效1已失效" json:"invalid_status"`
} }
// InvalidStatusKind 失效状态 // InvalidStatusKind 失效状态

View File

@ -15,10 +15,14 @@ type ManageAgent struct {
WorkPlace string `gorm:"column:work_place;type:varchar(255);default:0;comment:工作地点" json:"work_place"` WorkPlace string `gorm:"column:work_place;type:varchar(255);default:0;comment:工作地点" json:"work_place"`
IDImage string `gorm:"column:id_image;type:text;default:null;comment:身份证图片" json:"-"` IDImage string `gorm:"column:id_image;type:text;default:null;comment:身份证图片" json:"-"`
CredentialImage string `gorm:"column:credential_image;type:varchar(255);default:null;comment:资格证书" json:"credential_image"` CredentialImage string `gorm:"column:credential_image;type:varchar(255);default:null;comment:资格证书" json:"credential_image"`
Examine
ModelDeleted ModelDeleted
ModelAt ModelAt
} }
type ManageAgentIDImage struct {
}
func (m *ManageAgent) TableName() string { func (m *ManageAgent) TableName() string {
return "manage_agent" return "manage_agent"
} }
@ -43,6 +47,16 @@ func (m *ManageAgent) SetKeywordAttribute(value []string) {
m.Keyword = utils.AnyToJSON(value) m.Keyword = utils.AnyToJSON(value)
} }
func (m *ManageAgent) GetCredentialImageAttribute() []string {
out := make([]string, 0)
_ = utils.FromJSON(m.CredentialImage, &out)
return out
}
func (m *ManageAgent) SetCredentialImageAttribute(value []string) {
m.CredentialImage = utils.AnyToJSON(value)
}
func NewManageAgent() *ManageAgent { func NewManageAgent() *ManageAgent {
return &ManageAgent{} return &ManageAgent{}
} }

View File

@ -15,7 +15,7 @@ type ManageCompany struct {
Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"` Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"`
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"`
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
ExamineStatus Examine
ModelDeleted ModelDeleted
ModelAt ModelAt
} }

View File

@ -26,7 +26,7 @@ type ManageExpert struct {
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"`
Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"` Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"`
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
ExamineStatus Examine
ModelDeleted ModelDeleted
ModelAt ModelAt
} }

View File

@ -19,7 +19,7 @@ type ManageLaboratory struct {
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"`
Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"` Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"`
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
ExamineStatus Examine
ModelDeleted ModelDeleted
ModelAt ModelAt
} }

View File

@ -17,7 +17,7 @@ type ManageResearch struct {
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"` Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"`
Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"` Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"`
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
ExamineStatus Examine
ModelDeleted ModelDeleted
ModelAt ModelAt
} }

View File

@ -16,7 +16,7 @@ type SysPatent struct {
Description string `gorm:"column:description;type:text;default:null;comment:摘要" json:"description"` Description string `gorm:"column:description;type:text;default:null;comment:摘要" json:"description"`
PrincipalClaim string `gorm:"column:principal_claim;type:text;default:null;comment:主权项" json:"principal_claim"` PrincipalClaim string `gorm:"column:principal_claim;type:text;default:null;comment:主权项" json:"principal_claim"`
IPCCode string `gorm:"column:ipc_code;type:varchar(50);default:null;comment:IPC主分类号" json:"ipc_code"` IPCCode string `gorm:"column:ipc_code;type:varchar(50);default:null;comment:IPC主分类号" json:"ipc_code"`
ShelfStatus Shelf
Status SysParentStatus `gorm:"column:status;type:tinyint(1);default:1;comment:专利状态(1授权2实审3公开)" json:"-"` Status SysParentStatus `gorm:"column:status;type:tinyint(1);default:1;comment:专利状态(1授权2实审3公开)" json:"-"`
ModelDeleted ModelDeleted
ModelAt ModelAt

View File

@ -25,7 +25,7 @@ type TechnologyInstance struct {
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
Purpose string `gorm:"column:purpose;type:text;comment:意图-承担科研项目" json:"purpose"` Purpose string `gorm:"column:purpose;type:text;comment:意图-承担科研项目" json:"purpose"`
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"` Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"`
ShelfStatus Shelf
Status TechnologyInstanceStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` Status TechnologyInstanceStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
ModelDeleted ModelDeleted
ModelAt ModelAt

View File

@ -21,7 +21,7 @@ type TechnologyProduct struct {
CooperationMode config.TechnologyCooperationMode `gorm:"column:cooperation_mode;type:tinyint(1);default:0;comment:合作模式" json:"cooperation_mode"` CooperationMode config.TechnologyCooperationMode `gorm:"column:cooperation_mode;type:tinyint(1);default:0;comment:合作模式" json:"cooperation_mode"`
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"-"` Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"-"`
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
ShelfStatus Shelf
Status TechnologyProductStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` Status TechnologyProductStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
ModelDeleted ModelDeleted
ModelAt ModelAt

View File

@ -15,7 +15,7 @@ type TechnologyProject struct {
Director string `gorm:"column:director;type:varchar(100);default:null;comment:负责人" json:"director"` Director string `gorm:"column:director;type:varchar(100);default:null;comment:负责人" json:"director"`
BeginAt time.Time `gorm:"column:begin_at;type:datetime;not null;comment:开始时间" json:"begin_at"` BeginAt time.Time `gorm:"column:begin_at;type:datetime;not null;comment:开始时间" json:"begin_at"`
FinishAt time.Time `gorm:"column:finish_at;type:datetime;not null;comment:结束时间" json:"finish_at"` FinishAt time.Time `gorm:"column:finish_at;type:datetime;not null;comment:结束时间" json:"finish_at"`
ShelfStatus Shelf
ModelDeleted ModelDeleted
ModelAt ModelAt
} }

View File

@ -9,8 +9,7 @@ import (
// UserInstance 账号信息 // UserInstance 账号信息
type UserInstance struct { type UserInstance struct {
Model Model
Local UUID uint64 `gorm:"column:uuid;uniqueIndex:idx_tenant_user_uuid;type:int;default:0;comment:用户唯一UUID" json:"-"`
UUID uint64 `gorm:"column:-;uniqueIndex:idx_tenant_user_uuid;type:int;default:0;comment:用户唯一UUID" json:"-"`
Source UserInstanceSource `gorm:"column:source;type:tinyint(1);default:1;comment:账号来源" json:"source"` Source UserInstanceSource `gorm:"column:source;type:tinyint(1);default:1;comment:账号来源" json:"source"`
Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"` Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"`
Mobile string `gorm:"column:mobile;index:idx_user_instance_mobile;type:varchar(15);default:null;comment:联系方式" json:"mobile"` Mobile string `gorm:"column:mobile;index:idx_user_instance_mobile;type:varchar(15);default:null;comment:联系方式" json:"mobile"`