123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- package controllers
- import (
- "encoding/json"
- "hongze/hongze_mfyx/models"
- "hongze/hongze_mfyx/services"
- )
- type MicroRoadShowController struct {
- BaseAuthController
- }
- func (this *MicroRoadShowController) CommentDetail() {
- 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
- }
- sourceId, _ := this.GetInt("SourceId")
- sourceType, _ := this.GetInt("SourceType")
- resp := new(models.CygxArticleCommentWxResp)
- if sourceType == 1 || sourceType == 3 || sourceType == 4 || sourceType == 5 {
- detail, err := models.GetArticleCommentById(sourceId)
- if err != nil {
- br.Msg = "获取失败"
- br.ErrMsg = "获取用户权限失败, Err: " + err.Error()
- return
- }
- resp.Content = detail.Content
- if sourceType == 1 {
- resp.SourceId = detail.ArticleId
- resp.RedirectType = 1
- } else if sourceType == 3 {
- resp.SourceId = detail.IndustryId
- resp.RedirectType = 3
- } else {
- resp.SourceId = detail.ActivityId
- resp.RedirectType = 2
- }
- } else {
- detail, err := models.GetCygxActivityHelpAskById(sourceId)
- if err != nil {
- br.Msg = "获取失败"
- br.ErrMsg = "获取用户权限失败, Err: " + err.Error()
- return
- }
- resp.Content = detail.Content
- resp.SourceId = detail.ActivityId
- resp.RedirectType = 2
- }
- br.Ret = 200
- br.Success = true
- br.Data = resp
- br.Msg = "操作成功"
- return
- }
- 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.AddAllCygxVoiceAndVideoHistory(user, sourceId, sourceType, playSeconds)
- br.Ret = 200
- br.Success = true
- br.Msg = "操作成功"
- return
- }
|