2022-01-15 16:48:49 +08:00
|
|
|
|
package manage
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"SciencesServer/app/basic/config"
|
|
|
|
|
"SciencesServer/app/service"
|
2022-01-25 11:45:53 +08:00
|
|
|
|
"SciencesServer/serve/logger"
|
2022-01-15 16:48:49 +08:00
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ESParams struct {
|
2022-01-25 11:45:53 +08:00
|
|
|
|
ID uint64
|
2022-01-15 16:48:49 +08:00
|
|
|
|
Identity int
|
|
|
|
|
Name string
|
|
|
|
|
Keywords, Industrys, Researchs []string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *ESParams) Set() {
|
|
|
|
|
_identitys := make([]string, 0)
|
|
|
|
|
|
|
|
|
|
for _, v := range this.Industrys {
|
2022-01-20 09:43:26 +08:00
|
|
|
|
_identitys = append(_identitys, config.GetIndustryInfo(v, "-", "-").Value)
|
2022-01-15 16:48:49 +08:00
|
|
|
|
}
|
2022-01-25 11:45:53 +08:00
|
|
|
|
//fmt.Println(utils.AnyToJSON(this))
|
|
|
|
|
//fmt.Println(this.Identity)
|
|
|
|
|
err := service.NewESManage(
|
|
|
|
|
service.WithManageID(this.ID),
|
2022-01-15 16:48:49 +08:00
|
|
|
|
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()
|
2022-01-25 11:45:53 +08:00
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
logger.ErrorF("ES 身份信息【%d】存储错误【%s】", this.Identity, err)
|
|
|
|
|
}
|
2022-01-15 16:48:49 +08:00
|
|
|
|
}
|