Răsfoiți Sursa

Merge branch 'master' of http://8.136.199.33:3000/cxzhang/hongze_mfyx into mfyx_2.0

xingzai 11 luni în urmă
părinte
comite
9897669a53

+ 1 - 0
.gitignore

@@ -10,3 +10,4 @@
 /static
 /README.md
 /utils/cert/
+

+ 8 - 1
controllers/yanxuan_special.go

@@ -80,6 +80,12 @@ func (this *BaseAuthMobileController) List() {
 		br.ErrMsg = "获取失败, Err:" + err.Error()
 		return
 	}
+	var yanxuanSpecialIds []int
+	for _, v := range list {
+		yanxuanSpecialIds = append(yanxuanSpecialIds, v.Id)
+	}
+
+	yanxuanSpecialPv := services.GetYanxuanSpecialRecordByYanxuanSpecialId(yanxuanSpecialIds)
 	for _, v := range list {
 		hasImg, err := utils.ArticleHasImgUrl(v.Content)
 		if err != nil {
@@ -118,6 +124,7 @@ func (this *BaseAuthMobileController) List() {
 			}
 			v.Tags += v.IndustryTags
 		}
+		v.Pv = yanxuanSpecialPv[v.Id]
 		//if sysUser.UserId == 0 {
 		//	v.Content = utils.InterceptHtmlLength(v.Content, 242) // 截取前80个字
 		//}
@@ -202,7 +209,7 @@ func (this *BaseAuthMobileController) Detail() {
 
 	//如果状态未审核通过,而且查看的不是本人,不是审核人员,就无法查看详情
 	var configCode string
-	configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
+	configCode = utils.TPL_MSG_YAN_XUAN_SPECIAL_APPROVAL
 	cnf, err := models.GetConfigByCode(configCode)
 	if err != nil {
 		br.Msg = "获取失败"

+ 32 - 0
models/article_history_record_newpv.go

@@ -339,6 +339,38 @@ func GetCygxArticleHistoryRecordNewpvListPv(condition string, pars []interface{}
 	return
 }
 
+// 查研PV列表
+func GetCygxArticleHistoryRecordNewpvListPvCy(condition string, pars []interface{}) (items []*ListPvUvResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			COUNT( 1 ) AS pv,
+			article_id
+		FROM
+			cygx_article_history_record_all  WHERE 1 = 1  AND platfor = 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` GROUP BY article_id `
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+// 策略PV列表
+func GetCygxArticleHistoryRecordNewpvListPvCl(condition string, pars []interface{}) (items []*ListPvUvResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			COUNT( 1 ) AS pv,
+			article_id
+		FROM
+			cygx_article_history_record_all  WHERE 1 = 1  AND platfor = 2 AND is_del = 0 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` GROUP BY article_id `
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
 // 获取数量
 func GetCygxArticleHistoryRecordAllCount(condition string, pars []interface{}) (count int, err error) {
 	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_article_history_record_all  WHERE 1= 1  `

+ 2 - 2
models/cygx_yanxuan_special.go

@@ -101,8 +101,8 @@ type CygxYanxuanSpecialCenterResp struct {
 	Docs                []Doc
 	Annotation          string   `description:"核心观点"`
 	Source              string   `description:"来源"`
-	Pv                  string   `description:"Pv"`
-	Uv                  string   `description:"Uv"`
+	Pv                  int      `description:"Pv"`
+	Uv                  int      `description:"Uv"`
 	PublishDate         string   // 提审过审或驳回时间      string `description:"核心观点"`
 	BodyHighlight       []string `description:"搜索高亮展示结果"`
 	LabelKeyword        string   `description:"标签关键词"`

+ 22 - 0
models/cygx_yanxuan_special_record.go

@@ -110,3 +110,25 @@ func GetCygxYanxuanSpecialRecordRespList(condition string, pars []interface{}, s
 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }
+
+type LisYanxuanSpecialRecordPvResp struct {
+	YanxuanSpecialId int `description:"文章ID"`
+	Pv               int `description:"pv"`
+	Uv               int `description:"pv"`
+}
+
+// pv 列表
+func GetCygxYanxuanSpecialRecordListPv(condition string, pars []interface{}) (items []*LisYanxuanSpecialRecordPvResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			COUNT( 1 ) AS pv,
+			yanxuan_special_id
+		FROM
+			cygx_yanxuan_special_record  WHERE 1 = 1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` GROUP BY yanxuan_special_id  `
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 5 - 15
services/article.go

@@ -218,10 +218,6 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
 		list[k].Annotation = ArticleAnnotation(item)
 		list[k].Body = ""
 		list[k].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
-		if item.Pv > 999 {
-			list[k].Pv = 999
-		}
-
 		list[k].ChartPermissionName = mapChartPerssion[v.CategoryId]
 		//如果是研选系列的任意取五张图片的中的一张
 		if v.CategoryId == "0" || v.ArticleId > utils.SummaryArticleId {
@@ -236,17 +232,6 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
 			list[k].HttpUrl = utils.StrategyPlatform + strconv.Itoa(v.ArticleId)
 			list[k].IsNeedJump = true
 			list[k].ArticleResponse = 1
-			//if v.IsReport == 1 {
-			//	list[k].ArticleResponse = 1
-			//} else if v.ArticleTypeName == "纪要" {
-			//	list[k].ArticleResponse = 2
-			//} else if v.ArticleTypeName == "观点" {
-			//	list[k].ArticleResponse = 3
-			//} else if v.ArticleTypeName == "沙龙" {
-			//	list[k].ArticleResponse = 3
-			//} else if v.ArticleTypeName == "路演精华" {
-			//	list[k].ArticleResponse = 1
-			//}
 		}
 		list[k].Source = 1
 		//添加行业默认图片
@@ -280,6 +265,7 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
 	for i := range list {
 		articleIds = append(articleIds, list[i].ArticleId)
 	}
+	articleMapPv := GetArticleHistoryByArticleId(articleIds) //文章Pv
 	// 报告关联产业信息
 	industryMap := make(map[int][]*models.IndustrialManagementIdInt, 0)
 	if len(articleIds) > 0 {
@@ -308,6 +294,10 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
 		} else {
 			list[k].List = make([]*models.IndustrialManagementIdInt, 0)
 		}
+		v.Pv = articleMapPv[v.ArticleId]
+		if v.Pv > 999 {
+			list[k].Pv = 999
+		}
 	}
 
 	if len(list) == 0 {

+ 13 - 3
services/article_history.go

@@ -25,14 +25,24 @@ func GetArticleHistoryByArticleId(articleIds []int) (mapResp map[int]int) {
 	var pars []interface{}
 	condition = ` AND article_id IN (` + utils.GetOrmInReplace(lenIds) + `) `
 	pars = append(pars, articleIds)
-	list, err := models.GetCygxArticleHistoryRecordNewpvListPv(condition, pars)
-	if err != nil {
+	listCy, e := models.GetCygxArticleHistoryRecordNewpvListPvCy(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxArticleHistoryRecordNewpvListPvCy, Err: " + e.Error())
 		return
 	}
 	mapResp = make(map[int]int, 0)
-	for _, v := range list {
+	for _, v := range listCy {
 		mapResp[v.ArticleId] = v.Pv
 	}
+
+	listCl, e := models.GetCygxArticleHistoryRecordNewpvListPvCl(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxArticleHistoryRecordNewpvListPvCl, Err: " + e.Error())
+		return
+	}
+	for _, v := range listCl {
+		mapResp[v.ArticleId] += v.Pv
+	}
 	return
 }
 

+ 1 - 1
services/config.go

@@ -92,7 +92,7 @@ func CheckYxSpecialIsApprovalPersonnel(mobile string) (isApprovalPersonnel bool)
 	}()
 	var configCode string
 	//获取配置项里面审核人员的手机号
-	configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
+	configCode = utils.TPL_MSG_YAN_XUAN_SPECIAL_APPROVAL
 	cnf, e := models.GetConfigByCode(configCode)
 	if e != nil {
 		err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)

+ 3 - 3
services/cygx_yanxuan_special.go

@@ -97,7 +97,7 @@ func SendWxMsgSpecialFollow(specialId int) (err error) {
 	return
 }
 
-// SendReviewTemplateMsgAdmin 提交审核时给王芳,汪洋发消息
+// SendReviewTemplateMsgAdmin 提交审核时给王芳,葛琳发消息
 func SendReviewTemplateMsgAdmin(specialId int) (err error) {
 	defer func() {
 		if err != nil {
@@ -105,8 +105,8 @@ func SendReviewTemplateMsgAdmin(specialId int) (err error) {
 		}
 	}()
 	var configCode string
-	//如果是研选的就推送给汪洋跟王芳,否则就推送给王芳
-	configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
+	//研选专栏修改之后给这些手机号推送审核模版消息
+	configCode = utils.TPL_MSG_YAN_XUAN_SPECIAL_APPROVAL
 	cnf, e := models.GetConfigByCode(configCode)
 	if e != nil {
 		err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)

+ 29 - 0
services/cygx_yanxuan_special_company.go

@@ -108,3 +108,32 @@ func AddSpecialRecord(user *models.WxUserItem, specialId, stopTime int) (err err
 	}
 	return
 }
+
+// GetYanxuanSpecialRecordByYanxuanSpecialId 获取研选专栏阅读 pv map
+func GetYanxuanSpecialRecordByYanxuanSpecialId(articleIds []int) (mapResp map[int]int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("获取研选专栏阅读,信息失败,GetYanxuanSpecialRecordByYanxuanSpecialId Err:"+err.Error(), 3)
+		}
+	}()
+	lenIds := len(articleIds)
+	if lenIds == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND yanxuan_special_id IN (` + utils.GetOrmInReplace(lenIds) + `) `
+	pars = append(pars, articleIds)
+	listPv, e := models.GetCygxYanxuanSpecialRecordListPv(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxArticleHistoryRecordNewpvListPvCy, Err: " + e.Error())
+		return
+	}
+	mapResp = make(map[int]int, 0)
+	for _, v := range listPv {
+		mapResp[v.YanxuanSpecialId] = v.Pv
+	}
+	return
+}

+ 2 - 1
services/es_comprehensive.go

@@ -610,7 +610,7 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 			err = errors.New("GetYanxuanSpecialList, Err: " + e.Error())
 			return
 		}
-
+		yanxuanSpecialPv := GetYanxuanSpecialRecordByYanxuanSpecialId(yanxuanSpecialIds) // 专栏Pv
 		for _, v := range listyanxuanSpecial {
 			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
 			v.Annotation, _ = GetReportContentTextSubNew(v.Content)
@@ -623,6 +623,7 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 			// Source  PublishDate 字段兼容前端样式
 			v.Source = utils.CYGX_OBJ_YANXUANSPECIAL
 			v.PublishDate = v.PublishTime
+			v.Pv = yanxuanSpecialPv[v.Id]
 			mapItems[fmt.Sprint(utils.CYGX_OBJ_YANXUANSPECIAL, v.Id)].YanxuanSpecial = v
 		}
 	}

+ 2 - 1
services/resource_data.go

@@ -279,7 +279,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			err = errors.New("GetYanxuanSpecialList, Err: " + e.Error())
 			return
 		}
-
+		yanxuanSpecialPv := GetYanxuanSpecialRecordByYanxuanSpecialId(yanxuanSpecialIds) // 专栏Pv
 		for _, v := range listyanxuanSpecial {
 			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
 			v.Annotation, _ = GetReportContentTextSubNew(v.Content)
@@ -287,6 +287,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			v.Source = utils.CYGX_OBJ_YANXUANSPECIAL
 			v.PublishDate = v.PublishTime
 			v.LabelKeyword = "专栏"
+			v.Pv = yanxuanSpecialPv[v.Id]
 			v.LabelKeywordImgLink = utils.LABEL_ICO_4
 			mapItems[fmt.Sprint(utils.CYGX_OBJ_YANXUANSPECIAL, v.Id)].YanxuanSpecial = v
 		}

+ 2 - 2
utils/config.go

@@ -147,7 +147,7 @@ func init() {
 	SummaryArticleId = 1000000         //手动添加的纪要库开始ID
 	YanxSummaryPermissionId = 1001     //研选纪要分类ID
 	YanxViewpointPermissionId = 1002   //研选观点分类ID
-	WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829,18955528215"
+	WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829"
 	WxMsgTemplateIdAskMsgMobilePublic = "15557270714,18767183922,18621268829" // 沈涛:18767183922、 王芳:18621268829
 	HtgjDefaultSaleName = "王芳"
 	HtgjSalt = "HTGJ&HZ"
@@ -182,7 +182,7 @@ func init() {
 		WxMsgTemplateIdArticleUserRemind = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s"
 		WxMsgTemplateIdAskMsgMobile = ""
 		//ActSendMsgMobile = "15618524605"
-		ActSendMsgMobile = "18955528215" // 汪洋手机号
+		ActSendMsgMobile = "15557270714" // 汪洋手机号
 		ArticleTaskClassMobile = "15557270714,18767183922,15216736473,15000123056,18701809782,17706316791,18652179672"
 
 		ShangHaiCrmApiLink = "https://crm.hzinsights.com/"

+ 6 - 5
utils/constants.go

@@ -235,11 +235,12 @@ const (
 )
 
 const (
-	TPL_MSG_WANG_YANG                  = "tpl_msg_wang_yang"           //汪洋手机号地址参数
-	TPL_MSG_WANG_FANG_WANG_YANG        = "tpl_msg_wang_fang_wang_yang" //权限模板消息接收人,王芳,汪洋
-	TPL_MSG                            = "tpl_msg"                     //王芳手机号地址参数
-	TPL_MSG_NEI_RONG_ZU                = "tpl_msg_nei_rong_zu"         //内容组四人
-	CYGX_TAG_HOT_ACTIVITY_ID    string = "cygx_tag_hot_activity_id"    //标签管理自定义的热门活动ID
+	TPL_MSG_WANG_YANG                        = "tpl_msg_wang_yang"                 //汪洋手机号地址参数
+	TPL_MSG_WANG_FANG_WANG_YANG              = "tpl_msg_wang_fang_wang_yang"       //权限模板消息接收人,王芳,汪洋
+	TPL_MSG_YAN_XUAN_SPECIAL_APPROVAL        = "tpl_msg_yan_xuan_special_approval" //研选专栏修改之后给这些手机号推送审核模版消息
+	TPL_MSG                                  = "tpl_msg"                           //王芳手机号地址参数
+	TPL_MSG_NEI_RONG_ZU                      = "tpl_msg_nei_rong_zu"               //内容组四人
+	CYGX_TAG_HOT_ACTIVITY_ID          string = "cygx_tag_hot_activity_id"          //标签管理自定义的热门活动ID
 )
 
 const (