|
@@ -2251,3 +2251,262 @@ func (this *MobileReportController) TacticsList() {
|
|
br.Msg = "获取成功"
|
|
br.Msg = "获取成功"
|
|
br.Data = resp
|
|
br.Data = resp
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// @Title 周期行业报告分类列表接口
|
|
|
|
+// @Description 周期获取行业报告分类列表接口
|
|
|
|
+// @Success 200 {object} models.TradeReportMappingResp
|
|
|
|
+// @router /zhouqi_tradeList [get]
|
|
|
|
+func (this *MobileReportController) ZouqiTradeList() {
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ listCategory, err := models.GetCygxZhouqiArticleMapFirst()
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fllowMap := services.GetXzsChooseCategoryZhouqiMapByMobile(user.Mobile)
|
|
|
|
+
|
|
|
|
+ resp := new(models.TradeReportMappingResp)
|
|
|
|
+ var list []*models.TradeReportMapping
|
|
|
|
+ if len(listCategory) == 0 {
|
|
|
|
+ list = make([]*models.TradeReportMapping, 0)
|
|
|
|
+ } else {
|
|
|
|
+ for _, v := range listCategory {
|
|
|
|
+ item := new(models.TradeReportMapping)
|
|
|
|
+ item.CategoryId = v.CategoryId
|
|
|
|
+ item.MatchTypeName = v.MatchTypeName
|
|
|
|
+ item.UpdateTime = utils.TimeRemoveHms(v.ArticleUpdateTime)
|
|
|
|
+ item.IsFollow = fllowMap[item.CategoryId]
|
|
|
|
+ item.ListArticle = make([]*models.HomeArticle, 0)
|
|
|
|
+ list = append(list, item)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ resp.List = list
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "获取成功"
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// @Title 周期根据行业分类获取行业文章列表
|
|
|
|
+// @Description 周期根据行业分类获取行业文章列表接口
|
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
|
+// @Param CategoryId query int true "分类ID"
|
|
|
|
+// @Success 200 {object} models.TacticsListResp
|
|
|
|
+// @router /tactics/zhouqi_list [get]
|
|
|
|
+func (this *MobileReportController) ZhouqiTacticsList() {
|
|
|
|
+ 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
|
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
|
+ categoryId, _ := this.GetInt("CategoryId")
|
|
|
|
+
|
|
|
|
+ var startSize int
|
|
|
|
+ if pageSize <= 0 {
|
|
|
|
+ pageSize = utils.PageSize20
|
|
|
|
+ }
|
|
|
|
+ if currentIndex <= 0 {
|
|
|
|
+ currentIndex = 1
|
|
|
|
+ }
|
|
|
|
+ startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
|
+
|
|
|
|
+ detail, err := models.GetCygxZhouqiArticleMapInfoById(categoryId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var total int
|
|
|
|
+ //var err error
|
|
|
|
+ resp := new(models.TacticsListResp)
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ list := make([]*models.ArticleListResp, 0)
|
|
|
|
+ listCategory, err := models.GetCygxZhouqiArticleMapByParentId(categoryId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取产业报告+晨会点评列表,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var matchTypeName = []string{}
|
|
|
|
+ var seriesName = []string{}
|
|
|
|
+ for _, v := range listCategory {
|
|
|
|
+ if v.MatchTypeName != "" {
|
|
|
|
+ matchTypeName = append(matchTypeName, v.MatchTypeName)
|
|
|
|
+ }
|
|
|
|
+ if v.SeriesName != "" {
|
|
|
|
+ seriesName = append(seriesName, v.SeriesName)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var conditionOr string
|
|
|
|
+ if detail.FiccReportId != "" {
|
|
|
|
+ conditionOr = " OR art.report_id IN (" + detail.FiccReportId + ")" // 手动配置报告展示逻辑处理
|
|
|
|
+ }
|
|
|
|
+ if len(seriesName) > 0 {
|
|
|
|
+ conditionOr += " OR series_name IN ('" + strings.Join(seriesName, "','") + "') "
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var condition string
|
|
|
|
+ //var pars []interface{}
|
|
|
|
+ //if len(seriesName) == 0 {
|
|
|
|
+ // condition = " AND field_name IN ('" + strings.Join(matchTypeName, "','") + "')"
|
|
|
|
+ //} else {
|
|
|
|
+ // condition = " AND ( field_name IN ('" + strings.Join(matchTypeName, "','") + "') OR series_name IN ('" + strings.Join(seriesName, "','") + "') )"
|
|
|
|
+ //}
|
|
|
|
+ condition = " AND ( field_name IN ('" + strings.Join(matchTypeName, "','") + "') " + conditionOr + " ) "
|
|
|
|
+ list, total, err = models.GetReportAndproductIndustrylListimgZhouqi(condition, startSize, pageSize)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.Msg = "GetHomeList,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ listPublic, err := services.HandleArticleCategoryImg(list, user)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取报告封面图片失败, Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var articleIds []int
|
|
|
|
+ var productInteriorIs []int
|
|
|
|
+
|
|
|
|
+ for _, v := range listPublic {
|
|
|
|
+ if v.Resource == 1 {
|
|
|
|
+ articleIds = append(articleIds, v.ArticleId)
|
|
|
|
+ }
|
|
|
|
+ if v.Resource == 2 {
|
|
|
|
+ productInteriorIs = append(productInteriorIs, v.ArticleId)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ articleMapPv := services.GetArticleHistoryByArticleId(articleIds) //文章Pv
|
|
|
|
+ articleCollectMap, _ := services.GetCygxArticleCollectMap(user.UserId) //用户收藏的文章
|
|
|
|
+ articleCollectNumMap, _ := services.GetCygxArticleCollectNumMapByArtcileIds(articleIds) //文章收藏的数量
|
|
|
|
+
|
|
|
|
+ productInteriorMapPv := services.GetCygxProductInteriorHistoryListPvMap(productInteriorIs) //产品内测Pv
|
|
|
|
+ listResp := make([]*models.HomeArticle, 0)
|
|
|
|
+ for _, v := range listPublic {
|
|
|
|
+ item := new(models.HomeArticle)
|
|
|
|
+ item.ArticleId = v.ArticleId
|
|
|
|
+ item.ReportId = v.ReportId
|
|
|
|
+ item.Title = v.Title
|
|
|
|
+ item.Annotation = v.Annotation
|
|
|
|
+ item.Abstract = v.Abstract
|
|
|
|
+ item.ImgUrlPc = v.ImgUrlPc
|
|
|
|
+ item.PublishDate = v.PublishDate
|
|
|
|
+ item.Resource = v.Resource
|
|
|
|
+ if v.Resource == 1 {
|
|
|
|
+ item.Pv = articleMapPv[v.ArticleId]
|
|
|
|
+ item.IsCollect = articleCollectMap[v.ArticleId]
|
|
|
|
+ item.CollectNum = articleCollectNumMap[v.ArticleId]
|
|
|
|
+ }
|
|
|
|
+ if v.Resource == 2 {
|
|
|
|
+ item.Pv = productInteriorMapPv[v.ArticleId]
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if v.ReportId > 0 {
|
|
|
|
+ item.Resource = 3
|
|
|
|
+ }
|
|
|
|
+ listResp = append(listResp, item)
|
|
|
|
+ }
|
|
|
|
+ if len(listResp) == 0 {
|
|
|
|
+ listResp = make([]*models.HomeArticle, 0)
|
|
|
|
+ }
|
|
|
|
+ page = paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ resp.List = listResp
|
|
|
|
+ resp.Paging = page
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "获取成功"
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// @Title 周期行业关注/取消关注
|
|
|
|
+// @Description 周期行业关注/取消关注 接口
|
|
|
|
+// @Param request body models.CygxCategoryFllowRep true "type json string"
|
|
|
|
+// @Success 200
|
|
|
|
+// @router /category/zhouqi_fllow [post]
|
|
|
|
+func (this *ReportController) CategoryZhouqiFllow() {
|
|
|
|
+ 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.CygxCategoryFllowRep
|
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ categoryId := req.CategoryId
|
|
|
|
+ count, err := models.GetCountCategoryFllowZhouqi(categoryId, user.Mobile)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp := new(models.CygxIndustryFllowResp)
|
|
|
|
+ if count == 0 {
|
|
|
|
+ item := new(models.CygxXzsChooseCategoryZhouqi)
|
|
|
|
+ item.CategoryId = categoryId
|
|
|
|
+ item.UserId = uid
|
|
|
|
+ item.Email = user.Email
|
|
|
|
+ item.Mobile = user.Mobile
|
|
|
|
+ item.RealName = user.RealName
|
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
|
+ _, err = models.AddCygxCategoryFllowZhouqi(item)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.Status = 1
|
|
|
|
+ br.Msg = "关注成功"
|
|
|
|
+ } else {
|
|
|
|
+ err = models.RemoveCygxCategoryFllowZhouqi(user.Mobile, categoryId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "取消关注失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.Status = 2
|
|
|
|
+ br.Msg = "已取消关注"
|
|
|
|
+ }
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|