hsun преди 2 години
родител
ревизия
9925d0689c
променени са 2 файла, в които са добавени 79 реда и са изтрити 1 реда
  1. 17 1
      controllers/home.go
  2. 62 0
      services/micro_roadshow.go

+ 17 - 1
controllers/home.go

@@ -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
 }

+ 62 - 0
services/micro_roadshow.go

@@ -0,0 +1,62 @@
+package services
+
+import (
+	"errors"
+	"sync"
+)
+
+type MicroRoadShowPageList struct {
+	Title          string `description:"标题"`
+	ResourceUrl    string `description:"链接"`
+	Type           int    `description:"类型: 1-音频; 2-视频"`
+	PublishTime    string `description:"发布时间"`
+	BackgroundImg  string `description:"背景图"`
+	PermissionName string `description:"行业名称"`
+	PlaySeconds    string `description:"音视频时长"`
+}
+
+// GetMicroRoadShowPageList 获取微路演列表
+func GetMicroRoadShowPageList(keywords string) (err error) {
+	// 根据
+
+	var e error
+	//audioList := make([]*MicroRoadShowPageList, 0)
+	//videoList := make([]*MicroRoadShowPageList, 0)
+
+	wg := sync.WaitGroup{}
+
+	wg.Add(2)
+
+	// 分页查询音频
+	go func() {
+		defer wg.Done()
+		// TODO: 查询音频
+
+	}()
+
+	// 分页查询视频
+	go func() {
+		defer wg.Done()
+		// TODO: 查询视频
+
+	}()
+
+	wg.Wait()
+
+	if e != nil {
+		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
+		return
+	}
+
+	// 按比例组合列表
+
+	return
+}
+
+func GetMicroRoadShowAudioPageList() {
+
+}
+
+func GetMicroRoadShowVideoPageList() {
+
+}