feat:完善项目
This commit is contained in:
@ -50,7 +50,7 @@ func (*Manage) Expert(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewInstance()(api.GetSession()(c).(*session.Admin), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewInstance()(api.GetSession()(c).(*session.Admin), api.GetTenantID()(c).(uint64)).
|
||||
Expert(form.Name, form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)
|
||||
}
|
||||
|
28
app/api/admin/controller/manage/es.go
Normal file
28
app/api/admin/controller/manage/es.go
Normal file
@ -0,0 +1,28 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/service"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ESParams struct {
|
||||
Identity int
|
||||
Name string
|
||||
Keywords, Industrys, Researchs []string
|
||||
}
|
||||
|
||||
func (this *ESParams) Set() {
|
||||
_identitys := make([]string, 0)
|
||||
|
||||
for _, v := range this.Industrys {
|
||||
_identitys = append(_identitys, config.GetIndustryInfo(v, "-", "-"))
|
||||
}
|
||||
_ = service.NewESManage(
|
||||
service.WithManageIdentity(this.Identity),
|
||||
service.WithManageTitle(this.Name),
|
||||
service.WithManageIndustry(strings.Join(_identitys, ";")),
|
||||
service.WithManageKeyword(strings.Join(this.Keywords, ";")),
|
||||
service.WithManageResearch(strings.Join(this.Researchs, ";")),
|
||||
).Create()
|
||||
}
|
@ -18,8 +18,10 @@ type Examine struct {
|
||||
type ExamineHandle func(session *session.Admin) *Examine
|
||||
|
||||
type ExamineManageInfo struct {
|
||||
IModel model2.IModel
|
||||
UIDs []uint64 // 用户表UUID
|
||||
IModel model2.IModel
|
||||
UIDs []uint64 // 用户表UUID
|
||||
Name string
|
||||
Keywords, Industrys, Researchs []string
|
||||
}
|
||||
|
||||
// examineHandle 审核处理
|
||||
@ -60,7 +62,9 @@ func examineCompany(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageCompany.ManageCompany, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageCompany.ManageCompany, UIDs: uids,
|
||||
Name: mManageCompany.Name, Industrys: mManageCompany.GetIndustryAttribute(),
|
||||
Keywords: mManageCompany.GetKeywordAttribute()}, nil
|
||||
}
|
||||
|
||||
func examineExpert(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
@ -82,7 +86,9 @@ func examineExpert(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageExpert.ManageExpert, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageExpert.ManageExpert, UIDs: uids,
|
||||
Name: mManageExpert.Name, Industrys: mManageExpert.GetIndustryAttribute(),
|
||||
Keywords: mManageExpert.GetKeywordAttribute(), Researchs: mManageExpert.GetResearchAttribute()}, nil
|
||||
}
|
||||
|
||||
func examineResearch(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
@ -105,7 +111,9 @@ func examineResearch(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageResearch.ManageResearch, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageResearch.ManageResearch, UIDs: uids,
|
||||
Name: mManageResearch.Name, Industrys: mManageResearch.GetIndustryAttribute(),
|
||||
Keywords: mManageResearch.GetKeywordAttribute(), Researchs: mManageResearch.GetResearchAttribute()}, nil
|
||||
}
|
||||
|
||||
func examineLaboratory(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
@ -128,7 +136,9 @@ func examineLaboratory(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageLaboratory.ManageLaboratory, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageLaboratory.ManageLaboratory, UIDs: uids,
|
||||
Name: mManageLaboratory.Name, Industrys: mManageLaboratory.GetIndustryAttribute(),
|
||||
Keywords: mManageLaboratory.GetKeywordAttribute(), Researchs: mManageLaboratory.GetResearchAttribute()}, nil
|
||||
}
|
||||
|
||||
func examineAgent(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
@ -151,7 +161,9 @@ func examineAgent(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageAgent.ManageAgent, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageAgent.ManageAgent, UIDs: uids,
|
||||
Name: mManageAgent.Name, Industrys: mManageAgent.GetIndustryAttribute(),
|
||||
Keywords: mManageAgent.GetKeywordAttribute()}, nil
|
||||
}
|
||||
|
||||
// Launch 发起审核
|
||||
@ -210,6 +222,11 @@ func (c *Examine) Launch(id uint64, identity, status int) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// 存放es中
|
||||
(&ESParams{
|
||||
Identity: identity, Name: data.Name, Keywords: data.Keywords,
|
||||
Industrys: data.Industrys, Researchs: data.Researchs,
|
||||
}).Set()
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ import (
|
||||
type Instance struct {
|
||||
*session.Admin
|
||||
gorm.Model
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *session.Admin, local string) *Instance
|
||||
type InstanceHandle func(session *session.Admin, tenantID uint64) *Instance
|
||||
|
||||
type (
|
||||
// InstanceForExpert 专家信息
|
||||
@ -87,10 +87,10 @@ func (c *Instance) Expert(name string, status int, page, pageSize int) (*control
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *session.Admin, local string) *Instance {
|
||||
return func(session *session.Admin, tenantID uint64) *Instance {
|
||||
return &Instance{
|
||||
Admin: session,
|
||||
local: local,
|
||||
Admin: session,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user