|
@@ -816,4 +816,265 @@ func (this *UserController) CollectList() {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// @Title 获取我的留言
|
|
|
+// @Description 获取我的留言列表
|
|
|
+// @Success 200 {object} models.CygxCommentListResp
|
|
|
+// @router /comment/list [get]
|
|
|
+func (this *UserController) CommnetList() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+
|
|
|
+ userId := this.User.UserId
|
|
|
+ commentlist, err := models.GetCommentList(userId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取我的留言列表失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ resp := new(models.CygxCommentListResp)
|
|
|
+
|
|
|
+ for _, comment := range commentlist {
|
|
|
+ item := models.CygxArticleCommentResp{
|
|
|
+ Id: comment.Id,
|
|
|
+ UserId: comment.UserId,
|
|
|
+ ArticleId: comment.ArticleId,
|
|
|
+ IndustryId: comment.IndustryId,
|
|
|
+ ActivityId: comment.ActivityId,
|
|
|
+ CreateTime: comment.CreateTime,
|
|
|
+ Mobile: comment.Mobile,
|
|
|
+ Email: comment.Email,
|
|
|
+ CompanyId: comment.CompanyId,
|
|
|
+ CompanyName: comment.CompanyName,
|
|
|
+ Content: comment.Content,
|
|
|
+ Title: comment.Title,
|
|
|
+ }
|
|
|
+ if comment.ArticleId > 0 {
|
|
|
+ item.RedirectType = 1
|
|
|
+ } else if comment.IndustryId > 0 {
|
|
|
+ item.RedirectType = 3
|
|
|
+ } else if comment.ActivityId > 0 {
|
|
|
+ item.RedirectType = 2
|
|
|
+ }
|
|
|
+ resp.List = append(resp.List, &item)
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Msg = "获取成功!"
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取浏览历史列表
|
|
|
+// @Description 获取浏览历史列表
|
|
|
+// @Param PageSize query int true "PageSize"
|
|
|
+// @Param CurrentIndex query int true "CurrentIndex"
|
|
|
+// @Success 200 {object} models.ArticleBrowseHistoryListResp
|
|
|
+// @router /browse/history/list [get]
|
|
|
+func (this *UserController) BrowseHistoryList() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ userId := this.User.UserId
|
|
|
+ var pageSize, currentIndex, startSize int
|
|
|
+ pageSize, _ = this.GetInt("PageSize")
|
|
|
+ currentIndex, _ = this.GetInt("CurrentIndex")
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
+
|
|
|
+ endDate := time.Now().AddDate(0, -1, 0).Format(utils.FormatDate)
|
|
|
+ total, err := models.GetArticleUserBrowseHistoryCount(userId, endDate)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ list, err := models.GetArticleUserBrowseHistoryList(startSize, pageSize, userId, endDate)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(models.ArticleReportBillboardLIstPageResp)
|
|
|
+ if len(list) == 0 {
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ resp.List = list
|
|
|
+ resp.Paging = page
|
|
|
+ br.Msg = "获取成功!"
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var articleIds []string
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ for _, v := range list {
|
|
|
+ articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
|
|
|
+ }
|
|
|
+ articleIdStr := strings.Join(articleIds, ",")
|
|
|
+
|
|
|
+ //获取文章关联的产业
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+ condition = ` AND mg.article_id IN ( ` + utils.GetOrmInReplace(len(articleIds)) + ` ) `
|
|
|
+ pars = append(pars, articleIds)
|
|
|
+ industrialList, err := models.GetIndustrialListByarticleId(pars, condition)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,GetSubjectList Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ industrialMap := make(map[int][]*models.IndustrialManagementIdInt)
|
|
|
+ if len(industrialList) > 0 {
|
|
|
+ for _, v := range industrialList {
|
|
|
+ item := new(models.IndustrialManagementIdInt)
|
|
|
+ item.ArticleId = v.ArticleId
|
|
|
+ if v.ArticleId > utils.SummaryArticleId {
|
|
|
+ item.IsResearch = true
|
|
|
+ }
|
|
|
+ item.IndustrialManagementId = v.IndustrialManagementId
|
|
|
+ item.IndustryName = v.IndustryName
|
|
|
+ industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for k, v := range list {
|
|
|
+ if len(industrialMap[v.ArticleId]) > 0 {
|
|
|
+ list[k].List = industrialMap[v.ArticleId]
|
|
|
+ } else {
|
|
|
+ list[k].List = make([]*models.IndustrialManagementIdInt, 0)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ articleMap := make(map[int]*models.ArticleDetail)
|
|
|
+ if articleIdStr != "" {
|
|
|
+ articleList, err := models.GetArticleDetailByIdStr(articleIdStr)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取报告详情信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range articleList {
|
|
|
+ if _, ok := articleMap[v.ArticleId]; !ok {
|
|
|
+ articleMap[v.ArticleId] = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理文章PV收藏等数量
|
|
|
+ mapArticleCollectNum := make(map[int]*models.CygxArticleNum)
|
|
|
+ if len(articleIds) > 0 {
|
|
|
+ articleCollectNumList, err := models.GetArticleCollectNum(articleIds, userId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,GetArticleCollectNum Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range articleCollectNumList {
|
|
|
+ mapArticleCollectNum[v.ArticleId] = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ lenList := len(list)
|
|
|
+ for i := 0; i < lenList; i++ {
|
|
|
+ item := list[i]
|
|
|
+ article := articleMap[item.ArticleId]
|
|
|
+ if article != nil {
|
|
|
+ list[i].Title = article.Title
|
|
|
+ list[i].PublishDate = utils.TimeRemoveHms2(article.PublishDate)
|
|
|
+ list[i].DepartmentId = article.DepartmentId
|
|
|
+ list[i].NickName = article.NickName
|
|
|
+ if article.ArticleId < utils.SummaryArticleId {
|
|
|
+ list[i].Source = 1
|
|
|
+ } else {
|
|
|
+ list[i].Source = 2
|
|
|
+ }
|
|
|
+
|
|
|
+ if mapArticleCollectNum[article.ArticleId] != nil {
|
|
|
+ list[i].CollectNum = mapArticleCollectNum[article.ArticleId].CollectNum
|
|
|
+ list[i].Pv = mapArticleCollectNum[article.ArticleId].Pv
|
|
|
+ list[i].IsCollect = mapArticleCollectNum[article.ArticleId].IsCollect
|
|
|
+ }
|
|
|
+ //list[i].TitleEn = article.TitleEn
|
|
|
+ //list[i].UpdateFrequency = article.UpdateFrequency
|
|
|
+ //list[i].CreateDate = article.CreateDate
|
|
|
+ //list[i].Body, _ = services.GetReportContentTextSub(article.Body)
|
|
|
+ //list[i].Abstract = article.Abstract
|
|
|
+ //list[i].CategoryName = article.CategoryName
|
|
|
+ //list[i].SubCategoryName = article.SubCategoryName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+
|
|
|
+ resp.List = list
|
|
|
+ resp.Paging = page
|
|
|
+ br.Msg = "获取成功!"
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取我的提问
|
|
|
+// @Description 获取我的提问列表
|
|
|
+// @Success 200 {object} models.CygxAskListResp
|
|
|
+// @router /ask/list [get]
|
|
|
+func (this *UserController) AskList() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ userId := this.User.UserId
|
|
|
+ listActcivity, err := models.GetActivityAskList(userId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取活动问题失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listActcivity {
|
|
|
+ v.AskType = "Activity"
|
|
|
+ }
|
|
|
+ listArticle, err := models.GetArticleAskList(userId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取文章问题失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listArticle {
|
|
|
+ v.AskType = "Report"
|
|
|
+ listActcivity = append(listActcivity, v)
|
|
|
+ }
|
|
|
+ resp := new(models.CygxAskListResp)
|
|
|
+ resp.List = listActcivity
|
|
|
+ br.Msg = "获取成功!"
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Data = resp
|
|
|
}
|