Pārlūkot izejas kodu

fix:批量推送bug

zqbao 7 mēneši atpakaļ
vecāks
revīzija
51bce0df6b
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      models/report_push_status.go

+ 6 - 0
models/report_push_status.go

@@ -162,6 +162,9 @@ func GetReportCountByCondition(condition string, pars []interface{}) (count int,
 
 // BatchPushReport 批量推送报告
 func BatchPushReport(reportId []int) (err error) {
+	if len(reportId) == 0 {
+		return
+	}
 	o := orm.NewOrm()
 	sql := `UPDATE report_push_status SET state=1, push_time=NOW() WHERE report_id IN (` + utils.GetOrmReplaceHolder(len(reportId)) + `)`
 	_, err = o.Raw(sql, reportId).Exec()
@@ -170,6 +173,9 @@ func BatchPushReport(reportId []int) (err error) {
 
 // BatchPushCancelReport 批量撤销推送报告
 func BatchPushCancelReport(reportId []int) (err error) {
+	if len(reportId) == 0 {
+		return
+	}
 	o := orm.NewOrm()
 	sql := `UPDATE report_push_status SET state=0, modify_time=NOW() WHERE report_id IN (` + utils.GetOrmReplaceHolder(len(reportId)) + `)`
 	_, err = o.Raw(sql, reportId).Exec()