|
@@ -389,7 +389,7 @@ func (this *MobileReportController) ArticleCategoryList() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
- uid := user.UserId
|
|
|
+
|
|
|
industrialManagementId, _ := this.GetInt("IndustrialManagementId")
|
|
|
if industrialManagementId < 1 {
|
|
|
br.Msg = "请输入分类ID"
|
|
@@ -402,31 +402,37 @@ func (this *MobileReportController) ArticleCategoryList() {
|
|
|
br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- list, err := models.IndustrialToArticleCategory(industrialManagementId, detail.ChartPermissionId)
|
|
|
+ listCategory, err := models.IndustrialToArticleAndProductInteriorCategoryNew(industrialManagementId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- for k, v := range list {
|
|
|
- recordCount, err := models.IndustrialUserRecordArticleCount(uid, industrialManagementId, v.CategoryId)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- Newdetail, err := models.GetNewIndustrialUserRecordArticle(industrialManagementId, v.CategoryId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if Newdetail != nil {
|
|
|
- if recordCount == 0 && user.CreatedTime.Before(utils.StrTimeToTime(Newdetail.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(Newdetail.PublishDate)) {
|
|
|
- list[k].IsRed = true
|
|
|
- }
|
|
|
+ var list []*models.IndustrialToArticleCategoryRep
|
|
|
+ categoryMap := make(map[int]int)
|
|
|
+ for _, v := range listCategory {
|
|
|
+ if categoryMap[v.CategoryId] > 0 {
|
|
|
+ continue
|
|
|
}
|
|
|
+ categoryMap[v.CategoryId] = v.CategoryId
|
|
|
+ list = append(list, v)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
industrialSubjectList, err := models.GetIndustrialSubjectAll(industrialManagementId)
|
|
@@ -494,7 +500,7 @@ func (this *MobileReportController) List() {
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
categoryId, _ := this.GetInt("CategoryId")
|
|
|
industrialManagementId, _ := this.GetInt("IndustrialManagementId")
|
|
|
-
|
|
|
+ uid := user.UserId
|
|
|
var startSize int
|
|
|
if pageSize <= 0 {
|
|
|
pageSize = utils.PageSize20
|
|
@@ -503,7 +509,7 @@ func (this *MobileReportController) List() {
|
|
|
currentIndex = 1
|
|
|
}
|
|
|
startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
- var condition string
|
|
|
+
|
|
|
var pars []interface{}
|
|
|
var total int
|
|
|
resp := new(models.TacticsListResp)
|
|
@@ -520,18 +526,18 @@ func (this *MobileReportController) List() {
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
- var reportType int
|
|
|
- if industrialManagementId > 0 {
|
|
|
- reportType = 2
|
|
|
- } else {
|
|
|
- reportType = 1
|
|
|
- }
|
|
|
- detail, errCategory := models.GetdetailByCategoryIdOne(categoryId, reportType)
|
|
|
- if errCategory != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
|
|
|
if err != nil {
|
|
@@ -567,52 +573,60 @@ func (this *MobileReportController) List() {
|
|
|
imgUrlChart = vslice[len(vslice)-1]
|
|
|
mapCategoryUrl[categoryIdStr] = imgUrlChart
|
|
|
}
|
|
|
- if detail.CeLueFieldId != "" {
|
|
|
- condition = ` AND ce_lue_field_id IN(` + detail.CeLueFieldId + `)`
|
|
|
- } else if detail.PolymerizationId != "" {
|
|
|
- condition = ` AND category_id IN(` + detail.PolymerizationId + `)`
|
|
|
- } else {
|
|
|
- categoryIdSet, errCategory := models.GetdetailByCategoryIdSet(categoryId)
|
|
|
- if errCategory != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
|
|
|
- return
|
|
|
- }
|
|
|
- if categoryIdSet != "" {
|
|
|
- condition = ` AND category_id IN(` + categoryIdSet + `)`
|
|
|
- } else {
|
|
|
- condition = ` AND category_id IN(` + strconv.Itoa(categoryId) + `)`
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- if industrialManagementId > 0 {
|
|
|
- industrialManageentList, err := models.GetIndustrialArticleGroupManagementByIndustrialManagementId(industrialManagementId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.Msg = "获取产业关联的文章ID失败,GetIndustrialArticleGroupManagementByIndustrialManagementIdErr:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- articleIdList := make([]string, 0)
|
|
|
- for _, v := range industrialManageentList {
|
|
|
- articleIdList = append(articleIdList, strconv.Itoa(v.ArticleId))
|
|
|
- }
|
|
|
- condition += ` AND a.article_id IN ( ` + utils.GetOrmInReplace(len(articleIdList)) + ` ) `
|
|
|
- pars = append(pars, articleIdList)
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- total, err = models.GetHomeCount(condition, pars)
|
|
|
+ list, total, err = models.GetReportAndproductInteriorIndustrialList(pars, categoryId, industrialManagementId, uid, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
- br.Msg = "获取帖子总数失败,Err:" + err.Error()
|
|
|
+ br.ErrMsg = "获取帖子数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- list, err = models.GetHomeListNew(condition, pars, startSize, pageSize)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.Msg = "获取帖子数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
articleIdMap, err := services.GetUserArticleHistoryRecord(user)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
@@ -634,7 +648,7 @@ func (this *MobileReportController) List() {
|
|
|
}
|
|
|
resp.MatchTypeName = detail.MatchTypeName
|
|
|
}
|
|
|
- resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]
|
|
|
+
|
|
|
}
|
|
|
|
|
|
listPublic, err := services.HandleArticleCategoryImg(list, user)
|