|
@@ -131,8 +131,8 @@ func (this *MicroRoadShowController) List() {
|
|
|
}
|
|
|
|
|
|
//修改产业视频的标题
|
|
|
- if list[i].Type == 3 && list[i].IndustryName != ""{
|
|
|
- list[i].Title = "5min"+"【"+ list[i].IndustryName +"】"+"逻辑解析"
|
|
|
+ if list[i].Type == 3 && list[i].IndustryName != "" {
|
|
|
+ list[i].Title = "5min" + "【" + list[i].IndustryName + "】" + "逻辑解析"
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -242,3 +242,150 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
|
|
|
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
|
|
|
+ }
|
|
|
+
|
|
|
+ sourceType := req.SourceType
|
|
|
+
|
|
|
+ if sourceType == 0 {
|
|
|
+ sourceType = 1
|
|
|
+ }
|
|
|
+ //var sellerName string
|
|
|
+ //sellerName, err = models.GetCompanySellerName(user.CompanyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "报名失败!"
|
|
|
+ br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item := models.CygxArticleComment{
|
|
|
+ UserId: uid,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ Mobile: user.Mobile,
|
|
|
+ Email: user.Email,
|
|
|
+ CompanyId: user.CompanyId,
|
|
|
+ CompanyName: user.CompanyName,
|
|
|
+ Content: req.Content,
|
|
|
+ Title: req.Title,
|
|
|
+ }
|
|
|
+ if sourceType == 1 {
|
|
|
+ item.IndustryId = req.Id
|
|
|
+ } else if sourceType == 2 {
|
|
|
+ item.ActivityId = req.Id
|
|
|
+ }
|
|
|
+ _, err = models.AddArticleComment(&item)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "提交失败"
|
|
|
+ br.ErrMsg = "提交留言失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 收藏
|
|
|
+// @Description 收藏
|
|
|
+// @Param request body models.ArticleCollectReq true "type json string"
|
|
|
+// @Success 200 {object} models.FontsCollectResp
|
|
|
+// @router /collect [post]
|
|
|
+func (this *ArticleController) 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.ArticleCollectReq
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ articleId := req.ArticleId
|
|
|
+ detail, err := models.GetArticleDetailById(articleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ count, err := models.GetArticleCollectCount(uid, articleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(models.ArticleCollectResp)
|
|
|
+ if count <= 0 {
|
|
|
+ item := new(models.CygxArticleCollect)
|
|
|
+ item.ArticleId = req.ArticleId
|
|
|
+ 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.RemoveArticleCollect(uid, articleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "取消收藏失败"
|
|
|
+ br.ErrMsg = "取消收藏失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "已取消收藏"
|
|
|
+ resp.Status = 2
|
|
|
+ }
|
|
|
+ collectTotal, err := models.GetArticleCollectUsersCount(articleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.CollectCount = collectTotal
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Data = resp
|
|
|
+}
|