zqbao 8 сар өмнө
parent
commit
46c0c97ae8

+ 1 - 1
controllers/user.go

@@ -533,7 +533,7 @@ func (this *UserAuthController) AddReportPdfRecord() {
 			br.ErrMsg = "获取阅读记录失败,Err:" + err.Error()
 			return
 		}
-		if count > 0 {
+		if count > 1 {
 			err = models.UpdateReportPdfPv(req.ReportPdfId)
 			if err != nil {
 				br.Msg = "添加研报阅读记录失败"

+ 1 - 1
models/report_pdf.go

@@ -100,7 +100,7 @@ func UpdateReportPdfPv(id int) (err error) {
 // 更新uv和pv
 func UpdateReportPdfUvAndPv(id int) (err error) {
 	o := orm.NewOrm()
-	sql := `UPDATE report_pdf SET uv = uv + 1 AND pv = pv + 1 WHERE report_pdf_id = ?`
+	sql := `UPDATE report_pdf SET uv = uv + 1, pv = pv + 1 WHERE report_pdf_id = ?`
 	_, err = o.Raw(sql, id).Exec()
 	return
 }