xingzai 1 tahun lalu
induk
melakukan
50711cc5ba

+ 145 - 84
controllers/micro_roadshow.go

@@ -25,6 +25,10 @@ type MicroRoadShowController struct {
 // @Param   VideoId			query	int		false	"视频ID"
 // @Param   ActivityVideoId			query	int		false	"活动视频ID"
 // @Param   Filter			query	string		false	"筛选条件 为空:全部 1:视频 2:音频 3:逻辑解析 4:路演回放 多个用 , 隔开"
+// @Param   ChartPermissionIds   query   string  false     "行业id 多个用 , 隔开"
+// @Param   SourceId		query	int		true	"资源ID"
+// @Param   SourceType		query	int		true	" 1:活动音频  2:活动视频 3:产业视频 4:问答系列"
+// @Param   SearchType	string	int		true	"搜索类型: 1-路演回放; 2-问答系列; 3-调研反馈   多个用 , 隔开"
 // @Success 200 {object} models.HomeListResp
 // @router /list [get]
 func (this *MicroRoadShowController) List() {
@@ -43,11 +47,14 @@ func (this *MicroRoadShowController) List() {
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
 	keywords := this.GetString("KeyWord")
-	audioId, _ := this.GetInt("AudioId")
-	videoId, _ := this.GetInt("VideoId")
-	activityVideoId, _ := this.GetInt("ActivityVideoId")
+	//audioId, _ := this.GetInt("AudioId")
+	//videoId, _ := this.GetInt("VideoId")
+	//activityVideoId, _ := this.GetInt("ActivityVideoId")
 	filter := this.GetString("Filter")
-
+	chartPermissionIds := this.GetString("ChartPermissionIds")
+	sourceId, _ := this.GetInt("SourceId")
+	sourceType, _ := this.GetInt("SourceType")
+	searchType := this.GetString("SearchType")
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20
 	}
@@ -70,40 +77,40 @@ func (this *MicroRoadShowController) List() {
 	var e error
 
 	// 微路演列表
-	list, total, e = services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords)
+	list, total, e = services.GetMicroRoadShowPageListV12(pageSize, currentIndex, sourceId, sourceType, filter, keywords, searchType, chartPermissionIds)
 	if e != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
 		return
 	}
-	var pageSizeIk int
+	//var pageSizeIk int
 
 	//获取总的数量
-	totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, keyWordArr, filter)
-	if e != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取微路演联想词列表失败, Err: " + e.Error()
-		return
-	}
-	//return
-	pageSizeIk = totalIk - len(list)
-	//处理IK分词部分的分页获取条数
-	startSizeIk := utils.StartIndex(currentIndex, pageSize)
-	startSizeIk = startSizeIk - total
-	if startSizeIk < 0 {
-		startSizeIk = 0
-	}
-	if len(keyWordArr) > 0 {
-		lisIk, e := services.GetMicroRoadShowPageListIkWord(startSizeIk, pageSizeIk, audioId, videoId, activityVideoId, keyWordArr, filter, keywords)
-		if e != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
-			return
-		}
-		for _, item := range lisIk {
-			list = append(list, item)
-		}
-	}
+	//totalIk, e := services.CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId, keyWordArr, filter)
+	//if e != nil {
+	//	br.Msg = "获取失败"
+	//	br.ErrMsg = "获取微路演联想词列表失败, Err: " + e.Error()
+	//	return
+	//}
+	////return
+	//pageSizeIk = totalIk - len(list)
+	////处理IK分词部分的分页获取条数
+	//startSizeIk := utils.StartIndex(currentIndex, pageSize)
+	//startSizeIk = startSizeIk - total
+	//if startSizeIk < 0 {
+	//	startSizeIk = 0
+	//}
+	//if len(keyWordArr) > 0 {
+	//	lisIk, e := services.GetMicroRoadShowPageListIkWord(startSizeIk, pageSizeIk, audioId, videoId, activityVideoId, keyWordArr, filter, keywords)
+	//	if e != nil {
+	//		br.Msg = "获取失败"
+	//		br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
+	//		return
+	//	}
+	//	for _, item := range lisIk {
+	//		list = append(list, item)
+	//	}
+	//}
 
 	userId := user.UserId
 	listMycollect, err := models.GetUserMicroRoadshowCollectList(userId)
@@ -209,7 +216,7 @@ func (this *MicroRoadShowController) List() {
 	}
 
 	resp := new(models.MicroRoadShowListResp)
-	page := paging.GetPaging(currentIndex, pageSize, totalIk)
+	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp.List = list
 	resp.Paging = page
 
@@ -281,7 +288,11 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
 
 	videoId := req.VideoId
 	playSeconds := req.PlaySeconds
+	sourceType := req.SourceType
 
+	if sourceType == 0 {
+		sourceType = 1
+	}
 	var sellerName string
 	sellerName, err = models.GetCompanySellerName(user.CompanyId)
 	if err != nil {
@@ -289,58 +300,61 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
 		br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
 		return
 	}
-	item := models.CygxMicroRoadshowVideoHistory{
-		VideoId:     videoId,
-		UserId:      uid,
-		Mobile:      user.Mobile,
-		Email:       user.Email,
-		CompanyId:   user.CompanyId,
-		CompanyName: user.CompanyName,
-		RealName:    user.RealName,
-		SellerName:  sellerName,
-		PlaySeconds: strconv.Itoa(playSeconds),
-		CreateTime:  time.Now(),
-		ModifyTime:  time.Now(),
-	}
-	//if playSeconds != 0 {
-	//	lastItem, err := models.GetLastCygxMicroRoadshowVideoHistory(videoId, user.UserId)
-	//	if err != nil {
-	//		br.Msg = "操作失败"
-	//		br.ErrMsg = "操作失败,GetLastCygxMicroRoadshowVideoHistory Err:" + err.Error()
-	//		return
-	//	}
-	//	err = models.UpdateLastCygxActivityVideoHistory(strconv.Itoa(playSeconds), lastItem.Id)
-	//	if err != nil {
-	//		br.Msg = "更新失败"
-	//		br.ErrMsg = "更新失败,UpdateLastCygxActivityVideoHistory Err:" + err.Error()
-	//		return
-	//	}
-	//} else {
-	//	err = models.AddCygxMicroRoadshowVideoHistory(&item)
-	//	if err != nil {
-	//		br.Msg = "操作失败"
-	//		br.ErrMsg = "操作失败,Err:" + err.Error()
-	//		return
-	//	}
-	//	err = models.UpdateCygxActivityVideoCounts(videoId)
-	//	if err != nil {
-	//		br.Msg = "更新失败"
-	//		br.ErrMsg = "更新失败,Err:" + err.Error()
-	//		return
-	//	}
-	//}
-
-	err = models.AddCygxMicroRoadshowVideoHistory(&item)
-	if err != nil {
-		br.Msg = "操作失败"
-		br.ErrMsg = "操作失败,Err:" + err.Error()
-		return
-	}
-	err = models.UpdateCygxActivityVideoCounts(videoId)
-	if err != nil {
-		br.Msg = "更新失败"
-		br.ErrMsg = "更新失败,Err:" + err.Error()
-		return
+	if sourceType == 1 {
+		//添加活动音频的播放记录
+		go services.AddActivityVoiceHistory(user, videoId, playSeconds)
+	} else if sourceType == 2 {
+		//添加活动视频的播放记录
+		go services.AddActivityVideoHistory(user, videoId, playSeconds)
+		//if err != nil {
+		//	br.Msg = "更新失败"
+		//	br.ErrMsg = "更新失败,AddActivityVideoHistory Err:" + err.Error()
+		//	return
+		//}
+	} else if sourceType == 3 {
+		item := models.CygxMicroRoadshowVideoHistory{
+			VideoId:     videoId,
+			UserId:      uid,
+			Mobile:      user.Mobile,
+			Email:       user.Email,
+			CompanyId:   user.CompanyId,
+			CompanyName: user.CompanyName,
+			RealName:    user.RealName,
+			SellerName:  sellerName,
+			PlaySeconds: strconv.Itoa(playSeconds),
+			CreateTime:  time.Now(),
+			ModifyTime:  time.Now(),
+		}
+		if playSeconds != 0 {
+			lastItem, err := models.GetLastCygxMicroRoadshowVideoHistory(videoId, user.UserId)
+			if err != nil {
+				br.Msg = "操作失败"
+				br.ErrMsg = "操作失败,GetLastCygxMicroRoadshowVideoHistory Err:" + err.Error()
+				return
+			}
+			err = models.UpdateLastCygxActivityVideoHistory(strconv.Itoa(playSeconds), lastItem.Id)
+			if err != nil {
+				br.Msg = "更新失败"
+				br.ErrMsg = "更新失败,UpdateLastCygxActivityVideoHistory Err:" + err.Error()
+				return
+			}
+		} else {
+			err = models.AddCygxMicroRoadshowVideoHistory(&item)
+			if err != nil {
+				br.Msg = "操作失败"
+				br.ErrMsg = "操作失败,Err:" + err.Error()
+				return
+			}
+			err = models.UpdateCygxActivityVideoCounts(videoId)
+			if err != nil {
+				br.Msg = "更新失败"
+				br.ErrMsg = "更新失败,Err:" + err.Error()
+				return
+			}
+		}
+		go services.MicroRoadshowVideoUserRmind(user, videoId)
+	} else if sourceType == 4 {
+		go services.AddAskserieVideoHistoryRecord(user, videoId, playSeconds)
 	}
 	br.Ret = 200
 	br.Success = true
@@ -432,6 +446,10 @@ func (this *MicroRoadShowController) CommentAdd() {
 		item.IndustryId = microVideo.IndustryId
 		title = microVideo.VideoName
 		//resourceId = microVideo.IndustryId
+	} else if sourceType == 4 {
+		item.AskserieVideoId = req.Id
+
+		go services.AddCygxAskserieVideoCollection(user, item.AskserieVideoId, req.Content)
 	}
 	var isResearch bool // 是否属于研选
 	if sourceType == 2 || sourceType == 3 {
@@ -646,5 +664,48 @@ func (this *MicroRoadShowController) Collect() {
 		br.Ret = 200
 		br.Success = true
 		br.Data = resp
+	} else if req.SourceType == 4 {
+		// 系列问答视频收藏
+		count, err := models.GetAskserieVideoCount(uid, req.Id)
+		if err != nil {
+			br.Msg = "获取数据失败!"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+		resp := new(models.ArticleCollectResp)
+		if count <= 0 {
+			item := new(models.CygxAskserieVideoCollect)
+			item.AskserieVideoId = req.Id
+			item.UserId = uid
+			item.CreateTime = time.Now()
+			item.Mobile = user.Mobile
+			item.Email = user.Email
+			item.CompanyId = user.CompanyId
+			item.CompanyName = user.CompanyName
+			item.RealName = user.RealName
+			item.RegisterPlatform = utils.REGISTER_PLATFORM
+			err = models.AddCygxAskserieVideoCollect(item)
+			if err != nil {
+				br.Msg = "收藏失败"
+				br.ErrMsg = "收藏失败,Err:" + err.Error()
+				return
+			}
+			br.Msg = "收藏成功"
+			resp.Status = 1
+			// 文章收藏消息发送
+			//go services.ArticleUserRemind(user, detail, 2)
+		} else {
+			err = models.RemoveAskserieVideoCollect(uid, req.Id)
+			if err != nil {
+				br.Msg = "取消收藏失败"
+				br.ErrMsg = "取消收藏失败,Err:" + err.Error()
+				return
+			}
+			br.Msg = "已取消收藏"
+			resp.Status = 2
+		}
+		br.Ret = 200
+		br.Success = true
+		br.Data = resp
 	}
 }

+ 14 - 2
controllers/user.go

@@ -1331,12 +1331,20 @@ func (this *UserController) Mycollect() {
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
+	listAskserieVideoCollect, err := models.GetUserCygxAskserieVideoCollectList(userId)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
 	collectVoiceMap := make(map[int]time.Time, 0)
 	collectVideoMap := make(map[int]time.Time, 0)
 	collectActivityVideoMap := make(map[int]time.Time, 0)
 	var audioIds []string
 	var videoIds []string
 	var activityVideoIds []string
+	var askserieVideoIds []string //问答系列视频
 	for _, item := range listMycollect {
 		if item.ActivityVoiceId > 0 {
 			audioIds = append(audioIds, strconv.Itoa(item.ActivityVoiceId))
@@ -1350,7 +1358,10 @@ func (this *UserController) Mycollect() {
 		}
 	}
 
-	if len(audioIds) == 0 && len(videoIds) == 0 && len(activityVideoIds) == 0 {
+	for _, item := range listAskserieVideoCollect {
+		askserieVideoIds = append(askserieVideoIds, strconv.Itoa(item.AskserieVideoId))
+	}
+	if len(audioIds) == 0 && len(videoIds) == 0 && len(activityVideoIds) == 0 && len(askserieVideoIds) == 0 {
 		resp := new(models.MicroRoadShowListResp)
 		page := paging.GetPaging(currentIndex, pageSize, 0)
 		resp.List = make([]*models.MicroRoadShowPageList, 0)
@@ -1365,8 +1376,9 @@ func (this *UserController) Mycollect() {
 	audioIdstr := strings.Join(audioIds, ",")
 	ideoIdsStr := strings.Join(videoIds, ",")
 	activityVideoIdsStr := strings.Join(activityVideoIds, ",")
+	askserieVideoIdsStr := strings.Join(askserieVideoIds, ",")
 	// 微路演列表
-	list, total, e := services.GetMicroRoadShowMycollect(pageSize, currentIndex, audioIdstr, ideoIdsStr, activityVideoIdsStr)
+	list, total, e := services.GetMicroRoadShowMycollectV12(pageSize, currentIndex, audioIdstr, activityVideoIdsStr, ideoIdsStr, askserieVideoIdsStr)
 	if e != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()

+ 52 - 0
models/activity_video_history.go

@@ -0,0 +1,52 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxActivityVideoHistory struct {
+	Id               int       `orm:"column(id);pk"description:"音频id"`
+	VideoId          int       `description:"微路演音频id"`
+	ActivityId       int       `description:"活动id"`
+	UserId           int       `description:"用户id"`
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司Id"`
+	CompanyName      string    `description:"公司名称"`
+	RealName         string    `description:"用户实际名称"`
+	SellerName       string    `description:"所属销售"`
+	PlaySeconds      string    `description:"播放时间 单位s"`
+	CreateTime       time.Time `description:"视频创建时间"`
+	ModifyTime       time.Time `description:"视频修改时间"`
+	RegisterPlatform int       // 来源 1小程序,2:网页
+}
+
+// 添加
+func AddCygxActivityVideoHistory(item *CygxActivityVideoHistory) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+// 获取列表信息根据手机号分组
+func GetActivityVideoHistoryByMobileList(condition string) (items []*CygxActivityVideoHistory, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_activity_video_history  WHERE 1 =1  ` + condition + `  GROUP BY user_id  `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// 修改用户浏览活动视频的相关信息
+func UpdateCygxActivityVideoHistory(wxUser *WxUserItem) (err error) {
+	o := orm.NewOrm()
+	var sql string
+	if wxUser.Mobile != "" {
+		sql = `UPDATE cygx_activity_video_history SET email=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE mobile=? `
+		_, err = o.Raw(sql, wxUser.Email, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Mobile).Exec()
+	} else if wxUser.Email != "" {
+		sql = `UPDATE cygx_activity_video_history SET mobile=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE email=? `
+		_, err = o.Raw(sql, wxUser.Mobile, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Email).Exec()
+	}
+	return
+}

+ 16 - 15
models/activity_voice_history.go

@@ -6,21 +6,22 @@ import (
 )
 
 type CygxActivityVoiceHistory struct {
-	Id          int       `orm:"column(id);pk"`
-	ActivityId  int       `description:"活动ID"`
-	UserId      int       `description:"用户ID"`
-	CreateTime  time.Time `description:"创建时间"`
-	Mobile      string    `description:"手机号"`
-	Email       string    `description:"邮箱"`
-	CompanyId   int       `description:"公司id"`
-	CompanyName string    `description:"公司名称"`
-	RealName    string    `description:"用户实际名称"`
-	SellerName  string    `description:"所属销售"`
-	PlaySeconds string    `description:"播放时间 单位s"`
-	ModifyTime  time.Time `description:"视频修改时间"`
+	Id               int       `orm:"column(id);pk"`
+	ActivityId       int       `description:"活动ID"`
+	UserId           int       `description:"用户ID"`
+	CreateTime       time.Time `description:"创建时间"`
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司id"`
+	CompanyName      string    `description:"公司名称"`
+	RealName         string    `description:"用户实际名称"`
+	SellerName       string    `description:"所属销售"`
+	PlaySeconds      string    `description:"播放时间 单位s"`
+	ModifyTime       time.Time `description:"视频修改时间"`
+	RegisterPlatform int       // 来源 1小程序,2:网页
 }
 
-//添加
+// 添加
 func AddCygxActivityVoiceHistory(item *CygxActivityVoiceHistory) (err error) {
 	o := orm.NewOrm()
 	_, err = o.Insert(item)
@@ -41,7 +42,7 @@ func UpdateLastCygxActivityVoiceHistory(playSeconds string, lastId int) (err err
 	return
 }
 
-//获取列表信息根据手机号分组
+// 获取列表信息根据手机号分组
 func GetActivityVoiceHistoryByMobileList(condition string) (items []*CygxActivityVoiceHistory, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_activity_voice_history  WHERE 1 =1  ` + condition + `  GROUP BY user_id  `
@@ -49,7 +50,7 @@ func GetActivityVoiceHistoryByMobileList(condition string) (items []*CygxActivit
 	return
 }
 
-//修改用户浏览活动音频的相关信息
+// 修改用户浏览活动音频的相关信息
 func UpdateCygxActivityVoiceHistory(wxUser *WxUserItem) (err error) {
 	o := orm.NewOrm()
 	var sql string

+ 4 - 3
models/article_comment.go

@@ -14,6 +14,7 @@ type CygxArticleComment struct {
 	ActivityId      int       `description:"活动id"`
 	VideoId         int       `description:"视频id"`
 	ActivityVoiceId int       `description:"活动音频ID"`
+	AskserieVideoId int       `description:" 系列问答视频ID askserie_video_id"`
 	IndustryId      int       `description:"产业id"`
 	CreateTime      time.Time `description:"创建时间"`
 	Mobile          string    `description:"手机号"`
@@ -24,7 +25,7 @@ type CygxArticleComment struct {
 	Title           string    `description:"标题"`
 }
 
-//添加留言
+// 添加留言
 func AddArticleComment(item *CygxArticleComment) (lastId int64, err error) {
 	o := orm.NewOrm()
 	lastId, err = o.Insert(item)
@@ -36,7 +37,7 @@ type AddCygxArticleCommentReq struct {
 	Content   string `description:"内容"`
 }
 
-//我的留言列表
+// 我的留言列表
 func GetCommentList(userId, startSize, pageSize int) (items []*CygxArticleComment, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -50,7 +51,7 @@ func GetCommentList(userId, startSize, pageSize int) (items []*CygxArticleCommen
 	return
 }
 
-//我的留言列表
+// 我的留言列表
 func GetCommentListCount(userId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT

+ 49 - 0
models/askserie_video_collect.go

@@ -0,0 +1,49 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxAskserieVideoCollect struct {
+	Id               int       `orm:"column(id);pk"`
+	AskserieVideoId  int       `description:"askserie_video_id"`
+	UserId           int       `description:"用户ID"`
+	CreateTime       time.Time `description:"创建时间"`
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司id"`
+	CompanyName      string    `description:"公司名称"`
+	RealName         string    `description:"用户实际名称"`
+	SellerName       string    `description:"所属销售"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
+	ModifyTime       time.Time `description:"更新时间"`
+}
+
+// 添加
+func AddCygxAskserieVideoCollect(item *CygxAskserieVideoCollect) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+func RemoveAskserieVideoCollect(userId, askserieVideoId int) (err error) {
+	o := orm.NewOrm()
+	sql := `DELETE FROM cygx_askserie_video_collect WHERE user_id=? AND askserie_video_id=? `
+	_, err = o.Raw(sql, userId, askserieVideoId).Exec()
+	return
+}
+
+func GetAskserieVideoCount(userId, askserieVideoId int) (count int, err error) {
+	sql := `SELECT COUNT(1) AS count FROM cygx_askserie_video_collect WHERE user_id=? AND askserie_video_id=? `
+	err = orm.NewOrm().Raw(sql, userId, askserieVideoId).QueryRow(&count)
+	return
+}
+
+func GetUserCygxAskserieVideoCollectList(userId int) (items []*CygxAskserieVideoCollect, err error) {
+	sql := `SELECT a.* FROM cygx_askserie_video_collect AS a 
+			WHERE a.user_id=?
+           ORDER BY a.id DESC `
+	_, err = orm.NewOrm().Raw(sql, userId).QueryRows(&items)
+	return
+}

+ 36 - 0
models/askserie_video_collection.go

@@ -0,0 +1,36 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxAskserieVideoCollection struct {
+	Id               int       `orm:"column(id);pk"`
+	AskserieVideoId  int       `description:"askserie_video_id"`
+	UserId           int       `description:"用户ID"`
+	CreateTime       time.Time `description:"创建时间"`
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司id"`
+	CompanyName      string    `description:"公司名称"`
+	RealName         string    `description:"用户实际名称"`
+	SellerName       string    `description:"所属销售"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
+	ModifyTime       time.Time `description:"更新时间"`
+	Content          string    `description:"留言内容"`
+}
+
+// 添加
+func AddCygxAskserieVideoCollection(item *CygxAskserieVideoCollection) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+func UpdateAskserieVideoCommentNum(askserieVideoId int) (err error) {
+	sql := `UPDATE cygx_askserie_video SET comment_num = comment_num+1 WHERE askserie_video_id = ?  `
+	o := orm.NewOrm()
+	_, err = o.Raw(sql, askserieVideoId).Exec()
+	return
+}

+ 36 - 0
models/askserie_video_history_record.go

@@ -0,0 +1,36 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxAskserieVideoHistoryRecord struct {
+	Id               int       `orm:"column(id);pk"`
+	AskserieVideoId  int       `description:"askserie_video_id"`
+	UserId           int       `description:"用户ID"`
+	CreateTime       time.Time `description:"创建时间"`
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司id"`
+	CompanyName      string    `description:"公司名称"`
+	RealName         string    `description:"用户实际名称"`
+	SellerName       string    `description:"所属销售"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
+	ModifyTime       time.Time `description:"更新时间"`
+	VideoDuration    int       `description:"播放时长"`
+}
+
+// 添加
+func AddCygxAskserieVideoHistoryRecord(item *CygxAskserieVideoHistoryRecord) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+func UpdateAskserieVideoCounts(askserieVideoId int) (err error) {
+	sql := `UPDATE cygx_askserie_video SET video_counts = video_counts+1 WHERE askserie_video_id = ?  `
+	o := orm.NewOrm()
+	_, err = o.Raw(sql, askserieVideoId).Exec()
+	return
+}

+ 3 - 0
models/db.go

@@ -97,6 +97,9 @@ func init() {
 		new(CygxYanxuanSpecialCompany),
 		new(CygxResourceData),
 		new(CygxMorningMeetingReviewChapterHistory),
+		new(CygxAskserieVideoHistoryRecord),
+		new(CygxAskserieVideoCollection),
+		new(CygxAskserieVideoCollect),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 143 - 0
models/micro_roadshow.go

@@ -12,10 +12,31 @@ type MicroRoadShowListResp struct {
 	Paging *paging.PagingItem
 	List   []*MicroRoadShowPageList
 }
+type CygxMicroRoadshowVideo struct {
+	VideoId             int       `orm:"column(video_id);pk"description:"微路演视频id"`
+	VideoName           string    `description:"视频名称"`
+	ChartPermissionId   int       `description:"行业Id"`
+	ChartPermissionName string    `description:"行业名称"`
+	IndustryId          int       `description:"产业id"`
+	IndustryName        string    `description:"产业名称"`
+	PublishStatus       int       `description:"发布状态 1发布 0没有"`
+	ModifyDate          string    `description:"更新时间"`
+	PublishDate         time.Time `description:"发布时间"`
+	VideoDuration       string    `description:"视频时长"`
+	VideoCounts         int       `description:"播放量"`
+	VideoUrl            string    `description:"视频地址"`
+	CreateTime          string    `description:"创建时间"`
+	ImgUrl              string    `description:"视频封面图"`
+	ShareImgUrl         string    `description:"视频分享图"`
+	DetailImgUrl        string    `description:"产业详情页背景图"`
+	CommentNum          int       `description:"留言总数"`
+	IsSendWxMsg         int       `description:"是否推送过微信模板消息,1是,0:否"`
+}
 
 // MicroRoadShowPageList 微路演列表
 type MicroRoadShowPageList struct {
 	Id                     int       `description:"音视频ID"`
+	SourceId               int       `description:"资源ID"`
 	Title                  string    `description:"标题"`
 	ResourceUrl            string    `description:"链接"`
 	Type                   int       `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
@@ -34,9 +55,17 @@ type MicroRoadShowPageList struct {
 	AuthInfo               *UserPermissionAuthInfo
 }
 
+func GetMicroRoadshowVideoByVideoId(videoId int) (item *CygxMicroRoadshowVideo, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * from cygx_micro_roadshow_video where video_id = ? `
+	err = o.Raw(sql, videoId).QueryRow(&item)
+	return
+}
+
 type AddVideoHistoryReq struct {
 	VideoId     int `description:"视频ID"`
 	PlaySeconds int `description:"播放时长"`
+	SourceType  int `description:"音视频来源: 1-活动音频; 2-活动视频; 3-产业视频; 4-系列问答"`
 }
 
 type CygxMicroRoadshowVideoHistory struct {
@@ -292,6 +321,120 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 	return
 }
 
+// GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
+func GetMicroRoadShowVideoPageListV12(startSize, pageSize int, audioAct string, audioActPars []interface{}, videoAct string, videoActPars []interface{}, videoMico string, videoMicoPars []interface{}, conditionAskserie string, askseriePars []interface{}) (total int, list []*MicroRoadShowPageList, err error) {
+	o := orm.NewOrm()
+	var sql string
+
+	//活动音频1
+	sql += `
+			SELECT
+			a.activity_voice_id AS id,
+			a.activity_id AS source_id,
+			a.voice_name AS title,
+			a.voice_url AS resource_url,
+			1 AS type,
+			b.activity_time AS publish_time,
+			b.chart_permission_id,
+			b.chart_permission_name,
+			a.voice_play_seconds AS play_seconds,
+			a.background_img,
+			"" AS industry_name,
+			"",
+			a.share_img,
+			a.activity_id 
+		FROM
+			cygx_activity_voice AS a
+			JOIN cygx_activity AS b ON a.activity_id = b.activity_id  WHERE 1= 1  `
+	if audioAct != `` {
+		sql += audioAct
+	}
+
+	//活动视频2
+	sql += `  UNION ALL `
+	sql += `
+		SELECT
+			a.video_id AS id,
+			a.activity_id AS source_id,
+			a.video_name AS title,
+			a.video_url AS resource_url,
+			2 AS type,
+	    	b.activity_time as publish_time,
+			b.chart_permission_id,
+			b.chart_permission_name,
+			"" AS play_seconds,
+			a.background_img,
+			"" AS industry_name,
+			"",
+			a.share_img,
+			a.activity_id
+		FROM
+			cygx_activity_video as a
+			INNER JOIN cygx_activity as b on a.activity_id = b.activity_id WHERE 1= 1  `
+	if videoAct != `` {
+		sql += videoAct
+	}
+	sql += `  UNION ALL `
+
+	// 产业视频3
+	sql += `SELECT
+			video_id AS id,
+			video_id AS source_id,
+			video_name AS title,
+			video_url AS resource_url,
+			3 AS type,
+			publish_date AS publish_time,
+			chart_permission_id,
+			chart_permission_name,
+			video_duration AS play_seconds,
+			img_url AS background_img,            
+			industry_name,
+			industry_id,
+			share_img_url AS share_img,
+			"" as  activity_id
+		FROM
+			cygx_micro_roadshow_video  as a
+		WHERE
+			publish_status = 1 `
+	if videoMico != `` {
+		sql += videoMico
+	}
+
+	//系列问答
+	sql += `  UNION ALL `
+	sql += `
+			SELECT
+			a.askserie_video_id AS id,
+			a.askserie_video_id AS source_id,
+			a.video_name AS title,
+			a.video_url AS resource_url,
+			4 AS type,
+			a.publish_date AS publish_time,
+			a.chart_permission_id,
+			a.chart_permission_name,
+			a.video_duration AS play_seconds,
+			a.background_img,
+			"" AS industry_name,
+			"",
+			a.share_img,
+			0  as activity_id 
+		FROM
+			cygx_askserie_video AS a WHERE 1= 1 `
+	if conditionAskserie != `` {
+		sql += conditionAskserie
+	}
+
+	sql += ` ORDER BY publish_time DESC`
+	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
+	err = o.Raw(totalSql, audioActPars, videoActPars, videoMicoPars, askseriePars).QueryRow(&total)
+	if err != nil {
+		return
+	}
+	sql += ` LIMIT ?,?`
+	_, err = o.Raw(sql, audioActPars, videoActPars, videoMicoPars, askseriePars, startSize, pageSize).QueryRows(&list)
+	return
+}
+
 type MicroList []*MicroRoadShowPageList
 
 func (m MicroList) Len() int {

+ 1 - 0
models/resource_data.go

@@ -107,6 +107,7 @@ type CygxResourceDataNewResp struct {
 	IndustrialResource *IndustrialManagement                   `description:"产业资源包"`
 	ReportSelection    *CygxReportSelectionRep                 `description:"重点公司(原报告精选)"`
 	YanxuanSpecial     *CygxYanxuanSpecialItem                 `description:"研选专栏"`
+	AskserieVideo      *MicroRoadShowPageList                  `description:"活动音频"`
 }
 
 // 列表

+ 93 - 0
services/askserie_video.go

@@ -0,0 +1,93 @@
+package services
+
+import (
+	"errors"
+	"fmt"
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/utils"
+	"time"
+)
+
+// 记录用户活动音频播放记录
+func AddAskserieVideoHistoryRecord(user *models.WxUserItem, askserieVideoId, playSeconds int) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("记录用户活动音频播放记录失败 AddAskserieVideoHistoryRecord Err:", err.Error(), "askserieVideoId:", askserieVideoId, "UserId:", user.UserId), 2)
+		}
+	}()
+	item := new(models.CygxAskserieVideoHistoryRecord)
+	item.UserId = user.UserId
+	item.AskserieVideoId = askserieVideoId
+	item.VideoDuration = playSeconds
+	item.Mobile = user.Mobile
+	item.Email = user.Email
+	item.CompanyId = user.CompanyId
+	item.CompanyName = user.CompanyName
+	item.CreateTime = time.Now()
+	item.ModifyTime = time.Now()
+	item.RegisterPlatform = utils.REGISTER_PLATFORM
+	sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetSellerByCompanyIdCheckFicc, Err: " + e.Error())
+		return
+	}
+	if sellerItem != nil {
+		item.SellerName = sellerItem.RealName
+	}
+	//添加记录
+	e = models.AddCygxAskserieVideoHistoryRecord(item)
+	if e != nil {
+		err = errors.New("AddCygxAskserieVideoHistoryRecord, Err: " + e.Error())
+		return
+	}
+	//播放记录加1
+	e = models.UpdateAskserieVideoCounts(askserieVideoId)
+	if e != nil {
+		err = errors.New("UpdateAskserieVideoCounts, Err: " + e.Error())
+		return
+	}
+	return
+}
+
+// 系列问答视频留言记录
+func AddCygxAskserieVideoCollection(user *models.WxUserItem, askserieVideoId int, content string) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("记录用户活动音频播放记录失败 AddAskserieVideoHistoryRecord Err:", err.Error(), "askserieVideoId:", askserieVideoId, "UserId:", user.UserId), 2)
+		}
+	}()
+	item := new(models.CygxAskserieVideoCollection)
+	item.UserId = user.UserId
+	item.AskserieVideoId = askserieVideoId
+	item.Content = content
+	item.Mobile = user.Mobile
+	item.Email = user.Email
+	item.CompanyId = user.CompanyId
+	item.CompanyName = user.CompanyName
+	item.CreateTime = time.Now()
+	item.ModifyTime = time.Now()
+	item.RegisterPlatform = utils.REGISTER_PLATFORM
+	sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetSellerByCompanyIdCheckFicc, Err: " + e.Error())
+		return
+	}
+	if sellerItem != nil {
+		item.SellerName = sellerItem.RealName
+	}
+	//添加记录
+	e = models.AddCygxAskserieVideoCollection(item)
+	if e != nil {
+		err = errors.New("AddCygxAskserieVideoCollection, Err: " + e.Error())
+		return
+	}
+	//播放记录加1
+	e = models.UpdateAskserieVideoCommentNum(askserieVideoId)
+	if e != nil {
+		err = errors.New("UpdateAskserieVideoCommentNum, Err: " + e.Error())
+		return
+	}
+	return
+}

+ 137 - 0
services/cygx_activity_video_history.go

@@ -0,0 +1,137 @@
+package services
+
+import (
+	"errors"
+	"fmt"
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/utils"
+	"strconv"
+	"time"
+)
+
+// 添加活动的视频播放记录
+//func AddActivityVideoHistory(user *models.WxUserItem, activityId int) (err error) {
+//	activityInfo, errInfo := models.GetCygxActivityVideoByActivityId(activityId)
+//	if activityInfo == nil {
+//		return
+//	}
+//	if errInfo != nil {
+//		return
+//	}
+//	var sellerName string
+//	sellerName, err = models.GetCompanySellerName(user.CompanyId)
+//	if err != nil {
+//		return
+//	}
+//	item := models.CygxActivityVideoHistory{
+//		ActivityId:  activityInfo.ActivityId,
+//		VideoId:     activityInfo.VideoId,
+//		UserId:      user.UserId,
+//		CreateTime:  time.Now(),
+//		Mobile:      user.Mobile,
+//		Email:       user.Email,
+//		CompanyId:   user.CompanyId,
+//		CompanyName: user.CompanyName,
+//		RealName:    user.RealName,
+//		SellerName:  sellerName,
+//		ModifyTime:  time.Now(),
+//	}
+//	err = models.AddCygxActivityVideoHistory(&item)
+//	if err != nil {
+//		return
+//	}
+//	err = models.UpdateActivityVideoCounts(activityInfo.ActivityId)
+//	if err != nil {
+//		return
+//	}
+//	go ActivityVideoUserRmind(user, activityId, 1)
+//	return
+//}
+
+// 记录用户活动音频播放记录
+func AddActivityVideoHistory(user *models.WxUserItem, activityId, playSeconds int) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("记录用户活动音频播放记录失败 AddActivityVoiceHistory Err:", err.Error(), "活动ID:", activityId, "UserId:", user.UserId), 2)
+		}
+	}()
+	item := new(models.CygxActivityVideoHistory)
+	item.UserId = user.UserId
+	item.ActivityId = activityId
+	item.PlaySeconds = strconv.Itoa(playSeconds)
+	item.Mobile = user.Mobile
+	item.Email = user.Email
+	item.CompanyId = user.CompanyId
+	item.CompanyName = user.CompanyName
+	item.CreateTime = time.Now()
+	item.ModifyTime = time.Now()
+	item.RegisterPlatform = utils.REGISTER_PLATFORM
+	sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetSellerByCompanyIdCheckFicc, Err: " + e.Error())
+		return
+	}
+	if sellerItem != nil {
+		item.SellerName = sellerItem.RealName
+	}
+	//添加记录
+	e = models.AddCygxActivityVideoHistory(item)
+	if e != nil {
+		err = errors.New("AddCygxActivityVoiceHistory, Err: " + e.Error())
+		return
+	}
+	//播放记录加1
+	e = models.UpdateActivityVideoCounts(activityId)
+	if e != nil {
+		err = errors.New("UpdateCygxActivityVoiceCounts, Err: " + e.Error())
+		return
+	}
+	//设置消息提醒
+	go ActivityVideoUserRmind(user, activityId, 1)
+	return
+}
+
+// 记录用户活动音频播放记录
+func AddActivityVoiceHistory(user *models.WxUserItem, activityId, playSeconds int) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("记录用户活动音频播放记录失败 AddActivityVoiceHistory Err:", err.Error(), "活动ID:", activityId, "UserId:", user.UserId), 2)
+		}
+	}()
+	item := new(models.CygxActivityVoiceHistory)
+	item.UserId = user.UserId
+	item.ActivityId = activityId
+	item.PlaySeconds = strconv.Itoa(playSeconds)
+	item.Mobile = user.Mobile
+	item.Email = user.Email
+	item.CompanyId = user.CompanyId
+	item.CompanyName = user.CompanyName
+	item.CreateTime = time.Now()
+	item.ModifyTime = time.Now()
+	item.RegisterPlatform = utils.REGISTER_PLATFORM
+	sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetSellerByCompanyIdCheckFicc, Err: " + e.Error())
+		return
+	}
+	if sellerItem != nil {
+		item.SellerName = sellerItem.RealName
+	}
+	//添加记录
+	e = models.AddCygxActivityVoiceHistory(item)
+	if e != nil {
+		err = errors.New("AddCygxActivityVoiceHistory, Err: " + e.Error())
+		return
+	}
+	//播放记录加1
+	e = models.UpdateCygxActivityVoiceCounts(activityId)
+	if e != nil {
+		err = errors.New("UpdateCygxActivityVoiceCounts, Err: " + e.Error())
+		return
+	}
+	//设置消息提醒
+	go ActivityVideoUserRmind(user, activityId, 2)
+	return
+}

+ 171 - 0
services/micro_roadshow.go

@@ -3,8 +3,10 @@ package services
 import (
 	"encoding/json"
 	"errors"
+	"fmt"
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/utils"
+	"strconv"
 	"strings"
 )
 
@@ -313,6 +315,106 @@ func GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activi
 	return
 }
 
+// GetMicroRoadShowPageList 获取微路演列表添加活动视频 更新与8.1版本
+func GetMicroRoadShowPageListV12(pageSize, currentIndex, sourceId, tableType int, filter, keywords, searchType, chartPermissionIds string) (respList []*models.MicroRoadShowPageList, total int, err error) {
+	//Type                int    `description:"类型: 1-活动音频; 2-活动视频; 3-产业视频; 4-系列问答"`
+	var e error
+	// 根据每页数据量获取音视频配比
+	startSize := utils.StartIndex(currentIndex, pageSize)
+	videoList := make([]*models.MicroRoadShowPageList, 0)
+
+	var audioAct string // 活动音频 1
+	var audioActPars []interface{}
+
+	var videoAct string // 活动视频 2
+	var videoActPars []interface{}
+
+	//视频的处理
+	var videoMico string //产业视频 3
+	var videoMicoPars []interface{}
+
+	var conditionAskserie string // 系列问答 4
+	var askseriePars []interface{}
+
+	if sourceId > 0 && tableType > 0 {
+		//先给不相干的表查询ID = 0
+		audioAct += ` AND b.chart_permission_id  = 0 `
+		videoAct += ` AND b.chart_permission_id = 0`
+		videoMico += ` AND a.chart_permission_id  = 0 `
+		conditionAskserie += ` AND a.chart_permission_id   = 0 `
+		switch tableType {
+		case 1:
+			audioAct += ` OR  a.activity_id =  ` + strconv.Itoa(sourceId)
+		case 2:
+			videoAct += ` OR  a.activity_id =  ` + strconv.Itoa(sourceId)
+		case 3:
+			videoMico += ` OR  a.id =  ` + strconv.Itoa(sourceId)
+		case 4:
+			conditionAskserie += ` OR  a.askserie_video_id =  ` + strconv.Itoa(sourceId)
+		}
+	}
+
+	if filter == "1" {
+		audioAct += ` AND b.chart_permission_id  = 0 `
+	} else if filter == "2" {
+		videoAct += ` AND b.chart_permission_id = 0`
+		videoMico += ` AND a.chart_permission_id  = 0 `
+		conditionAskserie += ` AND a.chart_permission_id   = 0 `
+	}
+
+	if searchType != "" {
+		// @Param   SearchType	string	int		true	"搜索类型: 1-路演回放; 2-问答系列; 3-调研反馈   多个用 , 隔开"
+		videoMico += ` AND a.chart_permission_id  = 0 ` // 产业视频不在搜索范围内
+		if !strings.Contains(searchType, "1") {
+			audioAct += ` AND b.activity_type_id  != 2 `
+			videoAct += ` AND b.activity_type_id != 2`
+		}
+
+		if !strings.Contains(searchType, "2") {
+			conditionAskserie += ` AND a.chart_permission_id   = 0 `
+		}
+
+		if !strings.Contains(searchType, "3") && !strings.Contains(searchType, "1") {
+			audioAct += ` AND b.chart_permission_id  = 0  `
+			videoAct += ` AND b.chart_permission_id  = 0 `
+		}
+	}
+
+	if keywords != "" {
+		keywords = "%" + keywords + "%"
+
+		audioAct += ` AND  a.voice_name LIKE ? `
+		videoAct += ` AND  a.video_name LIKE ? `
+		videoMico += ` AND  a.video_name LIKE ? `
+		conditionAskserie += ` AND  a.video_name LIKE ? `
+
+		audioActPars = append(audioActPars, keywords)
+		videoActPars = append(videoActPars, keywords)
+		videoMicoPars = append(videoMicoPars, keywords)
+		askseriePars = append(askseriePars, keywords)
+	}
+	//行业筛选
+	if chartPermissionIds != "" {
+		audioAct += ` AND  b.chart_permission_id IN (` + chartPermissionIds + `)`
+		videoAct += ` AND b.chart_permission_id IN (` + chartPermissionIds + `)`
+		videoMico += ` AND a.chart_permission_id IN (` + chartPermissionIds + `)`
+		conditionAskserie += ` AND a.chart_permission_id IN (` + chartPermissionIds + `)`
+	}
+	//发布状态
+	audioAct += ` AND  b.publish_status = 1 `
+	videoAct += ` AND  b.publish_status = 1 `
+	videoMico += ` AND  a.publish_status = 1 `
+	conditionAskserie += ` AND  a.publish_status = 1 `
+
+	total, videoList, e = models.GetMicroRoadShowVideoPageListV12(startSize, pageSize, audioAct, audioActPars, videoAct, videoActPars, videoMico, videoMicoPars, conditionAskserie, askseriePars)
+	if e != nil {
+		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
+		return
+	}
+	respList = videoList
+	return
+}
+
 // GetMicroRoadShowPageListIkWord  添加IK分词联想词 获取微路演列表添加活动视频 更新与8.1版本
 func CountMicroRoadShowPageListIkWord(audioId, videoId, activityVideoId int, keywordArr []string, filter string) (total int, err error) {
 	var e error
@@ -511,3 +613,72 @@ func GetMicroRoadShowPageListIkWord(startSize, pageSize, audioId, videoId, activ
 	respList = videoList
 	return
 }
+
+// 用户微路演视频回放操作操作行为,模板消息推送
+func MicroRoadshowVideoUserRmind(user *models.WxUserItem, videoId int) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("用户音视频回放操作操作行为,模板消息推送失败"+err.Error(), 2)
+		}
+	}()
+	countUser, err := models.GetUserRemind(user.UserId)
+	if err != nil {
+		return err
+	}
+	if countUser == 0 {
+		return err
+	}
+	var first string
+	var keyword1 string
+	var keyword2 string
+	var keyword3 string
+	var keyword4 string
+	var remark string
+	//获取销售手机号
+	sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return err
+	}
+	if sellerItemQy != nil {
+		openIdList, e := models.GetWxOpenIdByMobileList(sellerItemQy.Mobile)
+		if e != nil {
+			err = errors.New("GetSellerByAdminId, Err: " + e.Error())
+			return
+		}
+		videoInfo, e := models.GetMicroRoadshowVideoByVideoId(videoId)
+		if e != nil {
+			err = errors.New("GetCygxActivitySpecialDetailById, Err: " + e.Error())
+			return
+		}
+		if videoInfo == nil {
+			return
+		}
+		first = fmt.Sprint(user.RealName, "--", user.CompanyName, ",有新的互动:播放微路演详视频")
+		keyword1 = videoInfo.VideoName
+		keyword2 = fmt.Sprint("互动:播放微路演详视频,", user.RealName, "--", user.CompanyName)
+		remark = "点击查看微路演详情"
+		openIdArr := make([]string, 0)
+		for _, v := range openIdList {
+			openIdArr = append(openIdArr, v.OpenId)
+		}
+		redirectUrl := utils.WX_MSG_PATH_ACTIVITY_INDUSTRYR_EPORT + strconv.Itoa(videoInfo.IndustryId)
+		sendInfo := new(SendWxTemplate)
+		sendInfo.First = first
+		sendInfo.Keyword1 = keyword1
+		sendInfo.Keyword2 = keyword2
+		sendInfo.Keyword3 = keyword3
+		sendInfo.Keyword4 = keyword4
+		sendInfo.Remark = remark
+		sendInfo.TemplateId = utils.WxMsgTemplateIdArticleUserRemind
+		sendInfo.RedirectUrl = redirectUrl
+		sendInfo.RedirectTarget = 3
+		sendInfo.Resource = strconv.Itoa(videoId)
+		sendInfo.SendType = utils.TEMPLATE_MSG_CYGX_ARTICLE_ADD
+		sendInfo.OpenIdArr = openIdArr
+		err = PublicSendTemplateMsg(sendInfo)
+		if err != nil {
+			return
+		}
+	}
+	return
+}

+ 11 - 5
services/resource_data.go

@@ -45,6 +45,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 	var productinteriorIds []int    //产品内测
 	var reportselectionIds []int    // 报告精选
 	var yanxuanSpecialIds []int     // 研选专栏
+	var askserieVideoIds []string   //问答系列视频
 	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt  、 产品内测:productinterior
 	for _, v := range list {
 		if v.Source == "article" {
@@ -73,7 +74,10 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			reportselectionIds = append(reportselectionIds, v.SourceId)
 		} else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL {
 			yanxuanSpecialIds = append(yanxuanSpecialIds, v.SourceId)
+		} else if v.Source == utils.CYGX_OBJ_ASKSERIEVIDEO {
+			askserieVideoIds = append(askserieVideoIds, strconv.Itoa(v.SourceId))
 		}
+
 	}
 	detail, e := models.GetConfigByCode("city_img_url")
 	if e != nil {
@@ -309,14 +313,14 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 		}
 	}
 
-	//处理路演 处理路活动视频 处理路活音频
-	if len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds) > 0 {
+	if len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds)+len(askserieVideoIds) > 0 {
 
 		audioIdstr := strings.Join(activityvoiceIds, ",")
-		ideoIdsStr := strings.Join(roadshowIds, ",")
 		activityVideoIdsStr := strings.Join(activityvideoIds, ",")
+		roadshowIdsStr := strings.Join(roadshowIds, ",")
+		askserieVideoIdsStr := strings.Join(askserieVideoIds, ",")
 
-		list, _, e := GetMicroRoadShowMycollect(len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds), 0, audioIdstr, ideoIdsStr, activityVideoIdsStr)
+		list, _, e := GetMicroRoadShowMycollectV12(len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds)+len(askserieVideoIds), 0, audioIdstr, activityVideoIdsStr, roadshowIdsStr, askserieVideoIdsStr)
 		if e != nil {
 			err = errors.New("GetMicroRoadShowMycollect, Err: " + e.Error())
 			return
@@ -425,6 +429,8 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 				mapItems[fmt.Sprint("activityvideo", item.Id)].Activityvideo = item
 			} else if item.Type == 3 {
 				mapItems[fmt.Sprint("roadshow", item.Id)].Roadshow = item
+			} else if item.Type == 4 {
+				mapItems[fmt.Sprint(utils.CYGX_OBJ_ASKSERIEVIDEO, item.Id)].AskserieVideo = item
 			}
 		}
 	}
@@ -472,7 +478,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 	for _, vList := range list {
 		for _, v := range mapItems {
 			//如果这些类型都为空,那么就不合并
-			if v.Article == nil && v.Newchart == nil && v.Roadshow == nil && v.Activity == nil && v.Activityvideo == nil && v.Activityvoice == nil && v.Activityspecial == nil && v.Researchsummary == nil && v.Minutessummary == nil && v.Meetingreviewchapt == nil && v.ProductInterior == nil && v.IndustrialResource == nil && v.ReportSelection == nil && v.YanxuanSpecial == nil {
+			if v.Article == nil && v.Newchart == nil && v.Roadshow == nil && v.Activity == nil && v.Activityvideo == nil && v.Activityvoice == nil && v.Activityspecial == nil && v.Researchsummary == nil && v.Minutessummary == nil && v.Meetingreviewchapt == nil && v.ProductInterior == nil && v.IndustrialResource == nil && v.ReportSelection == nil && v.YanxuanSpecial == nil && v.AskserieVideo == nil {
 				continue
 			}
 			if v.SourceId == vList.SourceId {

+ 64 - 0
services/user.go

@@ -523,6 +523,70 @@ func GetMicroRoadShowMycollect(pageSize, currentIndex int, audioIds, videoIds, a
 	return
 }
 
+// 我的收藏
+func GetMicroRoadShowMycollectV12(pageSize, currentIndex int, audioIds, activityVideoIds, roadshowIdsStr, askserieVideoIds string) (respList []*models.MicroRoadShowPageList, total int, err error) {
+	//Type                int    `description:"类型: 1-活动音频; 2-活动视频; 3-产业视频; 4-系列问答"`
+	var e error
+	// 根据每页数据量获取音视频配比
+	startSize := utils.StartIndex(currentIndex, pageSize)
+	videoList := make([]*models.MicroRoadShowPageList, 0)
+
+	var audioAct string // 活动音频 1
+	var audioActPars []interface{}
+
+	var videoAct string // 活动视频 2
+	var videoActPars []interface{}
+
+	//视频的处理
+	var videoMico string //产业视频 3
+	var videoMicoPars []interface{}
+
+	var conditionAskserie string // 系列问答 4
+	var askseriePars []interface{}
+
+	if audioIds != "" {
+		sliceId := strings.Split(audioIds, ",")
+		audioAct += ` AND a.activity_voice_id IN (` + strings.Join(sliceId, ",") + `)`
+	} else {
+		audioAct += ` AND a.activity_voice_id = 0 `
+	}
+
+	if activityVideoIds != "" {
+		sliceId := strings.Split(activityVideoIds, ",")
+		videoAct += ` AND a.video_id IN (` + strings.Join(sliceId, ",") + `)`
+	} else {
+		videoAct += ` AND a.video_id = 0 `
+	}
+
+	if roadshowIdsStr != "" {
+		sliceId := strings.Split(roadshowIdsStr, ",")
+		videoMico += ` AND a.video_id IN (` + strings.Join(sliceId, ",") + `)`
+	} else {
+		videoMico += ` AND a.video_id = 0 `
+	}
+
+	if askserieVideoIds != "" {
+		sliceId := strings.Split(askserieVideoIds, ",")
+		conditionAskserie += ` AND a.askserie_video_id IN (` + strings.Join(sliceId, ",") + `)`
+	} else {
+		conditionAskserie += ` AND a.askserie_video_id = 0 `
+	}
+
+	//发布状态
+	audioAct += ` AND  b.publish_status = 1 `
+	videoAct += ` AND  b.publish_status = 1 `
+	videoMico += ` AND  a.publish_status = 1 `
+	conditionAskserie += ` AND  a.publish_status = 1 `
+
+	total, videoList, e = models.GetMicroRoadShowVideoPageListV12(startSize, pageSize, audioAct, audioActPars, videoAct, videoActPars, videoMico, videoMicoPars, conditionAskserie, askseriePars)
+	if e != nil {
+		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
+		return
+	}
+	respList = videoList
+	return
+}
+
 // 获取用户权限
 func GetUserhasPermission(user *models.WxUserItem) (hasPermission int, err error) {
 	//判断是否已经申请过

+ 1 - 0
utils/constants.go

@@ -243,6 +243,7 @@ const (
 	CYGX_OBJ_RESEARCHSUMMARY    string = "researchsummary"    // 对象类型:本周研究汇总
 	CYGX_OBJ_MINUTESSUMMARY     string = "minutessummary"     // 对象类型:本周研究汇总
 	CYGX_OBJ_YANXUANSPECIAL     string = "yanxuanspecial"     // 对象类型:研选专栏
+	CYGX_OBJ_ASKSERIEVIDEO      string = "askserievideo"      // 对象类型:问答系列视频
 )
 
 const (