|
@@ -37,19 +37,21 @@ func (this *ReportSelectionController) Detail() {
|
|
|
//uid := user.UserId
|
|
|
articleId, _ := this.GetInt("ArticleId")
|
|
|
isBestNew, _ := this.GetBool("IsBestNew")
|
|
|
- isBestNew = true
|
|
|
- if isBestNew {
|
|
|
- tbdb := "cygx_report_selection"
|
|
|
- condition := ` AND publish_status = 1 `
|
|
|
- var pars []interface{}
|
|
|
- list, err := models.GetReportSelectionListPublic(condition, "1", tbdb, pars, 0, 1)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- for _, v := range list {
|
|
|
- articleId = v.ArticleId
|
|
|
+ if articleId == 0 {
|
|
|
+ isBestNew = true
|
|
|
+ if isBestNew {
|
|
|
+ tbdb := "cygx_report_selection"
|
|
|
+ condition := ` AND publish_status = 1 `
|
|
|
+ var pars []interface{}
|
|
|
+ list, err := models.GetReportSelectionListPublic(condition, "1", tbdb, pars, 0, 1)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range list {
|
|
|
+ articleId = v.ArticleId
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if articleId < 1 {
|
|
@@ -327,7 +329,7 @@ func (this *ReportSelectionController) List() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
- resp := new(models.GetCygxProductInteriorResp)
|
|
|
+ resp := new(models.CygxReportSelectionListPublicRep)
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
|
|
@@ -341,22 +343,46 @@ func (this *ReportSelectionController) List() {
|
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
- condition += ` AND art.status = 1 `
|
|
|
- total, err := models.GetCygxProductInteriorCount(condition, pars)
|
|
|
+ condition += ` AND art.publish_status = 1 AND article_id >= 16 `
|
|
|
+ total, err := models.GetCygxReportSelectionCount(condition, pars)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- condition += " ORDER BY art.publish_time DESC , art.product_interior_id DESC "
|
|
|
- list, err := models.GetCygxProductInteriorList(condition, pars, startSize, pageSize)
|
|
|
+ condition += " ORDER BY art.publish_date DESC "
|
|
|
+ list, err := models.GetReportSelectionList(condition, pars, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ var articleIdArr []int
|
|
|
+ for _, v := range list {
|
|
|
+ v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
|
|
|
+ articleIdArr = append(articleIdArr, v.ArticleId)
|
|
|
+ }
|
|
|
+
|
|
|
+ lenarticleIdArr := len(articleIdArr)
|
|
|
+ maplabel := make(map[int]string)
|
|
|
+ if lenarticleIdArr > 0 {
|
|
|
+ condition = ""
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+ condition = ` AND is_new = 1 AND article_id IN (` + utils.GetOrmInReplace(lenarticleIdArr) + `)`
|
|
|
+ pars = append(pars, articleIdArr)
|
|
|
+ listLog, err := models.GetCygxReportSelectionLog(condition, pars, 0, 9999)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,GetCygxReportSelectionLogErr:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listLog {
|
|
|
+ maplabel[v.ArticleId] += v.SubjectName + ","
|
|
|
+ }
|
|
|
+ }
|
|
|
for _, v := range list {
|
|
|
- v.PublishTime = utils.TimeRemoveHms(v.PublishTime)
|
|
|
+ v.SubjectName = strings.TrimRight(maplabel[v.ArticleId], ",")
|
|
|
}
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
resp.List = list
|