Browse Source

no message

xingzai 1 year ago
parent
commit
f05f3e6c35

+ 147 - 0
controllers/cygx/activity_video.go

@@ -406,3 +406,150 @@ func (this *ActivityVideoCoAntroller) VideoAndVoice() {
 	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 pars []interface{}
+	if keyWord != "" {
+		condition += ` AND (v.video_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 =  2  AND  art.yidong_activity_id_by_cygx != '' `
+	} else if searchType == 2 {
+		condition += ` AND art.activity_type_id !=  2  `
+	}
+
+	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, 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 + ","
+			}
+		}
+	}
+	for k, v := range list {
+		if mapIndustrial[v.ActivityId] != "" && v.TemporaryLabel == "" {
+			list[k].Label = strings.TrimRight(mapIndustrial[v.ActivityId], ",")
+		}
+		if strings.Contains(v.VideoUrl, ".mp3") {
+			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
+}

+ 49 - 0
controllers/cygx/askserie_video.go

@@ -325,3 +325,52 @@ func (this *AskserieVideoController) CollectionList() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @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 == 0 {
+		status = 1
+	} else {
+		status = 0
+		//go cygxService.UpdateResourceData(productInteriorId, "productinterior", "delete", time.Now().Format(utils.FormatDateTime))
+		//go cygxService.UpdateProductInteriorResourceData(productInteriorId) //写入首页最新  cygx_resource_data 表
+	}
+	err = cygx.EditCygxAskserieVideoStatus(status, askserieVideoId)
+	if err != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+}

+ 51 - 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 {
@@ -204,3 +205,53 @@ func Updatevideo_url(video_url string, video_id int) (err error) {
 	_, err = o.Raw(sql, video_url, video_id).Exec()
 	return
 }
+
+// 获取数量
+func GetActivityVoiceAndVideoList(condition, 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.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
+
+	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.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 + 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/askserie_video.go

@@ -193,3 +193,11 @@ 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
+}

+ 4 - 0
models/cygx/askserie_video_history_record.go

@@ -18,6 +18,10 @@ type CygxAskserieVideoHistoryRecordResp struct {
 	VideoDuration    string `description:"视频时长"`
 }
 
+type AskserieVideoIdIdReq struct {
+	AskserieVideoId int `description:"ID"`
+}
+
 // Pv数据列表
 type CygxCygxAskserieVideoHistoryRecordListResp struct {
 	//Paging *paging.PagingItem `description:"分页数据"`

+ 18 - 0
routers/commentsRouter.go

@@ -1258,6 +1258,15 @@ 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: "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",
@@ -1330,6 +1339,15 @@ 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: "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",