Browse Source

细分产业默认更新时间排序,将跟踪点评的发布时间,和专项产业调研的发布时间也纳入更新时间

xingzai 2 years ago
parent
commit
05b3a89b5d
2 changed files with 1 additions and 165 deletions
  1. 0 164
      controllers/report.go
  2. 1 1
      models/industrial_management.go

+ 0 - 164
controllers/report.go

@@ -211,170 +211,7 @@ func (this *ReportController) IndustryList() {
 		topCond += ` AND chart_permission_id = ?`
 		topPars = append(topPars, ChartPermissionId)
 	}
-	//topReadIndustry, e := models.GetTopOneMonthArtReadNumIndustry(topCond, topPars)
-	//if e != nil && e.Error() != utils.ErrNoRow() {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "获取近一个月报告阅读次数最多的产业失败, Err: " + e.Error()
-	//	return
-	//}
-	//if topReadIndustry != nil {
-	//	topReadIndustryId = topReadIndustry.IndustrialManagementId
-	//}
-
-	//查询产业视频
-	//industrialVideoMap := make(map[int]*models.MicroVideoSimpleInfo)
-	//var industrialManagementIds []int
-	//for _, v := range list {
-	//	if v.IndustrialManagementId > 0 {
-	//		industrialManagementIds = append(industrialManagementIds, v.IndustrialManagementId)
-	//	}
-	//}
-
-	// 用户权限
-	//authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
-	//if e != nil {
-	//	br.Msg = "获取失败"
-	//	br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
-	//	return
-	//}
-	//mapUPdateTime := make(map[int]string)
-	//
-	//if len(industrialManagementIds) > 0 {
-	//	// 获取默认图配置
-	//	_, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
-	//	if e != nil {
-	//		br.Msg = "获取视频默认配置图失败"
-	//		br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
-	//		return
-	//	}
-	//	videoList, err := models.GetMicroRoadshowVideoByIndustryIds(industrialManagementIds)
-	//	if err != nil {
-	//		br.Msg = "产业视频列表失败"
-	//		br.ErrMsg = "产业视频列表失败, Err: " + err.Error()
-	//		return
-	//	}
-	//	for _, v := range videoList {
-	//		tmp := &models.MicroVideoSimpleInfo{
-	//			Id:                  v.VideoId,
-	//			Title:               "5min逻辑【" + v.IndustryName + "】解析",
-	//			ResourceUrl:         v.VideoUrl,
-	//			BackgroundImg:       v.ImgUrl,
-	//			PlaySeconds:         v.VideoDuration,
-	//			DetailImgUrl:        v.DetailImgUrl,
-	//			ChartPermissionId:   v.ChartPermissionId,
-	//			ChartPermissionName: v.ChartPermissionName,
-	//		}
-	//		if tmp.BackgroundImg == "" {
-	//			tmp.BackgroundImg = videoMap[v.ChartPermissionId]
-	//		}
-	//		industrialVideoMap[v.IndustryId] = tmp
-	//	}
-	//	//获取这些产业下最新更新的文章
-	//	listUpdateTime, err := models.GetNewArticleDetailByIndustrialIds(industrialManagementIds)
-	//	if err != nil && err.Error() != utils.ErrNoRow() {
-	//		return
-	//	}
-	//	for _, v := range listUpdateTime {
-	//		mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
-	//	}
-	//
-	//	//时间线的更新时间
-	//	//	maptimelineUPdateTime := make(map[int]string)
-	//	listtimelinePublishdate, err := models.GetTimeLineReportIndustrialPublishdateList(industrialManagementIds)
-	//	if err != nil && err.Error() != utils.ErrNoRow() {
-	//		return
-	//	}
-	//	for _, v := range listtimelinePublishdate {
-	//		if mapUPdateTime[v.IndustrialManagementId] != "" {
-	//			if utils.StrTimeToTime(v.PublishDate).After(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
-	//				mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
-	//			}
-	//		}
-	//	}
-	//}
-	//
-	//nowTime := time.Now().Local()
-	//threeMonBefore := nowTime.AddDate(0, -3, 0)
-
 	list, err = services.HandleIndustryList(list, user)
-	//for k, v := range list {
-	//	industrialSubjectList, err := models.GetIndustrialSubjectAll(v.IndustrialManagementId)
-	//	if err != nil {
-	//		br.Msg = "获取信息失败"
-	//		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
-	//		return
-	//	}
-	//	list[k].IndustrialSubjectList = industrialSubjectList
-	//	list[k].LayoutTime = utils.TimeRemoveHms(v.LayoutTime)
-	//	newArtinfo, err := models.GetIndustrialNewArticleDetail(v.IndustrialManagementId)
-	//	if err != nil {
-	//		br.Msg = "获取信息失败"
-	//		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
-	//		return
-	//	}
-	//	list[k].UpdateTime = utils.TimeRemoveHms(mapUPdateTime[v.IndustrialManagementId])
-	//	recordCount, err := models.GetUserToArticleCount(uid, newArtinfo.ArticleId)
-	//	if err != nil && err.Error() != utils.ErrNoRow() {
-	//		br.Msg = "获取信息失败"
-	//		br.ErrMsg = "获取信息失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(newArtinfo.ArticleId)
-	//		return
-	//	}
-	//	if recordCount == 0 && user.CreatedTime.Before(utils.StrTimeToTime(newArtinfo.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(newArtinfo.PublishDate)) {
-	//		list[k].IsRed = true
-	//	}
-	//	// 原:关联的报告阅读量大于等于阅读第三的产业,则标记热门
-	//	//if v.ArticleReadNum >= detailHot3.ArticleReadNum {
-	//	//	list[k].IsHot = true
-	//	//}
-	//
-	//	// 近一个月报告阅读次数最多的产业标记Hot
-	//	if topReadIndustryId > 0 && list[k].IndustrialManagementId == topReadIndustryId {
-	//		list[k].IsHot = true
-	//	}
-	//
-	//	// 关联报告发布时间均在3个月内则标记New
-	//	if v.MinReportTime != "" {
-	//		t, e := time.Parse(utils.FormatDateTime, v.MinReportTime)
-	//		if e != nil {
-	//			br.Msg = "获取信息失败"
-	//			br.ErrMsg = "报告最早发布时间有误, Err: " + e.Error()
-	//			return
-	//		}
-	//		if t.After(threeMonBefore) {
-	//			list[k].IsNew = true
-	//		}
-	//	}
-	//
-	//	//展示产业视频
-	//	if video, ok := industrialVideoMap[v.IndustrialManagementId]; ok {
-	//		//控制用户权限
-	//		// 权限
-	//		au := new(models.UserPermissionAuthInfo)
-	//		au.SellerName = authInfo.SellerName
-	//		au.SellerMobile = authInfo.SellerMobile
-	//		au.HasPermission = authInfo.HasPermission
-	//		au.OperationMode = authInfo.OperationMode
-	//		if au.HasPermission == 1 {
-	//			// 非宏观权限进一步判断是否有权限
-	//			if video.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, video.ChartPermissionName) {
-	//				au.HasPermission = 2
-	//			}
-	//		}
-	//		// 无权限的弹框提示
-	//		if au.HasPermission != 1 {
-	//			if au.OperationMode == services.UserPermissionOperationModeCall {
-	//				au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
-	//			} else {
-	//				au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
-	//			}
-	//			video.ResourceUrl = ""
-	//		}
-	//		list[k].AuthInfo = au
-	//		list[k].IndustryVideo = video
-	//	}
-	//
-	//}
-	//记录用户搜索的筛选条件
 	if orderColumnNew != "" {
 		item := new(models.CygxReportIndustrialSeaarchHistory)
 		item.UserId = user.UserId
@@ -3013,7 +2850,6 @@ func (this *ReportController) SearchReportAndResource() {
 				}
 			}
 		}
-
 	}
 
 	resp := new(models.SearchReportAndResourceResp)

+ 1 - 1
models/industrial_management.go

@@ -62,7 +62,7 @@ func GetIndustrialManagementAll(uid int, condition, orderSrt string, startSize,
 	o := orm.NewOrm()
 	sql := `SELECT
 			man.*,re.chart_permission_name as permission_name,
-            MAX(art.publish_date) AS update_time , MIN(art.publish_date) AS min_report_time,(
+           	man.new_art_publish_date AS update_time , MIN(art.publish_date) AS min_report_time,(
 			SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(uid) + ` AND rec.article_id = art.article_id ) AS readnum ,
 		    (SELECT COUNT( 1 )  FROM cygx_industry_fllow AS f WHERE f.user_id = ` + strconv.Itoa(uid) + ` AND f.industrial_management_id = man.industrial_management_id AND f.type = 1) AS is_follow
 			FROM