Browse Source

no message

xingzai 2 years ago
parent
commit
b26917d8c3
3 changed files with 30 additions and 0 deletions
  1. 7 0
      models/micro_roadshow.go
  2. 8 0
      services/industrial_management.go
  3. 15 0
      services/micro_roadshow.go

+ 7 - 0
models/micro_roadshow.go

@@ -167,3 +167,10 @@ func GetMicroRoadshowVideoByIndustryIdCount(industryId int) (count int, err erro
 	err = o.Raw(sql, industryId).QueryRow(&count)
 	return
 }
+
+// GetMicroRoadshowVideoList 获取已经发布的微路演视频
+func GetMicroRoadshowVideoList() (list []*MicroRoadshowVideo, err error) {
+	sql := `SELECT * FROM cygx_micro_roadshow_video WHERE  publish_status = 1`
+	_, err = orm.NewOrm().Raw(sql).QueryRows(&list)
+	return
+}

+ 8 - 0
services/industrial_management.go

@@ -89,6 +89,11 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 			fllowMap[v.IndustrialManagementId] = v.IndustrialManagementId
 		}
 	}
+	mapindustrialId, e := GetMicroRoadshowVideoMap()
+	if e != nil {
+		err = e
+		return
+	}
 	//合并产业关联的标的
 	listSubjcet, err := models.GetThemeHeatSubjectList("")
 	if err != nil {
@@ -101,6 +106,9 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 			list[k].IsFollow = true
 		}
 		industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
+		if _, ok := mapindustrialId[v.IndustrialManagementId]; !ok {
+			continue
+		}
 		videoSimple, au, e := GetindustryVideo(user, v.IndustrialManagementId)
 		if e != nil {
 			err = errors.New("获取产业关联的视频失败,GetindustryVideo " + e.Error())

+ 15 - 0
services/micro_roadshow.go

@@ -170,3 +170,18 @@ func GetindustryVideoDetailById(user *models.WxUserItem, videoId int) (industryV
 	AuthInfo = au
 	return
 }
+
+//GetMicroRoadshowVideoMap 获取已经发布的微路演的产业ID
+func GetMicroRoadshowVideoMap() (items map[int]int, err error) {
+	list, e := models.GetMicroRoadshowVideoList()
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("获取已经发布的微路演的产业失败,GetMicroRoadshowVideoList " + e.Error())
+		return
+	}
+	mapindustrialId := make(map[int]int)
+	for _, v := range list {
+		mapindustrialId[v.IndustryId] = v.IndustryId
+	}
+	items = mapindustrialId
+	return
+}