|
@@ -1,11 +1,11 @@
|
|
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"
|
|
"rdluck_tools/paging"
|
|
"rdluck_tools/paging"
|
|
|
|
+ "strings"
|
|
)
|
|
)
|
|
|
|
|
|
type HomeController struct {
|
|
type HomeController struct {
|
|
@@ -58,28 +58,15 @@ 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 != "" {
|
|
if categoryId != "" {
|
|
condition += ` AND category_id IN(` + categoryId + `)`
|
|
condition += ` AND category_id IN(` + categoryId + `)`
|
|
- condition += ` OR ( category_name = '` + categoryinfo.PermissionName + `' AND publish_status = 1 AND is_summary = 1 )`
|
|
|
|
|
|
+ condition += ` OR ( category_name LIKE '%` + categoryinfo.PermissionName + `%' AND publish_status = 1 AND is_summary = 1 )`
|
|
} else {
|
|
} else {
|
|
- condition += ` AND category_name = '` + categoryinfo.PermissionName + `'`
|
|
|
|
|
|
+ condition += ` AND category_name LIKE '%` + categoryinfo.PermissionName + `%'`
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
//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 = "获取信息失败"
|
|
@@ -97,6 +84,10 @@ func (this *HomeController) ListHome() {
|
|
for i := 0; i < lenList; i++ {
|
|
for i := 0; i < lenList; i++ {
|
|
item := list[i]
|
|
item := list[i]
|
|
list[i].Body, _ = services.GetReportContentTextSub(item.Body)
|
|
list[i].Body, _ = services.GetReportContentTextSub(item.Body)
|
|
|
|
+ list[i].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDateTimeNoSecond) //时间字符串格式转时间格式
|
|
|
|
+ if strings.Contains(item.CategoryName, "研选") {
|
|
|
|
+ list[i].IsResearch = true
|
|
|
|
+ }
|
|
}
|
|
}
|
|
resp.List = list
|
|
resp.List = list
|
|
resp.Paging = page
|
|
resp.Paging = page
|