Explorar o código

Merge branch 'bzq/dev' of eta_mini/eta_mini_crm into debug

baoziqiang hai 6 meses
pai
achega
baaf894297
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      models/report_pdf.go

+ 3 - 3
models/report_pdf.go

@@ -95,7 +95,7 @@ func (r *ReportPdf) ToView() (item *ReportPdfView) {
 func (r *ReportPdf) Update(cols []string) (err error) {
 	reportPushStatus := new(ReportPushStatus)
 	o := orm.NewOrm()
-	sql := `SELECT * FROM report_pdf WHERE report_pdf_id=? AND report_type=?`
+	sql := `SELECT * FROM report_push_status WHERE report_id=? AND report_type=?`
 	err = o.Raw(sql, r.ReportPdfId, utils.ReportTypePdf).QueryRow(&reportPushStatus)
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		return
@@ -117,7 +117,7 @@ func (r *ReportPdf) Update(cols []string) (err error) {
 	if err != nil {
 		return
 	}
-	if (reportPushStatus == nil || err.Error() == utils.ErrNoRow()) && r.State == utils.ReportStatusUp {
+	if reportPushStatus == nil && r.State == utils.ReportStatusUp {
 		insertPushStatus := &ReportPushStatus{
 			ReportId:           r.ReportPdfId,
 			State:              0,
@@ -137,7 +137,7 @@ func (r *ReportPdf) Update(cols []string) (err error) {
 			ModifyTime:         time.Now(),
 		}
 		_, err = tx.Insert(insertPushStatus)
-	} else if reportPushStatus != nil || err.Error() != utils.ErrNoRow() {
+	} else if reportPushStatus != nil {
 		// pdf报告发布后编辑,则更新report_push_status表, 若取消发布,则在推送表中删除
 		if r.State == utils.ReportStatusDown {
 			err = reportPushStatus.Delete()