|
@@ -200,20 +200,23 @@ func GetPushReportListByClassifyIds(classifyFirstIds, classifySecondIds, classif
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetPushReportCount(classifyIds []int) (count int, err error) {
|
|
|
+func GetPushReportCount(classifyIds []int, dateCondition string) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := ` SELECT COUNT(*) AS count FROM report_push_status WHERE state=1 AND report_type=1 `
|
|
|
var pars []interface{}
|
|
|
if len(classifyIds) > 0 {
|
|
|
- sql += " AND (classify_id_first IN (%s) OR classify_id_second IN (%s) OR classify_id_third IN (%s))"
|
|
|
+ sql += ` AND (classify_id_first IN (%s) OR classify_id_second IN (%s) OR classify_id_third IN (%s)) `
|
|
|
sql = fmt.Sprintf(sql, utils.GetOrmReplaceHolder(len(classifyIds)), utils.GetOrmReplaceHolder(len(classifyIds)), utils.GetOrmReplaceHolder(len(classifyIds)))
|
|
|
pars = append(pars, classifyIds, classifyIds, classifyIds)
|
|
|
}
|
|
|
+ if dateCondition != "" {
|
|
|
+ sql += dateCondition
|
|
|
+ }
|
|
|
err = o.Raw(sql, pars...).QueryRow(&count)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetPushReportListByPage(classifyIds []int, startSize, pageSize int) (items []*ReportPushView, err error) {
|
|
|
+func GetPushReportListByPage(classifyIds []int, dateCondition string, startSize, pageSize int) (items []*ReportPushView, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := ` SELECT * FROM report_push_status WHERE state=1 AND report_type=1 `
|
|
|
var pars []interface{}
|
|
@@ -222,6 +225,9 @@ func GetPushReportListByPage(classifyIds []int, startSize, pageSize int) (items
|
|
|
sql = fmt.Sprintf(sql, utils.GetOrmReplaceHolder(len(classifyIds)), utils.GetOrmReplaceHolder(len(classifyIds)), utils.GetOrmReplaceHolder(len(classifyIds)))
|
|
|
pars = append(pars, classifyIds, classifyIds, classifyIds)
|
|
|
}
|
|
|
+ if dateCondition != "" {
|
|
|
+ sql += dateCondition
|
|
|
+ }
|
|
|
sql += ` ORDER BY publish_time DESC LIMIT ?,? `
|
|
|
_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
return
|