Browse Source

no message

xingzai 6 months ago
parent
commit
b7a38007a6
2 changed files with 8 additions and 5 deletions
  1. 4 1
      controllers/home.go
  2. 4 4
      services/tag.go

+ 4 - 1
controllers/home.go

@@ -295,6 +295,7 @@ func (this *MobileHomeController) NewList() {
 	var pars []interface{}
 	var yanxuanActivityIds []int
 	var yanxuanArticleIds []int
+	var conditionresp string
 	//var yanxuanspecialIds []int
 
 	if hashtagKeyword != "" {
@@ -314,12 +315,13 @@ func (this *MobileHomeController) NewList() {
 			yanxuanActivityIds = services.GetYanxuanActivityIds(user, "1,2") // 获取所有的研选活动ID
 			yanxuanArticleIds = services.GetYanxuanArticleIds()              //获取所有研选文章ID
 		} else {
-			yanxuanActivityIds, yanxuanArticleIds, err = services.GetConditionInitByTagIds(user, labelKeyword)
+			yanxuanActivityIds, yanxuanArticleIds, conditionresp, err = services.GetConditionInitByTagIds(user, labelKeyword)
 			if err != nil {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取活动权限数据失败,GetConditionInitByTagIds Err:" + err.Error()
 				return
 			}
+			condition += conditionresp
 			//如果不是 "全部报告" 、 "专栏" 的关键词查询,就不做研选专栏的查询
 			if labelKeyword != utils.LABEL_L2_1 && labelKeyword != utils.LABEL_L2_2 {
 				condition += `  AND IF ( source = 'yanxuanspecial' , source_id   IN (0) ,1=1 ) `
@@ -341,6 +343,7 @@ func (this *MobileHomeController) NewList() {
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
+
 		list, err = services.GetResourceDataList(condition, pars, startSize, pageSize, user)
 		if err != nil {
 			br.Msg = "获取失败"

+ 4 - 4
services/tag.go

@@ -45,7 +45,7 @@ func AddCygxTagHistory(user *models.WxUserItem, tagId int) (err error) {
 //	fmt.Println(conditionInit)
 //}
 
-func GetConditionInitByTagIds(user *models.WxUserItem, labelKeyword string) (yanxuanActivityIdsResp, yanxuanArticleIdsResp []int, err error) {
+func GetConditionInitByTagIds(user *models.WxUserItem, labelKeyword string) (yanxuanActivityIdsResp, yanxuanArticleIdsResp []int, conditionresp string, err error) {
 	var yanxuanActivityIds []int
 	var yanxuanArticleIds []int
 	var condition string
@@ -89,11 +89,11 @@ func GetConditionInitByTagIds(user *models.WxUserItem, labelKeyword string) (yan
 		}
 	case "全部报告": // 全部报告
 		yanxuanArticleIds = GetYanxuanArticleIds() //获取所有研选文章ID
-
+		conditionresp = `  AND source IN ('article','yanxuanspecial')  `
 	case "专栏": //专栏
-
+		conditionresp = `  AND source IN ('yanxuanspecial')  `
 	case "纪要": //纪要
-
+		conditionresp = `  AND source IN ('article')  `
 		//condition = ` AND  article_type_id > 0  AND  article_type_id != 12  `
 		condition = ` AND  article_type_id > 0  `
 		list, e := models.GetCygxCygxArticleIdList(condition, pars)