|
@@ -1,6 +1,7 @@
|
|
package controllers
|
|
package controllers
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "fmt"
|
|
"hongze/hongze_cygx/models"
|
|
"hongze/hongze_cygx/models"
|
|
"hongze/hongze_cygx/services"
|
|
"hongze/hongze_cygx/services"
|
|
"hongze/hongze_cygx/utils"
|
|
"hongze/hongze_cygx/utils"
|
|
@@ -57,22 +58,27 @@ func (this *HomeController) ListHome() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
page = paging.GetPaging(currentIndex, pageSize, total)
|
|
page = paging.GetPaging(currentIndex, pageSize, total)
|
|
- if categoryId == "" {
|
|
|
|
- list := make([]*models.HomeArticle, 0)
|
|
|
|
- resp.List = list
|
|
|
|
- resp.Paging = page
|
|
|
|
- br.Ret = 200
|
|
|
|
- br.Success = true
|
|
|
|
- br.Msg = "获取成功"
|
|
|
|
- br.Data = resp
|
|
|
|
- return
|
|
|
|
|
|
+ //if categoryId == "" {
|
|
|
|
+ // list := make([]*models.HomeArticle, 0)
|
|
|
|
+ // resp.List = list
|
|
|
|
+ // resp.Paging = page
|
|
|
|
+ // br.Ret = 200
|
|
|
|
+ // br.Success = true
|
|
|
|
+ // br.Msg = "获取成功"
|
|
|
|
+ // br.Data = resp
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ if categoryId != "" {
|
|
|
|
+ condition = ` AND category_id IN(` + categoryId + `)`
|
|
|
|
+ condition += ` OR ( category_name = '` + categoryinfo.PermissionName + `' AND publish_status = 1 )`
|
|
|
|
+ } else {
|
|
|
|
+ condition += ` AND category_name = '` + categoryinfo.PermissionName + `'`
|
|
}
|
|
}
|
|
- condition = ` AND category_id IN(` + categoryId + `)`
|
|
|
|
- condition += ` OR ( category_name = '` + categoryinfo.PermissionName + `' AND publish_status = 1 )`
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
condition += ` AND is_summary = 1 `
|
|
condition += ` AND is_summary = 1 `
|
|
//condition = ` AND a.category_id NOT IN (85,71) `
|
|
//condition = ` AND a.category_id NOT IN (85,71) `
|
|
-
|
|
|
|
|
|
+ fmt.Println(condition)
|
|
total, err := models.GetHomeCount(condition, pars)
|
|
total, err := models.GetHomeCount(condition, pars)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取信息失败"
|
|
br.Msg = "获取信息失败"
|