feat:优化项目信息

This commit is contained in:
henry
2022-02-15 17:19:23 +08:00
parent cbc0ad1a41
commit dcb5948e91
45 changed files with 852 additions and 100 deletions

View File

@ -5,10 +5,12 @@ import (
"SciencesServer/app/basic/config"
"SciencesServer/app/basic/controller"
model2 "SciencesServer/app/common/model"
"SciencesServer/app/service"
"SciencesServer/app/session"
config2 "SciencesServer/config"
"SciencesServer/utils"
"errors"
"strings"
"time"
)
@ -136,7 +138,7 @@ func (c *Expert) Form(params *BasicParams, other *config.IdentityForExpert) erro
if params.ID > 0 {
mManageExpert.ID = params.ID
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "name", "mobile", "tenant_id", "created_at"})
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "name", "mobile", "tenant_id", "examine_status", "created_at"})
if err != nil {
return err
@ -158,6 +160,7 @@ func (c *Expert) Form(params *BasicParams, other *config.IdentityForExpert) erro
}
}
mManageExpert.TenantID = c.TenantID
mManageExpert.Name = params.Name
mManageExpert.ResearchID = other.ConvertResearch()
mManageExpert.LaboratoryID = other.ConvertLaboratory()
mManageExpert.Image.Image = params.Image
@ -179,11 +182,26 @@ func (c *Expert) Form(params *BasicParams, other *config.IdentityForExpert) erro
if c.TenantID <= 0 {
mManageExpert.TenantID = params.TenantID
}
_industrys := make([]string, 0)
for _, v := range params.Industrys {
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", "-").Value)
}
manage := service.NewESManage(
service.WithManageIdentity(config.TenantUserIdentityForExpert),
service.WithManageIndustry(strings.Join(_industrys, "")),
service.WithManageKeyword(strings.Join(params.Keywords, "")),
)
if mManageExpert.ID > 0 {
return model2.Updates(mManageExpert.ManageExpert, mManageExpert.ManageExpert)
if err := model2.Updates(mManageExpert.ManageExpert, mManageExpert.ManageExpert); err != nil {
return err
}
if mManageExpert.ExamineStatus == model2.ExamineStatusForAgree {
_ = manage.Update()
}
return nil
}
// 查询手机号码是否在当前租户下是否已经注册了
mManageExpert.Name = params.Name
mManageExpert.Mobile = params.Mobile
mManageExpert.ExamineStatus = model2.ExamineStatusForAgree
mManageExpert.ExamineRemark = "主动创建,无需审核"
@ -194,7 +212,13 @@ func (c *Expert) Form(params *BasicParams, other *config.IdentityForExpert) erro
} else if isExist {
return errors.New("操作错误,已存在相同手机号码")
}
return model2.Create(mManageExpert.ManageExpert)
if err := model2.Create(mManageExpert.ManageExpert); err != nil {
return err
}
service.WithManageID(mManageExpert.ID)(manage)
service.WithManageTitle(params.Name)(manage)
return manage.Create()
}
// Patent 专利信息