xingzai пре 2 година
родитељ
комит
011773702d
7 измењених фајлова са 82 додато и 47 уклоњено
  1. 1 1
      controllers/home.go
  2. 1 1
      controllers/user.go
  3. 4 3
      controllers/yidong.go
  4. 13 3
      models/article.go
  5. 2 2
      services/activity.go
  6. 33 23
      services/article.go
  7. 28 14
      services/yidong.go

+ 1 - 1
controllers/home.go

@@ -523,7 +523,7 @@ func (this *HomeController) ListHomeArtAndChart() {
 			item := list[k]
 			//如果文章一开始的内容是图片,优先展示第一张图片
 			imgurl, _ := services.FixArticleImgUrl(html.UnescapeString(list[k].Body))
-			newBody, _ := services.GetReportContentTextSubByarticle(item.Body, item.Abstract, item.ArticleId)
+			newBody, _ := services.GetReportContentTextSubByarticle(item.Body, item.Annotation, item.ArticleId)
 			list[k].Body = newBody
 			if imgurl != "" {
 				list[k].BodyHtml = imgurl

+ 1 - 1
controllers/user.go

@@ -706,7 +706,7 @@ func (this *UserController) BrowseHistoryList() {
 		article := articleMap[item.ArticleId]
 		if article != nil {
 			list[i].Title = article.Title
-			list[i].PublishDate = article.PublishDate
+			list[i].PublishDate = utils.TimeRemoveHms2(article.PublishDate)
 			list[i].DepartmentId = article.DepartmentId
 			list[i].NickName = article.NickName
 			if article.ArticleId < utils.SummaryArticleId {

+ 4 - 3
controllers/yidong.go

@@ -85,14 +85,15 @@ func (this *BaseYidongController) Ativitylist() {
 		this.Data["json"] = br
 		this.ServeJSON()
 	}()
-	Ydtoklen, _ := services.GetYiDongToken()
-	url := "https://services-dev.valueonline.cn/interact/activityManageApi/getRoadshowList?access_token=" + Ydtoklen
+	token, _ := services.GetYiDongToken()
+	//url := "https://services-dev.valueonline.cn/interact/activityManageApi/getRoadshowList?access_token=" + Ydtoklen
+	url := utils.YiDongZhengTongYunUrl + "interact/activityManageApi/getRoadshowList?access_token=" + token
 	method := "POST"
 	//payload := strings.NewReader(`{"meetingStatus":"0,1","conveneStartStr":"2022-05-06","conveneEndStr":"2022-05-14",
 	//"lastUpdateTime":"2022-05-08 12:00:00"}`)
 
 	payload := strings.NewReader(`{
-    "meetingStatus": "0,1,2"
+    "meetingStatus": "0"
 }`)
 	client := &http.Client{}
 	req, err := http.NewRequest(method, url, payload)

+ 13 - 3
models/article.go

@@ -43,6 +43,7 @@ type CygxArticle struct {
 	VideoPlaySeconds string `description:"音频播放时长"`
 	Stock            string `description:"个股标签"`
 	FieldName        string `description:"产业标签"`
+	Annotation       string `description:"核心观点"`
 }
 
 type CygxArticleEs struct {
@@ -100,6 +101,7 @@ type HomeArticle struct {
 	HttpUrl          string `description:"文章链接跳转地址"`
 	IsNeedJump       bool   `description:"是否需要跳转链接地址"`
 	Source           int    `description:"来源  1:文章, 2:图表"`
+	Annotation       string `description:"核心观点"`
 }
 
 type ArticleDetail struct {
@@ -524,6 +526,7 @@ type ArticleResultApidate struct {
 	Type          ArticleResultApiType     `json:"type"`
 	Stock         []string                 `json:"stock"`
 	Field         ArticleField             `json:"field"`
+	Corpus        Corpus                   `json:"corpus"`
 }
 
 type ArticleField struct {
@@ -533,13 +536,20 @@ type ArticleField struct {
 	IndustryId  int    `json:"industry_id"`
 }
 
+type Corpus struct {
+	Id        int    `json:"id"`
+	ArticleId int    `json:"article_id"`
+	Corpus    string `json:"corpus"`
+}
+
 type ArticleSeries struct {
 	Name string `json:"name"`
 }
 type ArticleResultApiContent struct {
-	ArticleId int    `json:"id"`
-	Body      string `json:"body"`
-	Abstract  string `json:"abstract"`
+	ArticleId  int    `json:"id"`
+	Body       string `json:"body"`
+	Abstract   string `json:"abstract"`
+	Annotation string `json:"annotation"`
 }
 
 type ArticleResultApiAuthor struct {

+ 2 - 2
services/activity.go

@@ -1310,8 +1310,8 @@ func DoActivityOnenIdWxTemplateMsg(cont context.Context) (err error) {
 		return err
 	}
 	first := "近期所有行业活动预告,欢迎参与"
-	keyword1 := "--"
-	keyword2 := "--"
+	keyword1 := "下周活动预告"
+	keyword2 := "已发布"
 	keyword3 := ""
 	keyword4 := "点击查看下周活动列表"
 	SendActivityOnenIdWxTemplateMsg(first, keyword1, keyword2, keyword3, keyword4, openidPowerList)

+ 33 - 23
services/article.go

@@ -670,6 +670,11 @@ func GetArticleListByApi(cont context.Context) (err error) {
 	return
 }
 
+//func init() {
+//
+//	HandleArticleListByApi(7214)
+//}
+
 //处理同步过来的文章
 func HandleArticleListByApi(artcleId int) (err error) {
 	defer func() {
@@ -751,8 +756,9 @@ func HandleArticleListByApi(artcleId int) (err error) {
 		item.CreateDate = articleResult.CreateDate
 		item.PublishDate = articleResult.PublishDate.Add(time.Hour * 8)
 		item.PublishStatus = 1
-		item.Body = articleResult.Content.Body
+		item.Body = articleResult.Corpus.Corpus
 		item.Abstract = articleResult.Content.Abstract
+		item.Annotation = articleResult.Content.Annotation
 		item.CategoryName = articleResult.Industry.Name
 		item.CategoryId = exitMap[articleResult.SeriesId]
 		item.SubCategoryName = articleResult.Series.Name
@@ -772,7 +778,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 		listAuthor = append(listAuthor, itemAuthor)
 	} else {
 		// 如果这篇文章没有发布,那么就不作处理。
-		err = models.UpdateArticlePublish(0, artcleId)
+		err = models.UpdateArticlePublish(artcleId, 0)
 		if err != nil {
 			fmt.Println("UpdateArticlePublish Err:", err.Error())
 			return err
@@ -918,6 +924,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 			updateParams["FileLink"] = v.File
 			updateParams["Stock"] = v.Stock
 			updateParams["FieldName"] = v.FieldName
+			updateParams["Annotation"] = v.Annotation
 			whereParam := map[string]interface{}{"article_id": v.ArticleId}
 			err = models.UpdateByExpr(models.CygxArticle{}, whereParam, updateParams)
 			if err != nil {
@@ -956,6 +963,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 			item.MatchTypeName = matchTypeName
 			item.Stock = v.Stock
 			item.FieldName = v.FieldName
+			item.Annotation = v.Annotation
 			newId, err := models.AddCygxArticles(item)
 			if err != nil {
 				fmt.Println("AddCygxArticle Err:", err.Error())
@@ -1555,9 +1563,7 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 		}
 
 		//获取提交过推送规则的用户的 openid 并推送模版消息
-		openIditem := new(models.OpenIdList)
-		first := "您关注的赛道,有新的报告发布/更新,欢迎查看"
-		keyword1 := "所属赛道:" + industryName
+
 		//mapActivityUserId := make(map[int]string)
 		//if articleInfo.IsSummary == 1 {
 		//	sliceSubjectId, _ := models.GetSubjectIds(articleId)
@@ -1590,24 +1596,28 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
 		//	//	mapAlreadySend[openIditem.UserId] = openIditem.UserId
 		//	//}
 		//}
-		var ids []string
-		for k, _ := range mapUserIdChooseSendTypeNoPermission {
-			ids = append(ids, strconv.Itoa(k))
-		}
-		if len(ids) > 0 {
-			idStr := strings.Join(ids, ",")
-			openidIlist, err := models.GetCygxXzsChooseSendOpenIdByUserIds(idStr)
-			if err != nil {
-				return err
-			}
-			for _, item := range openidIlist {
-				openIditem.OpenId = item.OpenId
-				openIditem.UserId = item.UserId
-				if _, ok := mapAlreadySend[openIditem.UserId]; !ok {
-					SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
-				}
-			}
-		}
+
+		//openIditem := new(models.OpenIdList)
+		//first := "您关注的赛道,有新的报告发布/更新,欢迎查看"
+		//keyword1 := "所属赛道:" + industryName
+		//var ids []string
+		//for k, _ := range mapUserIdChooseSendTypeNoPermission {
+		//	ids = append(ids, strconv.Itoa(k))
+		//}
+		//if len(ids) > 0 {
+		//	idStr := strings.Join(ids, ",")
+		//	openidIlist, err := models.GetCygxXzsChooseSendOpenIdByUserIds(idStr)
+		//	if err != nil {
+		//		return err
+		//	}
+		//	for _, item := range openidIlist {
+		//		openIditem.OpenId = item.OpenId
+		//		openIditem.UserId = item.UserId
+		//		if _, ok := mapAlreadySend[openIditem.UserId]; !ok {
+		//			SendWxMsgWithArticleUpdate(first, keyword1, keyword2, keyword3, keyword4, openIditem, articleId)
+		//		}
+		//	}
+		//}
 	}
 	utils.Rc.Put(cacheKey, articleId, time.Hour*12)
 	return

+ 28 - 14
services/yidong.go

@@ -179,9 +179,11 @@ func GetYiDongToken() (token string, err error) {
 
 //获取易董活动列表
 func GetYiDongActivity(cont context.Context) (err error) {
+	//func GetYiDongActivity() (err error) {
 	defer func() {
 		if err != nil {
 			fmt.Println(err)
+			go utils.SendAlarmMsg("获取易董活动列表失败:"+err.Error(), 2)
 			utils.FileLog.Info(err.Error())
 		}
 	}()
@@ -247,13 +249,20 @@ func GetYiDongActivity(cont context.Context) (err error) {
 	if len(ApifoxModal.Result) > 0 {
 		actList := ApifoxModal.Result
 		for _, v := range actList {
+			//同步有效性 1有效,0失效
+			if v.SyncFlag == "0" {
+				continue
+			}
 			var item = new(models.CygxActivity)
 			item.YidongActivityId = v.ID
 			item.ActivityTypeId = 3
 			item.ActivityTypeName = "公司调研电话会"
-			item.ActivityName = v.CompanyInfo + v.Title
-			item.Label = v.CompanyInfo
-			item.TemporaryLabel = v.CompanyInfo
+			sliceCompanyInfo := strings.Split(v.Title, "(")
+			companyInfo := sliceCompanyInfo[0]
+			item.ActivityName = v.Title
+			item.LastUpdatedTime = time.Now()
+			item.Label = companyInfo
+			item.TemporaryLabel = companyInfo
 			item.ChartPermissionId = GetActivityTypeIdWithYiDong(v.IndustrySwName)
 			item.ChartPermissionName = GetActivityTypeNameWithYiDong(v.IndustrySwName)
 			item.ChartPermissionNames = GetActivityTypeNameWithYiDong(v.IndustrySwName)
@@ -271,10 +280,12 @@ func GetYiDongActivity(cont context.Context) (err error) {
 			}
 			detailList := detailYidng.Resultdetail.GuestPersonList
 			for _, vdetail := range detailList {
-				item.DistinguishedGuest += vdetail.PersonName + ","
+				item.DistinguishedGuest += vdetail.PersonName + " " + vdetail.JobName + ","
 			}
 			item.DistinguishedGuest = strings.TrimRight(item.DistinguishedGuest, ",")
-			item.Body = "<p>" + "【" + v.CompanyInfo + v.Title + "】" + "<p>时间:" + v.Start + "</p>嘉宾:" + item.DistinguishedGuest + "</p>"
+			item.Body = "<p>" + "【" + v.Title + "】" + "<p>时间:" + v.Start + "</p>嘉宾:" + item.DistinguishedGuest + "</p>"
+			//fmt.Println(item.Body)
+			//return err
 			if mapOldYiDong[v.ID] == "" {
 				itemsAdd = append(itemsAdd, item)
 				newId, err := models.AddCygxActivity(item)
@@ -285,12 +296,13 @@ func GetYiDongActivity(cont context.Context) (err error) {
 				}
 
 				//把公司名称当做标的 对活动进行产业标的的关联
-				YidongActivityGroup(v.CompanyInfo, int(newId))
+				YidongActivityGroup(companyInfo, int(newId))
 			} else {
 				//如果内容主体有做变更,就修改内容
-				if mapOldYiDongBody[v.ID] != fmt.Sprint(item.ActivityName, item.Label, item.ChartPermissionId, item.ActivityTime, item.YidongActivityEndTime, item.DistinguishedGuest) {
+				if mapOldYiDongBody[v.ID] != fmt.Sprint(item.ActivityName+"12", item.Label, item.ChartPermissionId, item.ActivityTime, item.YidongActivityEndTime, item.DistinguishedGuest) {
 					updateParams := make(map[string]interface{})
 					updateParams["ActivityName"] = item.ActivityName
+					updateParams["Body"] = item.Body
 					updateParams["Label"] = item.Label
 					updateParams["TemporaryLabel"] = item.TemporaryLabel
 					updateParams["DistinguishedGuest"] = item.DistinguishedGuest
@@ -304,6 +316,7 @@ func GetYiDongActivity(cont context.Context) (err error) {
 					updateParams["ActivityJoinType"] = item.ActivityJoinType
 					updateParams["YidongSignUpStart"] = item.YidongSignUpStart
 					updateParams["YidongSignUpEnd"] = item.YidongSignUpEnd
+					updateParams["LastUpdatedTime"] = time.Now()
 					whereParam := map[string]interface{}{"yidong_activity_id": item.YidongActivityId}
 					err = models.UpdateByExpr(models.CygxActivity{}, whereParam, updateParams)
 					if err != nil {
@@ -352,13 +365,13 @@ func GetYiDongActivityDetail(activityId string) (detail *models.ApifoxModaldetai
 	}
 
 	//添加请求日志记录
-	//itemApiLog := new(models.CygxThreeApiLog)
-	//itemApiLog.CreateTime = time.Now()
-	//itemApiLog.Source = 1
-	//itemApiLog.Url = url
-	//itemApiLog.Body = utils.ReplaceSpaceAndWrap(fmt.Sprint(payload))
-	//itemApiLog.Result = string(body)
-	//go models.AddCygxThreeApiLog(itemApiLog)
+	itemApiLog := new(models.CygxThreeApiLog)
+	itemApiLog.CreateTime = time.Now()
+	itemApiLog.Source = 1
+	itemApiLog.Url = url
+	itemApiLog.Body = utils.ReplaceSpaceAndWrap(fmt.Sprint(payload))
+	itemApiLog.Result = string(body)
+	go models.AddCygxThreeApiLog(itemApiLog)
 
 	err = json.Unmarshal(body, &ApifoxModal)
 	if err != nil {
@@ -375,6 +388,7 @@ func GetYiDongCreateUserInfo(user *models.WxUserItem) (userTgc string, err error
 	defer func() {
 		if err != nil {
 			fmt.Println(err)
+			go utils.SendAlarmMsg("生成用户相关信息接口 获取用户tgc失败:"+err.Error(), 2)
 			utils.FileLog.Info(err.Error())
 		}
 	}()