|
@@ -350,3 +350,83 @@ func (this *UserController) CollectList() {
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Data = resp
|
|
br.Data = resp
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// @Title 获取申请访谈列表
|
|
|
|
+// @Description 获取申请访谈列表
|
|
|
|
+// @Param PageSize query int true "PageSize"
|
|
|
|
+// @Param CurrentIndex query int true "CurrentIndex"
|
|
|
|
+// @Success 200 {object} models.ArticleInterviewApplyListResp
|
|
|
|
+// @router /interview/apply/list [get]
|
|
|
|
+func (this *UserController) InterviewApplyList() {
|
|
|
|
+ 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)
|
|
|
|
+
|
|
|
|
+ total, err := models.GetArticleUserInterviewApplyCount(userId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ list, err := models.GetArticleUserInterviewApplyList(startSize, pageSize, userId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var articleIds []string
|
|
|
|
+ for _, v := range list {
|
|
|
|
+ articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
|
|
|
|
+ }
|
|
|
|
+ articleIdStr := strings.Join(articleIds, ",")
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ lenList := len(list)
|
|
|
|
+ for i := 0; i < lenList; i++ {
|
|
|
|
+ item := list[i]
|
|
|
|
+ article := articleMap[item.ArticleId]
|
|
|
|
+ list[i].Title = article.Title
|
|
|
|
+ list[i].TitleEn = article.TitleEn
|
|
|
|
+ list[i].UpdateFrequency = article.UpdateFrequency
|
|
|
|
+ list[i].CreateDate = article.CreateDate
|
|
|
|
+ list[i].PublishDate = article.PublishDate
|
|
|
|
+ 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 := new(models.ArticleInterviewApplyListResp)
|
|
|
|
+ resp.List = list
|
|
|
|
+ resp.Paging = page
|
|
|
|
+ br.Msg = "获取成功!"
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|