|
@@ -265,7 +265,7 @@ func (this *MobileHomeController) NewList() {
|
|
//uid := user.UserId
|
|
//uid := user.UserId
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
- //tagIds := this.GetString("TagIds")
|
|
|
|
|
|
+ tagIds := this.GetString("TagIds")
|
|
|
|
|
|
var startSize int
|
|
var startSize int
|
|
if pageSize <= 0 {
|
|
if pageSize <= 0 {
|
|
@@ -282,6 +282,62 @@ func (this *MobileHomeController) NewList() {
|
|
var pars []interface{}
|
|
var pars []interface{}
|
|
var total int
|
|
var total int
|
|
resp := new(models.HomeResourceDataListNewResp)
|
|
resp := new(models.HomeResourceDataListNewResp)
|
|
|
|
+
|
|
|
|
+ var articleTypes, activityTypes, industries, subjectNames string
|
|
|
|
+
|
|
|
|
+ if tagIds != "" {
|
|
|
|
+ tags := strings.Split(tagIds, ",")
|
|
|
|
+ for _, tagIdStr := range tags {
|
|
|
|
+ tagId, err := strconv.Atoi(tagIdStr)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "转换失败"
|
|
|
|
+ br.ErrMsg = "tagid转换失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ tagInfo, err := models.GetCygxTagByTagId(tagId)
|
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "GetCygxTagByTagId,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ activityTypes += tagInfo.ActivityTypes + ","
|
|
|
|
+ articleTypes += tagInfo.ArticleTypes + ","
|
|
|
|
+ industries += tagInfo.Industries + ","
|
|
|
|
+ subjectNames += tagInfo.SubjectNames + ","
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ activityTypes = strings.TrimRight(activityTypes,",")
|
|
|
|
+ articleTypes = strings.TrimRight(articleTypes,",")
|
|
|
|
+ industries = strings.TrimRight(industries,",")
|
|
|
|
+ subjectNames = strings.TrimRight(subjectNames,",")
|
|
|
|
+
|
|
|
|
+ articleTypesCond := ``
|
|
|
|
+ if articleTypes != "" {
|
|
|
|
+ articleTypesCond += ` AND art.sub_category_name In (`+ articleTypes +`) `
|
|
|
|
+ }
|
|
|
|
+ //activityTypesCond := ``
|
|
|
|
+ //if activityTypes != "" {
|
|
|
|
+ // activityTypesCond += ` AND sub_category_name In (`+ activityTypes +`) `
|
|
|
|
+ //}
|
|
|
|
+ industriesCond := ``
|
|
|
|
+ if industries != "" {
|
|
|
|
+ industriesCond += ` AND im.industry_name In (`+ industries +`) `
|
|
|
|
+ }
|
|
|
|
+ subjectNamesCond := ``
|
|
|
|
+ if subjectNames != "" {
|
|
|
|
+ subjectNamesCond += ` AND is.subject_name In (`+ subjectNames +`) `
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ articleIntIds, err := models.GetCygxCygxArticleListByCondition(articleTypesCond, industriesCond, subjectNamesCond)
|
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ condition += ` OR (source = 'article' AND source_id IN (` + articleIntIds + `) `
|
|
|
|
+
|
|
//查询近一个月的数据
|
|
//查询近一个月的数据
|
|
conditionInit = " AND publish_date > '" + time.Now().AddDate(0, 0, -30).Format(utils.FormatDateTime) + "'"
|
|
conditionInit = " AND publish_date > '" + time.Now().AddDate(0, 0, -30).Format(utils.FormatDateTime) + "'"
|
|
//conditionInit += ` AND source IN ('newchart')`
|
|
//conditionInit += ` AND source IN ('newchart')`
|
|
@@ -335,7 +391,7 @@ func (this *MobileHomeController) NewList() {
|
|
pars = append(pars, activityspecialIds)
|
|
pars = append(pars, activityspecialIds)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- total, err := models.GetResourceDataCount(condition, pars)
|
|
|
|
|
|
+ total, err = models.GetResourceDataCount(condition, pars)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|