|
@@ -316,64 +316,64 @@ func (this *MobileHomeController) NewList() {
|
|
|
}
|
|
|
//return
|
|
|
//conditionInit += ` AND source IN ('newchart')`
|
|
|
- if user.CompanyId <= 1 {
|
|
|
- condition += " AND source IN ('roadshow','article') "
|
|
|
- startSize = 0
|
|
|
- pageSize = utils.PageSize5
|
|
|
- } else {
|
|
|
- condition += ` AND source NOT IN ('activity','activityspecial','newchart','industrialsourceHz','industrialsourceYx') ` + conditionInit
|
|
|
- //conditionActivity, err := services.GetActivityonditionList(user, "", "", "", "1,2,3", "", 0, 0, "", 0, 1)
|
|
|
- conditionActivity, err := services.ActivityConditioninitSql(user, "", 0)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- conditionActivity += ` AND art.publish_status = 1 `
|
|
|
- var conditionOrder string
|
|
|
- conditionOrder = ` ORDER BY art.activity_time DESC , art.active_state ASC `
|
|
|
- conditionActivity += conditionOrder
|
|
|
- actPageSize := 200
|
|
|
- if tagIds != "" {
|
|
|
- actPageSize = 2000
|
|
|
- }
|
|
|
- listActivity, err := models.GetActivityListHomeNew(conditionActivity, 0, actPageSize)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取可见活动数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
+ //if user.CompanyId <= 1 {
|
|
|
+ // condition += " AND source IN ('roadshow','article','activity') "
|
|
|
+ // startSize = 0
|
|
|
+ // pageSize = utils.PageSize5
|
|
|
+ //} else {
|
|
|
+ condition += ` AND source NOT IN ('activity','activityspecial','newchart','industrialsourceHz','industrialsourceYx') ` + conditionInit
|
|
|
+ //conditionActivity, err := services.GetActivityonditionList(user, "", "", "", "1,2,3", "", 0, 0, "", 0, 1)
|
|
|
+ conditionActivity, err := services.ActivityConditioninitSql(user, "", 0)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ conditionActivity += ` AND art.publish_status = 1 `
|
|
|
+ var conditionOrder string
|
|
|
+ conditionOrder = ` ORDER BY art.activity_time DESC , art.active_state ASC `
|
|
|
+ conditionActivity += conditionOrder
|
|
|
+ actPageSize := 200
|
|
|
+ if tagIds != "" {
|
|
|
+ actPageSize = 2000
|
|
|
+ }
|
|
|
+ listActivity, err := models.GetActivityListHomeNew(conditionActivity, 0, actPageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取可见活动数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- var activityIds []int
|
|
|
- for _, v := range listActivity {
|
|
|
- activityIds = append(activityIds, v.ActivityId)
|
|
|
- }
|
|
|
- lenActivityIds := len(activityIds)
|
|
|
+ var activityIds []int
|
|
|
+ for _, v := range listActivity {
|
|
|
+ activityIds = append(activityIds, v.ActivityId)
|
|
|
+ }
|
|
|
+ lenActivityIds := len(activityIds)
|
|
|
|
|
|
- listActivitySpecial, _, err := services.GetActivitySpecialList(user, 1, 200, "", "", "")
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取专项调研可见权限失败失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
+ listActivitySpecial, _, err := services.GetActivitySpecialList(user, 1, 200, "", "", "")
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取专项调研可见权限失败失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- var activityspecialIds []int
|
|
|
- for _, v := range listActivitySpecial {
|
|
|
- activityspecialIds = append(activityspecialIds, v.ActivityId)
|
|
|
- }
|
|
|
- lenActivityspecialIds := len(activityspecialIds)
|
|
|
+ var activityspecialIds []int
|
|
|
+ for _, v := range listActivitySpecial {
|
|
|
+ activityspecialIds = append(activityspecialIds, v.ActivityId)
|
|
|
+ }
|
|
|
+ lenActivityspecialIds := len(activityspecialIds)
|
|
|
|
|
|
- //if lenActivityIds > 0 && tagIds == "" {
|
|
|
- if lenActivityIds > 0 {
|
|
|
- condition += ` OR ( source = 'activity' AND source_id IN (` + utils.GetOrmInReplace(lenActivityIds) + `) ` + conditionInit + ` ) `
|
|
|
- pars = append(pars, activityIds)
|
|
|
- }
|
|
|
+ //if lenActivityIds > 0 && tagIds == "" {
|
|
|
+ if lenActivityIds > 0 {
|
|
|
+ condition += ` OR ( source = 'activity' AND source_id IN (` + utils.GetOrmInReplace(lenActivityIds) + `) ` + conditionInit + ` ) `
|
|
|
+ pars = append(pars, activityIds)
|
|
|
+ }
|
|
|
|
|
|
- if lenActivityspecialIds > 0 {
|
|
|
- condition += ` OR ( source = 'activityspecial' AND source_id IN (` + utils.GetOrmInReplace(lenActivityspecialIds) + `) ` + conditionInit + ` ) `
|
|
|
- pars = append(pars, activityspecialIds)
|
|
|
- }
|
|
|
+ if lenActivityspecialIds > 0 && user.CompanyId > 1 {
|
|
|
+ condition += ` OR ( source = 'activityspecial' AND source_id IN (` + utils.GetOrmInReplace(lenActivityspecialIds) + `) ` + conditionInit + ` ) `
|
|
|
+ pars = append(pars, activityspecialIds)
|
|
|
}
|
|
|
+ //}
|
|
|
//return
|
|
|
total, err = models.GetResourceDataCount(condition, pars)
|
|
|
if err != nil {
|
|
@@ -382,9 +382,10 @@ func (this *MobileHomeController) NewList() {
|
|
|
return
|
|
|
}
|
|
|
//return
|
|
|
- if user.CompanyId <= 1 {
|
|
|
- total = utils.PageSize5
|
|
|
- }
|
|
|
+ //if user.CompanyId <= 1 {
|
|
|
+ // total = utils.PageSize5
|
|
|
+ //}
|
|
|
+ //fmt.Println(condition)
|
|
|
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
//Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
|