|
@@ -559,64 +559,6 @@ func (this *HomeController) ListHomeArtAndChart() {
|
|
|
list = homeList
|
|
|
}
|
|
|
|
|
|
- ////研选的五张图片
|
|
|
- //detailResearch, err := models.GetConfigByCode("category_research_img_url")
|
|
|
- //if err != nil {
|
|
|
- // br.Msg = "获取数据失败"
|
|
|
- // br.ErrMsg = "获取数据研选分类图片失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- //}
|
|
|
- //researchList := strings.Split(detailResearch.ConfigValue, "{|}")
|
|
|
- ////对应分类的所图片
|
|
|
- //detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
|
|
|
- //if err != nil {
|
|
|
- // br.Msg = "获取数据失败"
|
|
|
- // br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- //}
|
|
|
- //categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
|
|
|
- //mapCategoryUrl := make(map[string]string)
|
|
|
- //var categoryId string
|
|
|
- //var imgUrlChart string
|
|
|
- //for _, v := range categoryUrlList {
|
|
|
- // vslice := strings.Split(v, "_")
|
|
|
- // categoryId = vslice[0]
|
|
|
- // imgUrlChart = vslice[len(vslice)-1]
|
|
|
- // mapCategoryUrl[categoryId] = imgUrlChart
|
|
|
- //}
|
|
|
- //
|
|
|
- //for k, v := range list {
|
|
|
- // if v.HomeType != 0 {
|
|
|
- // continue
|
|
|
- // }
|
|
|
- // item := list[k]
|
|
|
- // //如果文章一开始的内容是图片,优先展示第一张图片
|
|
|
- // imgurl, _ := services.FixArticleImgUrl(html.UnescapeString(list[k].Body))
|
|
|
- // newBody, _ := services.GetReportContentTextSubByarticle(item.Body, item.Annotation, item.ArticleId)
|
|
|
- // list[k].Body = newBody
|
|
|
- // if imgurl != "" {
|
|
|
- // list[k].BodyHtml = imgurl
|
|
|
- // }
|
|
|
- // list[k].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
|
|
|
- // if strings.Contains(item.CategoryName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
|
- // list[k].IsResearch = true
|
|
|
- // }
|
|
|
- // if item.Pv > 999 {
|
|
|
- // list[k].Pv = 999
|
|
|
- // }
|
|
|
- // //如果是研选系列的任意取五张图片的中的一张
|
|
|
- // if v.CategoryId == "0" {
|
|
|
- // knum := v.ArticleId % 5
|
|
|
- // list[k].ImgUrlPc = researchList[knum]
|
|
|
- // } else {
|
|
|
- // list[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
|
|
|
- // }
|
|
|
- // if list[k].ArticleId < utils.SummaryArticleId {
|
|
|
- // list[k].HttpUrl = utils.StrategyPlatform + strconv.Itoa(v.ArticleId)
|
|
|
- // list[k].IsNeedJump = true
|
|
|
- // }
|
|
|
- // list[k].Source = 1
|
|
|
- //}
|
|
|
resp.List, err = services.HandleArticleCategoryImg(list)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
@@ -684,11 +626,11 @@ func (this *HomeController) NewList() {
|
|
|
}
|
|
|
|
|
|
var articleTypes, activityTypes, industries, subjectNames string
|
|
|
- articleTypeCondSlice := make([]string,0)
|
|
|
- activityTypesCondSlice := make([]string,0)
|
|
|
- industriesCondSlice := make([]string,0)
|
|
|
- subjectNamesSlice := make([]string,0)
|
|
|
- articleTypeSlice := make([]string,0)
|
|
|
+ articleTypeCondSlice := make([]string, 0)
|
|
|
+ activityTypesCondSlice := make([]string, 0)
|
|
|
+ industriesCondSlice := make([]string, 0)
|
|
|
+ subjectNamesSlice := make([]string, 0)
|
|
|
+ articleTypeSlice := make([]string, 0)
|
|
|
if tagIds != "" {
|
|
|
tags := strings.Split(tagIds, ",")
|
|
|
for _, tagIdStr := range tags {
|
|
@@ -739,48 +681,48 @@ func (this *HomeController) NewList() {
|
|
|
var articleTypeStr string
|
|
|
if articleType != "" {
|
|
|
articleTypeSlice := strings.Split(articleType, ",")
|
|
|
- newArticleTypeSlice := make([]string,0)
|
|
|
+ newArticleTypeSlice := make([]string, 0)
|
|
|
for _, s := range articleTypeSlice {
|
|
|
- newArticleTypeSlice = append(newArticleTypeSlice, "'"+ s + "'")
|
|
|
+ newArticleTypeSlice = append(newArticleTypeSlice, "'"+s+"'")
|
|
|
}
|
|
|
articleTypeStr = strings.Join(newArticleTypeSlice, ",")
|
|
|
- articleTypeStr = strings.TrimRight(articleTypeStr,",")
|
|
|
- articleTypeCond += ` AND (art.sub_category_name In (`+ articleTypeStr +`) OR (art.article_type_name In (`+ articleTypeStr +`) AND art.article_type_name <> '路演精华' AND art.article_type_id <> 0 ) ) `
|
|
|
+ articleTypeStr = strings.TrimRight(articleTypeStr, ",")
|
|
|
+ articleTypeCond += ` AND (art.sub_category_name In (` + articleTypeStr + `) OR (art.article_type_name In (` + articleTypeStr + `) AND art.article_type_name <> '路演精华' AND art.article_type_id <> 0 ) ) `
|
|
|
}
|
|
|
activityTypesCond := ``
|
|
|
if activityType != "" {
|
|
|
activityTypeSlice := strings.Split(activityType, ",")
|
|
|
- newActivityTypeSlice := make([]string,0)
|
|
|
+ newActivityTypeSlice := make([]string, 0)
|
|
|
for _, s := range activityTypeSlice {
|
|
|
- newActivityTypeSlice = append(newActivityTypeSlice, "'"+ s + "'")
|
|
|
+ newActivityTypeSlice = append(newActivityTypeSlice, "'"+s+"'")
|
|
|
}
|
|
|
activityTypeStr := strings.Join(newActivityTypeSlice, ",")
|
|
|
- activityTypeStr = strings.TrimRight(activityTypeStr,",")
|
|
|
- activityTypesCond += ` AND act.activity_type_name In (`+ activityTypeStr +`) `
|
|
|
+ activityTypeStr = strings.TrimRight(activityTypeStr, ",")
|
|
|
+ activityTypesCond += ` AND act.activity_type_name In (` + activityTypeStr + `) `
|
|
|
}
|
|
|
industriesCond := ``
|
|
|
var industryStr string
|
|
|
if industry != "" {
|
|
|
industrieSlice := strings.Split(industry, ",")
|
|
|
- newIndustrieSlice := make([]string,0)
|
|
|
+ newIndustrieSlice := make([]string, 0)
|
|
|
for _, s := range industrieSlice {
|
|
|
- newIndustrieSlice = append(newIndustrieSlice, "'"+ s + "'")
|
|
|
+ newIndustrieSlice = append(newIndustrieSlice, "'"+s+"'")
|
|
|
}
|
|
|
industryStr = strings.Join(newIndustrieSlice, ",")
|
|
|
industryStr = strings.TrimRight(industryStr, ",")
|
|
|
- industriesCond += ` AND im.industry_name In (`+ industryStr +`) `
|
|
|
+ industriesCond += ` AND im.industry_name In (` + industryStr + `) `
|
|
|
}
|
|
|
subjectNamesCond := ``
|
|
|
var subjectNameStr string
|
|
|
if subjectName != "" {
|
|
|
subjectNameSlice := strings.Split(subjectName, ",")
|
|
|
- newSubjectNameSlice := make([]string,0)
|
|
|
+ newSubjectNameSlice := make([]string, 0)
|
|
|
for _, s := range subjectNameSlice {
|
|
|
- newSubjectNameSlice = append(newSubjectNameSlice, "'"+ s + "'")
|
|
|
+ newSubjectNameSlice = append(newSubjectNameSlice, "'"+s+"'")
|
|
|
}
|
|
|
subjectNameStr = strings.Join(newSubjectNameSlice, ",")
|
|
|
subjectNameStr = strings.TrimRight(subjectNameStr, ",")
|
|
|
- subjectNamesCond += ` AND cis.subject_name In (`+ subjectNameStr +`) `
|
|
|
+ subjectNamesCond += ` AND cis.subject_name In (` + subjectNameStr + `) `
|
|
|
}
|
|
|
articleTypeCondSlice = append(articleTypeCondSlice, articleTypeCond)
|
|
|
activityTypesCondSlice = append(activityTypesCondSlice, activityTypesCond)
|
|
@@ -800,61 +742,61 @@ func (this *HomeController) NewList() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- articleTypes = strings.TrimRight(articleTypes,",")
|
|
|
- activityTypes = strings.TrimRight(activityTypes,",")
|
|
|
- industries = strings.TrimRight(industries,",")
|
|
|
- subjectNames = strings.TrimRight(subjectNames,",")
|
|
|
+ articleTypes = strings.TrimRight(articleTypes, ",")
|
|
|
+ activityTypes = strings.TrimRight(activityTypes, ",")
|
|
|
+ industries = strings.TrimRight(industries, ",")
|
|
|
+ subjectNames = strings.TrimRight(subjectNames, ",")
|
|
|
|
|
|
articleTypesCond := ``
|
|
|
var articleTypeStr string
|
|
|
if articleTypes != "" {
|
|
|
articleTypeSlice := strings.Split(articleTypes, ",")
|
|
|
- newArticleTypeSlice := make([]string,0)
|
|
|
+ newArticleTypeSlice := make([]string, 0)
|
|
|
for _, s := range articleTypeSlice {
|
|
|
- newArticleTypeSlice = append(newArticleTypeSlice, "'"+ s + "'")
|
|
|
+ newArticleTypeSlice = append(newArticleTypeSlice, "'"+s+"'")
|
|
|
}
|
|
|
articleTypeStr = strings.Join(newArticleTypeSlice, ",")
|
|
|
- articleTypeStr = strings.TrimRight(articleTypeStr,",")
|
|
|
- articleTypesCond += ` AND (art.sub_category_name In (`+ articleTypeStr +`) OR (art.article_type_name In (`+ articleTypeStr +`) AND art.article_type_name <> '路演精华' AND art.article_type_id <> 0 ) ) `
|
|
|
+ articleTypeStr = strings.TrimRight(articleTypeStr, ",")
|
|
|
+ articleTypesCond += ` AND (art.sub_category_name In (` + articleTypeStr + `) OR (art.article_type_name In (` + articleTypeStr + `) AND art.article_type_name <> '路演精华' AND art.article_type_id <> 0 ) ) `
|
|
|
}
|
|
|
activityTypesCond := ``
|
|
|
if activityTypes != "" {
|
|
|
activityTypeSlice := strings.Split(activityTypes, ",")
|
|
|
- newActivityTypeSlice := make([]string,0)
|
|
|
+ newActivityTypeSlice := make([]string, 0)
|
|
|
for _, s := range activityTypeSlice {
|
|
|
- newActivityTypeSlice = append(newActivityTypeSlice, "'"+ s + "'")
|
|
|
+ newActivityTypeSlice = append(newActivityTypeSlice, "'"+s+"'")
|
|
|
}
|
|
|
activityTypeStr := strings.Join(newActivityTypeSlice, ",")
|
|
|
- activityTypeStr = strings.TrimRight(activityTypeStr,",")
|
|
|
- activityTypesCond += ` AND act.activity_type_name In (`+ activityTypeStr +`) `
|
|
|
+ activityTypeStr = strings.TrimRight(activityTypeStr, ",")
|
|
|
+ activityTypesCond += ` AND act.activity_type_name In (` + activityTypeStr + `) `
|
|
|
}
|
|
|
industriesCond := ``
|
|
|
var industryStr string
|
|
|
if industries != "" {
|
|
|
industrieSlice := strings.Split(industries, ",")
|
|
|
- newIndustrieSlice := make([]string,0)
|
|
|
+ newIndustrieSlice := make([]string, 0)
|
|
|
for _, s := range industrieSlice {
|
|
|
- newIndustrieSlice = append(newIndustrieSlice, "'"+ s + "'")
|
|
|
+ newIndustrieSlice = append(newIndustrieSlice, "'"+s+"'")
|
|
|
}
|
|
|
industryStr = strings.Join(newIndustrieSlice, ",")
|
|
|
industryStr = strings.TrimRight(industryStr, ",")
|
|
|
- industriesCond += ` AND im.industry_name In (`+ industryStr +`) `
|
|
|
+ industriesCond += ` AND im.industry_name In (` + industryStr + `) `
|
|
|
}
|
|
|
subjectNamesCond := ``
|
|
|
var subjectNameStr string
|
|
|
if subjectNames != "" {
|
|
|
subjectNameSlice := strings.Split(subjectNames, ",")
|
|
|
- newSubjectNameSlice := make([]string,0)
|
|
|
+ newSubjectNameSlice := make([]string, 0)
|
|
|
for _, s := range subjectNameSlice {
|
|
|
- newSubjectNameSlice = append(newSubjectNameSlice, "'"+ s + "'")
|
|
|
+ newSubjectNameSlice = append(newSubjectNameSlice, "'"+s+"'")
|
|
|
}
|
|
|
subjectNameStr = strings.Join(newSubjectNameSlice, ",")
|
|
|
subjectNameStr = strings.TrimRight(subjectNameStr, ",")
|
|
|
- subjectNamesCond += ` AND cis.subject_name In (`+ subjectNameStr +`) `
|
|
|
+ subjectNamesCond += ` AND cis.subject_name In (` + subjectNameStr + `) `
|
|
|
}
|
|
|
|
|
|
- var tagArticleIds,tagActivityIds, mmIds string
|
|
|
- if articleTypesCond != "" || activityTypesCond != "" || industryStr != "" || subjectNameStr != ""{
|
|
|
+ var tagArticleIds, tagActivityIds, mmIds string
|
|
|
+ if articleTypesCond != "" || activityTypesCond != "" || industryStr != "" || subjectNameStr != "" {
|
|
|
tagArticleIds, tagActivityIds, mmIds, err = models.GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, industryStr, subjectNameStr, articleTypeStr)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取失败"
|
|
@@ -923,7 +865,6 @@ func (this *HomeController) NewList() {
|
|
|
}
|
|
|
lenActivityIds := len(activityIds)
|
|
|
|
|
|
-
|
|
|
listActivitySpecial, _, err := services.GetActivitySpecialList(user, 1, 200, "")
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
@@ -937,7 +878,6 @@ func (this *HomeController) NewList() {
|
|
|
}
|
|
|
lenActivityspecialIds := len(activityspecialIds)
|
|
|
|
|
|
-
|
|
|
if tagIds != "" {
|
|
|
if tagArticleIds != "" {
|
|
|
condition = ` AND ((source = 'article' AND source_id IN (` + tagArticleIds + `) ) `
|
|
@@ -975,7 +915,7 @@ func (this *HomeController) NewList() {
|
|
|
pars = append(pars, activityIds)
|
|
|
}
|
|
|
|
|
|
- if lenActivityspecialIds > 0 && tagIds == "" {
|
|
|
+ if lenActivityspecialIds > 0 && tagIds == "" {
|
|
|
condition += ` OR ( source = 'activityspecial' AND source_id IN (` + utils.GetOrmInReplace(lenActivityspecialIds) + `) ` + conditionInit + ` ) `
|
|
|
pars = append(pars, activityspecialIds)
|
|
|
}
|