|
@@ -2,6 +2,7 @@ package cygx
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "fmt"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"github.com/tealeg/xlsx"
|
|
|
"hongze/hz_crm_api/controllers"
|
|
@@ -206,7 +207,7 @@ func (this *YanxuanSpecialController) AuthorList() {
|
|
|
//排序字段以及排序方式处理
|
|
|
var sortStr string
|
|
|
if sortParam != "" && sortType != "" {
|
|
|
- if sortParam == "CreatTime" {
|
|
|
+ if sortParam == "CreateTime" {
|
|
|
if sortType == "asc" {
|
|
|
sortStr = " ORDER BY art.create_time ASC "
|
|
|
} else {
|
|
@@ -229,9 +230,13 @@ func (this *YanxuanSpecialController) AuthorList() {
|
|
|
sortStr = " ORDER BY art.pv DESC "
|
|
|
}
|
|
|
}
|
|
|
+ if sortStr == "" {
|
|
|
+ sortStr = " ORDER BY a.publish_time DESC " // 兼容前端老六乱传字段
|
|
|
+ }
|
|
|
} else {
|
|
|
sortStr = " ORDER BY art.create_time DESC "
|
|
|
}
|
|
|
+ fmt.Println(sortStr)
|
|
|
|
|
|
total, err := cygx.GetYanxuanSpecialAuthorCount(condition, pars)
|
|
|
if err != nil {
|
|
@@ -246,6 +251,17 @@ func (this *YanxuanSpecialController) AuthorList() {
|
|
|
br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ var userIds []int
|
|
|
+
|
|
|
+ for _, v := range list {
|
|
|
+ userIds = append(userIds, v.UserId)
|
|
|
+ }
|
|
|
+ //获取专栏用户最新的一篇文章信息
|
|
|
+ mapNewTime := cygxService.GetBestNewYanxuanSpecialByUserId(userIds)
|
|
|
+ for _, v := range list {
|
|
|
+ v.ArticlePublishTime = mapNewTime[v.UserId]
|
|
|
+ }
|
|
|
resp := new(cygx.GetCygxYanxuanSpecialAuthorItemResp)
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
resp.List = list
|
|
@@ -347,6 +363,9 @@ func (this *YanxuanSpecialController) List() {
|
|
|
sortStr = " ORDER BY a.pv DESC "
|
|
|
}
|
|
|
}
|
|
|
+ if sortStr == "" {
|
|
|
+ sortStr = " ORDER BY a.publish_time DESC " // 兼容前端老六乱传字段
|
|
|
+ }
|
|
|
} else {
|
|
|
sortStr = " ORDER BY a.publish_time DESC "
|
|
|
}
|