feat:完善项目信息
This commit is contained in:
@ -11,6 +11,19 @@ import (
|
||||
type Manage struct{}
|
||||
|
||||
type (
|
||||
// manageForm 参数信息
|
||||
manageForm struct {
|
||||
api.IDStringForm
|
||||
api.TenantIDStringForm
|
||||
api.ImageForm
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Code string `json:"code" form:"code" binding:"required"`
|
||||
Mobile string `json:"mobile" form:"mobile" binding:"required"`
|
||||
config.Area
|
||||
Industrys []string `json:"industrys" form:"industrys"`
|
||||
Keywords []string `json:"keywords" form:"keywords"`
|
||||
Introduce string `json:"introduce" form:"introduce"`
|
||||
}
|
||||
// manageExamineForm 审核处理
|
||||
manageExamineForm struct {
|
||||
api.IDStringForm
|
||||
@ -19,6 +32,13 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func (c *manageForm) bind() *manage.BasicParams {
|
||||
return &manage.BasicParams{ID: c.IDStringForm.Convert(), TenantID: c.TenantIDStringForm.Convert(),
|
||||
Name: c.Name, Image: c.FilterImageURL(), Code: c.Code, Mobile: c.Mobile,
|
||||
Introduce: c.Introduce, Area: c.Area, Industrys: c.Industrys, Keywords: c.Keywords,
|
||||
}
|
||||
}
|
||||
|
||||
// handle 审核处理
|
||||
func (a *manageExamineForm) handle(session *session.Admin, params map[string]interface{}) error {
|
||||
return manage.NewExamine()(session).Launch(a.Convert(), a.Identity, a.Status, params)
|
||||
@ -35,8 +55,8 @@ func (*Manage) Company(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewInstance()(api.GetSession()(c).(*session.Admin), api.GetTenantID()(c).(uint64)).
|
||||
Company(form.Convert(), form.Name, form.ExamineStatus, form.Page, form.PageSize)
|
||||
data, err := manage.NewCompany()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert(), form.Name,
|
||||
form.ExamineStatus, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -47,8 +67,7 @@ func (*Manage) CompanyDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewInstance()(api.GetSession()(c).(*session.Admin), api.GetTenantID()(c).(uint64)).
|
||||
CompanyDetail(form.Convert())
|
||||
data, err := manage.NewCompany()(api.GetSession()(c).(*session.Admin)).Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -77,8 +96,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).(uint64)).
|
||||
Expert(form.Convert(), form.Name, form.ExamineStatus, form.Page, form.PageSize)
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert(), form.Name, form.ExamineStatus, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -89,11 +107,23 @@ func (*Manage) ExpertDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewInstance()(api.GetSession()(c).(*session.Admin), api.GetTenantID()(c).(uint64)).
|
||||
ExpertDetail(form.Convert())
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Admin)).Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) ExpertForm(c *gin.Context) {
|
||||
form := &struct {
|
||||
manageForm
|
||||
config.IdentityForExpert
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewExpert()(api.GetSession()(c).(*session.Admin)).Form(form.bind(), &form.IdentityForExpert)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Manage) ExpertExamine(c *gin.Context) {
|
||||
form := new(manageExamineForm)
|
||||
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"SciencesServer/app/api/admin/controller/user"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/session"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@ -39,6 +40,8 @@ func (this *userForm) RoleInfo() []uint64 {
|
||||
}
|
||||
|
||||
func (*User) Info(c *gin.Context) {
|
||||
fmt.Println(4564645646)
|
||||
|
||||
data, err := user.NewInstance()(api.GetSession()(c).(*session.Admin)).Info()
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
11
app/api/admin/controller/manage/basic.go
Normal file
11
app/api/admin/controller/manage/basic.go
Normal file
@ -0,0 +1,11 @@
|
||||
package manage
|
||||
|
||||
import "SciencesServer/app/basic/config"
|
||||
|
||||
// BasicParams 基本信息
|
||||
type BasicParams struct {
|
||||
ID, TenantID uint64
|
||||
Name, Image, Code, Mobile, Introduce string
|
||||
config.Area
|
||||
Industrys, Keywords []string
|
||||
}
|
106
app/api/admin/controller/manage/company.go
Normal file
106
app/api/admin/controller/manage/company.go
Normal file
@ -0,0 +1,106 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/admin/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type Company struct {
|
||||
*session.Admin
|
||||
}
|
||||
|
||||
type CompanyHandle func(session *session.Admin) *Company
|
||||
|
||||
type (
|
||||
// CompanyInstance 公司企业信息
|
||||
CompanyInstance struct {
|
||||
ID string `json:"id"`
|
||||
*model.ManageCompanyInfo
|
||||
Industrys []string `json:"industrys"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// CompanyDetail 公司企业详细信息
|
||||
CompanyDetail struct {
|
||||
ID string `json:"id"`
|
||||
*model2.ManageCompany
|
||||
Industrys []string `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Directions []string `json:"directions"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// CompanyParams 公司企业参数信息
|
||||
CompanyParams struct {
|
||||
}
|
||||
)
|
||||
|
||||
// Instance 首页信息
|
||||
func (c *Company) Instance(tenantID uint64, name string, status int, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if c.TenantID > 0 {
|
||||
where = append(where, model2.NewWhere("c.tenant_id", c.TenantID))
|
||||
}
|
||||
if tenantID > 0 {
|
||||
where = append(where, model2.NewWhere("c.tenant_id", tenantID))
|
||||
}
|
||||
if name != "" {
|
||||
where = append(where, model2.NewWhereLike("c.name", name))
|
||||
}
|
||||
if status > 0 {
|
||||
where = append(where, model2.NewWhere("c.examine_status", status))
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mManageCompany.Companys(page, pageSize, &count)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := make([]*CompanyInstance, 0)
|
||||
|
||||
for _, v := range out {
|
||||
mManageCompany.Industry = v.Industry
|
||||
|
||||
list = append(list, &CompanyInstance{
|
||||
ID: v.GetEncodeID(), ManageCompanyInfo: v, Industrys: mManageCompany.GetIndustryAttribute(), Area: v.FormatBasic(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// Form 数据操作
|
||||
func (c *Company) Form(params *CompanyParams) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Detail 详细信息
|
||||
func (c *Company) Detail(id uint64) (*CompanyDetail, error) {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
out, err := mManageCompany.Company(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if out.ManageCompany == nil {
|
||||
return nil, errors.New("操作错误,公司企业信息不存在或已被删除")
|
||||
}
|
||||
return &CompanyDetail{
|
||||
ID: out.GetEncodeID(),
|
||||
ManageCompany: out.ManageCompany,
|
||||
Industrys: out.GetIndustryAttribute(),
|
||||
Keywords: out.GetKeywordAttribute(),
|
||||
Area: out.FormatBasic(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewCompany() CompanyHandle {
|
||||
return func(session *session.Admin) *Company {
|
||||
return &Company{session}
|
||||
}
|
||||
}
|
158
app/api/admin/controller/manage/expert.go
Normal file
158
app/api/admin/controller/manage/expert.go
Normal file
@ -0,0 +1,158 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/admin/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Expert struct {
|
||||
*session.Admin
|
||||
}
|
||||
|
||||
type ExpertHandle func(session *session.Admin) *Expert
|
||||
|
||||
type (
|
||||
// ExpertInstance 专家信息
|
||||
ExpertInstance struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Industrys []string `json:"industrys"`
|
||||
ResearchName string `json:"research_name"`
|
||||
LaboratoryName string `json:"laboratory_name"`
|
||||
Address string `json:"address"`
|
||||
ExamineStatus model2.ExamineStatusKind `json:"examine_status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// ExpertDetail 专家详细信息
|
||||
ExpertDetail struct {
|
||||
ID string `json:"id"`
|
||||
*model2.ManageExpert
|
||||
Industrys []string `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Researchs []string `json:"researchs"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// ExpertParams 专家参数信息
|
||||
ExpertParams struct {
|
||||
ID, TenantID uint64
|
||||
}
|
||||
)
|
||||
|
||||
// Instance 首页信息
|
||||
func (c *Expert) Instance(tenantID uint64, name string, examineStatus int, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mManageExpert := model.NewManageExpert()
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if c.TenantID > 0 {
|
||||
where = append(where, model2.NewWhere("e.tenant_id", c.TenantID))
|
||||
}
|
||||
if tenantID > 0 {
|
||||
where = append(where, model2.NewWhere("e.tenant_id", tenantID))
|
||||
}
|
||||
if name != "" {
|
||||
where = append(where, model2.NewWhereLike("e.name", name))
|
||||
}
|
||||
if examineStatus > 0 {
|
||||
where = append(where, model2.NewWhere("e.examine_status", examineStatus))
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mManageExpert.Experts(page, pageSize, &count, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*ExpertInstance, 0)
|
||||
|
||||
for _, v := range out {
|
||||
_industrys := make([]string, 0)
|
||||
|
||||
for _, v := range strings.Split(v.Industry, ";") {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/"))
|
||||
}
|
||||
// 研究机构,实验室
|
||||
list = append(list, &ExpertInstance{ID: v.GetEncodeID(), Name: v.Name, Industrys: _industrys,
|
||||
ResearchName: v.ResearchName, LaboratoryName: v.LaboratoryName, ExamineStatus: v.ExamineStatus,
|
||||
Address: v.FormatBasic(), CreatedAt: v.CreatedAt, Area: v.FormatBasic(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// Detail 详细信息
|
||||
func (*Expert) Detail(id uint64) (*ExpertDetail, error) {
|
||||
mManageExpert := model.NewManageExpert()
|
||||
|
||||
out, err := mManageExpert.Expert(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if out.ManageExpert == nil {
|
||||
return nil, errors.New("操作错误,专家信息不存在或已被删除")
|
||||
}
|
||||
return &ExpertDetail{
|
||||
ID: out.GetEncodeID(),
|
||||
ManageExpert: out.ManageExpert,
|
||||
Industrys: out.GetIndustryAttribute(),
|
||||
Keywords: out.GetKeywordAttribute(),
|
||||
Researchs: out.GetResearchAttribute(),
|
||||
Area: out.FormatBasic(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Form 数据操作
|
||||
func (*Expert) Form(params *BasicParams, other *config.IdentityForExpert) error {
|
||||
mManageExpert := model.NewManageExpert()
|
||||
|
||||
if params.ID > 0 {
|
||||
mManageExpert.ID = params.ID
|
||||
|
||||
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "examine_status", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,专家信息不存在或已被删除")
|
||||
}
|
||||
}
|
||||
mManageExpert.TenantID = params.TenantID
|
||||
mManageExpert.ResearchID = other.ConvertResearch()
|
||||
mManageExpert.LaboratoryID = other.ConvertLaboratory()
|
||||
mManageExpert.Image.Image = params.Image
|
||||
mManageExpert.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
mManageExpert.School = other.School
|
||||
mManageExpert.Major = other.Major
|
||||
mManageExpert.Job = other.Job
|
||||
mManageExpert.Title = other.Title
|
||||
mManageExpert.Gender = model2.Gender{Gender: model2.GenderKind(other.Gender)}
|
||||
mManageExpert.WorkAt = utils.DataTimeToDate(other.WorkAt)
|
||||
mManageExpert.SetIndustryAttribute(params.Industrys)
|
||||
mManageExpert.SetKeywordAttribute(params.Keywords)
|
||||
mManageExpert.SetResearchAttribute(other.Researchs)
|
||||
mManageExpert.Introduce = params.Introduce
|
||||
|
||||
if mManageExpert.ID > 0 {
|
||||
return model2.Updates(mManageExpert.ManageExpert, mManageExpert.ManageExpert)
|
||||
}
|
||||
mManageExpert.Name = params.Name
|
||||
mManageExpert.Mobile = params.Mobile
|
||||
|
||||
return model2.Create(mManageExpert.ManageExpert)
|
||||
}
|
||||
|
||||
func NewExpert() ExpertHandle {
|
||||
return func(session *session.Admin) *Expert {
|
||||
return &Expert{session}
|
||||
}
|
||||
}
|
@ -1,191 +0,0 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/admin/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Instance struct {
|
||||
*session.Admin
|
||||
gorm.Model
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *session.Admin, tenantID uint64) *Instance
|
||||
|
||||
type (
|
||||
// InstanceForCompany 公司企业信息
|
||||
InstanceForCompany struct {
|
||||
ID string `json:"id"`
|
||||
*model.ManageCompanyInfo
|
||||
Industrys []string `json:"industrys"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// InstanceForCompanyDetail 公司企业详细信息
|
||||
InstanceForCompanyDetail struct {
|
||||
ID string `json:"id"`
|
||||
*model2.ManageCompany
|
||||
Industrys []string `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Directions []string `json:"directions"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// InstanceForExpert 专家信息
|
||||
InstanceForExpert struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Industrys []string `json:"industrys"`
|
||||
ResearchName string `json:"research_name"`
|
||||
LaboratoryName string `json:"laboratory_name"`
|
||||
Address string `json:"address"`
|
||||
ExamineStatus model2.ExamineStatusKind `json:"examine_status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// InstanceForExpertDetail 专家详细信息
|
||||
InstanceForExpertDetail struct {
|
||||
ID string `json:"id"`
|
||||
*model2.ManageExpert
|
||||
Industrys []string `json:"industrys"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Researchs []string `json:"researchs"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
)
|
||||
|
||||
// Company 公司企业信息
|
||||
func (c *Instance) Company(tenantID uint64, name string, status int, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if c.TenantID > 0 {
|
||||
where = append(where, model2.NewWhere("c.tenant_id", c.TenantID))
|
||||
}
|
||||
if tenantID > 0 {
|
||||
where = append(where, model2.NewWhere("c.tenant_id", tenantID))
|
||||
}
|
||||
if name != "" {
|
||||
where = append(where, model2.NewWhereLike("c.name", name))
|
||||
}
|
||||
if status > 0 {
|
||||
where = append(where, model2.NewWhere("c.examine_status", status))
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mManageCompany.Companys(page, pageSize, &count)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := make([]*InstanceForCompany, 0)
|
||||
|
||||
for _, v := range out {
|
||||
mManageCompany.Industry = v.Industry
|
||||
|
||||
list = append(list, &InstanceForCompany{
|
||||
ID: v.GetEncodeID(), ManageCompanyInfo: v, Industrys: mManageCompany.GetIndustryAttribute(), Area: v.FormatBasic(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// CompanyDetail 公司企业详细信息
|
||||
func (c *Instance) CompanyDetail(id uint64) (*InstanceForCompanyDetail, error) {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
out, err := mManageCompany.Company(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if out.ManageCompany == nil {
|
||||
return nil, errors.New("操作错误,公司企业信息不存在或已被删除")
|
||||
}
|
||||
return &InstanceForCompanyDetail{
|
||||
ID: out.GetEncodeID(),
|
||||
ManageCompany: out.ManageCompany,
|
||||
Industrys: out.GetIndustryAttribute(),
|
||||
Keywords: out.GetKeywordAttribute(),
|
||||
Area: out.FormatBasic(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Expert 专家信息
|
||||
func (c *Instance) Expert(tenantID uint64, name string, examineStatus int, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mManageExpert := model.NewManageExpert()
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if c.TenantID > 0 {
|
||||
where = append(where, model2.NewWhere("e.tenant_id", c.TenantID))
|
||||
}
|
||||
if tenantID > 0 {
|
||||
where = append(where, model2.NewWhere("e.tenant_id", tenantID))
|
||||
}
|
||||
if name != "" {
|
||||
where = append(where, model2.NewWhereLike("e.name", name))
|
||||
}
|
||||
if examineStatus > 0 {
|
||||
where = append(where, model2.NewWhere("e.examine_status", examineStatus))
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mManageExpert.Experts(page, pageSize, &count, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*InstanceForExpert, 0)
|
||||
|
||||
for _, v := range out {
|
||||
_industrys := make([]string, 0)
|
||||
|
||||
for _, v := range strings.Split(v.Industry, ";") {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "/"))
|
||||
}
|
||||
// 研究机构,实验室
|
||||
list = append(list, &InstanceForExpert{ID: v.GetEncodeID(), Name: v.Name, Industrys: _industrys,
|
||||
ResearchName: v.ResearchName, LaboratoryName: v.LaboratoryName, ExamineStatus: v.ExamineStatus,
|
||||
Address: v.FormatBasic(), CreatedAt: v.CreatedAt, Area: v.FormatBasic(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// ExpertDetail 专家详细信息
|
||||
func (*Instance) ExpertDetail(id uint64) (*InstanceForExpertDetail, error) {
|
||||
mManageExpert := model.NewManageExpert()
|
||||
|
||||
out, err := mManageExpert.Expert(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if out.ManageExpert == nil {
|
||||
return nil, errors.New("操作错误,专家信息不存在或已被删除")
|
||||
}
|
||||
return &InstanceForExpertDetail{
|
||||
ID: out.GetEncodeID(),
|
||||
ManageExpert: out.ManageExpert,
|
||||
Industrys: out.GetIndustryAttribute(),
|
||||
Keywords: out.GetKeywordAttribute(),
|
||||
Researchs: out.GetResearchAttribute(),
|
||||
Area: out.FormatBasic(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *session.Admin, tenantID uint64) *Instance {
|
||||
return &Instance{
|
||||
Admin: session,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
@ -50,8 +50,8 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
mUserExpert.ID = 0
|
||||
}
|
||||
mManageExpert.TenantID = c.tenantID
|
||||
mManageExpert.ResearchID = other.ResearchID
|
||||
mManageExpert.LaboratoryID = other.LaboratoryID
|
||||
mManageExpert.ResearchID = other.ConvertResearch()
|
||||
mManageExpert.LaboratoryID = other.ConvertLaboratory()
|
||||
mManageExpert.Image.Image = params.Image
|
||||
mManageExpert.Name = params.Name
|
||||
mManageExpert.Mobile = params.Mobile
|
||||
|
@ -49,7 +49,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
mManageLaboratory.ID = 0
|
||||
}
|
||||
mManageLaboratory.TenantID = c.tenantID
|
||||
mManageLaboratory.ResearchID = other.ResearchID
|
||||
mManageLaboratory.ResearchID = other.ConvertResearch()
|
||||
mManageLaboratory.Image.Image = params.Image
|
||||
mManageLaboratory.Name = params.Name
|
||||
mManageLaboratory.Code = params.Code
|
||||
|
@ -1,5 +1,7 @@
|
||||
package config
|
||||
|
||||
import "SciencesServer/utils"
|
||||
|
||||
// Area 区域
|
||||
type Area struct {
|
||||
Province string `json:"province" form:"province"`
|
||||
@ -19,8 +21,8 @@ type (
|
||||
}
|
||||
// IdentityForExpert 专家附加信息
|
||||
IdentityForExpert struct {
|
||||
ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
|
||||
LaboratoryID uint64 `json:"laboratory_id" form:"laboratory_id"` // 实验室ID
|
||||
ResearchID string `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
|
||||
LaboratoryID string `json:"laboratory_id" form:"laboratory_id"` // 实验室ID
|
||||
School string `json:"school" form:"school"` // 毕业院校
|
||||
Major string `json:"major" form:"major"` // 专业
|
||||
Job string `json:"job" form:"job"` // 职务
|
||||
@ -37,7 +39,7 @@ type (
|
||||
}
|
||||
// IdentityForLaboratory 实验室
|
||||
IdentityForLaboratory struct {
|
||||
ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
|
||||
ResearchID string `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"` // 纬度
|
||||
@ -45,7 +47,7 @@ type (
|
||||
}
|
||||
// IdentityForAgent 经纪人
|
||||
IdentityForAgent struct {
|
||||
ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
|
||||
ResearchID string `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"` // 工作地点
|
||||
@ -61,6 +63,34 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func (this *IdentityForExpert) ConvertResearch() uint64 {
|
||||
if this.ResearchID == "" {
|
||||
return 0
|
||||
}
|
||||
return uint64(utils.HASHIDDecode(this.ResearchID))
|
||||
}
|
||||
|
||||
func (this *IdentityForExpert) ConvertLaboratory() uint64 {
|
||||
if this.LaboratoryID == "" {
|
||||
return 0
|
||||
}
|
||||
return uint64(utils.HASHIDDecode(this.LaboratoryID))
|
||||
}
|
||||
|
||||
func (this *IdentityForLaboratory) ConvertResearch() uint64 {
|
||||
if this.ResearchID == "" {
|
||||
return 0
|
||||
}
|
||||
return uint64(utils.HASHIDDecode(this.ResearchID))
|
||||
}
|
||||
|
||||
func (this *IdentityForAgent) ConvertResearch() uint64 {
|
||||
if this.ResearchID == "" {
|
||||
return 0
|
||||
}
|
||||
return uint64(utils.HASHIDDecode(this.ResearchID))
|
||||
}
|
||||
|
||||
// TechnologyMaturity 科技成熟度
|
||||
type TechnologyMaturity int
|
||||
|
||||
|
@ -289,6 +289,8 @@ func registerAdminAPI(app *gin.Engine) {
|
||||
manage.POST("/company/detail", _api.CompanyDetail)
|
||||
manage.POST("/company/examine", _api.CompanyExamine)
|
||||
manage.POST("/expert", _api.Expert)
|
||||
manage.POST("/expert/add", _api.ExpertForm)
|
||||
manage.POST("/expert/edit", _api.ExpertForm)
|
||||
manage.POST("/expert/detail", _api.ExpertDetail)
|
||||
manage.POST("/expert/examine", _api.ExpertExamine)
|
||||
}
|
||||
|
Reference in New Issue
Block a user