|
@@ -49,8 +49,8 @@ func (this *VideoController) TagsList() {
|
|
|
// @Param PageSize query int true "每页数据条数"
|
|
|
// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
// @Param KeyWord query string true "搜索关键词"
|
|
|
-// @Param Tags query string true "标签名称"
|
|
|
// @Param DateType query string true "时间筛选组合:1:近一个月,2:近三个月,3:近半年,4:全部"
|
|
|
+// @Param Tags query string true "标签名称"
|
|
|
// @Success 200 {object} video.VideoListResp
|
|
|
// @router /list [get]
|
|
|
func (this *VideoController) List() {
|
|
@@ -81,7 +81,9 @@ func (this *VideoController) List() {
|
|
|
if company == nil {
|
|
|
status = 1
|
|
|
} else {
|
|
|
- if company.CompanyType == 3 || company.CompanyType == 4 {
|
|
|
+ if company.Status == utils.COMPANY_STATUS_FREEZE ||
|
|
|
+ company.Status == utils.COMPANY_STATUS_LOSE ||
|
|
|
+ company.Status == utils.COMPANY_STATUS_POTENTIAL {
|
|
|
status = 1
|
|
|
}
|
|
|
}
|
|
@@ -89,8 +91,8 @@ func (this *VideoController) List() {
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
keyWord := this.GetString("KeyWord")
|
|
|
- tags := this.GetString("Tags")
|
|
|
dateType, _ := this.GetInt("DateType")
|
|
|
+ tags := this.GetString("Tags")
|
|
|
|
|
|
var startSize int
|
|
|
if pageSize <= 0 {
|
|
@@ -100,11 +102,13 @@ func (this *VideoController) List() {
|
|
|
currentIndex = 1
|
|
|
}
|
|
|
startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
-
|
|
|
+ total := 0
|
|
|
+ resp := new(models.VideoListResp)
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
|
|
|
- if tags != "" {
|
|
|
+ if keyWord != "" {
|
|
|
videoIdStr, err := models.GetVideoIdByKeyWord(keyWord)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
@@ -112,14 +116,32 @@ func (this *VideoController) List() {
|
|
|
return
|
|
|
}
|
|
|
if videoIdStr != "" {
|
|
|
- condition += ` AND a.video_id IN (` + videoIdStr + `) `
|
|
|
+ condition += ` AND (a.video_id IN (` + videoIdStr + `) OR a.title LIKE '%` + keyWord + `%' ) `
|
|
|
+ } else {
|
|
|
+ condition += ` AND (a.title LIKE '%` + keyWord + `%' ) `
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if keyWord != "" {
|
|
|
- condition += ` AND (a.title LIKE '%` + keyWord + `%' ) `
|
|
|
+ if tags != "" {
|
|
|
+ videoIdStr, err := models.GetVideoIdByKeyWord(tags)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if videoIdStr != "" {
|
|
|
+ condition += ` AND a.video_id IN (` + videoIdStr + `) `
|
|
|
+ } else {
|
|
|
+ list := make([]*models.VideoList, 0)
|
|
|
+ resp.List = list
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
publishDate := ""
|
|
|
if dateType == 1 {
|
|
|
publishDate = time.Now().AddDate(0, -1, 0).Format(utils.FormatDate)
|
|
@@ -134,8 +156,6 @@ func (this *VideoController) List() {
|
|
|
condition += ` AND a.publish_time >=? `
|
|
|
pars = append(pars, publishDate)
|
|
|
}
|
|
|
- total := 0
|
|
|
- resp := new(models.VideoListResp)
|
|
|
if status == 0 {
|
|
|
total, err = models.GetVideoListCount(condition, pars)
|
|
|
if err != nil {
|
|
@@ -150,12 +170,16 @@ func (this *VideoController) List() {
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- resp.List = list
|
|
|
+ if len(list) <= 0 {
|
|
|
+ list := make([]*models.VideoList, 0)
|
|
|
+ resp.List = list
|
|
|
+ } else {
|
|
|
+ resp.List = list
|
|
|
+ }
|
|
|
} else {
|
|
|
list := make([]*models.VideoList, 0)
|
|
|
resp.List = list
|
|
|
}
|
|
|
- page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
resp.Paging = page
|
|
|
resp.Status = status
|
|
|
br.Ret = 200
|