feat:完善入驻信息管理
This commit is contained in:
@ -31,8 +31,8 @@ func (c *RegisterParams) checkCaptcha() (bool, error) {
|
||||
func (c *RegisterParams) checkUserExist(mUserInstance *model2.UserInstance, local string) (bool, error) {
|
||||
var count int64
|
||||
|
||||
if err := model2.Count(mUserInstance, &count, model2.NewWhere("mobile", c.Mobile),
|
||||
model2.NewWhere("local", local)); err != nil {
|
||||
if err := model2.Count(mUserInstance, &count, model2.NewWhere("mobile", c.Mobile)); //model2.NewWhere("local", local)
|
||||
err != nil {
|
||||
return false, err
|
||||
}
|
||||
return count <= 0, nil
|
||||
@ -60,7 +60,6 @@ func (c *Register) Launch(params *RegisterParams) (*InstanceLoginReturn, error)
|
||||
} else if !pass {
|
||||
return nil, errors.New("当前手机号码已注册")
|
||||
}
|
||||
mUserInstance.Local.Local = c.local
|
||||
mUserInstance.Source = model2.UserInstanceSourceForLocal
|
||||
mUserInstance.Password = utils.GetRandomString(12)
|
||||
mUserInstance.Mobile = params.Mobile
|
||||
|
@ -1,11 +1,17 @@
|
||||
package settled
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Company 经纪人入驻信息
|
||||
// Agent 经纪人入驻信息
|
||||
type Agent struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
@ -15,7 +21,62 @@ type AgentHandle func(session *session.Enterprise, local string) *Agent
|
||||
|
||||
// Launch 经纪人入驻
|
||||
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 {
|
||||
|
@ -36,11 +36,11 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
return err
|
||||
} else if isExist {
|
||||
// 审核中
|
||||
if mManageCompany.Status == model2.ExamineStatusForOngoing {
|
||||
if mManageCompany.Examine.ExamineStatus == model2.ExamineStatusForOngoing {
|
||||
return errors.New("操作错误,当前该企业信息审核中,不可入驻")
|
||||
}
|
||||
// 审核通过
|
||||
if mManageCompany.Status == model2.ExamineStatusForAgree {
|
||||
if mManageCompany.Examine.ExamineStatus == model2.ExamineStatusForAgree {
|
||||
// 筛选企业条件
|
||||
if err = params.filter(config.TenantUserIdentityForCompany,
|
||||
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
|
||||
}
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
|
@ -36,13 +36,13 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
return err
|
||||
} else if isExist {
|
||||
// 审核中
|
||||
if mManageExpert.Status == model2.ExamineStatusForOngoing {
|
||||
if mManageExpert.Examine.ExamineStatus == model2.ExamineStatusForOngoing {
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
@ -80,7 +80,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
return err
|
||||
}
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
|
@ -35,13 +35,13 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
return err
|
||||
} else if isExist {
|
||||
// 审核中
|
||||
if mManageLaboratory.Status == model2.ExamineStatusForOngoing {
|
||||
if mManageLaboratory.Examine.ExamineStatus == model2.ExamineStatusForOngoing {
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
@ -73,7 +73,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
return err
|
||||
}
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
|
@ -35,13 +35,13 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
return err
|
||||
} else if isExist {
|
||||
// 审核中
|
||||
if mManageResearch.Status == model2.ExamineStatusForOngoing {
|
||||
if mManageResearch.Examine.ExamineStatus == model2.ExamineStatusForOngoing {
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
@ -71,7 +71,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
return err
|
||||
}
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
|
||||
mSysPatent := model.NewSysPatent()
|
||||
|
||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("shelf", model2.ShelfStatusForUp),
|
||||
Where: model2.NewWhere("shelf_status", model2.ShelfStatusForUp),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}}
|
||||
|
||||
|
@ -120,7 +120,7 @@ func (c *Instance) Form(params *InstanceParams) error {
|
||||
func (c *Instance) Shelf(id uint64, status int) error {
|
||||
mTechnologyInstance := model.NewTechnologyInstance()
|
||||
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 {
|
||||
return err
|
||||
@ -130,11 +130,11 @@ func (c *Instance) Shelf(id uint64, status int) error {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
|
||||
return errors.New("操作错误,当前状态不允许处理上下架")
|
||||
} else if mTechnologyInstance.ShelfStatus.Shelf == model2.ShelfStatusKind(status) {
|
||||
} else if mTechnologyInstance.Shelf.ShelfStatus == model2.ShelfStatusKind(status) {
|
||||
return errors.New("操作错误,状态异常")
|
||||
}
|
||||
if err = model2.Updates(mTechnologyInstance.TechnologyInstance, map[string]interface{}{
|
||||
"shelf": status, "updated_at": time.Now(),
|
||||
"shelf_status": status, "updated_at": time.Now(),
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ type (
|
||||
// PatentInfo 专利信息
|
||||
PatentInfo struct {
|
||||
*sys.PatentInfo
|
||||
Shelf model2.ShelfStatusKind
|
||||
Status model2.SysParentStatus
|
||||
ShelfStatus model2.ShelfStatusKind
|
||||
Status model2.SysParentStatus
|
||||
}
|
||||
// PatentDetailInfo 专利详细信息
|
||||
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,
|
||||
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
|
||||
|
@ -149,7 +149,7 @@ func (c *Product) Shelf(id uint64, status int) error {
|
||||
mTechnologyProduct := model.NewTechnologyProduct()
|
||||
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 {
|
||||
return err
|
||||
@ -157,11 +157,11 @@ func (c *Product) Shelf(id uint64, status int) error {
|
||||
return errors.New("操作错误,产品信息不存在或已被删除")
|
||||
} else if mTechnologyProduct.UID != c.UID {
|
||||
return errors.New("无权限操作")
|
||||
} else if mTechnologyProduct.ShelfStatus.Shelf == model2.ShelfStatusKind(status) {
|
||||
} else if mTechnologyProduct.ShelfStatus == model2.ShelfStatusKind(status) {
|
||||
return errors.New("操作错误,无需变更上下架状态")
|
||||
}
|
||||
return model2.Updates(mTechnologyProduct.TechnologyProduct, map[string]interface{}{
|
||||
"shelf": status, "updated_at": time.Now(),
|
||||
"shelf_status": status, "updated_at": time.Now(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ func (c *Project) Shelf(id uint64, status int) error {
|
||||
mSysPatent.ID = mUserPatent.PatentID
|
||||
|
||||
return model2.Updates(mSysPatent.SysPatent, map[string]interface{}{
|
||||
"shelf": status, "updated_at": time.Now(),
|
||||
"shelf_status": status, "updated_at": time.Now(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,7 @@ import (
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Settled 入驻
|
||||
@ -80,62 +77,62 @@ func (c *Settled) filter(identity int, where ...*model2.ModelWhere) (bool, error
|
||||
return mSysIdentity.IsExamine == model2.SysIdentityExamineForYes, nil
|
||||
}
|
||||
|
||||
// Company 公司企业
|
||||
func (c *Settled) Company(params *SettledParams, inviterID uint64, other *config.IdentityForCompany) error {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local),
|
||||
model2.NewWhere("status", model2.ExamineStatusForRefuse))
|
||||
|
||||
isExamine := true
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if isExist {
|
||||
if mManageCompany.Status == model2.ExamineStatusForOngoing {
|
||||
return errors.New("操作错误,当前企业信息审核中,不可入驻")
|
||||
}
|
||||
// 筛选企业条件
|
||||
if isExamine, err = c.filter(config.TenantUserIdentityForCompany, model2.NewWhere("company_id", mManageCompany.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
mManageCompany.Local.Local = c.local
|
||||
mManageCompany.InviterID = inviterID
|
||||
mManageCompany.Name = params.Name
|
||||
mManageCompany.Code = params.Code
|
||||
mManageCompany.Image = model2.Image{Image: params.Image}
|
||||
mManageCompany.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
mManageCompany.WebUrl = other.WebUrl
|
||||
mManageCompany.SetIndustryAttribute(params.Industrys)
|
||||
mManageCompany.SetKeywordAttribute(params.Keywords)
|
||||
mManageCompany.Introduce = params.Introduce
|
||||
|
||||
if isExamine {
|
||||
mManageCompany.Status = model2.ExamineStatusForAgree
|
||||
}
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
if mManageCompany.ID <= 0 {
|
||||
if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// 过滤用户其他公司入驻信息
|
||||
mUserCompany := model.NewUserCompany()
|
||||
|
||||
if err := model2.UpdatesWhere(mUserCompany.UserCompany, map[string]interface{}{
|
||||
"status": model2.InvalidStatusForYes, "updated_at": time.Now(),
|
||||
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mUserCompany.UID = c.UID
|
||||
mUserCompany.CompanyID = mManageCompany.ID
|
||||
return model2.Create(mUserCompany.UserCompany, tx)
|
||||
})
|
||||
}
|
||||
//// Company 公司企业
|
||||
//func (c *Settled) Company(params *SettledParams, inviterID uint64, other *config.IdentityForCompany) error {
|
||||
// mManageCompany := model.NewManageCompany()
|
||||
//
|
||||
// isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "status"},
|
||||
// model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local),
|
||||
// model2.NewWhere("status", model2.ExamineStatusForRefuse))
|
||||
//
|
||||
// isExamine := true
|
||||
//
|
||||
// if err != nil {
|
||||
// return err
|
||||
// } else if isExist {
|
||||
// if mManageCompany.ExamineStatus == model2.ExamineStatusForOngoing {
|
||||
// return errors.New("操作错误,当前企业信息审核中,不可入驻")
|
||||
// }
|
||||
// // 筛选企业条件
|
||||
// if isExamine, err = c.filter(config.TenantUserIdentityForCompany, model2.NewWhere("company_id", mManageCompany.ID)); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// }
|
||||
// mManageCompany.Local.Local = c.local
|
||||
// mManageCompany.InviterID = inviterID
|
||||
// mManageCompany.Name = params.Name
|
||||
// mManageCompany.Code = params.Code
|
||||
// mManageCompany.Image = model2.Image{Image: params.Image}
|
||||
// mManageCompany.Area = model2.Area{
|
||||
// Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
// }
|
||||
// mManageCompany.Url = other.Url
|
||||
// mManageCompany.SetIndustryAttribute(params.Industrys)
|
||||
// mManageCompany.SetKeywordAttribute(params.Keywords)
|
||||
// mManageCompany.Introduce = params.Introduce
|
||||
//
|
||||
// if isExamine {
|
||||
// mManageCompany.ExamineStatus = model2.ExamineStatusForAgree
|
||||
// }
|
||||
// return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// if mManageCompany.ID <= 0 {
|
||||
// if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// }
|
||||
// // 过滤用户其他公司入驻信息
|
||||
// mUserCompany := model.NewUserCompany()
|
||||
//
|
||||
// if err := model2.UpdatesWhere(mUserCompany.UserCompany, map[string]interface{}{
|
||||
// "status": model2.InvalidStatusForYes, "updated_at": time.Now(),
|
||||
// }, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// mUserCompany.UID = c.UID
|
||||
// mUserCompany.CompanyID = mManageCompany.ID
|
||||
// return model2.Create(mUserCompany.UserCompany, tx)
|
||||
// })
|
||||
//}
|
||||
|
||||
//
|
||||
//// Expert 专家
|
||||
|
@ -19,9 +19,8 @@ type Examine struct {
|
||||
type ExamineHandle func(session *service.Session, local string) *Examine
|
||||
|
||||
type ExamineManageInfo struct {
|
||||
IModel model2.IModel
|
||||
TenantID uint64 // 租户ID
|
||||
UID uint64 // 用户表UUID
|
||||
IModel model2.IModel
|
||||
UIDs []uint64 // 用户表UUID
|
||||
}
|
||||
|
||||
// examineHandle 审核处理
|
||||
@ -50,11 +49,11 @@ func examineCompany(id uint64) (*ExamineManageInfo, error) {
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if mManageCompany.Status != model2.ExamineStatusForOngoing {
|
||||
} else if mManageCompany.Examine.ExamineStatus != model2.ExamineStatusForOngoing {
|
||||
return nil, errors.New("当前入住信息已审核")
|
||||
}
|
||||
return &ExamineManageInfo{
|
||||
IModel: mManageCompany.ManageCompany, UID: mManageCompany.UID,
|
||||
IModel: mManageCompany.ManageCompany,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -65,11 +64,11 @@ func examineExpert(id uint64) (*ExamineManageInfo, error) {
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if mManageExpert.Status != model2.ExamineStatusForOngoing {
|
||||
} else if mManageExpert.Examine.ExamineStatus != model2.ExamineStatusForOngoing {
|
||||
return nil, errors.New("当前入住信息已审核")
|
||||
}
|
||||
return &ExamineManageInfo{
|
||||
IModel: mManageExpert.ManageExpert, UID: mManageExpert.UID,
|
||||
IModel: mManageExpert.ManageExpert,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -80,11 +79,11 @@ func examineResearch(id uint64) (*ExamineManageInfo, error) {
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if mManageResearch.Status != model2.ExamineStatusForOngoing {
|
||||
} else if mManageResearch.Examine.ExamineStatus != model2.ExamineStatusForOngoing {
|
||||
return nil, errors.New("当前入住信息已审核")
|
||||
}
|
||||
return &ExamineManageInfo{
|
||||
IModel: mManageResearch.ManageResearch, UID: mManageResearch.UID,
|
||||
IModel: mManageResearch.ManageResearch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -95,11 +94,11 @@ func examineLaboratory(id uint64) (*ExamineManageInfo, error) {
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if mManageLaboratory.Status != model2.ExamineStatusForOngoing {
|
||||
} else if mManageLaboratory.Examine.ExamineStatus != model2.ExamineStatusForOngoing {
|
||||
return nil, errors.New("当前入住信息已审核")
|
||||
}
|
||||
return &ExamineManageInfo{
|
||||
IModel: mManageLaboratory.ManageLaboratory, UID: mManageLaboratory.UID,
|
||||
IModel: mManageLaboratory.ManageLaboratory,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -134,19 +133,20 @@ func (c *Examine) Launch(id uint64, identity, status int) error {
|
||||
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
if !isExist {
|
||||
mUserIdentity.UID = data.UID
|
||||
//mUserIdentity.UID = data.UID
|
||||
mUserIdentity.Identity = identity
|
||||
}
|
||||
// 更新账户身份信息
|
||||
mUserInstance := model.NewUserInstance()
|
||||
|
||||
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
|
||||
}
|
||||
if err = model2.Updates(mUserInstance.UserInstance, map[string]interface{}{
|
||||
|
@ -41,11 +41,13 @@ type (
|
||||
}
|
||||
// IdentityForAgent 经纪人
|
||||
IdentityForAgent struct {
|
||||
ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
|
||||
Url string `json:"url" form:"url"` // 实验室网站
|
||||
Longitude float64 `json:"longitude" form:"longitude"` // 经度
|
||||
Latitude float64 `json:"latitude" form:"latitude"` // 纬度
|
||||
Researchs []string `json:"researchs" form:"researchs"` // 研究方向
|
||||
ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
|
||||
IDCard string `json:"id_card" form:"id_card" binding:"required"` // 身份证号
|
||||
WorkExperience string `json:"work_experience" form:"work_experience" binding:"required"` // 工作经历
|
||||
WorkPlace string `json:"work_place" form:"work_place" binding:"required"` // 工作地点
|
||||
CredentialImages []string `json:"credential_images" form:"credential_images"` // 资格证书
|
||||
Longitude float64 `json:"longitude" form:"longitude"` // 经度
|
||||
Latitude float64 `json:"latitude" form:"latitude"` // 纬度
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -74,6 +74,16 @@ func initModel() {
|
||||
// 日志管理
|
||||
&synchronized{iModel: model.NewSysUserRole()},
|
||||
&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() {
|
||||
|
@ -72,9 +72,9 @@ const (
|
||||
AccountStatusForDisable
|
||||
)
|
||||
|
||||
// ShelfStatus 上下架状态
|
||||
type ShelfStatus struct {
|
||||
Shelf ShelfStatusKind `gorm:"column:shelf;type:tinyint(1);default:0;comment:上下架状态(1:上架,2:下架)" json:"shelf"`
|
||||
// Shelf 上下架状态
|
||||
type Shelf struct {
|
||||
ShelfStatus ShelfStatusKind `gorm:"column:shelf_status;type:tinyint(1);default:0;comment:上下架状态(1:上架,2:下架)" json:"shelf_status"`
|
||||
}
|
||||
|
||||
type ShelfStatusKind int
|
||||
@ -86,9 +86,9 @@ const (
|
||||
ShelfStatusForDown
|
||||
)
|
||||
|
||||
// ExamineStatus 审核状态
|
||||
type ExamineStatus struct {
|
||||
Status ExamineStatusKind `gorm:"column:status;type:tinyint(1);default:0;comment:审核状态(0:审核中,1:审核通过,2:审核拒绝)" json:"status"`
|
||||
// Examine 审核状态
|
||||
type Examine struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ const (
|
||||
|
||||
// InvalidStatus 失效状态
|
||||
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 失效状态
|
||||
|
@ -15,10 +15,14 @@ type ManageAgent struct {
|
||||
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:"-"`
|
||||
CredentialImage string `gorm:"column:credential_image;type:varchar(255);default:null;comment:资格证书" json:"credential_image"`
|
||||
Examine
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
type ManageAgentIDImage struct {
|
||||
}
|
||||
|
||||
func (m *ManageAgent) TableName() string {
|
||||
return "manage_agent"
|
||||
}
|
||||
@ -43,6 +47,16 @@ func (m *ManageAgent) SetKeywordAttribute(value []string) {
|
||||
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 {
|
||||
return &ManageAgent{}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ type ManageCompany struct {
|
||||
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"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
ExamineStatus
|
||||
Examine
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ type ManageExpert struct {
|
||||
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"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
ExamineStatus
|
||||
Examine
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ type ManageLaboratory struct {
|
||||
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"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
ExamineStatus
|
||||
Examine
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ type ManageResearch struct {
|
||||
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"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
ExamineStatus
|
||||
Examine
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ type SysPatent struct {
|
||||
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"`
|
||||
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:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
|
@ -25,7 +25,7 @@ type TechnologyInstance struct {
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
Purpose string `gorm:"column:purpose;type:text;comment:意图-承担科研项目" json:"purpose"`
|
||||
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"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
|
@ -21,7 +21,7 @@ type TechnologyProduct struct {
|
||||
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:"-"`
|
||||
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"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
|
@ -15,7 +15,7 @@ type TechnologyProject struct {
|
||||
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"`
|
||||
FinishAt time.Time `gorm:"column:finish_at;type:datetime;not null;comment:结束时间" json:"finish_at"`
|
||||
ShelfStatus
|
||||
Shelf
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -9,8 +9,7 @@ import (
|
||||
// UserInstance 账号信息
|
||||
type UserInstance struct {
|
||||
Model
|
||||
Local
|
||||
UUID uint64 `gorm:"column:-;uniqueIndex:idx_tenant_user_uuid;type:int;default:0;comment:用户唯一UUID" json:"-"`
|
||||
UUID uint64 `gorm:"column:uuid;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"`
|
||||
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"`
|
||||
|
Reference in New Issue
Block a user