Эх сурвалжийг харах

Merge branch 'mfyx_3.6' of http://8.136.199.33:3000/cxzhang/hongze_mfyx into debug

xingzai 7 сар өмнө
parent
commit
5d7816f1c4

+ 6 - 3
controllers/home.go

@@ -58,6 +58,7 @@ func (this *HomeController) NewList() {
 	var pars []interface{}
 	var yanxuanActivityIds []int
 	var yanxuanArticleIds []int
+	var conditionresp string
 	//var yanxuanspecialIds []int
 
 	if hashtagKeyword != "" {
@@ -70,20 +71,20 @@ func (this *HomeController) NewList() {
 	resp := new(models.HomeResourceDataListResp)
 
 	if keyWord == "" {
-		//condition += " AND source IN ('article','activity','yanxuanspecial')   " // 只有研选的文章、研选的活动、研选的专栏这三种
 		condition += " AND source IN ('article','activity','yanxuanspecial','activityvoice','activityvideo')  AND IF   ( source IN('activityvoice','activityvideo') , chart_permission_id = 31 ,1=1 ) " // 只有研选的文章、研选的活动、研选的专栏这三种
 		if labelKeyword == "" {
 			//查询近一个月的数据
-			condition += " AND search_order_time  >   '" + time.Now().AddDate(0, 0, -60).Format(utils.FormatDateTime) + "'"
+			condition += " AND search_order_time  >   '" + time.Now().AddDate(0, 0, -180).Format(utils.FormatDateTime) + "'"
 			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 ) `
@@ -105,6 +106,7 @@ func (this *HomeController) NewList() {
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
+
 		list, err = services.GetResourceDataList(condition, pars, startSize, pageSize, user)
 		if err != nil {
 			br.Msg = "获取失败"
@@ -119,6 +121,7 @@ func (this *HomeController) NewList() {
 			br.ErrMsg = "检索失败,Err:" + err.Error()
 			return
 		}
+
 		total = tmpTotalResult
 		list, err = services.GetResourceDataEsList(tmpResult, user)
 		if err != nil {

+ 3 - 3
services/es_comprehensive.go

@@ -653,7 +653,7 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
 	}
 
 	//yanxuanspecialIds = append(yanxuanspecialIds, 0)
-	condition := " AND source IN ('article','activity','yanxuanspecial')   " // 只有研选的文章、研选的活动、研选的专栏这三种
+	condition := " AND source IN ('article','activity','yanxuanspecial','activityvoice','activityvideo')  AND IF   ( source IN('activityvoice','activityvideo') , chart_permission_id = 31 ,1=1 ) " // 只有研选的文章、研选的活动、研选的专栏这三种
 	condition += `  AND IF ( source = 'article' , source_id   IN (` + strings.Join(yanxuanArticleIdsStr, ",") + `) ,1=1 ) `
 	//pars = append(pars, yanxuanArticleIds)
 
@@ -671,6 +671,7 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
 
 	conditionContentYxAuthor = " AND  (special_name LIKE  ?  OR  nick_name LIKE  ? )  "
 	parsContentYxAuthor = append(parsContentYxAuthor, keyWord, keyWord)
+
 	totalTitle, e := models.GetResourceDataAndYanxuanSpecialAuthorCount(conditionTitle, parsTitle, conditionContentYxAuthor, parsContentYxAuthor)
 
 	//totalTitle, e := models.GetResourceDataCount(conditionTitle, parsTitle)
@@ -698,10 +699,9 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
 	if totalTitle >= searchTotal {
 		fmt.Println("1")
 		//全部都是标题搜索
-		//list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
 		list, e = models.GetResourceDataAndYanxuanSpecialAuthorListCondition(conditionTitle, parsTitle, conditionContentYxAuthor, parsContentYxAuthor, startSize, pageSize)
 		if e != nil && e.Error() != utils.ErrNoRow() {
-			err = errors.New("GetResourceDataAndYanxuanSpecialAuthorListCondition, Err: " + e.Error())
+			err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
 			return
 		}
 	} else if totalTitle <= searchTotal-pageSize {

+ 4 - 3
services/tag.go

@@ -59,7 +59,7 @@ func AddCygxTagHistory(user *models.WxUserItem, tagId int) (err error) {
 //	LABEL_L3_3 string = "主题c"     // 主题c
 //)
 
-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
@@ -103,10 +103,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   `
 		list, e := models.GetCygxCygxArticleIdList(condition, pars)