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