|
@@ -2,6 +2,7 @@ package controllers
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "fmt"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
"hongze/hongze_cygx/services"
|
|
@@ -564,6 +565,7 @@ func (this *HomeController) ListHomeArtAndChart() {
|
|
|
|
|
|
// @Title 首页/搜索头部导航接口
|
|
|
// @Description 首页/搜索头部导航接口
|
|
|
+// @Param SearchPage query int false "是否为搜索页面"
|
|
|
// @Success 200 {object} models.HomeListResp
|
|
|
// @router /header_tab [get]
|
|
|
func (this *HomeController) HeaderTab() {
|
|
@@ -579,6 +581,7 @@ func (this *HomeController) HeaderTab() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
+ searchPage, _ := this.GetInt("SearchPage")
|
|
|
|
|
|
key := models.HomeHeaderTabConfigCode
|
|
|
conf, e := models.GetConfigByCode(key)
|
|
@@ -599,9 +602,22 @@ func (this *HomeController) HeaderTab() {
|
|
|
br.ErrMsg = "首页头部导航配置值解析失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
+ // 搜索页
|
|
|
+ resp := make([]*models.HomeHeaderTab, 0)
|
|
|
+ if searchPage == 1 {
|
|
|
+ for i := range list {
|
|
|
+ if list[i].Name == "最新" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ list[i].Name = fmt.Sprint("搜", list[i].Name)
|
|
|
+ resp = append(resp, list[i])
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ resp = list
|
|
|
+ }
|
|
|
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|
|
|
- br.Data = list
|
|
|
+ br.Data = resp
|
|
|
}
|