|
@@ -6,6 +6,7 @@ import (
|
|
|
"fmt"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
"hongze/hongze_cygx/utils"
|
|
|
+ "strconv"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -164,8 +165,14 @@ func ArticleWxUserRaiLabelRedisAddReduce(log models.WxUserRaiLabelRedis) (err er
|
|
|
}
|
|
|
articlePermissionName := articlePermission.PermissionName
|
|
|
matchTypeName := articlePermission.MatchTypeName
|
|
|
+ matchTypeNameArr := []string{"季度策略", "科技前沿(周报)", "本周荟", "智造精粹"}
|
|
|
|
|
|
- if articlePermissionName == utils.CE_LUE_NAME || articlePermissionName == utils.GU_SHOU_NAME { // 策略、固收的所有报告,以报告类型做标签
|
|
|
+ //1;四大行业汇总类报告:季度策略、科技前沿(周报)、本周荟、智造精粹以报告类型做标签
|
|
|
+ //2:策略、固收的所有报告,以报告类型做标签
|
|
|
+ if articlePermissionName == utils.CE_LUE_NAME || articlePermissionName == utils.GU_SHOU_NAME || utils.InArrayByStr(matchTypeNameArr, matchTypeName) { // 策略、固收的所有报告,以报告类型做标签
|
|
|
+ if matchTypeName == "季度策略" {
|
|
|
+ matchTypeName = articlePermissionName + matchTypeName //其中季度策略以:xx行业季度策略 呈现
|
|
|
+ }
|
|
|
item := new(models.WxUserRaiLabel)
|
|
|
item.UserId = wxUser.UserId
|
|
|
item.RealName = wxUser.RealName
|
|
@@ -175,6 +182,7 @@ func ArticleWxUserRaiLabelRedisAddReduce(log models.WxUserRaiLabelRedis) (err er
|
|
|
item.CompanyName = wxUser.CompanyName
|
|
|
item.Label = matchTypeName
|
|
|
item.SourceType = 8
|
|
|
+ item.SourceId = sourceId
|
|
|
item.CreateTime = log.CreateTime
|
|
|
item.ModifyTime = time.Now()
|
|
|
item.RegisterPlatform = log.RegisterPlatform
|
|
@@ -184,6 +192,92 @@ func ArticleWxUserRaiLabelRedisAddReduce(log models.WxUserRaiLabelRedis) (err er
|
|
|
err = errors.New("AddWxUserRaiLabel" + e.Error())
|
|
|
return
|
|
|
}
|
|
|
+ } else if articlePermissionName == utils.ZHOU_QI_NAME {
|
|
|
+ //周期的行业深度、调研纪要、产业跟踪这些系列的报告用领域做标签,其余的周期报告,都用报告类型(也就是ficc定义的类型)做标签
|
|
|
+ //其中周期的周度观点,以 周期周度观点 呈现
|
|
|
+ matchTypeNameArrZhouqi := []string{"行业深度", "调研纪要", "产业跟踪"}
|
|
|
+ if utils.InArrayByStr(matchTypeNameArrZhouqi, matchTypeName) {
|
|
|
+ matchTypeName = articleDetail.FieldName
|
|
|
+ }
|
|
|
+ item := new(models.WxUserRaiLabel)
|
|
|
+ item.UserId = wxUser.UserId
|
|
|
+ item.RealName = wxUser.RealName
|
|
|
+ item.Mobile = wxUser.Mobile
|
|
|
+ item.Email = wxUser.Email
|
|
|
+ item.CompanyId = wxUser.CompanyId
|
|
|
+ item.CompanyName = wxUser.CompanyName
|
|
|
+ item.Label = matchTypeName
|
|
|
+ item.SourceType = 8
|
|
|
+ item.SourceId = sourceId
|
|
|
+ item.CreateTime = log.CreateTime
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
+ item.TableName = "cygx_article"
|
|
|
+ e = models.AddWxUserRaiLabel(item)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("AddWxUserRaiLabel" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //正常的有产业报告
|
|
|
+ var labelArr []string
|
|
|
+ //建立首页资源表,与产业的关系
|
|
|
+ industrialList, e := models.GetIndustrialArticleGroupManagementListByArticleId(sourceId)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetIndustrialArticleGroupManagementListByArticleId, Err: " + e.Error() + "sourceId:" + strconv.Itoa(sourceId))
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var items []*models.WxUserRaiLabel
|
|
|
+ for _, v := range industrialList {
|
|
|
+ item := new(models.WxUserRaiLabel)
|
|
|
+ item.UserId = wxUser.UserId
|
|
|
+ item.RealName = wxUser.RealName
|
|
|
+ item.Mobile = wxUser.Mobile
|
|
|
+ item.Email = wxUser.Email
|
|
|
+ item.CompanyId = wxUser.CompanyId
|
|
|
+ item.CompanyName = wxUser.CompanyName
|
|
|
+ item.Label = v.IndustryName
|
|
|
+ item.SourceType = 7
|
|
|
+ item.SourceId = sourceId
|
|
|
+ item.CreateTime = log.CreateTime
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
+ item.TableName = "cygx_article"
|
|
|
+ items = append(items, item)
|
|
|
+ labelArr = append(labelArr, v.IndustryName)
|
|
|
+ }
|
|
|
+
|
|
|
+ //建立首页资源表,与标的 的关系
|
|
|
+ subjectList, e := models.GetSubjectArticleGroupManagementListByArtcileId(sourceId)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetSubjectArticleGroupManagementListByArtcileId, Err: " + e.Error() + "sourceId:" + strconv.Itoa(sourceId))
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range subjectList {
|
|
|
+ item := new(models.WxUserRaiLabel)
|
|
|
+ item.UserId = wxUser.UserId
|
|
|
+ item.RealName = wxUser.RealName
|
|
|
+ item.Mobile = wxUser.Mobile
|
|
|
+ item.Email = wxUser.Email
|
|
|
+ item.CompanyId = wxUser.CompanyId
|
|
|
+ item.CompanyName = wxUser.CompanyName
|
|
|
+ item.Label = v.SubjectName
|
|
|
+ item.SourceType = 7
|
|
|
+ item.SourceId = sourceId
|
|
|
+ item.CreateTime = log.CreateTime
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ item.RegisterPlatform = log.RegisterPlatform
|
|
|
+ item.TableName = "cygx_article"
|
|
|
+ items = append(items, item)
|
|
|
+ labelArr = append(labelArr, v.SubjectName)
|
|
|
+ }
|
|
|
+ e = models.AddWxUserRaiLabelMulti(items, labelArr, userId)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("AddWxUserRaiLabelMulti" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return
|