init
This commit is contained in:
@ -28,8 +28,10 @@ type ExamineManageInfo struct {
|
||||
|
||||
// examineHandle 审核处理
|
||||
var examineHandle = map[int]func(uint64) (*ExamineManageInfo, error){
|
||||
config.TenantUserIdentityForCompany: examineCompany,
|
||||
config.TenantUserIdentityForExpert: examineExpert,
|
||||
config.TenantUserIdentityForCompany: examineCompany,
|
||||
config.TenantUserIdentityForExpert: examineExpert,
|
||||
config.TenantUserIdentityForResearch: examineResearch,
|
||||
config.TenantUserIdentityForLaboratory: examineLaboratory,
|
||||
}
|
||||
|
||||
func checkManage(IModel model2.IModel, id uint64) error {
|
||||
@ -56,7 +58,7 @@ func examineCompany(id uint64) (*ExamineManageInfo, error) {
|
||||
return &ExamineManageInfo{
|
||||
IModel: mManageCompany.ManageCompany, UID: mManageCompany.UID,
|
||||
IdentityInfo: &model2.UserIdentityForCompany{
|
||||
Industry: mManageCompany.Industry, Keyword: mManageCompany.Keyword,
|
||||
Industry: mManageCompany.Industry, Keyword: mManageCompany.Keyword, CreatedAt: time.Now(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@ -75,6 +77,45 @@ func examineExpert(id uint64) (*ExamineManageInfo, error) {
|
||||
IModel: mManageExpert.ManageExpert, UID: mManageExpert.UID,
|
||||
IdentityInfo: &model2.UserIdentityForExpert{
|
||||
Industry: mManageExpert.Industry, Keyword: mManageExpert.Keyword, Research: mManageExpert.Research,
|
||||
CreatedAt: time.Now(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func examineResearch(id uint64) (*ExamineManageInfo, error) {
|
||||
mManageResearch := model.NewManageResearch()
|
||||
|
||||
err := checkManage(mManageResearch.ManageResearch, id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if mManageResearch.Status != model2.ExamineStatusForOngoing {
|
||||
return nil, errors.New("当前入住信息已审核")
|
||||
}
|
||||
return &ExamineManageInfo{
|
||||
IModel: mManageResearch.ManageResearch, UID: mManageResearch.UID,
|
||||
IdentityInfo: &model2.UserIdentityForResearch{
|
||||
Name: mManageResearch.Name, Industry: mManageResearch.Industry, Keyword: mManageResearch.Keyword,
|
||||
Research: mManageResearch.Research, CreatedAt: time.Now(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func examineLaboratory(id uint64) (*ExamineManageInfo, error) {
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
|
||||
err := checkManage(mManageLaboratory.ManageLaboratory, id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if mManageLaboratory.Status != model2.ExamineStatusForOngoing {
|
||||
return nil, errors.New("当前入住信息已审核")
|
||||
}
|
||||
return &ExamineManageInfo{
|
||||
IModel: mManageLaboratory.ManageLaboratory, UID: mManageLaboratory.UID,
|
||||
IdentityInfo: &model2.UserIdentityForLaboratory{
|
||||
Name: mManageLaboratory.Name, Industry: mManageLaboratory.Industry, Keyword: mManageLaboratory.Keyword,
|
||||
Research: mManageLaboratory.Research, CreatedAt: time.Now(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@ -96,7 +137,6 @@ func (c *Examine) Launch(id uint64, identity, status int) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
if err = model2.Updates(data.IModel, map[string]interface{}{
|
||||
"status": status, "updated_at": time.Now(),
|
||||
|
Reference in New Issue
Block a user