Browse Source

Merge branch 'cygx/cygx_12.4.1' of http://8.136.199.33:3000/hongze/hz_crm_api

xingzai 1 year ago
parent
commit
321aea07e2

+ 324 - 18
controllers/cygx/activity_video.go

@@ -192,6 +192,10 @@ func (this *ActivityVideoCoAntroller) VideoDeatil() {
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
+
+	for _, v := range list {
+		v.RegisterPlatform = utils.CYGX_REGISTER_PLATFORM_MAP[v.RegisterPlatform]
+	}
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
@@ -349,6 +353,7 @@ func (this *ActivityVideoCoAntroller) CommentList() {
 // @Description 获取音视频上传之后的封面图
 // @Param   ActivityId   query   int  true       "活动ID"
 // @Param   FileType   query   int  true       "音视频文件类型 。1:音频。2:视频"
+// @Param   ChartPermissionId     query   int  true       "行业ID"
 // @Success 200 {object} cygx.ChartPermissionRepMoreList
 // @router /activityVideo/video_and_voice/img [get]
 func (this *ActivityVideoCoAntroller) VideoAndVoice() {
@@ -364,19 +369,6 @@ func (this *ActivityVideoCoAntroller) VideoAndVoice() {
 		br.Ret = 408
 		return
 	}
-	activityId, _ := this.GetInt("ActivityId")
-	fileType, _ := this.GetInt("FileType")
-	if activityId < 1 {
-		br.Msg = "请输入活动ID"
-		return
-	}
-	activityInfo, err := cygx.GetAddActivityInfoById(activityId)
-	if err != nil {
-		br.Msg = "活动不存在"
-		br.ErrMsg = "活动ID错误,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
-		return
-	}
-	//key := utils.MicroRoadshowDefaultImgKey
 	conf, err := cygx.GetCygxConfigDetailByCode("activity_video_default_img")
 	if err != nil {
 		br.Msg = "获取微路演默认图配置失败" + err.Error()
@@ -388,21 +380,335 @@ func (this *ActivityVideoCoAntroller) VideoAndVoice() {
 		return
 	}
 	resp := new(cygx.ActivityVideoDefaultImgListResp)
-	if fileType == 1 {
+	chartPermissionId, _ := this.GetInt("ChartPermissionId")
+	activityId, _ := this.GetInt("ActivityId")
+	fileType, _ := this.GetInt("FileType")
+
+	if chartPermissionId > 0 {
 		for _, v := range list.Audio {
-			if v.ChartPermissionId == activityInfo.ChartPermissionId {
+			if v.ChartPermissionId == chartPermissionId {
 				resp.List = v.List
 			}
 		}
 	} else {
-		for _, v := range list.Video {
-			if v.ChartPermissionId == activityInfo.ChartPermissionId {
-				resp.List = v.List
+		if activityId < 1 {
+			br.Msg = "请输入活动ID"
+			return
+		}
+		activityInfo, err := cygx.GetAddActivityInfoById(activityId)
+		if err != nil {
+			br.Msg = "活动不存在"
+			br.ErrMsg = "活动ID错误,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+			return
+		}
+		//key := utils.MicroRoadshowDefaultImgKey
+		if fileType == 1 {
+			for _, v := range list.Audio {
+				if v.ChartPermissionId == activityInfo.ChartPermissionId {
+					resp.List = v.List
+				}
+			}
+		} else {
+			for _, v := range list.Video {
+				if v.ChartPermissionId == activityInfo.ChartPermissionId {
+					resp.List = v.List
+				}
+			}
+		}
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 路演反馈、调研反馈列表
+// @Description 路演反馈、调研反馈列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   ChartPermissionId   query   string  false     "行业id"
+// @Param   ActivityTypeId   query   string  false     "活动类型id"
+// @Param   StartDate   query   string  false       "开始时间 ,列如2021-03-06 "
+// @Param   EndDate   query   string  false       "结束时间,列如2021-03-06 "
+// @Param   KeyWord   query   string  false       "搜索关键词"
+// @Param   SortType          query   string    false		"排序顺序:asc、desc"
+// @Param   SearchType          query   int    false		"类型 1 路演回放 ,2:调研反馈"
+// @Success 200 {object} cygx.CygxActivityVideoListRep
+// @router /activity_voice_and_video/list [get]
+func (this *ActivityVideoCoAntroller) ActivityVoiceAndVideoList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		return
+	}
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	chartPermissionId, _ := this.GetInt("ChartPermissionId")
+	ActivityTypeId, _ := this.GetInt("ActivityTypeId")
+	searchType, _ := this.GetInt("SearchType", 1)
+	startDate := this.GetString("StartDate")
+	endDate := this.GetString("EndDate")
+	keyWord := this.GetString("KeyWord")
+	sortType := this.GetString("SortType")
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	var condition string
+	var conditionVideo string
+	var conditionVoice string
+	var pars []interface{}
+	if keyWord != "" {
+		conditionVideo += ` AND (v.video_name LIKE '%` + keyWord + `%' )  `
+		conditionVoice += ` AND (v.voice_name LIKE '%` + keyWord + `%' )  `
+	}
+	//行业名称
+	if chartPermissionId > 0 {
+		condition += ` AND art.chart_permission_id  = ?  `
+		pars = append(pars, chartPermissionId)
+	}
+
+	if startDate != "" {
+		condition += ` AND art.activity_time >= ` + "'" + startDate + " 00:00:00'"
+	}
+	if endDate != "" {
+		condition += ` AND art.activity_time <= ` + "'" + endDate + " 23:59:59'"
+	}
+	if ActivityTypeId > 0 {
+		condition += ` AND art.activity_type_id  = ?  `
+		pars = append(pars, ActivityTypeId)
+	}
+	//类型 1 路演反馈 ,2:调研反馈
+	if searchType == 1 {
+		condition += ` AND art.activity_type_id IN (2,7)   AND  art.is_yidong_conduct = 1 `
+	} else if searchType == 2 {
+		condition += ` AND  (	  art.activity_type_id NOT IN (2,7)  OR  art.is_yidong_conduct = 0)  `
+	}
+
+	var conditionOrder string
+	if sortType == "asc" || sortType == "desc" {
+		conditionOrder += ` ORDER BY video_counts   ` + sortType
+	} else {
+		conditionOrder += ` 	ORDER BY activity_time DESC  `
+	}
+
+	list, total, err := cygx.GetActivityVoiceAndVideoList(condition, conditionVoice, conditionVideo, conditionOrder, pars, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	var activityIds string
+	for k, v := range list {
+		if v.ChartPermissionNames != "" {
+			list[k].ChartPermissionName = v.ChartPermissionNames
+		}
+		activityIds += strconv.Itoa(v.ActivityId) + ","
+	}
+	activityIds = strings.TrimRight(activityIds, ",")
+	mapIndustrial := make(map[int]string)
+	mapSubject := make(map[string]string)
+	if activityIds != "" {
+		industrialList, err := cygx.GetIndustrialActivityGroupListByactivityIds(activityIds)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,GetIndustrialActivityGroupListByactivityIds Err:" + err.Error()
+			return
+		}
+		subjectList, err := cygx.GetSubjectActivityGroupListByactivityIds(activityIds)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,GetSubjectActivityGroupListByactivityIds Err:" + err.Error()
+			return
+		}
+		//合并活动对应的多个标的
+		for _, v := range subjectList {
+			mapSubject[fmt.Sprint(v.ActivityId, "_", v.IndustrialManagementId)] += v.SubjectName + "/"
+		}
+		//活动对应的产业
+		for _, v := range industrialList {
+			var labelSubject string
+			labelSubject = mapSubject[fmt.Sprint(v.ActivityId, "_", v.IndustrialManagementId)]
+			if labelSubject != "" {
+				mapIndustrial[v.ActivityId] += v.IndustryName + "--" + strings.TrimRight(labelSubject, "/") + ","
+			} else {
+				mapIndustrial[v.ActivityId] += v.IndustryName + ","
+			}
+		}
+
+		//处理音视文件标识
+		mapVoice := make(map[int]bool)
+		var conditionVoice string
+		var parsVoice []interface{}
+		conditionVoice = " AND activity_id IN (" + activityIds + ")  "
+		listVoice, err := cygx.GetActivityVoiceList(conditionVoice, parsVoice)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+		if len(listVoice) > 0 {
+			for _, v := range listVoice {
+				mapVoice[v.ActivityId] = true
+			}
+		}
+		for k, v := range list {
+			if mapIndustrial[v.ActivityId] != "" && v.TemporaryLabel == "" {
+				list[k].Label = strings.TrimRight(mapIndustrial[v.ActivityId], ",")
+			}
+			if mapVoice[v.ActivityId] {
+				v.FileName = "音频"
+			} else {
+				v.FileName = "视频"
 			}
 		}
+		if len(list) == 0 {
+			list = make([]*cygx.CygxActivityVideoListResp, 0)
+		}
 	}
+
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp := new(cygx.CygxActivityVideoListRep)
+	resp.List = list
+	resp.Paging = page
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 留言列表详情
+// @Description 获取留言列表详情接口
+// @Param   ActivityId   query   int  true     "活动ID"
+// @Param   IsExport   query   bool  false       "是否导出excel,默认是false"
+// @Success 200 {object} cygx.ArticleCommentListResp
+// @router /activity_voice_and_video/commentList [get]
+func (this *ActivityVideoCoAntroller) VoiceAndVideoCommentList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		return
+	}
+	activityId, _ := this.GetInt("ActivityId")
+	//是否导出报表
+	isExport, _ := this.GetBool("IsExport")
+	var condition string
+	var pars []interface{}
+
+	videoInfo, _ := cygx.GetCygxActivityVideoReqDetail(activityId)
+	if videoInfo != nil {
+		condition += `  AND activity_id =  ? AND video_id = ?  `
+		pars = append(pars, videoInfo.ActivityId, videoInfo.VideoId)
+	} else {
+		videoInfo, _ := cygx.GetMicroRoadshowVoiceById(activityId)
+		if videoInfo == nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "音频ID错误"
+			return
+		}
+		condition += `  AND activity_voice_id = ? `
+		pars = append(pars, videoInfo.ActivityVoiceId)
+	}
+	list, err := cygx.GetArticleCommentListSearch(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	resp := new(cygx.ArticleCommentListResp)
+	resp.List = list
+	//导出excel
+	if isExport {
+		VoiceAndVideoCommentListExport(this, resp, br)
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// VoiceAndVideoCommentListExport 导出Excel
+func VoiceAndVideoCommentListExport(this *ActivityVideoCoAntroller, resp *cygx.ArticleCommentListResp, br *models.BaseResponse) {
+	//创建excel
+	dir, err := os.Executable()
+	exPath := filepath.Dir(dir)
+	downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
+	xlsxFile := xlsx.NewFile()
+	if err != nil {
+		br.Msg = "生成文件失败"
+		br.ErrMsg = "生成文件失败"
+		return
+	}
+	style := xlsx.NewStyle()
+	alignment := xlsx.Alignment{
+		Horizontal: "center",
+		Vertical:   "center",
+		WrapText:   true,
+	}
+	style.Alignment = alignment
+	style.ApplyAlignment = true
+	sheet, err := xlsxFile.AddSheet("阅读明细")
+	if err != nil {
+		br.Msg = "新增Sheet失败"
+		br.ErrMsg = "新增Sheet失败,Err:" + err.Error()
+		return
+	}
+	//标头
+	rowTitle := sheet.AddRow()
+	cellA := rowTitle.AddCell()
+	cellA.Value = "姓名"
+	cellB := rowTitle.AddCell()
+	cellB.Value = "公司名称"
+	cellC := rowTitle.AddCell()
+	cellC.Value = "留言"
+	cellD := rowTitle.AddCell()
+	cellD.Value = "提交时间"
+
+	for _, item := range resp.List {
+		row := sheet.AddRow()
+		cellA := row.AddCell()
+		cellA.Value = item.RealName
+		cellB := row.AddCell()
+		cellB.Value = item.CompanyName
+		cellC := row.AddCell()
+		cellC.Value = item.Content
+		cellD := row.AddCell()
+		cellD.Value = item.CreateTime
+	}
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		br.Msg = "保存文件失败"
+		br.ErrMsg = "保存文件失败"
+		return
+	}
+	downloadFileName := time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
+	this.Ctx.Output.Download(downLoadnFilePath, downloadFileName)
+	defer func() {
+		os.Remove(downLoadnFilePath)
+	}()
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "导出成功"
+}

+ 486 - 0
controllers/cygx/askserie_video.go

@@ -0,0 +1,486 @@
+package cygx
+
+import (
+	"encoding/json"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"github.com/tealeg/xlsx"
+	"hongze/hz_crm_api/controllers"
+	"hongze/hz_crm_api/models"
+	"hongze/hz_crm_api/models/cygx"
+	cygxService "hongze/hz_crm_api/services/cygx"
+	"hongze/hz_crm_api/services/elastic"
+	"hongze/hz_crm_api/utils"
+	"os"
+	"path/filepath"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// 系列问答视频
+type AskserieVideoController struct {
+	controllers.BaseAuthController
+}
+
+// @Title 新增
+// @Description 新增系列问答接口
+// @Param	request	body cygx.AddProductInteriorReq true "type json string"
+// @Success 200 {object} "保存成功"
+// @router /askserie_video/preserveAndEdit [post]
+func (this *AskserieVideoController) PreserveAndPublish() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	var req cygx.AddAskserieVideoReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	askserieVideoId := req.AskserieVideoId
+	videoName := req.VideoName
+	videoUrl := req.VideoUrl
+	videoDuration := req.VideoDuration
+	chartPermissionId := req.ChartPermissionId
+	chartPermissionName := req.ChartPermissionName
+	industrialManagementIds := req.IndustrialManagementIds
+	backgroundImg := req.BackgroundImg
+	shareImg := req.ShareImg
+	// 产业ID校验
+	if industrialManagementIds != "" {
+		industrialManagementIdList := strings.Split(industrialManagementIds, ",")
+		for _, v := range industrialManagementIdList {
+			_, err := strconv.Atoi(v)
+			if err != nil {
+				br.Msg = "参数解析异常!"
+				br.ErrMsg = "产业ID不规范,Err:" + err.Error() + industrialManagementIds
+				return
+			}
+		}
+	}
+
+	item := new(cygx.CygxAskserieVideo)
+	item.AskserieVideoId = askserieVideoId
+	item.VideoName = videoName
+	item.VideoUrl = videoUrl
+	item.VideoDuration = videoDuration
+	item.ChartPermissionId = chartPermissionId
+	item.ChartPermissionName = chartPermissionName
+	item.PublishStatus = 1
+	item.BackgroundImg = backgroundImg
+	item.ShareImg = shareImg
+	item.AdminId = sysUser.AdminId
+	item.ModifyDate = time.Now()
+	item.PublishDate = time.Now()
+	item.CreateTime = time.Now()
+
+	if askserieVideoId == 0 {
+		//新增
+		newId, err := cygx.AddCygxAskserieVideo(item, industrialManagementIds)
+		if err != nil {
+			br.Msg = "保存失败"
+			br.ErrMsg = "保存失败,Err:" + err.Error()
+			return
+		}
+		askserieVideoId = int(newId)
+	} else {
+		//更新
+		_, err := cygx.GetCygxAskserieVideoDetail(askserieVideoId)
+		if err != nil {
+			br.Msg = "详情不存在"
+			br.ErrMsg = "获取失败,Err:" + err.Error()
+			return
+		}
+		err = cygx.UpdateCygxAskserieVideo(item, industrialManagementIds)
+		if err != nil {
+			br.Msg = "保存失败"
+			br.ErrMsg = "保存失败,Err:" + err.Error()
+			return
+		}
+	}
+
+	go cygxService.UpdateAskserieVideoResourceData(askserieVideoId) //写入首页最新  cygx_resource_data 表
+	go elastic.EsAddAskserieVideo(askserieVideoId)                  // 写入es 综合搜索
+	br.Ret = 200
+	br.Success = true
+	br.IsAddLog = true
+	br.Msg = "操作成功"
+}
+
+// @Title 列表
+// @Description 列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   StartDate   query   string  false       "开始时间 ,列如2021-03-06 "
+// @Param   EndDate   query   string  false       "结束时间,列如2021-03-06 "
+// @Param   PublishStatus   query   int  true       "发布状态: -1-默认全部; 0-未发布; 1-已关注"
+// @Param   ChartPermissionId   query   string  false       "行业Id"
+// @Param   KeyWord   query   string  false       "搜索关键词"
+// @Param   SortType          query   string    false		"排序顺序:asc、desc"
+// @Success Ret=200 {object} cygx.GetCygxTacticsTimeLineResp
+// @router /askserie_video/list [get]
+func (this *AskserieVideoController) List() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	resp := new(cygx.GetCygxAskserieVideoRespListResp)
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	publishStatus, _ := this.GetInt("PublishStatus", -1)
+	startDate := this.GetString("StartDate")
+	endDate := this.GetString("EndDate")
+	chartPermissionId, _ := this.GetInt("ChartPermissionId")
+	keyWord := this.GetString("KeyWord")
+	keyWord = strings.Trim(keyWord, " ")
+	keyWord = strings.Replace(keyWord, "'", "", -1)
+	sortType := this.GetString("SortType")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	var condition string
+	var pars []interface{}
+	//发布状态查询
+	if publishStatus == 0 || publishStatus == 1 || publishStatus == 3 {
+		condition += ` AND art.publish_status = ? `
+		pars = append(pars, publishStatus)
+	}
+	//起始日期查询
+	if startDate != "" && endDate != "" {
+		condition += ` 	AND art.publish_date  BETWEEN ?   AND  ? `
+		pars = append(pars, startDate+" 00:00:00", endDate+" 23:59:59")
+	}
+	//行业查询
+	if chartPermissionId > 0 {
+		condition += ` 	AND art.chart_permission_id = ?`
+		pars = append(pars, chartPermissionId)
+	}
+	if keyWord != "" {
+		condition += ` AND ( video_name LIKE '%` + keyWord + `%' ) `
+	}
+	total, err := cygx.GetCygxAskserieVideoCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	var conditionOrder string
+	if sortType == "asc" || sortType == "desc" {
+		conditionOrder += ` ORDER BY art.video_counts   ` + sortType
+	} else {
+		conditionOrder += ` 	ORDER BY art.modify_date DESC  `
+	}
+	//condition += "	ORDER BY art.modify_date DESC  "
+	condition += conditionOrder
+	list, err := cygx.GetCygxAskserieVideoList(condition, pars, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	var askserieVideoIds []int
+	for _, v := range list {
+		askserieVideoIds = append(askserieVideoIds, v.AskserieVideoId)
+	}
+
+	mapLabel := cygxService.GetCygxAskserieVideoLabelMap(askserieVideoIds) // 标签
+	for _, v := range list {
+		v.IndustryName = mapLabel[v.AskserieVideoId]
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.List = list
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title  详情
+// @Description 获取详情接口
+// @Param   AskserieVideoId   query   int  true       "ID"
+// @Success Ret=200 {object} cygx.GetCygxProductInteriorDetailResp
+// @router /askserie_video/detail [get]
+func (this *AskserieVideoController) Detail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	AdminUser := this.SysUser
+	if AdminUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	resp := new(cygx.GetCygxAskserieVideoDetailResp)
+	askserieVideoId, _ := this.GetInt("AskserieVideoId")
+	if askserieVideoId < 1 {
+		br.Msg = "请输入详情ID"
+		return
+	}
+	detail, err := cygx.GetCygxAskserieVideoDetail(askserieVideoId)
+	if err != nil {
+		br.Msg = "详情不存在"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	//产业标签
+	industrialListMap := cygxService.GetCygxAskserieVideoLabelListMap([]int{askserieVideoId})
+	detail.ListIndustrial = industrialListMap[askserieVideoId]
+	resp.Detail = detail
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title  播放记录详情
+// @Description 播放记录详情接口
+// @Param   AskserieVideoId   query   int  true       "ID"
+// @Success Ret=200 {object} cygx.GetCygxProductInteriorDetailResp
+// @router /askserie_video/history_list [get]
+func (this *AskserieVideoController) HistoryList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	AdminUser := this.SysUser
+	if AdminUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	resp := new(cygx.CygxCygxAskserieVideoHistoryRecordListResp)
+	askserieVideoId, _ := this.GetInt("AskserieVideoId")
+	if askserieVideoId < 1 {
+		br.Msg = "请输入详情ID"
+		return
+	}
+	_, err := cygx.GetCygxAskserieVideoDetail(askserieVideoId)
+	if err != nil {
+		br.Msg = "详情不存在"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND askserie_video_id = ?  ORDER BY id DESC  `
+	pars = append(pars, askserieVideoId)
+	list, err := cygx.GetCygxAskserieVideoHistoryRecordList(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
+	for _, v := range list {
+		v.PlaySeconds = v.VideoDuration
+		v.RegisterPlatform = utils.CYGX_REGISTER_PLATFORM_MAP[v.RegisterPlatform]
+	}
+	resp.List = list
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title  留言记录详情
+// @Description 留言记录详情接口
+// @Param   AskserieVideoId   query   int  true       "ID"
+// @Param   IsExport   query   bool  false       "是否导出excel,默认是false"
+// @Success Ret=200 {object} cygx.GetCygxProductInteriorDetailResp
+// @router /askserie_video/collection_list [get]
+func (this *AskserieVideoController) CollectionList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	AdminUser := this.SysUser
+	if AdminUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	resp := new(cygx.CygxAskserieVideoCollectionListResp)
+	askserieVideoId, _ := this.GetInt("AskserieVideoId")
+	if askserieVideoId < 1 {
+		br.Msg = "请输入详情ID"
+		return
+	}
+	//是否导出报表
+	isExport, _ := this.GetBool("IsExport")
+	_, err := cygx.GetCygxAskserieVideoDetail(askserieVideoId)
+	if err != nil {
+		br.Msg = "详情不存在"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND askserie_video_id = ?  ORDER BY id DESC  `
+	pars = append(pars, askserieVideoId)
+	list, err := cygx.GetCygxAskserieVideoCollectionList(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	for _, v := range list {
+		v.RegisterPlatform = utils.CYGX_REGISTER_PLATFORM_MAP[v.RegisterPlatform]
+	}
+	resp.List = list
+	//导出excel
+	if isExport {
+		CollectionListExport(this, resp, br)
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// VoiceAndVideoCommentListExport 导出Excel
+func CollectionListExport(this *AskserieVideoController, resp *cygx.CygxAskserieVideoCollectionListResp, br *models.BaseResponse) {
+	//创建excel
+	dir, err := os.Executable()
+	exPath := filepath.Dir(dir)
+	downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
+	xlsxFile := xlsx.NewFile()
+	if err != nil {
+		br.Msg = "生成文件失败"
+		br.ErrMsg = "生成文件失败"
+		return
+	}
+	style := xlsx.NewStyle()
+	alignment := xlsx.Alignment{
+		Horizontal: "center",
+		Vertical:   "center",
+		WrapText:   true,
+	}
+	style.Alignment = alignment
+	style.ApplyAlignment = true
+	sheet, err := xlsxFile.AddSheet("阅读明细")
+	if err != nil {
+		br.Msg = "新增Sheet失败"
+		br.ErrMsg = "新增Sheet失败,Err:" + err.Error()
+		return
+	}
+	//标头
+	rowTitle := sheet.AddRow()
+	cellA := rowTitle.AddCell()
+	cellA.Value = "姓名"
+	cellB := rowTitle.AddCell()
+	cellB.Value = "公司名称"
+	cellC := rowTitle.AddCell()
+	cellC.Value = "留言"
+	cellD := rowTitle.AddCell()
+	cellD.Value = "提交时间"
+
+	for _, item := range resp.List {
+		row := sheet.AddRow()
+		cellA := row.AddCell()
+		cellA.Value = item.RealName
+		cellB := row.AddCell()
+		cellB.Value = item.CompanyName
+		cellC := row.AddCell()
+		cellC.Value = item.Content
+		cellD := row.AddCell()
+		cellD.Value = item.CreateTime
+	}
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		br.Msg = "保存文件失败"
+		br.ErrMsg = "保存文件失败"
+		return
+	}
+	downloadFileName := time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
+	this.Ctx.Output.Download(downLoadnFilePath, downloadFileName)
+	defer func() {
+		os.Remove(downLoadnFilePath)
+	}()
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "导出成功"
+}
+
+// @Title 发布/取消发布
+// @Description 发布/取消发布接口
+// @Param	request	body cygx.ProductInteriorIdReq true "type json string"
+// @Success 200 Ret=200 发布成功
+// @router /askserie_video/publishAndcancel [post]
+func (this *AskserieVideoController) PublishReport() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req cygx.AskserieVideoIdIdReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	askserieVideoId := req.AskserieVideoId
+	if askserieVideoId == 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,id不可为空"
+		return
+	}
+	detail, err := cygx.GetCygxAskserieVideoDetail(askserieVideoId)
+	if err != nil {
+		br.Msg = "详情不存在"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	var status int
+	if detail.PublishStatus != 1 {
+		status = 1
+	} else {
+		status = 3
+	}
+	err = cygx.EditCygxAskserieVideoStatus(status, askserieVideoId)
+	if err != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	go cygxService.UpdateAskserieVideoResourceData(askserieVideoId) //写入首页最新  cygx_resource_data 表
+	go elastic.EsAddAskserieVideo(askserieVideoId)                  // 写入es 综合搜索
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+}

+ 25 - 8
controllers/cygx/micro_roadshow.go

@@ -80,12 +80,12 @@ func (this *MicroRoadshowController) List() {
 
 	if startDate != "" {
 		condition += ` AND publish_date>=? `
-		pars = append(pars, startDate)
+		pars = append(pars, startDate+" 00:00:00")
 	}
 
 	if endDate != "" {
 		condition += ` AND publish_date<=? `
-		pars = append(pars, endDate)
+		pars = append(pars, endDate+" 23:59:59")
 	}
 
 	if chartPermissionId > 0 {
@@ -283,8 +283,9 @@ func (this *MicroRoadshowController) Add() {
 			go cygxService.SendWxMsgWithCygxMicroRoadshowVideo(req.VideoId)
 		}
 
-		go cygxService.UpdateResourceData(req.VideoId, "roadshow", "update", publishDate.Format(utils.FormatDateTime))
-		go elastic.AddComprehensiveRoadshow(req.VideoId) //Es添加微路演
+		//go cygxService.UpdateResourceData(req.VideoId, "roadshow", "update", publishDate.Format(utils.FormatDateTime))
+		go cygxService.UpdateMicroRoadshowResourceData(req.VideoId) //写入首页最新  cygx_resource_data 表
+		go elastic.AddComprehensiveRoadshow(req.VideoId)            //Es添加微路演
 		br.Ret = 200
 		br.Success = true
 		br.Msg = "编辑成功"
@@ -327,8 +328,9 @@ func (this *MicroRoadshowController) Add() {
 
 		if req.PublishOrSave == 1 {
 			go cygxService.SendWxMsgWithCygxMicroRoadshowVideo(int(newId))
-			go cygxService.UpdateResourceData(int(newId), "roadshow", "add", publishDate.Format(utils.FormatDateTime))
-			go elastic.AddComprehensiveRoadshow(req.VideoId) //Es添加微路演
+			//go cygxService.UpdateResourceData(int(newId), "roadshow", "add", publishDate.Format(utils.FormatDateTime))
+			go cygxService.UpdateMicroRoadshowResourceData(int(newId)) //写入首页最新  cygx_resource_data 表
+			go elastic.AddComprehensiveRoadshow(req.VideoId)           //Es添加微路演
 		}
 
 		br.Ret = 200
@@ -448,10 +450,12 @@ func (this *MicroRoadshowController) PublishCancel() {
 	br.Success = true
 	if publishOrCancle == 0 {
 		br.Msg = "取消发布成功"
-		go cygxService.UpdateResourceData(int(videoId), "roadshow", "delete", time.Now().Format(utils.FormatDateTime))
+		//go cygxService.UpdateResourceData(int(videoId), "roadshow", "delete", time.Now().Format(utils.FormatDateTime))
+		go cygxService.UpdateMicroRoadshowResourceData(int(videoId)) //写入首页最新  cygx_resource_data 表
 	} else {
 		go cygxService.SendWxMsgWithCygxMicroRoadshowVideo(videoId)
-		go cygxService.UpdateResourceData(int(videoId), "roadshow", "add", videoInfo.PublishDate.Format(utils.FormatDateTime))
+		//go cygxService.UpdateResourceData(int(videoId), "roadshow", "add", videoInfo.PublishDate.Format(utils.FormatDateTime))
+		go cygxService.UpdateMicroRoadshowResourceData(int(videoId)) //写入首页最新  cygx_resource_data 表
 		br.Msg = "发布成功"
 	}
 	go elastic.AddComprehensiveRoadshow(videoId) //Es添加微路演
@@ -514,6 +518,10 @@ func (this *MicroRoadshowController) Deatil() {
 		br.ErrMsg = "获取历史详情失败,Err:" + err.Error()
 		return
 	}
+
+	for _, v := range list {
+		v.RegisterPlatform = utils.CYGX_REGISTER_PLATFORM_MAP[v.RegisterPlatform]
+	}
 	//resp := new(cygx.MicroRoadshowVideoHistoryListResp)
 	//page := paging.GetPaging(currentIndex, pageSize, total)
 	//resp.List = list
@@ -686,6 +694,12 @@ func (this *MicroRoadshowController) VoiceDeatil() {
 		return
 	}
 	voiceId, _ := this.GetInt("VoiceId")
+	videoId, _ := this.GetInt("VideoId")
+
+	//参数ID做兼容
+	if voiceId == 0 {
+		voiceId = videoId
+	}
 
 	if voiceId <= 0 {
 		br.Msg = "参数错误"
@@ -705,6 +719,9 @@ func (this *MicroRoadshowController) VoiceDeatil() {
 		return
 	}
 
+	for _, v := range list {
+		v.RegisterPlatform = utils.CYGX_REGISTER_PLATFORM_MAP[v.RegisterPlatform]
+	}
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 0 - 1
controllers/cygx/report_article.go

@@ -349,7 +349,6 @@ func (this *ReportArticleController) ReportArticleList() {
 		list[k].ListIndustrial = mapIndustrialList[v.ArticleId]
 		list[k].ListSubject = mapSubjectList[v.ArticleId]
 	}
-	fmt.Println(mapCommment)
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp := new(cygx.GetReportArticleListRep)
 	resp.List = list

+ 65 - 0
models/cygx/activity_video.go

@@ -45,6 +45,7 @@ type CygxActivityVideoListResp struct {
 	VideoDuration        string `description:"视频时长"`
 	CommentNum           int    `description:"留言总数"`
 	VideoUrl             string `description:"视频地址"`
+	FileName             string `description:"文件类型名称"`
 }
 
 type CygxActivityVideoListRep struct {
@@ -96,6 +97,18 @@ func GetActivityVideoCount(condition string, pars []interface{}) (count int, err
 	return
 }
 
+// 获取数量
+func GetActivityVideoCountByActivityId(activityId int) (count int, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sqlCount := ` SELECT
+				COUNT( 1 ) AS count 
+			FROM
+   				JOIN cygx_activity_video
+			WHERE activity_id = ? `
+	err = o.Raw(sqlCount, activityId).QueryRow(&count)
+	return
+}
+
 // 列表
 func GetActivityVideoListAll(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityVideoListResp, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")
@@ -204,3 +217,55 @@ func Updatevideo_url(video_url string, video_id int) (err error) {
 	_, err = o.Raw(sql, video_url, video_id).Exec()
 	return
 }
+
+// 获取数量
+func GetActivityVoiceAndVideoList(condition, conditionVoice, conditionVideo, conditionOrder string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityVideoListResp, total int, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := ` 	
+		SELECT
+		art.activity_id,
+		art.activity_time,
+		art.activity_name,
+		art.activity_type_name,
+		art.chart_permission_name,
+		art.activity_time_text,
+		v.activity_voice_id as video_id,
+		v.voice_name as video_name,
+		v.voice_counts as video_counts,
+		v.comment_num as comment_num,
+		v.voice_play_seconds as  video_duration,
+		v.voice_url as  video_url
+	FROM
+		cygx_activity AS art
+		INNER JOIN cygx_activity_voice AS v ON v.activity_id = art.activity_id 
+	WHERE
+		1 = 1 ` + condition + conditionVoice
+
+	sql += `	UNION ALL`
+	sql += ` SELECT
+		art.activity_id,
+		art.activity_time,
+		art.activity_name,
+		art.activity_type_name,
+		art.chart_permission_name,
+		art.activity_time_text,
+		v.video_id,
+		v.video_name,
+		v.video_counts,
+		v.comment_num as comment_num,
+		v.video_duration,
+		v.video_url
+	FROM
+		cygx_activity AS art
+		INNER JOIN cygx_activity_video AS v ON v.activity_id = art.activity_id 
+	WHERE
+		1 = 1  ` + condition + conditionVideo + conditionOrder
+	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
+	err = o.Raw(totalSql, pars, pars).QueryRow(&total)
+	if err != nil {
+		return
+	}
+	sql += ` LIMIT ?,?`
+	_, err = o.Raw(sql, pars, pars, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 8 - 0
models/cygx/activity_voice.go

@@ -103,3 +103,11 @@ func DeleteCygxActivityVoice(activityId int) (err error) {
 	_, err = o.Raw(sql, activityId).Exec()
 	return
 }
+
+// 根据音频ID获取详情
+func GetCygxActivityVoiceReqDetailByActivityVoiceId(activityVoiceId int) (item *CygxActivityVoice, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT *  FROM cygx_activity_voice  WHERE activity_voice_id= ? `
+	err = o.Raw(sql, activityVoiceId).QueryRow(&item)
+	return
+}

+ 206 - 0
models/cygx/askserie_video.go

@@ -0,0 +1,206 @@
+package cygx
+
+import (
+	//"github.com/beego/beego/v2/client/orm"
+	//"github.com/rdlucklib/rdluck_tools/paging"
+	//"strconv"
+	//"strings"
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"strconv"
+	"strings"
+	"time"
+)
+
+type CygxAskserieVideo struct {
+	AskserieVideoId     int       `orm:"column(askserie_video_id);pk"description:"视频id"`
+	VideoName           string    `description:"视频标题"`
+	VideoUrl            string    `description:"视频地址"`
+	VideoDuration       string    `description:"视频时长"`
+	ChartPermissionId   int       `description:"行业ID"`
+	ChartPermissionName string    `description:"行业名称"`
+	PublishStatus       int       `description:"发布状态 1发布 0没有"`
+	VideoCounts         int       `description:"播放量"`
+	BackgroundImg       string    `description:"封面图片"`
+	ShareImg            string    `description:"分享图片"`
+	AdminId             int       `description:"管理员、销售ID"`
+	ModifyDate          time.Time `description:"更新时间"`
+	PublishDate         time.Time `description:"发布时间"`
+	CreateTime          time.Time `description:"创建时间"`
+}
+
+type AddAskserieVideoReq struct {
+	AskserieVideoId         int    `description:"askserie_video_id"`
+	VideoName               string `description:"视频标题"`
+	VideoUrl                string `description:"视频地址"`
+	VideoDuration           string `description:"视频时长"`
+	ChartPermissionId       int    `description:"行业ID"`
+	ChartPermissionName     string `description:"行业名称"`
+	IndustrialManagementIds string `description:"产业id 多个用 , 隔开"`
+	BackgroundImg           string `description:"封面图片"`
+	ShareImg                string `description:"分享图片"`
+}
+
+type CygxAskserieVideoResp struct {
+	AskserieVideoId     int    `orm:"column(askserie_video_id);pk"description:"视频id"`
+	VideoName           string `description:"视频标题"`
+	VideoUrl            string `description:"视频地址"`
+	VideoDuration       string `description:"视频时长"`
+	ChartPermissionId   int    `description:"行业ID"`
+	ChartPermissionName string `description:"行业名称"`
+	PublishStatus       int    `description:"发布状态 1发布 0没有"`
+	VideoCounts         int    `description:"播放量"`
+	CommentNum          int    `description:"留言总数"`
+	BackgroundImg       string `description:"封面图片"`
+	ShareImg            string `description:"分享图片"`
+	AdminId             int    `description:"管理员、销售ID"`
+	IndustryName        string `description:"产业名称"`
+	ModifyDate          string `description:"更新时间"`
+	PublishDate         string `description:"发布时间"`
+	CreateTime          string `description:"创建时间"`
+	ListIndustrial      []*IndustrialActivityGroupManagementRep
+}
+
+type GetCygxAskserieVideoDetailResp struct {
+	Detail *CygxAskserieVideoResp
+}
+
+// 通过ID获取详情
+func GetCygxAskserieVideoDetail(askserieVideoId int) (item *CygxAskserieVideoResp, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_askserie_video  WHERE askserie_video_id=? `
+	err = o.Raw(sql, askserieVideoId).QueryRow(&item)
+	return
+}
+
+// 添加
+func AddCygxAskserieVideo(item *CygxAskserieVideo, industrialManagementIds string) (newId int64, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	to, err := o.Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		if err != nil {
+			_ = to.Rollback()
+		} else {
+			_ = to.Commit()
+		}
+	}()
+	newId, err = to.Insert(item)
+	if err != nil {
+		return
+	}
+	//添加与产业的关联
+	//new(cygx.CygxIndustrialAskserieVideoGroupManagement),
+	industrialManagementIdList := strings.Split(industrialManagementIds, ",")
+	for _, v := range industrialManagementIdList {
+		itemIndustrialManagementGroup := new(CygxIndustrialAskserieVideoGroupManagement)
+		newIndustrialId, _ := strconv.Atoi(v)
+		if newIndustrialId == 0 {
+			continue
+		}
+		itemIndustrialManagementGroup.CreateTime = time.Now()
+		itemIndustrialManagementGroup.AskserieVideoId = int(newId)
+		itemIndustrialManagementGroup.IndustrialManagementId = newIndustrialId
+		_, err = to.Insert(itemIndustrialManagementGroup)
+		if err != nil {
+			return
+		}
+	}
+	return
+}
+
+// 修改
+func UpdateCygxAskserieVideo(item *CygxAskserieVideo, industrialManagementIds string) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	to, err := o.Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		if err != nil {
+			_ = to.Rollback()
+		} else {
+			_ = to.Commit()
+		}
+	}()
+
+	updateParams := make(map[string]interface{})
+	updateParams["VideoName"] = item.VideoName
+	updateParams["VideoUrl"] = item.VideoUrl
+	updateParams["VideoDuration"] = item.VideoDuration
+	updateParams["ChartPermissionId"] = item.ChartPermissionId
+	updateParams["ChartPermissionName"] = item.ChartPermissionName
+	updateParams["BackgroundImg"] = item.BackgroundImg
+	updateParams["ShareImg"] = item.ShareImg
+	updateParams["ModifyDate"] = time.Now()
+	ptrStructOrTableName := "cygx_askserie_video"
+	whereParam := map[string]interface{}{"askserie_video_id": item.AskserieVideoId}
+	qs := to.QueryTable(ptrStructOrTableName)
+	for expr, exprV := range whereParam {
+		qs = qs.Filter(expr, exprV)
+	}
+	_, err = qs.Update(updateParams)
+	if err != nil {
+		return
+	}
+
+	//删除关联产业 (避免截断表时产生的脏数据,故不用update而是先删除再增加)
+	sql := `	DELETE FROM cygx_industrial_askserie_video_group_management WHERE askserie_video_id = ?`
+	_, err = to.Raw(sql, item.AskserieVideoId).Exec()
+	if err != nil {
+		return
+	}
+
+	industrialManagementIdList := strings.Split(industrialManagementIds, ",")
+	for _, v := range industrialManagementIdList {
+		itemIndustrialManagementGroup := new(CygxIndustrialAskserieVideoGroupManagement)
+		newIndustrialId, _ := strconv.Atoi(v)
+		itemIndustrialManagementGroup.CreateTime = time.Now()
+		itemIndustrialManagementGroup.AskserieVideoId = item.AskserieVideoId
+		itemIndustrialManagementGroup.IndustrialManagementId = newIndustrialId
+		_, err = to.Insert(itemIndustrialManagementGroup)
+		if err != nil {
+			return
+		}
+	}
+
+	return
+}
+
+// 获取数量
+func GetCygxAskserieVideoCount(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_askserie_video as art WHERE 1= 1  `
+	if condition != "" {
+		sqlCount += condition
+	}
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+// 列表
+func GetCygxAskserieVideoList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxAskserieVideoResp, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_askserie_video as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+type GetCygxAskserieVideoRespListResp struct {
+	Paging *paging.PagingItem `description:"分页数据"`
+	List   []*CygxAskserieVideoResp
+}
+
+// 修改是否展示
+func EditCygxAskserieVideoStatus(status, askserieVideoId int) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `UPDATE cygx_askserie_video SET publish_status=?,publish_date = NOW() , modify_date=NOW()   WHERE askserie_video_id=? `
+	_, err = o.Raw(sql, status, askserieVideoId).Exec()
+	return
+}

+ 74 - 0
models/cygx/askserie_video_history_record.go

@@ -0,0 +1,74 @@
+package cygx
+
+import "github.com/beego/beego/v2/client/orm"
+
+type CygxAskserieVideoHistoryRecordResp struct {
+	Id               int    `orm:"column(id);pk"`
+	AskserieVideoId  int    `description:"askserie_video_id"`
+	UserId           int    `description:"用户ID"`
+	CreateTime       string `description:"创建时间"`
+	Mobile           string `description:"手机号"`
+	Email            string `description:"邮箱"`
+	CompanyId        int    `description:"公司id"`
+	CompanyName      string `description:"公司名称"`
+	RealName         string `description:"用户实际名称"`
+	SellerName       string `description:"所属销售"`
+	RegisterPlatform string `description:"来源 1小程序,2:网页"`
+	ModifyTime       string `description:"更新时间"`
+	VideoDuration    string `description:"视频时长"`
+	PlaySeconds      string `description:"播放时间 单位s"`
+}
+
+type AskserieVideoIdIdReq struct {
+	AskserieVideoId int `description:"ID"`
+}
+
+// Pv数据列表
+type CygxCygxAskserieVideoHistoryRecordListResp struct {
+	//Paging *paging.PagingItem `description:"分页数据"`
+	List []*CygxAskserieVideoHistoryRecordResp
+}
+
+// 列表
+func GetCygxAskserieVideoHistoryRecordList(condition string, pars []interface{}) (items []*CygxAskserieVideoHistoryRecordResp, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_askserie_video_history_record as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+type CygxAskserieVideoCollectionResp struct {
+	Id               int    `orm:"column(id);pk"`
+	AskserieVideoId  int    `description:"askserie_video_id"`
+	UserId           int    `description:"用户ID"`
+	CreateTime       string `description:"创建时间"`
+	Mobile           string `description:"手机号"`
+	Email            string `description:"邮箱"`
+	CompanyId        int    `description:"公司id"`
+	CompanyName      string `description:"公司名称"`
+	RealName         string `description:"用户实际名称"`
+	SellerName       string `description:"所属销售"`
+	RegisterPlatform string `description:"来源 1小程序,2:网页"`
+	ModifyTime       string `description:"更新时间"`
+	Content          string `description:"留言"`
+}
+
+// Pv数据列表
+type CygxAskserieVideoCollectionListResp struct {
+	//Paging *paging.PagingItem `description:"分页数据"`
+	List []*CygxAskserieVideoCollectionResp
+}
+
+// 列表
+func GetCygxAskserieVideoCollectionList(condition string, pars []interface{}) (items []*CygxAskserieVideoCollectionResp, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_askserie_video_collection as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 41 - 0
models/cygx/industrial_askserie_video_group_management.go

@@ -0,0 +1,41 @@
+package cygx
+
+import (
+	//"github.com/beego/beego/v2/client/orm"
+	"github.com/beego/beego/v2/client/orm"
+	"hongze/hz_crm_api/utils"
+	"time"
+)
+
+// 首页资源表与产业的关系
+type CygxIndustrialAskserieVideoGroupManagement struct {
+	Id                     int       `orm:"column(id);pk" description:"主键ID"`
+	AskserieVideoId        int       `description:"askserie_video_id"`
+	IndustrialManagementId int       `description:"cygx_industrial_management表的主键ID"`
+	CreateTime             time.Time `description:"创建时间"`
+}
+
+type IndustrialAskserieVideoManagementRep struct {
+	AskserieVideoId        int    `description:"askserie_video_id"`
+	IndustrialManagementId int    `description:"cygx_industrial_management表的主键ID"`
+	IndustryName           string `description:"产业名称"`
+	ChartPermissionId      int    `description:"权限id"`
+	PermissionName         string `description:"行业名称"`
+}
+
+// 列表GetCygxIndustrialAskserieVideoGroupManagementList
+func GetCygxIndustrialAskserieVideoGroupManagementList(askserieVideoIds []int) (items []*IndustrialAskserieVideoManagementRep, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT
+			am.askserie_video_id,
+			m.chart_permission_id,
+			m.industrial_management_id,
+			m.industry_name 
+			FROM
+			cygx_industrial_askserie_video_group_management AS am
+			INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = am.industrial_management_id
+			WHERE
+			am.askserie_video_id IN (` + utils.GetOrmInReplace(len(askserieVideoIds)) + `)`
+	_, err = o.Raw(sql, askserieVideoIds).QueryRows(&items)
+	return
+}

+ 31 - 25
models/cygx/micro_roadshow.go

@@ -132,6 +132,10 @@ func EditVideo(item *CygxMicroRoadshowVideo) (err error) {
 }
 
 func PublishVideoCancel(videoId, publishOrCancle int) (err error) {
+
+	if publishOrCancle == 0 {
+		publishOrCancle = 3 // 取消发布状态
+	}
 	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := `UPDATE cygx_micro_roadshow_video SET publish_status=?,modify_date=NOW() WHERE video_id =?`
 	_, err = o.Raw(sql, publishOrCancle, videoId).Exec()
@@ -139,18 +143,19 @@ func PublishVideoCancel(videoId, publishOrCancle int) (err error) {
 }
 
 type CygxMicroRoadshowVideoHistory struct {
-	Id          int       `orm:"column(id);pk"description:"微路演视频浏览记录表id"`
-	VideoId     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  string    `description:"视频创建时间"`
-	ModifyTime  time.Time `description:"视频修改时间"`
+	Id               int       `orm:"column(id);pk"description:"微路演视频浏览记录表id"`
+	VideoId          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       string    `description:"视频创建时间"`
+	ModifyTime       time.Time `description:"视频修改时间"`
+	RegisterPlatform string    `description:"来源 1小程序,2:网页"`
 }
 
 func GetMicroRoadshowVideoHistoryByIdPage(condition string, pars []interface{}, startSize, pageSize int) (item []*CygxMicroRoadshowVideoHistory, err error) {
@@ -312,19 +317,20 @@ type MicroRoadshowVideoHistoryListResp struct {
 }
 
 type CygxMicroRoadshowVoiceHistory 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  string    `description:"视频创建时间"`
-	ModifyTime  time.Time `description:"视频修改时间"`
+	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       string    `description:"视频创建时间"`
+	ModifyTime       time.Time `description:"视频修改时间"`
+	RegisterPlatform string    `description:"来源 1小程序,2:网页"`
 }
 
 func GetMicroRoadshowVoiceHistoryById(condition string, pars []interface{}) (item []*CygxMicroRoadshowVoiceHistory, err error) {

+ 1 - 0
models/cygx/report_article.go

@@ -479,6 +479,7 @@ type ArticleDetail struct {
 	IsClass              int    `description:"是否归类,1是,0否"`
 	IsSummary            int    `description:"是否是纪要库,1是,0否"`
 	CategoryId           int    `description:"分类ID"`
+	CategoryIdTwo        int    `description:"分类ID"`
 	FileLink             string `description:"下载预览链接"`
 	ReportType           int    `description:"报告类型,2产业报告,1行业报告"`
 	TypeName             string `description:"策略平台类型字段名称"`

+ 8 - 0
models/cygx/report_mapping_celue.go

@@ -45,6 +45,14 @@ func GetCygxReportMappingCelueMaxDetail() (item *CygxReportMappingCelue, err err
 	return
 }
 
+// 通过 categoryId 获取详情
+func GetCygxReportMappingCelueMaxDetailByCategoryId(categoryId int) (item *CygxReportMappingCelue, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT  * FROM cygx_report_mapping_celue  WHERE  category_id = ?  LIMIT 1 `
+	err = o.Raw(sql, categoryId).QueryRow(&item)
+	return
+}
+
 // 列表
 func GetCygxReportMappingList(condition string, pars []interface{}) (items []*CygxReportMappingCelueResp, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")

+ 30 - 10
models/cygx/resource_data.go

@@ -6,21 +6,22 @@ import (
 )
 
 type CygxResourceData struct {
-	Id          int       `orm:"column(id);pk"`
-	SourceId    int       `description:"资源ID"`
-	Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
-	Title       string    `description:"标题"`
-	Annotation  string    `description:"核心观点"`
-	CreateTime  time.Time `description:"创建时间"`
-	PublishDate string    `description:"发布时间"`
-	Abstract    string    `description:"摘要"`
-	SearchTag   string    `description:"搜索标签"`
+	Id                int       `orm:"column(id);pk"`
+	SourceId          int       `description:"资源ID"`
+	Source            string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+	Title             string    `description:"标题"`
+	Annotation        string    `description:"核心观点"`
+	CreateTime        time.Time `description:"创建时间"`
+	PublishDate       string    `description:"发布时间"`
+	Abstract          string    `description:"摘要"`
+	SearchTag         string    `description:"搜索标签"`
+	ChartPermissionId int       `description:"行业id"`
 }
 
 // 根据资源类型获取列表
 func GetCygxResourceDataListBysource(source string) (items []*CygxResourceData, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")
-	sql := `SELECT * FROM cygx_resource_data as art WHERE 1= 1  AND  source = ? `
+	sql := `SELECT * FROM cygx_resource_data as art WHERE 1= 1  AND  source = ?  AND chart_permission_id = 0   `
 	_, err = o.Raw(sql, source).QueryRows(&items)
 	return
 }
@@ -54,6 +55,25 @@ func UpdateResourceDataByItem(item *CygxResourceData) (err error) {
 	updateParams := make(map[string]interface{})
 	updateParams["PublishDate"] = item.PublishDate
 	updateParams["SearchTag"] = item.SearchTag
+	updateParams["ChartPermissionId"] = item.ChartPermissionId
+	ptrStructOrTableName := "cygx_resource_data"
+	whereParam := map[string]interface{}{"source_id": item.SourceId, "source": item.Source}
+	qs := o.QueryTable(ptrStructOrTableName)
+	for expr, exprV := range whereParam {
+		qs = qs.Filter(expr, exprV)
+	}
+	_, err = qs.Update(updateParams)
+	if err != nil {
+		return
+	}
+	return
+}
+
+// 修改
+func UpdateChartPermissionIdResourceDataByItem(item *CygxResourceData) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	updateParams := make(map[string]interface{})
+	updateParams["ChartPermissionId"] = item.ChartPermissionId
 	ptrStructOrTableName := "cygx_resource_data"
 	whereParam := map[string]interface{}{"source_id": item.SourceId, "source": item.Source}
 	qs := o.QueryTable(ptrStructOrTableName)

+ 2 - 0
models/db.go

@@ -458,6 +458,8 @@ func initCygx() {
 		new(cygx.CygxAllocationCompanyContractPermissionLog),
 		new(cygx.CygxQuestionnaire),
 		new(cygx.CygxQuestionnaireTheme),
+		new(cygx.CygxAskserieVideo),
+		new(cygx.CygxIndustrialAskserieVideoGroupManagement),
 	)
 }
 

+ 72 - 0
routers/commentsRouter.go

@@ -1258,6 +1258,24 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ActivityVideoCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ActivityVideoCoAntroller"],
+        beego.ControllerComments{
+            Method: "VoiceAndVideoCommentList",
+            Router: `/activity_voice_and_video/commentList`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ActivityVideoCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ActivityVideoCoAntroller"],
+        beego.ControllerComments{
+            Method: "ActivityVoiceAndVideoList",
+            Router: `/activity_voice_and_video/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AdviceController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AdviceController"],
         beego.ControllerComments{
             Method: "List",
@@ -1285,6 +1303,60 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"],
+        beego.ControllerComments{
+            Method: "CollectionList",
+            Router: `/askserie_video/collection_list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"],
+        beego.ControllerComments{
+            Method: "Detail",
+            Router: `/askserie_video/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"],
+        beego.ControllerComments{
+            Method: "HistoryList",
+            Router: `/askserie_video/history_list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"],
+        beego.ControllerComments{
+            Method: "List",
+            Router: `/askserie_video/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"],
+        beego.ControllerComments{
+            Method: "PreserveAndPublish",
+            Router: `/askserie_video/preserveAndEdit`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:AskserieVideoController"],
+        beego.ControllerComments{
+            Method: "PublishReport",
+            Router: `/askserie_video/publishAndcancel`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:BannerCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:BannerCoAntroller"],
         beego.ControllerComments{
             Method: "PreserveAndPublish",

+ 1 - 0
routers/router.go

@@ -155,6 +155,7 @@ func init() {
 				&cygx.YanxuanSpecialController{},
 				&cygx.ContractAllocationController{},
 				&cygx.QuestionnaireController{},
+				&cygx.AskserieVideoController{},
 			),
 		),
 		web.NSNamespace("/advisory",

+ 10 - 4
services/cygx/activity_ocr.go

@@ -182,7 +182,8 @@ func UpdateActivityVideoAndVoice(activityInfo *cygx.ActivityDetail, itemVoice *c
 				err = errors.New("GetCygxActivityVoiceCount" + e.Error())
 				return
 			}
-			go UpdateResourceData(int(newId), utils.CYGX_OBJ_ACTIVITYVOICE, "add", activityInfo.ActivityTime) // 把活动音频的数据添加到 cygx_resource_data 表
+			go UpdateActivityVoiceResourceData(int(newId)) //写入首页最新  cygx_resource_data 表
+			//go UpdateResourceData(int(newId), utils.CYGX_OBJ_ACTIVITYVOICE, "add", activityInfo.ActivityTime) // 把活动音频的数据添加到 cygx_resource_data 表
 
 			go SendWxMsgWithUpdateActivityVideoAndVoice(activityId, itemVoice.VoiceName) //  已结束的活动上传音频或视频后给已关注这个活动关联的产业的正式、试用 客户发送模板信息
 		} else {
@@ -214,7 +215,8 @@ func UpdateActivityVideoAndVoice(activityInfo *cygx.ActivityDetail, itemVoice *c
 				err = errors.New("AddCygxActivityVideo" + e.Error())
 				return
 			}
-			go UpdateResourceData(int(newId), utils.CYGX_OBJ_ACTIVITYVIDEO, "add", activityInfo.ActivityTime) // 把活动视频的数据添加到 cygx_resource_data 表
+			go UpdateActivityVideoResourceData(int(newId)) //写入首页最新  cygx_resource_data 表
+			//go UpdateResourceData(int(newId), utils.CYGX_OBJ_ACTIVITYVIDEO, "add", activityInfo.ActivityTime) // 把活动视频的数据添加到 cygx_resource_data 表
 
 			go SendWxMsgWithUpdateActivityVideoAndVoice(activityId, itemVideo.VideoName) //  已结束的活动上传音频或视频后给已关注这个活动关联的产业的正式、试用 客户发送模板信息
 		} else {
@@ -239,7 +241,9 @@ func UpdateActivityVideoAndVoice(activityInfo *cygx.ActivityDetail, itemVoice *c
 				err = errors.New("DeleteCygxActivityVoice" + e.Error())
 				return
 			}
-			go UpdateResourceData(voiceDetail.ActivityVoiceId, utils.CYGX_OBJ_ACTIVITYVOICE, "delete", time.Now().Format(utils.FormatDateTime)) // 把活动音频在 cygx_resource_data 表中删除
+
+			go UpdateActivityVoiceResourceData(voiceDetail.ActivityVoiceId) //写入首页最新  cygx_resource_data 表
+			//go UpdateResourceData(voiceDetail.ActivityVoiceId, utils.CYGX_OBJ_ACTIVITYVOICE, "delete", time.Now().Format(utils.FormatDateTime)) // 把活动音频在 cygx_resource_data 表中删除
 		}
 
 		//删除原有的视频数据
@@ -254,7 +258,9 @@ func UpdateActivityVideoAndVoice(activityInfo *cygx.ActivityDetail, itemVoice *c
 				err = errors.New("DeleteCygxActivityVideo" + e.Error())
 				return
 			}
-			go UpdateResourceData(videoDetail.VideoId, utils.CYGX_OBJ_ACTIVITYVIDEO, "delete", time.Now().Format(utils.FormatDateTime)) // 把活动视频在 cygx_resource_data 表中删除
+
+			go UpdateActivityVideoResourceData(videoDetail.VideoId) //写入首页最新  cygx_resource_data 表
+			//go UpdateResourceData(videoDetail.VideoId, utils.CYGX_OBJ_ACTIVITYVIDEO, "delete", time.Now().Format(utils.FormatDateTime)) // 把活动视频在 cygx_resource_data 表中删除
 		}
 	}
 	return

+ 136 - 0
services/cygx/askserie_video.go

@@ -0,0 +1,136 @@
+package cygx
+
+import (
+	"errors"
+	"fmt"
+	"hongze/hz_crm_api/models/cygx"
+	"hongze/hz_crm_api/services/alarm_msg"
+	"hongze/hz_crm_api/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// 获取问答系列产业列表
+func GetCygxAskserieVideoLabelListMap(askserieVideoIds []int) (mapResp map[int][]*cygx.IndustrialActivityGroupManagementRep) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go alarm_msg.SendAlarmMsg("获取产品内测的阅读数据,信息失败,GetCygxAskserieVideoLabelListMap Err:"+err.Error(), 3)
+		}
+	}()
+	lenArr := len(askserieVideoIds)
+	if lenArr == 0 {
+		return
+	}
+	industrialList, e := cygx.GetCygxIndustrialAskserieVideoGroupManagementList(askserieVideoIds)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("获取详情失败 GetCygxIndustrialAskserieVideoGroupManagementList Err" + e.Error())
+		return
+	}
+	mapResp = make(map[int][]*cygx.IndustrialActivityGroupManagementRep, 0)
+	for _, v := range industrialList {
+		item := new(cygx.IndustrialActivityGroupManagementRep)
+		item.IndustryName = v.IndustryName
+		item.IndustrialManagementId = v.IndustrialManagementId
+		item.ChartPermissionId = v.ChartPermissionId
+		mapResp[v.AskserieVideoId] = append(mapResp[v.AskserieVideoId], item)
+	}
+	return
+}
+
+// 获取问答系列产业列表
+func GetCygxAskserieVideoLabelMap(askserieVideoIds []int) (mapResp map[int]string) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go alarm_msg.SendAlarmMsg("获取产品内测的阅读数据,信息失败,GetCygxAskserieVideoLabelListMap Err:"+err.Error(), 3)
+		}
+	}()
+	lenArr := len(askserieVideoIds)
+	if lenArr == 0 {
+		return
+	}
+	industrialList, e := cygx.GetCygxIndustrialAskserieVideoGroupManagementList(askserieVideoIds)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("获取详情失败 GetCygxIndustrialAskserieVideoGroupManagementList Err" + e.Error())
+		return
+	}
+	mapIndustryName := make(map[int][]string)
+	mapResp = make(map[int]string, 0)
+	for _, v := range industrialList {
+		mapIndustryName[v.AskserieVideoId] = append(mapIndustryName[v.AskserieVideoId], v.IndustryName)
+	}
+
+	for k, v := range mapIndustryName {
+		mapResp[k] = strings.Join(v, ",")
+	}
+	return
+}
+
+//func init() {
+//	UpdateAskserieVideoResourceData(75)
+//}
+
+func init12() {
+	var conditionupload string
+	var pars []interface{}
+	conditionupload = " AND  voice_name LIKE '%科技问答%' "
+	listVoice, err := cygx.GetActivityVoiceList(conditionupload, pars)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		fmt.Println(err)
+		return
+	}
+
+	for _, v := range listVoice {
+		activityId := v.ActivityId
+		var industrialManagementIds []string
+		industrialList, err := cygx.GetIndustrialActivityGroupManagementList(activityId, 1)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			fmt.Println(v.ActivityId)
+			fmt.Println(err)
+			return
+		}
+		for _, vi := range industrialList {
+			industrialManagementIds = append(industrialManagementIds, strconv.Itoa(vi.IndustrialManagementId))
+		}
+
+		activityInfo, err := cygx.GetAddActivityInfoById(activityId)
+		if err != nil {
+			fmt.Println(v.ActivityId)
+			fmt.Println(err)
+			return
+		}
+		if activityInfo != nil {
+
+			item := new(cygx.CygxAskserieVideo)
+			//item.AskserieVideoId = askserieVideoId
+			item.VideoName = v.VoiceName
+			item.VideoUrl = v.VoiceUrl
+			item.VideoDuration = v.VoicePlaySeconds
+			item.ChartPermissionId = activityInfo.ChartPermissionId
+			item.ChartPermissionName = activityInfo.ChartPermissionName
+			item.PublishStatus = 1
+			item.BackgroundImg = v.BackgroundImg
+			item.ShareImg = v.ShareImg
+			//item.AdminId = sysUser.AdminId
+			item.ModifyDate = time.Now()
+			item.PublishDate = utils.StrTimeToTime(activityInfo.ActivityTime)
+			item.CreateTime = time.Now()
+
+			fmt.Println(item.VideoDuration, "VideoDuration")
+			fmt.Println(item.ShareImg, "ShareImg")
+			fmt.Println(item.PublishDate, "PublishDate")
+			//fmt.Println(item, strings.Join(industrialManagementIds, ","))
+
+			newId, err := cygx.AddCygxAskserieVideo(item, strings.Join(industrialManagementIds, ","))
+			fmt.Println(newId)
+			if err != nil {
+				fmt.Println(err)
+				return
+			}
+		}
+	}
+}

+ 416 - 15
services/cygx/resource_data.go

@@ -26,7 +26,7 @@ import (
 //roadshow
 
 //func init() {
-//	UpdateMeetingreviewchaptResourceData(141)
+//	UpdateMicroRoadshowResourceData(1)
 //}
 
 // 更新活动
@@ -81,6 +81,7 @@ func UpdateActivityResourceData(sourceId int) {
 		item.Source = source
 		//分析师电话会(C类)
 		item.SearchTag = detail.ActivityTypeName
+		item.ChartPermissionId = detail.ChartPermissionId
 		item.PublishDate = publishDate
 		item.CreateTime = time.Now()
 		if totalData == 0 {
@@ -167,6 +168,11 @@ func UpdateActivitySpecialResourceData(sourceId int) {
 		err = errors.New("GetCygxReportSelection, Err: " + e.Error())
 		return
 	}
+	activityInfo, e := cygx.GetAddActivityInfoSpecialById(sourceId)
+	if e != nil {
+		err = errors.New("GetAddActivityInfoSpecialById, Err: " + e.Error())
+		return
+	}
 	//如果取消发布了就做删除处理
 	if total == 0 {
 		e = cygx.DeleteResourceData(sourceId, source)
@@ -195,6 +201,7 @@ func UpdateActivitySpecialResourceData(sourceId int) {
 		//分析师电话会(C类)
 		item.SearchTag = ""
 		item.PublishDate = publishDate
+		item.ChartPermissionId = activityInfo.ChartPermissionId
 		item.CreateTime = time.Now()
 		if totalData == 0 {
 			newId, e := cygx.AddCygxResourceData(item)
@@ -304,14 +311,22 @@ func UpdateArticleResourceData(sourceId int) {
 			err = errors.New("GetCygxReportSelectionInfoById, Err: " + e.Error())
 			return
 		}
+
 		var resourceDataId int
 		publishDate := time.Now().Format(utils.FormatDateTime)
 		item := new(cygx.CygxResourceData)
 		if detail.ArticleTypeId > 0 {
 			item.SearchTag = detail.ArticleTypeName // 研选类型名称
+			item.ChartPermissionId = utils.CHART_PERMISSION_ID_YANXUAN
 		} else {
 			item.SearchTag = detail.MatchTypeName
+			//获取文章分类详情
+			detailCategory, _ := cygx.GetCygxReportMappingCelueMaxDetailByCategoryId(detail.CategoryId)
+			if detailCategory != nil {
+				item.ChartPermissionId = detailCategory.ChartPermissionId
+			}
 		}
+
 		item.SourceId = sourceId
 		item.Source = source
 		item.PublishDate = publishDate
@@ -434,6 +449,7 @@ func UpdateProductInteriorResourceData(sourceId int) {
 		item.Source = source
 		item.SearchTag = mapMatchTypeName[detail.MatchTypeId]
 		item.PublishDate = publishDate
+		item.ChartPermissionId = detail.ChartPermissionId
 		item.CreateTime = time.Now()
 		if totalData == 0 {
 			newId, e := cygx.AddCygxResourceData(item)
@@ -548,6 +564,7 @@ func UpdateMeetingreviewchaptResourceData(sourceId int) {
 		item.Source = source
 		item.SearchTag = "晨会精华"
 		item.PublishDate = publishDate
+		item.ChartPermissionId = detail.ChartPermissionId
 		item.CreateTime = time.Now()
 		if totalData == 0 {
 			newId, e := cygx.AddCygxResourceData(item)
@@ -800,7 +817,282 @@ func UpdateMinutesSummaryResourceData(sourceId int) {
 	return
 }
 
-func init1123232() {
+// 更新活动音频
+func UpdateActivityVoiceResourceData(sourceId int) {
+	time.Sleep(1 * time.Second) // 添加1秒的延迟
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println("err:", err)
+			go alarm_msg.SendAlarmMsg("更新更新活动音频 失败,UpdateActivityVoiceResourceData Err:"+err.Error()+"资源ID"+strconv.Itoa(sourceId), 3)
+		}
+	}()
+	var source = utils.CYGX_OBJ_ACTIVITYVOICE
+
+	var condition string
+	var pars []interface{}
+	condition = ` AND activity_voice_id = ? `
+	pars = append(pars, sourceId)
+	total, e := cygx.GetCygxActivityVoiceCount(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxResearchSummary, Err: " + e.Error())
+		return
+	}
+	//如果取消发布了就做删除处理
+	if total == 0 {
+		e = cygx.DeleteResourceData(sourceId, source)
+		if e != nil {
+			err = errors.New("DeleteResourceData, Err: " + e.Error())
+			return
+		}
+	} else {
+		//获取音频详情
+		voiceDetail, e := cygx.GetCygxActivityVoiceReqDetailByActivityVoiceId(sourceId)
+		if e != nil {
+			err = errors.New("GetCygxActivityVoiceReqDetail" + e.Error())
+			return
+		}
+		activityId := voiceDetail.ActivityId
+		//获取活动详情
+		activityInfo, e := cygx.GetAddActivityInfoById(activityId)
+		if e != nil {
+			err = errors.New("GetAddActivityInfoById, Err: " + e.Error())
+			return
+		}
+		//判断是否存在,如果不存在就新增,存在就更新
+		totalData, e := cygx.GetCygxReportSelectionBySourceAndId(sourceId, source)
+		if e != nil {
+			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
+			return
+		}
+		publishDate := time.Now().Format(utils.FormatDateTime)
+		item := new(cygx.CygxResourceData)
+		item.SourceId = sourceId
+		item.Source = source
+		item.SearchTag = ""
+		item.PublishDate = publishDate
+		item.ChartPermissionId = activityInfo.ChartPermissionId
+		item.CreateTime = utils.StrDateToDate(activityInfo.ActivityTime)
+		if totalData == 0 {
+			_, e := cygx.AddCygxResourceData(item)
+			if e != nil {
+				err = errors.New("AddCygxResourceData, Err: " + e.Error())
+				return
+			}
+		} else {
+			e = cygx.UpdateResourceDataByItem(item)
+			if e != nil {
+				err = errors.New("UpdateResourceDataByItem, Err: " + e.Error())
+				return
+			}
+		}
+	}
+	return
+}
+
+// 更新活动视频
+func UpdateActivityVideoResourceData(sourceId int) {
+	time.Sleep(1 * time.Second) // 添加1秒的延迟
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println("err:", err)
+			go alarm_msg.SendAlarmMsg("更新更新活动视频 失败,UpdateActivityVideoResourceData Err:"+err.Error()+"资源ID"+strconv.Itoa(sourceId), 3)
+		}
+	}()
+	var source = utils.CYGX_OBJ_ACTIVITYVIDEO
+	var condition string
+	var pars []interface{}
+	condition = ` AND v.video_id = ? `
+	pars = append(pars, sourceId)
+	total, e := cygx.GetActivityVideoCount(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxResearchSummary, Err: " + e.Error())
+		return
+	}
+	//如果取消发布了就做删除处理
+	if total == 0 {
+		e = cygx.DeleteResourceData(sourceId, source)
+		if e != nil {
+			err = errors.New("DeleteResourceData, Err: " + e.Error())
+			return
+		}
+	} else {
+		videoDetail, e := cygx.GetCygxActivityVideoReqDetailByVideoId(sourceId)
+		if e != nil {
+			err = errors.New("GetCygxActivityVoiceReqDetail" + e.Error())
+			return
+		}
+		activityId := videoDetail.ActivityId
+
+		activityInfo, e := cygx.GetAddActivityInfoById(activityId)
+		if e != nil {
+			err = errors.New("GetAddActivityInfoById, Err: " + e.Error())
+			return
+		}
+		//判断是否存在,如果不存在就新增,存在就更新
+		totalData, e := cygx.GetCygxReportSelectionBySourceAndId(sourceId, source)
+		if e != nil {
+			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
+			return
+		}
+		publishDate := time.Now().Format(utils.FormatDateTime)
+		item := new(cygx.CygxResourceData)
+		item.SourceId = sourceId
+		item.Source = source
+		item.SearchTag = ""
+		item.PublishDate = publishDate
+		item.ChartPermissionId = activityInfo.ChartPermissionId
+		item.CreateTime = utils.StrDateToDate(activityInfo.ActivityTime)
+		if totalData == 0 {
+			_, e := cygx.AddCygxResourceData(item)
+			if e != nil {
+				err = errors.New("AddCygxResourceData, Err: " + e.Error())
+				return
+			}
+		} else {
+			e = cygx.UpdateResourceDataByItem(item)
+			if e != nil {
+				err = errors.New("UpdateResourceDataByItem, Err: " + e.Error())
+				return
+			}
+		}
+	}
+	return
+}
+
+// 更新产业视频
+func UpdateMicroRoadshowResourceData(sourceId int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println("err:", err)
+			go alarm_msg.SendAlarmMsg("更新产业视频 失败,UpdateMicroRoadshowResourceData Err:"+err.Error()+"资源ID"+strconv.Itoa(sourceId), 3)
+		}
+	}()
+	var source = utils.CYGX_OBJ_ROADSHOW
+	var condition string
+	var pars []interface{}
+	condition = ` AND publish_status = 1  AND video_id = ? `
+	pars = append(pars, sourceId)
+	total, e := cygx.GetMicroRoadshowVideoListCount(condition, pars)
+	if e != nil {
+		err = errors.New("GetMicroRoadshowVideoListCount, Err: " + e.Error())
+		return
+	}
+	//如果取消发布了就做删除处理
+	if total == 0 {
+		e = cygx.DeleteResourceData(sourceId, source)
+		if e != nil {
+			err = errors.New("DeleteResourceData, Err: " + e.Error())
+			return
+		}
+	} else {
+		//判断是否存在,如果不存在就新增,存在就更新
+		totalData, e := cygx.GetCygxReportSelectionBySourceAndId(sourceId, source)
+		if e != nil {
+			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
+			return
+		}
+		detail, e := cygx.GetMicroRoadshowVideoByVideoId(sourceId)
+		if e != nil {
+			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
+			return
+		}
+		publishDate := time.Now().Format(utils.FormatDateTime)
+		item := new(cygx.CygxResourceData)
+		item.SourceId = sourceId
+		item.Source = source
+		item.SearchTag = ""
+		item.PublishDate = publishDate
+		item.ChartPermissionId = detail.ChartPermissionId
+		item.CreateTime = time.Now()
+		if totalData == 0 {
+			_, e := cygx.AddCygxResourceData(item)
+			if e != nil {
+				err = errors.New("AddCygxResourceData, Err: " + e.Error())
+				return
+			}
+		} else {
+			e = cygx.UpdateResourceDataByItem(item)
+			if e != nil {
+				err = errors.New("UpdateResourceDataByItem, Err: " + e.Error())
+				return
+			}
+		}
+	}
+	return
+}
+
+//func init() {
+//	UpdateAskserieVideoResourceData(7)
+//}
+
+// 更新问答系列  写入首页最新  cygx_resource_data 表
+func UpdateAskserieVideoResourceData(sourceId int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("更新问答系列ourceId: ", sourceId, err.Error()), 2)
+		}
+	}()
+	var source = utils.CYGX_OBJ_ASKSERIEVIDEO
+	var condition string
+	var pars []interface{}
+	condition = ` AND publish_status = 1  AND  askserie_video_id = ?  `
+	pars = append(pars, sourceId)
+	total, e := cygx.GetCygxAskserieVideoCount(condition, pars)
+
+	if e != nil {
+		err = errors.New("GetCygxAskserieVideoCount, Err: " + e.Error())
+		return
+	}
+	//如果取消发布了就做删除处理
+	if total == 0 {
+		e = cygx.DeleteResourceData(sourceId, source)
+		if e != nil {
+			err = errors.New("DeleteResourceData, Err: " + e.Error())
+			return
+		}
+	} else {
+		//判断是否存在,如果不存在就新增,存在就更新
+		totalData, e := cygx.GetCygxResourceDataBySourceAndIdCount(sourceId, source)
+		if e != nil {
+			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
+			return
+		}
+		detail, e := cygx.GetCygxAskserieVideoDetail(sourceId)
+		if e != nil {
+			err = errors.New("GetCygxAskserieVideoDetail, Err: " + e.Error())
+			return
+		}
+
+		publishDate := time.Now().Format(utils.FormatDateTime)
+		item := new(cygx.CygxResourceData)
+		item.SourceId = sourceId
+		item.Source = source
+		item.PublishDate = publishDate
+		item.ChartPermissionId = detail.ChartPermissionId
+		item.CreateTime = time.Now()
+		if totalData == 0 {
+			_, e := cygx.AddCygxResourceData(item)
+			if e != nil {
+				err = errors.New("AddCygxResourceData, Err: " + e.Error())
+				return
+			}
+		} else {
+			e = cygx.UpdateResourceDataByItem(item)
+			if e != nil {
+				err = errors.New("UpdateResourceDataByItem, Err: " + e.Error())
+				return
+			}
+		}
+	}
+	return
+}
+
+func init23() {
 	//var condition string
 	//var pars []interface{}
 	//
@@ -812,7 +1104,36 @@ func init1123232() {
 	//	}
 	//	for _, v := range list {
 	//		fmt.Println(v.Source)
-	//		//UpdateActivityResourceData(v.SourceId)
+	//		UpdateActivityResourceData(v.SourceId)
+	//	}
+	//}
+
+	//12.4
+
+	//{
+	//	//活动
+	//	list, err := cygx.GetCygxResourceDataListBysource(utils.CYGX_OBJ_ACTIVITY)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//	}
+	//
+	//	for _, v := range list {
+	//		detail, e := cygx.GetAddActivityInfoById(v.SourceId)
+	//		if e != nil {
+	//			err = errors.New("GetCygxReportSelectionInfoById, Err: " + e.Error())
+	//			fmt.Println(err)
+	//			return
+	//		}
+	//		item := new(cygx.CygxResourceData)
+	//		item.SourceId = v.SourceId
+	//		item.Source = utils.CYGX_OBJ_ACTIVITY
+	//		item.ChartPermissionId = detail.ChartPermissionId
+	//		fmt.Println(v.Source)
+	//		err = cygx.UpdateChartPermissionIdResourceDataByItem(item)
+	//		if err != nil {
+	//			fmt.Println(err)
+	//			return
+	//		}
 	//	}
 	//}
 
@@ -840,6 +1161,49 @@ func init1123232() {
 	//	}
 	//}
 
+	//{
+	//	//文章//12.4
+	//	list, err := cygx.GetCygxResourceDataListBysource(utils.CYGX_OBJ_ARTICLE)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//		return
+	//	}
+	//	for _, v := range list {
+	//		detail, e := cygx.GetArticleDetailByArticleId(v.SourceId)
+	//		if e != nil {
+	//			err = errors.New("GetCygxReportSelectionInfoById, Err: " + e.Error())
+	//			fmt.Println(err)
+	//			return
+	//		}
+	//
+	//		item := new(cygx.CygxResourceData)
+	//		if detail.ArticleTypeId > 0 {
+	//			//item.SearchTag = detail.ArticleTypeName // 研选类型名称
+	//			item.ChartPermissionId = utils.CHART_PERMISSION_ID_YANXUAN
+	//		} else {
+	//			//item.SearchTag = detail.MatchTypeName
+	//			//获取文章分类详情
+	//			detailCategory, _ := cygx.GetCygxReportMappingCelueMaxDetailByCategoryId(detail.CategoryId)
+	//			if detailCategory != nil {
+	//				item.ChartPermissionId = detailCategory.ChartPermissionId
+	//			}else{
+	//				detailCategoryTwo, _ := cygx.GetCygxReportMappingCelueMaxDetailByCategoryId(detail.CategoryIdTwo)
+	//				if detailCategoryTwo != nil {
+	//					item.ChartPermissionId = detailCategoryTwo.ChartPermissionId
+	//				}
+	//			}
+	//		}
+	//		item.SourceId = v.SourceId
+	//		item.Source = utils.CYGX_OBJ_ARTICLE
+	//		fmt.Println(v.Source)
+	//		err = cygx.UpdateChartPermissionIdResourceDataByItem(item)
+	//		if err != nil {
+	//			fmt.Println(err)
+	//			return
+	//		}
+	//	}
+	//}
+
 	//{
 	//	//产品内测
 	//	list, err := cygx.GetCygxResourceDataListBysource(utils.CYGX_OBJ_PRODUCTINTERIOR)
@@ -848,7 +1212,7 @@ func init1123232() {
 	//	}
 	//	for _, v := range list {
 	//		fmt.Println(v.Source)
-	//		//UpdateProductInteriorResourceData(v.SourceId)
+	//		UpdateProductInteriorResourceData(v.SourceId)
 	//	}
 	//}
 	//
@@ -890,15 +1254,52 @@ func init1123232() {
 	//	}
 	//}
 	//
-	{
-		//更新本周研究汇总
-		list, err := cygx.GetCygxResourceDataListBysource(utils.CYGX_OBJ_MINUTESSUMMARY)
-		if err != nil {
-			fmt.Println(err)
-		}
-		for _, v := range list {
-			fmt.Println(v.Source)
-			//UpdateMinutesSummaryResourceData(v.SourceId)
-		}
-	}
+	//{
+	//	//更新本周研究汇总
+	//	list, err := cygx.GetCygxResourceDataListBysource(utils.CYGX_OBJ_MINUTESSUMMARY)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//	}
+	//	for _, v := range list {
+	//		fmt.Println(v.Source)
+	//		//UpdateMinutesSummaryResourceData(v.SourceId)
+	//	}
+	//}
+
+	//{
+	//	//活动音频
+	//	list, err := cygx.GetCygxResourceDataListBysource(utils.CYGX_OBJ_ACTIVITYVOICE)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//	}
+	//	for _, v := range list {
+	//		fmt.Println(v.Source)
+	//		UpdateActivityVoiceResourceData(v.SourceId)
+	//	}
+	//}
+
+	//{
+	//	//活动视频
+	//	list, err := cygx.GetCygxResourceDataListBysource(utils.CYGX_OBJ_ACTIVITYVIDEO)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//	}
+	//	for _, v := range list {
+	//		fmt.Println(v.Source)
+	//		UpdateActivityVideoResourceData(v.SourceId)
+	//	}
+	//}
+
+	//{
+	//	//活动音频
+	//	list, err := cygx.GetCygxResourceDataListBysource(utils.CYGX_OBJ_ROADSHOW)
+	//	if err != nil {
+	//		fmt.Println(err)
+	//	}
+	//	for _, v := range list {
+	//		fmt.Println(v.Source)
+	//		UpdateMicroRoadshowResourceData(v.SourceId)
+	//	}
+	//}
+
 }

+ 43 - 1
services/elastic/es_comprehensive.go

@@ -8,6 +8,7 @@ import (
 	"github.com/olivere/elastic/v7"
 	"hongze/hz_crm_api/models/cygx"
 	"hongze/hz_crm_api/services/alarm_msg"
+	cygxService "hongze/hz_crm_api/services/cygx"
 	"hongze/hz_crm_api/utils"
 	"html"
 	"strconv"
@@ -543,7 +544,7 @@ func EsAddYanxuanSpecial(sourceId int) {
 	defer func() {
 		if err != nil {
 			fmt.Println("err:", err)
-			go alarm_msg.SendAlarmMsg(fmt.Sprint("更新研选专栏失败sourceId: ", sourceId), 2)
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("更新研选专栏失败sourceId: ", sourceId, err.Error()), 2)
 		}
 	}()
 	detail, e := cygx.GetYanxuanSpecialItemById(sourceId)
@@ -571,3 +572,44 @@ func EsAddYanxuanSpecial(sourceId int) {
 	}
 	return
 }
+
+//func init() {
+//	EsAddAskserieVideo(74)
+//}
+
+// Es问答系列视频
+func EsAddAskserieVideo(sourceId int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println("err:", err)
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("Es更新问答系列视频AddAskserieVideo失败sourceId: ", sourceId, err.Error()), 2)
+		}
+	}()
+	detail, e := cygx.GetCygxAskserieVideoDetail(sourceId)
+	if e != nil {
+		err = errors.New("GetArticleInfoOtherByArticleId" + e.Error())
+		return
+	}
+	content := html.UnescapeString(detail.VideoName)
+	doc, e := goquery.NewDocumentFromReader(strings.NewReader(content))
+	if e != nil {
+		err = errors.New("goquery.NewDocumentFromReader" + e.Error())
+		return
+	}
+	bodyText := doc.Text()
+	item := new(ElasticComprehensiveDetail)
+	item.SourceId = detail.AskserieVideoId
+	item.Source = utils.CYGX_OBJ_ASKSERIEVIDEO
+	item.Title = detail.VideoName
+	item.PublishDate = detail.PublishDate
+	item.BodyText = bodyText
+	mapLabel := cygxService.GetCygxAskserieVideoLabelMap([]int{sourceId}) // 标签
+	item.IndustryName = mapLabel[sourceId]
+	if detail.PublishStatus == 1 {
+		EsAddOrEditComprehensiveData(item) //如果发布了就新增
+	} else {
+		EsDeleteComprehensiveData(item) // 没有发布就删除
+	}
+	return
+}

+ 6 - 0
utils/constants.go

@@ -410,6 +410,11 @@ const (
 	HONG_GUAN_NAME                          string = "宏观"
 )
 
+var CYGX_REGISTER_PLATFORM_MAP = map[string]string{
+	"1": "小程序",
+	"2": "网页版",
+}
+
 const (
 	CYGX_OBJ_ARTICLE            string = "article"            // 对象类型:文章
 	CYGX_OBJ_ACTIVITY           string = "activity"           // 对象类型:活动
@@ -423,6 +428,7 @@ const (
 	CYGX_OBJ_RESEARCHSUMMARY    string = "researchsummary"    // 对象类型:本周研究汇总
 	CYGX_OBJ_MINUTESSUMMARY     string = "minutessummary"     // 对象类型:本周研究汇总
 	CYGX_OBJ_YANXUANSPECIAL     string = "yanxuanspecial"     // 对象类型:研选专栏
+	CYGX_OBJ_ASKSERIEVIDEO      string = "askserievideo"      // 对象类型:问答系列视频
 )
 
 const (