瀏覽代碼

fix:批量推送bug

zqbao 7 月之前
父節點
當前提交
51bce0df6b
共有 1 個文件被更改,包括 6 次插入0 次删除
  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()