Browse Source

fix:报告取消发布后时,报告状态异常

Roc 8 months ago
parent
commit
a23067942f
2 changed files with 4 additions and 5 deletions
  1. 3 4
      controllers/voice.go
  2. 1 1
      models/report.go

+ 3 - 4
controllers/voice.go

@@ -8,7 +8,6 @@ import (
 	"fmt"
 	"github.com/kgiannakakis/mp3duration/src/mp3duration"
 	"github.com/rdlucklib/rdluck_tools/http"
-	"io/ioutil"
 	"os"
 	"path"
 	"strconv"
@@ -42,8 +41,8 @@ func (this *VoiceController) Upload() {
 	}
 	reportId, err := this.GetInt("ReportId")
 	if err != nil {
-		br.Msg = "获取资源信息失败"
-		br.ErrMsg = "获取资源信息失败,Err:" + err.Error()
+		br.Msg = "报告id异常"
+		br.ErrMsg = "报告id异常,Err:" + err.Error()
 		return
 	}
 	reportInfo, err := models.GetReportByReportId(reportId)
@@ -128,7 +127,7 @@ func (this *VoiceController) Upload() {
 		}
 	}
 
-	fileBody, err := ioutil.ReadFile(fpath)
+	fileBody, err := os.ReadFile(fpath)
 	videoSize := len(fileBody)
 	sizeFloat := (float64(videoSize) / float64(1024)) / float64(1024)
 	sizeStr := utils.SubFloatToFloatStr(sizeFloat, 2)

+ 1 - 1
models/report.go

@@ -305,7 +305,7 @@ func PublishCancelReport(reportId, state int, publishTimeNullFlag bool, lastModi
 	} else {
 		sql = ` UPDATE report SET state=?, pre_publish_time=null, pre_msg_send=0,last_modify_admin_id=?,last_modify_admin_name=?,modify_time = NOW() WHERE id =?`
 	}
-	_, err = o.Raw(sql, state, reportId, lastModifyAdminId, lastModifyAdminName).Exec()
+	_, err = o.Raw(sql, state, lastModifyAdminId, lastModifyAdminName, reportId).Exec()
 	return
 }