hsun 2 жил өмнө
parent
commit
823d9a99cc
1 өөрчлөгдсөн 3 нэмэгдсэн , 3 устгасан
  1. 3 3
      models/report.go

+ 3 - 3
models/report.go

@@ -715,9 +715,9 @@ func GetReportCollectionBillboardList(limit int, pars []interface{}, condition s
 			ac.id,
 			a.article_id,
 			a.title,
-			date_format( a.publish_date, '%Y-%m-%d' ) AS publish_date,
+			date_format(a.publish_date, '%Y-%m-%d') AS publish_date,
 			m.chart_permission_name AS permission_name,
-			a.user_collection_num 
+			COUNT(ac.id) AS collection_num
 		FROM
 			cygx_article AS a
 			INNER JOIN cygx_report_mapping AS m ON m.category_id = a.category_id
@@ -728,7 +728,7 @@ func GetReportCollectionBillboardList(limit int, pars []interface{}, condition s
 	if condition != "" {
 		sql += condition
 	}
-	sql += ` GROUP BY a.article_id ORDER BY a.user_collection_num DESC, ac.id DESC,	a.publish_date DESC`
+	sql += ` GROUP BY a.article_id ORDER BY collection_num DESC, ac.id DESC, a.publish_date DESC`
 	sql += ` LIMIT ?`
 	_, err = o.Raw(sql, pars, limit).QueryRows(&items)
 	return