|
@@ -682,8 +682,13 @@ func (this *HomeController) NewList() {
|
|
|
br.ErrMsg = "GetCountCompanyProductCompanyId,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- var articleTypes, activityTypes, industries, subjectNames string
|
|
|
|
|
|
+ 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)
|
|
|
if tagIds != "" {
|
|
|
tags := strings.Split(tagIds, ",")
|
|
|
for _, tagIdStr := range tags {
|
|
@@ -699,21 +704,102 @@ func (this *HomeController) NewList() {
|
|
|
br.ErrMsg = "GetCygxTagByTagId,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- if tagInfo.ActivityTypes != "" {
|
|
|
- activityTypes += tagInfo.ActivityTypes + ","
|
|
|
- }
|
|
|
- if tagInfo.ArticleTypes != "" {
|
|
|
- articleTypes += tagInfo.ArticleTypes + ","
|
|
|
- }
|
|
|
- if tagInfo.Industries != "" {
|
|
|
- industries += tagInfo.Industries + ","
|
|
|
- }
|
|
|
- if tagInfo.SubjectNames != "" {
|
|
|
- subjectNames += tagInfo.SubjectNames + ","
|
|
|
+ // 只有AB或CD的情况
|
|
|
+ if (tagInfo.ActivityTypes == "" && tagInfo.ArticleTypes == "") || (tagInfo.Industries == "" && tagInfo.SubjectNames == "") {
|
|
|
+ if tagInfo.ActivityTypes != "" {
|
|
|
+ activityTypes += tagInfo.ActivityTypes + ","
|
|
|
+ }
|
|
|
+ if tagInfo.ArticleTypes != "" {
|
|
|
+ articleTypes += tagInfo.ArticleTypes + ","
|
|
|
+ }
|
|
|
+ if tagInfo.Industries != "" {
|
|
|
+ industries += tagInfo.Industries + ","
|
|
|
+ }
|
|
|
+ if tagInfo.SubjectNames != "" {
|
|
|
+ subjectNames += tagInfo.SubjectNames + ","
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // ABCD都有的情况
|
|
|
+ // 每一个tag都单独处理
|
|
|
+ var articleType, activityType, industry, subjectName string
|
|
|
+
|
|
|
+ if tagInfo.ActivityTypes != "" {
|
|
|
+ activityType = tagInfo.ActivityTypes
|
|
|
+ }
|
|
|
+ if tagInfo.ArticleTypes != "" {
|
|
|
+ articleType = tagInfo.ArticleTypes
|
|
|
+ }
|
|
|
+ if tagInfo.Industries != "" {
|
|
|
+ industry = tagInfo.Industries
|
|
|
+ }
|
|
|
+ if tagInfo.SubjectNames != "" {
|
|
|
+ subjectName = tagInfo.SubjectNames
|
|
|
+ }
|
|
|
+ articleTypeCond := ``
|
|
|
+ var articleTypeStr string
|
|
|
+ if articleType != "" {
|
|
|
+ articleTypeSlice := strings.Split(articleType, ",")
|
|
|
+ newArticleTypeSlice := make([]string,0)
|
|
|
+ for _, s := range articleTypeSlice {
|
|
|
+ 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 ) ) `
|
|
|
+ }
|
|
|
+ activityTypesCond := ``
|
|
|
+ if activityType != "" {
|
|
|
+ activityTypeSlice := strings.Split(activityType, ",")
|
|
|
+ newActivityTypeSlice := make([]string,0)
|
|
|
+ for _, s := range activityTypeSlice {
|
|
|
+ newActivityTypeSlice = append(newActivityTypeSlice, "'"+ s + "'")
|
|
|
+ }
|
|
|
+ activityTypeStr := strings.Join(newActivityTypeSlice, ",")
|
|
|
+ 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)
|
|
|
+ for _, s := range industrieSlice {
|
|
|
+ newIndustrieSlice = append(newIndustrieSlice, "'"+ s + "'")
|
|
|
+ }
|
|
|
+ industryStr = strings.Join(newIndustrieSlice, ",")
|
|
|
+ industryStr = strings.TrimRight(industryStr, ",")
|
|
|
+ industriesCond += ` AND im.industry_name In (`+ industryStr +`) `
|
|
|
+ }
|
|
|
+ subjectNamesCond := ``
|
|
|
+ var subjectNameStr string
|
|
|
+ if subjectName != "" {
|
|
|
+ subjectNameSlice := strings.Split(subjectName, ",")
|
|
|
+ newSubjectNameSlice := make([]string,0)
|
|
|
+ for _, s := range subjectNameSlice {
|
|
|
+ newSubjectNameSlice = append(newSubjectNameSlice, "'"+ s + "'")
|
|
|
+ }
|
|
|
+ subjectNameStr = strings.Join(newSubjectNameSlice, ",")
|
|
|
+ subjectNameStr = strings.TrimRight(subjectNameStr, ",")
|
|
|
+ subjectNamesCond += ` AND cis.subject_name In (`+ subjectNameStr +`) `
|
|
|
+ }
|
|
|
+ articleTypeCondSlice = append(articleTypeCondSlice, articleTypeCond)
|
|
|
+ activityTypesCondSlice = append(activityTypesCondSlice, activityTypesCond)
|
|
|
+ industriesCondSlice = append(industriesCondSlice, industryStr)
|
|
|
+ subjectNamesSlice = append(subjectNamesSlice, subjectNameStr)
|
|
|
+ articleTypeSlice = append(articleTypeSlice, articleType)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 先拿abdc都有的tag取合集的ids。。。
|
|
|
+ soloTagArticleIds, soloTagActivityIds, soloMmIds, err := models.GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityTypesCondSlice, industriesCondSlice, subjectNamesSlice, articleTypeSlice)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
articleTypes = strings.TrimRight(articleTypes,",")
|
|
|
activityTypes = strings.TrimRight(activityTypes,",")
|
|
|
industries = strings.TrimRight(industries,",")
|
|
@@ -767,11 +853,36 @@ func (this *HomeController) NewList() {
|
|
|
subjectNamesCond += ` AND cis.subject_name In (`+ subjectNameStr +`) `
|
|
|
}
|
|
|
|
|
|
- tagArticleIds, tagActivityIds, mmIds, err := models.GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, industryStr, subjectNameStr, articleTypeStr)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
+ 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 = "获取失败"
|
|
|
+ br.ErrMsg = "获取单个标签ids失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if soloTagArticleIds != "" {
|
|
|
+ if tagArticleIds != "" {
|
|
|
+ tagArticleIds += "," + soloTagArticleIds
|
|
|
+ } else {
|
|
|
+ tagArticleIds = soloTagArticleIds
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if soloTagActivityIds != "" {
|
|
|
+ if tagActivityIds != "" {
|
|
|
+ tagActivityIds += "," + soloTagActivityIds
|
|
|
+ } else {
|
|
|
+ tagActivityIds = soloTagActivityIds
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if soloMmIds != "" {
|
|
|
+ if mmIds != "" {
|
|
|
+ mmIds += "," + soloMmIds
|
|
|
+ } else {
|
|
|
+ mmIds = soloMmIds
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//fmt.Println("condition:",condition)
|