feat:优化项目信息
This commit is contained in:
@ -6,7 +6,6 @@ import (
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
@ -20,10 +19,9 @@ type Examine struct {
|
||||
type ExamineHandle func(session *service.Session, local string) *Examine
|
||||
|
||||
type ExamineManageInfo struct {
|
||||
IModel model2.IModel
|
||||
TenantID uint64 // 租户ID
|
||||
UID uint64 // 用户表UUID
|
||||
IdentityInfo model2.IUserIdentity
|
||||
IModel model2.IModel
|
||||
TenantID uint64 // 租户ID
|
||||
UID uint64 // 用户表UUID
|
||||
}
|
||||
|
||||
// examineHandle 审核处理
|
||||
@ -57,9 +55,6 @@ func examineCompany(id uint64) (*ExamineManageInfo, error) {
|
||||
}
|
||||
return &ExamineManageInfo{
|
||||
IModel: mManageCompany.ManageCompany, UID: mManageCompany.UID,
|
||||
IdentityInfo: &model2.UserIdentityForCompany{
|
||||
Industry: mManageCompany.Industry, Keyword: mManageCompany.Keyword, CreatedAt: time.Now(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -75,10 +70,6 @@ func examineExpert(id uint64) (*ExamineManageInfo, error) {
|
||||
}
|
||||
return &ExamineManageInfo{
|
||||
IModel: mManageExpert.ManageExpert, UID: mManageExpert.UID,
|
||||
IdentityInfo: &model2.UserIdentityForExpert{
|
||||
Industry: mManageExpert.Industry, Keyword: mManageExpert.Keyword, Research: mManageExpert.Research,
|
||||
CreatedAt: time.Now(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -94,10 +85,6 @@ func examineResearch(id uint64) (*ExamineManageInfo, error) {
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
@ -113,10 +100,6 @@ func examineLaboratory(id uint64) (*ExamineManageInfo, error) {
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
@ -147,25 +130,17 @@ func (c *Examine) Launch(id uint64, identity, status int) error {
|
||||
if _status == model2.ExamineStatusForRefuse {
|
||||
return nil
|
||||
}
|
||||
mUserManage := model.NewUserManage()
|
||||
mUserIdentity := model.NewUserIdentity()
|
||||
|
||||
isExist := true
|
||||
|
||||
if isExist, err = model2.FirstField(mUserManage.UserManage, []string{"id", "uid"}, model2.NewWhere("uid", data.UID),
|
||||
if isExist, err = model2.FirstField(mUserIdentity.UserIdentity, []string{"id", "uid"}, model2.NewWhere("uid", data.UID),
|
||||
model2.NewWhere("identity", identity)); err != nil {
|
||||
return err
|
||||
}
|
||||
if !isExist {
|
||||
mUserManage.ManageID = data.IModel.GetID()
|
||||
mUserManage.UID = data.UID
|
||||
mUserManage.Identity = identity
|
||||
mUserManage.IdentityInfo = utils.AnyToJSON(data.IdentityInfo)
|
||||
} else {
|
||||
if err = model2.Updates(mUserManage.UserManage, map[string]interface{}{
|
||||
"identity_info": utils.AnyToJSON(data.IdentityInfo), "updated_at": time.Now(),
|
||||
}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mUserIdentity.UID = data.UID
|
||||
mUserIdentity.Identity = identity
|
||||
}
|
||||
// 更新账户身份信息
|
||||
mUserInstance := model.NewUserInstance()
|
||||
|
Reference in New Issue
Block a user