|
@@ -8,6 +8,7 @@ import (
|
|
|
"github.com/olivere/elastic/v7"
|
|
|
"hongze/hz_crm_api/models/cygx"
|
|
|
"hongze/hz_crm_api/services/alarm_msg"
|
|
|
+ cygxService "hongze/hz_crm_api/services/cygx"
|
|
|
"hongze/hz_crm_api/utils"
|
|
|
"html"
|
|
|
"strconv"
|
|
@@ -543,7 +544,7 @@ func EsAddYanxuanSpecial(sourceId int) {
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
fmt.Println("err:", err)
|
|
|
- go alarm_msg.SendAlarmMsg(fmt.Sprint("更新研选专栏失败sourceId: ", sourceId), 2)
|
|
|
+ go alarm_msg.SendAlarmMsg(fmt.Sprint("更新研选专栏失败sourceId: ", sourceId, err.Error()), 2)
|
|
|
}
|
|
|
}()
|
|
|
detail, e := cygx.GetYanxuanSpecialItemById(sourceId)
|
|
@@ -571,3 +572,44 @@ func EsAddYanxuanSpecial(sourceId int) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func init() {
|
|
|
+ EsAddAskserieVideo(74)
|
|
|
+}
|
|
|
+
|
|
|
+// Es问答系列视频
|
|
|
+func EsAddAskserieVideo(sourceId int) {
|
|
|
+ var err error
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("err:", err)
|
|
|
+ go alarm_msg.SendAlarmMsg(fmt.Sprint("Es更新问答系列视频AddAskserieVideo失败sourceId: ", sourceId, err.Error()), 2)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ detail, e := cygx.GetCygxAskserieVideoDetail(sourceId)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetArticleInfoOtherByArticleId" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ content := html.UnescapeString(detail.VideoName)
|
|
|
+ doc, e := goquery.NewDocumentFromReader(strings.NewReader(content))
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("goquery.NewDocumentFromReader" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ bodyText := doc.Text()
|
|
|
+ item := new(ElasticComprehensiveDetail)
|
|
|
+ item.SourceId = detail.AskserieVideoId
|
|
|
+ item.Source = utils.CYGX_OBJ_ASKSERIEVIDEO
|
|
|
+ item.Title = detail.VideoName
|
|
|
+ item.PublishDate = detail.PublishDate
|
|
|
+ item.BodyText = bodyText
|
|
|
+ mapLabel := cygxService.GetCygxAskserieVideoLabelMap([]int{sourceId}) // 标签
|
|
|
+ item.IndustryName = mapLabel[sourceId]
|
|
|
+ if detail.PublishStatus == 1 {
|
|
|
+ EsAddOrEditComprehensiveData(item) //如果发布了就新增
|
|
|
+ } else {
|
|
|
+ EsDeleteComprehensiveData(item) // 没有发布就删除
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|