Kaynağa Gözat

Merge branch 'cygx_12.2' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 yıl önce
ebeveyn
işleme
0e4607f105

+ 3 - 1
controllers/micro_roadshow.go

@@ -28,6 +28,7 @@ type MicroRoadShowController struct {
 // @Param   VideoIds			query	string		false	"视频IDs"
 // @Param   ActivityVideoId			query	int		false	"活动视频ID"
 // @Param   Filter			query	string		false	"筛选条件 为空:全部 1:视频 2:音频 3:逻辑解析 4:路演回放 多个用 , 隔开"
+// @Param   ChartPermissionIds   query   string  false     "行业id 多个用 , 隔开"
 // @Success 200 {object} models.HomeListResp
 // @router /list [get]
 func (this *MicroRoadShowController) List() {
@@ -53,6 +54,7 @@ func (this *MicroRoadShowController) List() {
 	activityVideoIds := this.GetString("ActivityVideoIds")
 	activityVideoId, _ := this.GetInt("ActivityVideoId")
 	filter := this.GetString("Filter")
+	chartPermissionIds := this.GetString("ChartPermissionIds")
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20
 	}
@@ -74,7 +76,7 @@ func (this *MicroRoadShowController) List() {
 	var total int
 	var e error
 	// 微路演列表
-	list, total, e = services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords, audioIds, videoIds, activityVideoIds)
+	list, total, e = services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords, audioIds, videoIds, activityVideoIds, chartPermissionIds)
 	if e != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()

+ 1 - 0
models/activity.go

@@ -239,6 +239,7 @@ type ActivityDetail struct {
 	CancelDeadline            string                     `description:"取消报名截止时间"`
 	ImgUrlBgYx                string                     `description:"研选背景图片"`
 	ChartPermissionNameDeputy string                     `description:"副行业名称"`
+	TopTime                   int                        `description:"置顶时间"`
 }
 type ListArticleActivity struct {
 	Title   string `description:"文章标题"`

+ 1 - 0
models/product_interior.go

@@ -54,6 +54,7 @@ type CygxProductInteriorResp struct {
 	VisibleRange      int                       `description:"设置可见范围1全部,0内部"`
 	Abstract          string                    `description:"摘要"`
 	Department        string                    `description:"作者"`
+	Pv                int                       `description:"PV"`
 }
 
 type ProductInteriorUrlResp struct {

+ 17 - 0
models/product_interior_history.go

@@ -37,3 +37,20 @@ func GetCygxProductInteriorHistoryList(condition string, pars []interface{}) (it
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
+
+type ListProductInteriorPvResp struct {
+	ProductInteriorId int `description:"文章ID"`
+	Pv                int `description:"pv"`
+}
+
+// 列表
+func GetCygxProductInteriorHistoryListPv(condition string, pars []interface{}) (items []*ListProductInteriorPvResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT  product_interior_id ,COUNT(*)  as  pv  FROM cygx_product_interior_history WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += " GROUP BY product_interior_id "
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 17 - 0
models/report_history_record.go

@@ -56,3 +56,20 @@ func AddCygxReportHistoryRecordLog(item *CygxReportHistoryRecordLog) (lastId int
 	lastId, err = o.Insert(item)
 	return
 }
+
+type ListPvResp struct {
+	ArticleId int `description:"文章ID"`
+	Pv        int `description:"pv"`
+}
+
+// 列表
+func GetCygxReportHistoryRecordListPv(condition string, pars []interface{}) (items []*ListPvResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT  article_id ,COUNT(*)  as  pv  FROM cygx_report_history_record WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += " GROUP BY article_id "
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 1 - 0
models/report_selection.go

@@ -18,6 +18,7 @@ type CygxReportSelectionRep struct {
 	SubjectName       string `description:"标的名称"`
 	Periods           string `description:"期数"`
 	MarketStrategy    string `description:"市场策略核心逻辑汇总"`
+	Pv                int    `description:"pv"`
 }
 
 type CygxReportSelectionListPublicRep struct {

+ 7 - 0
services/activity_signup.go

@@ -42,6 +42,13 @@ func CheckActivitySignUpLimit(user *models.WxUserItem, activityInfo *models.Acti
 			err = errors.New("GetActivitySignupSuccessByUserCountNoHz, Err: " + e.Error())
 			return
 		}
+		if totaSignupPeopleNum == 1 && activityInfo.LimitPeopleNum == 1 {
+			signupStatus = "FullStarffed"
+			popupMsg = "该活动为非公开活动,如有专家访谈需求请联系对口销售"
+			failType = 1
+			return
+		}
+
 		if totaSignupPeopleNum >= activityInfo.LimitPeopleNum {
 			signupStatus = "FullStarffed"
 			popupMsg = "此活动报名人数已满,请留意下期活动"

+ 9 - 1
services/micro_roadshow.go

@@ -165,7 +165,7 @@ func GetHomeNewestList(userId, companyId, startSize, pageSize int, condition str
 }
 
 // GetMicroRoadShowPageList 获取微路演列表添加活动视频 更新与8.1版本
-func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId int, filter, keywords, audioIds, videoIds, activityVideoIds string) (respList []*models.MicroRoadShowPageList, total int, err error) {
+func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId int, filter, keywords, audioIds, videoIds, activityVideoIds, chartPermissionIds string) (respList []*models.MicroRoadShowPageList, total int, err error) {
 	var e error
 	// 根据每页数据量获取音视频配比
 	startSize := utils.StartIndex(currentIndex, pageSize)
@@ -204,6 +204,7 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 		idSqlStr = strings.TrimRight(idSqlStr, ",")
 		audioCond += ` AND a.activity_voice_id IN (` + idSqlStr + `)`
 	}
+
 	//}
 	//视频的处理
 	var videoCond string
@@ -273,6 +274,13 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 		videoCond += ` AND video_id IN (` + idSqlStr + `)`
 	}
 	videoCond += ` AND publish_status = 1`
+
+	if chartPermissionIds != "" {
+		videoCond += ` AND chart_permission_id IN (` + chartPermissionIds + `)`
+		audioCond += ` AND b.chart_permission_id IN (` + chartPermissionIds + `)`
+		videoCondAct += ` AND art.chart_permission_id IN (` + chartPermissionIds + `)`
+	}
+
 	//}
 	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars)
 	if e != nil {

+ 28 - 0
services/product_interior.go

@@ -219,3 +219,31 @@ func GetCygxProductInteriorHistoryListMap(productInteriorIs []int, user *models.
 	}
 	return
 }
+
+// 获取产品内测的阅读数据
+func GetCygxProductInteriorHistoryListPvMap(productInteriorIs []int) (mapPv map[int]int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("获取产品内测的阅读数据,信息失败,Err:"+err.Error(), 3)
+		}
+	}()
+	lenproductInteriorIs := len(productInteriorIs)
+	if lenproductInteriorIs == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND product_interior_id IN (` + utils.GetOrmInReplace(lenproductInteriorIs) + `) `
+	pars = append(pars, productInteriorIs)
+	list, err := models.GetCygxProductInteriorHistoryList(condition, pars)
+	if err != nil {
+		return
+	}
+	mapPv = make(map[int]int, 0)
+	for _, v := range list {
+		mapPv[v.ProductInteriorId]++
+	}
+	return
+}

+ 27 - 0
services/report_history_record.go

@@ -39,3 +39,30 @@ func AddCygxReportHistoryRecord(item *models.CygxReportHistoryRecord) (err error
 	}
 	return
 }
+
+// 获取 报告精选,本周研究汇总、上周纪要汇总Pv 阅读数据
+func GetCygxReportHistoryRecordListMap(articleIds []int, reportType string) (mapPv map[int]int) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("获取产品内测的阅读数据,信息失败,Err:"+err.Error(), 3)
+		}
+	}()
+	lenArr := len(articleIds)
+	if lenArr == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND article_id IN (` + utils.GetOrmInReplace(lenArr) + `) AND  report_type = ?`
+	pars = append(pars, articleIds, reportType)
+	list, e := models.GetCygxReportHistoryRecordListPv(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		return
+	}
+	mapPv = make(map[int]int, 0)
+	for _, v := range list {
+		mapPv[v.ArticleId] = v.Pv
+	}
+	return
+}

+ 8 - 0
services/resource_data.go

@@ -125,7 +125,9 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			err = errors.New("GetResourceDataList, Err: " + e.Error())
 			return
 		}
+		mapPv := GetCygxReportHistoryRecordListMap(minutessummaryIds, "szjyhz")
 		for _, v := range listresearchsummary {
+			v.Pv = mapPv[v.ArticleId]
 			v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
 			mapItems[fmt.Sprint("minutessummary", v.ArticleId)].Minutessummary = v
 		}
@@ -142,7 +144,9 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			err = errors.New("GetReportSelectionListHome, Err: " + e.Error())
 			return
 		}
+		mapPv := GetCygxReportHistoryRecordListMap(minutessummaryIds, "bzyjhz")
 		for _, v := range listresearchsummary {
+			v.Pv = mapPv[v.ArticleId]
 			v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
 			mapItems[fmt.Sprint("researchsummary", v.ArticleId)].Researchsummary = v
 		}
@@ -158,8 +162,10 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			err = errors.New("GetCygxProductInteriorList, Err: " + e.Error())
 			return
 		}
+		ProductInteriorHistoryMap := GetCygxProductInteriorHistoryListPvMap(articleIds)
 		for _, v := range listProductInterior {
 			v.Body = ProductInteriorHtml(v.Body)
+			v.Pv = ProductInteriorHistoryMap[v.ProductInteriorId]
 			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
 			mapItems[fmt.Sprint("productinterior", v.ProductInteriorId)].ProductInterior = v
 		}
@@ -434,10 +440,12 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			err = errors.New("GetReportSelectionList, Err: " + e.Error())
 			return
 		}
+		mapPv := GetCygxReportHistoryRecordListMap(reportselectionIds, "bgjx")
 		for _, v := range listreportselection {
 			v.Title += "(第" + v.Periods + "期)"
 			v.MarketStrategy = AnnotationHtml(v.MarketStrategy)
 			v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
+			v.Pv = mapPv[v.ArticleId]
 			mapItems[fmt.Sprint("reportselection", v.ArticleId)].ReportSelection = v
 		}
 	}