123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725 |
- package controllers
- import (
- "encoding/json"
- "github.com/rdlucklib/rdluck_tools/paging"
- "hongze/hongze_web_mfyx/models"
- "hongze/hongze_web_mfyx/services"
- "hongze/hongze_web_mfyx/utils"
- "strconv"
- "strings"
- "time"
- )
- // 微路演
- type MicroRoadShowController struct {
- BaseAuthController
- }
- // @Title 微路演列表
- // @Description 微路演列表接口
- // @Param PageSize query int true "每页数据条数"
- // @Param CurrentIndex query int true "当前页页码,从1开始"
- // @Param KeyWord query string false "搜索关键词"
- // @Param Filter query string false "筛选条件 为空:全部 1:视频 2:音频 "
- // @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() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- user := this.User
- if user == nil {
- br.Msg = "请登录"
- br.ErrMsg = "请登录,用户信息为空"
- br.Ret = 408
- return
- }
- pageSize, _ := this.GetInt("PageSize")
- currentIndex, _ := this.GetInt("CurrentIndex")
- keywords := this.GetString("KeyWord")
- //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
- }
- if currentIndex <= 0 {
- currentIndex = 1
- }
- var keyWordArr []string
- var err error
- if keywords != "" {
- keyWordArr, err = services.GetIndustryMapNameSliceV3(keywords)
- if err != nil {
- br.Msg = "获取失败"
- br.ErrMsg = "获取分词失败,GetIndustryMapNameSliceV3 Err: " + err.Error()
- return
- }
- keyWordArr = services.RemoveDuplicatesAndEmpty(keyWordArr)
- }
- var list []*models.MicroRoadShowPageList
- var total int
- var e error
- // 微路演列表
- 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
- //获取总的数量
- //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)
- if err != nil {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
- return
- }
- mapaudioIds := make(map[int]int) //活动音频
- mapvideoIds := make(map[int]int) // 微路演视频
- mapactivityVideoIds := make(map[int]int) // 活动视频
- mapAskserieVideoIds := make(map[int]int) // 问答系列音频
- for _, item := range listMycollect {
- if item.ActivityVoiceId > 0 {
- mapaudioIds[item.ActivityVoiceId] = item.ActivityVoiceId
- } else if item.VideoId > 0 {
- mapvideoIds[item.VideoId] = item.VideoId
- } else if item.ActivityVideoId > 0 {
- mapactivityVideoIds[item.ActivityVideoId] = item.ActivityVideoId
- }
- }
- listAskserieVideoCollect, err := models.GetUserCygxAskserieVideoCollectList(userId)
- if err != nil {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
- return
- }
- for _, v := range listAskserieVideoCollect {
- if v.AskserieVideoId > 0 {
- mapAskserieVideoIds[v.AskserieVideoId] = v.AskserieVideoId
- }
- }
- for _, item := range list {
- if item.Type == 1 {
- //音频
- if mapaudioIds[item.Id] > 0 {
- item.IsCollect = true
- }
- } else if item.Type == 2 {
- //活动视频
- if mapactivityVideoIds[item.Id] > 0 {
- item.IsCollect = true
- }
- } else if item.Type == 3 {
- //微路演视频
- if mapvideoIds[item.Id] > 0 {
- item.IsCollect = true
- }
- } else if item.Type == 4 {
- //系列问答视频
- if mapAskserieVideoIds[item.SourceId] > 0 {
- item.IsCollect = true
- }
- }
- item.IndustrialManagementId = item.IndustryId
- }
- // 用户权限
- authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
- if e != nil {
- br.Msg = "获取失败"
- br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
- return
- }
- // 获取默认图配置
- audioMap, videoMap, audioShareMap, videoShareMap, e := services.GetMicroRoadShowDefaultImgConfig()
- if e != nil {
- br.Msg = "获取失败"
- br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
- return
- }
- for i := range list {
- // 权限
- au := new(models.UserPermissionAuthInfo)
- au.SellerName = authInfo.SellerName
- au.SellerMobile = authInfo.SellerMobile
- au.HasPermission = authInfo.HasPermission
- au.OperationMode = authInfo.OperationMode
- if au.HasPermission == 1 {
- // 非宏观权限进一步判断是否有权限
- if list[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, list[i].ChartPermissionName) {
- au.HasPermission = 2
- }
- }
- // 无权限的弹框提示
- if au.HasPermission != 1 {
- if au.OperationMode == services.UserPermissionOperationModeCall {
- if list[i].Type == 1 {
- au.PopupMsg = services.UserPermissionPopupMsgCallActivity
- } else {
- au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
- }
- } else {
- if list[i].Type == 1 {
- au.PopupMsg = services.UserPermissionPopupMsgApplyActivity
- } else {
- au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
- }
- }
- }
- list[i].AuthInfo = au
- list[i].PublishTime = utils.StrTimeToTime(list[i].PublishTime).Format(utils.FormatDate)
- // 默认图
- if list[i].BackgroundImg == "" {
- if list[i].Type == 1 {
- list[i].BackgroundImg = audioMap[list[i].ChartPermissionId]
- } else {
- list[i].BackgroundImg = videoMap[list[i].ChartPermissionId]
- }
- }
- // 分享图
- if list[i].ShareImg == "" {
- if list[i].Type == 1 {
- list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
- } else {
- list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
- }
- }
- }
- resp := new(models.MicroRoadShowListResp)
- 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 VideoId query int true "视频ID"
- // @Success 200 {object} models.IndustryVideoDetailResp
- // @router /detail [get]
- func (this *MicroRoadShowController) Detail() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- user := this.User
- if user == nil {
- br.Msg = "请重新登录"
- br.Ret = 408
- return
- }
- videoId, _ := this.GetInt("VideoId")
- videoSimple, au, err := services.GetindustryVideoDetailById(user, videoId)
- if err != nil {
- br.Msg = "获取失败"
- br.ErrMsg = "获取用户权限失败, Err: " + err.Error()
- return
- }
- resp := new(models.IndustryVideoDetailResp)
- resp.IndustryVideo = videoSimple
- resp.AuthInfo = au
- br.Ret = 200
- br.Success = true
- br.Msg = "获取成功"
- br.Data = resp
- }
- // @Title 记录用户浏览音频回放接口
- // @Description 记录用户浏览音频回放接口
- // @Param request body models.ActivityIdRep true "type json string"
- // @Success Ret=200 {object} models.AddVideoHistoryReq
- // @router /videoHistory/add [post]
- func (this *MicroRoadShowController) VideoHistoryAdd() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- user := this.User
- if user == nil {
- br.Msg = "请登录"
- br.ErrMsg = "请登录,用户信息为空"
- br.Ret = 408
- return
- }
- var req models.AddVideoHistoryReq
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
- if err != nil {
- br.Msg = "参数解析异常!"
- br.ErrMsg = "参数解析失败,Err:" + err.Error()
- return
- }
- sourceId := req.SourceId
- playSeconds := req.PlaySeconds
- sourceType := req.SourceType
- inviteShareCode := req.InviteShareCode
- if sourceType == 0 {
- sourceType = 1
- }
- if sourceType == 1 {
- //添加活动音频的播放记录
- go services.AddActivityVoiceHistory(user, sourceId, playSeconds, inviteShareCode)
- } else if sourceType == 2 {
- //添加活动视频的播放记录
- go services.AddActivityVideoHistory(user, sourceId, playSeconds, inviteShareCode)
- } else if sourceType == 3 {
- //添加产业视频播放记录
- go services.AddMicroRoadshowVideoRecord(user, sourceId, playSeconds)
- } else if sourceType == 4 {
- //问答系列音频播放记录
- go services.AddAskserieVideoHistoryRecord(user, sourceId, playSeconds)
- }
- go services.AddAllCygxVoiceAndVideoHistory(user, sourceId, sourceType, playSeconds)
- br.Ret = 200
- br.Success = true
- br.Msg = "操作成功"
- return
- }
- // @Title 微路演新增留言
- // @Description 微路演新增留言接口
- // @Param request body models.AddVideoCommnetReq true "type json string"
- // @Success Ret=200 {object} models.AppointmentResp
- // @router /comment/add [post]
- func (this *MicroRoadShowController) CommentAdd() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- user := this.User
- if user == nil {
- br.Msg = "请登录"
- br.ErrMsg = "请登录,用户信息为空"
- br.Ret = 408
- return
- }
- uid := user.UserId
- var req models.AddVideoCommnetReq
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
- if err != nil {
- br.Msg = "参数解析异常!"
- br.ErrMsg = "参数解析失败,Err:" + err.Error()
- return
- }
- content := req.Content
- if content == "" {
- br.Msg = "留言内容不能为空!"
- return
- }
- sourceType := req.SourceType
- sourceId := req.SourceId
- title := req.Title
- if sourceType == 0 {
- sourceType = 1
- }
- item := models.CygxArticleComment{
- UserId: uid,
- CreateTime: time.Now(),
- RealName: user.RealName,
- Mobile: user.Mobile,
- Email: user.Email,
- CompanyId: user.CompanyId,
- CompanyName: user.CompanyName,
- Content: req.Content,
- Title: req.Title,
- }
- //var resourceId int
- if sourceType == 1 {
- activityVoiceInfo, _ := models.GetCygxActivityVoiceByActivityId(sourceId)
- if activityVoiceInfo == nil {
- br.Msg = "操作失败"
- br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(sourceId)
- return
- }
- item.ActivityId = activityVoiceInfo.ActivityId
- item.Title = activityVoiceInfo.VoiceName
- item.ActivityVoiceId = activityVoiceInfo.ActivityVoiceId
- title = activityVoiceInfo.VoiceName
- err = models.UpdateActivityVoiceCommentNum(sourceId)
- if err != nil {
- br.Msg = "操作失败"
- br.ErrMsg = "操作失败 ,更新活动音频留言次数失败:" + strconv.Itoa(sourceId)
- return
- }
- } else if sourceType == 2 {
- activityInfo, _ := models.GetCygxActivityVideoByActivityIdInfo(sourceId)
- if activityInfo == nil {
- br.Msg = "操作失败"
- br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(sourceId)
- return
- }
- item.Title = activityInfo.Title
- item.VideoId = activityInfo.Id
- item.ActivityId = activityInfo.ActivityId
- title = activityInfo.Title
- err = models.UpdateActivityVideoCommentNum(sourceId)
- if err != nil {
- br.Msg = "操作失败"
- br.ErrMsg = "操作失败 ,更新活动视频留言次数失败:" + strconv.Itoa(sourceId)
- return
- }
- } else if sourceType == 3 {
- item.VideoId = sourceId
- microVideo, e := models.GetMicroRoadshowVideoById(sourceId)
- if e != nil {
- br.Msg = "操作失败"
- br.ErrMsg = "微路演视频信息有误, 不存在的VideoId: " + strconv.Itoa(sourceId)
- return
- }
- item.Title = microVideo.VideoName
- item.IndustryId = microVideo.IndustryId
- title = microVideo.VideoName
- //resourceId = microVideo.IndustryId
- } else if sourceType == 4 {
- item.AskserieVideoId = sourceId
- go services.AddCygxAskserieVideoCollection(user, item.AskserieVideoId, req.Content)
- }
- var isResearch bool // 是否属于研选
- if sourceType == 1 || sourceType == 2 {
- detail, err := models.GetAddActivityInfoById(sourceId)
- if err != nil {
- br.Msg = "操作失败"
- br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(sourceId)
- return
- }
- if strings.Contains(detail.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
- isResearch = true
- }
- }
- msgId, err := models.AddArticleComment(&item)
- if err != nil {
- br.Msg = "提交失败"
- br.ErrMsg = "提交留言失败,Err:" + err.Error()
- return
- }
- services.SendWxMsgWithMicroRoadshowAsk(req, user, sourceType, int(msgId), title, isResearch)
- br.Ret = 200
- br.Success = true
- br.Msg = "操作成功"
- return
- }
- // @Title 微路演收藏
- // @Description 微路演收藏
- // @Param request body models.MicroRoadshowCollectReq true "type json string"
- // @Success 200 {object} models.FontsCollectResp
- // @router /collect [post]
- func (this *MicroRoadShowController) Collect() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- user := this.User
- if user == nil {
- br.Msg = "请重新登录"
- br.Ret = 408
- return
- }
- uid := user.UserId
- var req models.MicroRoadshowCollectReq
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
- if err != nil {
- br.Msg = "参数解析异常!"
- br.ErrMsg = "参数解析失败,Err:" + err.Error()
- return
- }
- sourceId := req.SourceId
- if req.SourceType == 1 {
- detail, err := models.GetCygxActivityVoiceByActivityId(sourceId)
- if err != nil {
- br.Msg = "获取信息失败"
- br.ErrMsg = "获取信息失败,Err:" + err.Error()
- return
- }
- count, err := models.GetVoiceCollectCount(uid, detail.ActivityVoiceId)
- if err != nil {
- br.Msg = "获取数据失败!"
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
- return
- }
- resp := new(models.ArticleCollectResp)
- if count <= 0 {
- item := new(models.CygxArticleCollect)
- item.ActivityVoiceId = detail.ActivityVoiceId
- 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
- _, err = models.AddCygxArticleCollect(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.RemoveVoiceCollect(uid, detail.ActivityVoiceId)
- if err != nil {
- br.Msg = "取消收藏失败"
- br.ErrMsg = "取消收藏失败,Err:" + err.Error()
- return
- }
- br.Msg = "已取消收藏"
- resp.Status = 2
- }
- collectTotal, err := models.GetVoiceCollectUsersCount(detail.ActivityVoiceId)
- if err != nil {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
- return
- }
- resp.CollectCount = collectTotal
- br.Ret = 200
- br.Success = true
- br.Data = resp
- } else if req.SourceType == 2 {
- detail, err := models.GetCygxActivityVideoByActivityIdInfo(sourceId)
- if err != nil {
- br.Msg = "获取信息失败"
- br.ErrMsg = "获取信息失败,Err:" + err.Error()
- return
- }
- count, err := models.GetActivityVideoCollectCount(uid, detail.Id)
- if err != nil {
- br.Msg = "获取数据失败!"
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
- return
- }
- resp := new(models.ArticleCollectResp)
- if count <= 0 {
- item := new(models.CygxArticleCollect)
- item.ActivityVideoId = detail.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
- _, err = models.AddCygxArticleCollect(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.RemoveActivityVideoCollect(uid, detail.Id)
- if err != nil {
- br.Msg = "取消收藏失败"
- br.ErrMsg = "取消收藏失败,Err:" + err.Error()
- return
- }
- br.Msg = "已取消收藏"
- resp.Status = 2
- }
- collectTotal, err := models.GetActivityVideoCollectUsersCount(detail.Id)
- if err != nil {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
- return
- }
- resp.CollectCount = collectTotal
- br.Ret = 200
- br.Success = true
- br.Data = resp
- } else if req.SourceType == 3 {
- _, err := models.GetMicroRoadshowVideoById(sourceId)
- if err != nil {
- br.Msg = "获取信息失败"
- br.ErrMsg = "获取信息失败,Err:" + err.Error()
- return
- }
- count, err := models.GetVideoCollectCount(uid, sourceId)
- if err != nil {
- br.Msg = "获取数据失败!"
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
- return
- }
- resp := new(models.ArticleCollectResp)
- if count <= 0 {
- item := new(models.CygxArticleCollect)
- item.VideoId = sourceId
- 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
- _, err = models.AddCygxArticleCollect(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.RemoveVideoCollect(uid, sourceId)
- if err != nil {
- br.Msg = "取消收藏失败"
- br.ErrMsg = "取消收藏失败,Err:" + err.Error()
- return
- }
- br.Msg = "已取消收藏"
- resp.Status = 2
- }
- collectTotal, err := models.GetVideoCollectUsersCount(sourceId)
- if err != nil {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
- return
- }
- resp.CollectCount = collectTotal
- br.Ret = 200
- br.Success = true
- br.Data = resp
- } else if req.SourceType == 4 {
- // 系列问答视频收藏
- count, err := models.GetAskserieVideoCount(uid, sourceId)
- if err != nil {
- br.Msg = "获取数据失败!"
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
- return
- }
- resp := new(models.ArticleCollectResp)
- if count <= 0 {
- item := new(models.CygxAskserieVideoCollect)
- item.AskserieVideoId = sourceId
- item.UserId = uid
- item.CreateTime = time.Now()
- item.ModifyTime = 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
- // 文章收藏消息发送
- } else {
- err = models.RemoveAskserieVideoCollect(uid, sourceId)
- 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
- }
- }
- // @Title 问答系列视频详情
- // @Description 问答系列视频详情接口
- // @Param VideoId query int true "视频ID"
- // @Success 200 {object} models.IndustryVideoDetailResp
- // @router /askserie_video/detail [get]
- func (this *MicroRoadShowController) AskserieVideoDetail() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- user := this.User
- if user == nil {
- br.Msg = "请重新登录"
- br.Ret = 408
- return
- }
- askserieVideoId, _ := this.GetInt("VideoId")
- videoSimple, au, err := services.GetAskserieVideoDetailById(user, askserieVideoId)
- if err != nil {
- br.Msg = "获取失败"
- br.ErrMsg = "获取用户权限失败, Err: " + err.Error()
- return
- }
- resp := new(models.IndustryVideoDetailResp)
- resp.IndustryVideo = videoSimple
- resp.AuthInfo = au
- br.Ret = 200
- br.Success = true
- br.Msg = "获取成功"
- br.Data = resp
- }
|