Explorar o código

fix:帮助文档编辑页面发布失效

zqbao hai 6 meses
pai
achega
88ae329136
Modificáronse 1 ficheiros con 13 adicións e 1 borrados
  1. 13 1
      controllers/help_doc/doc.go

+ 13 - 1
controllers/help_doc/doc.go

@@ -3,7 +3,6 @@ package help_doc
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hz_crm_api/controllers"
 	"hongze/hz_crm_api/models"
 	"hongze/hz_crm_api/models/help_doc"
@@ -12,6 +11,8 @@ import (
 	"strconv"
 	"strings"
 	"time"
+
+	"github.com/rdlucklib/rdluck_tools/paging"
 )
 
 // HelpDocController 帮助文档
@@ -87,6 +88,17 @@ func (this *HelpDocController) Add() {
 	if req.Status == 2 {
 		item.PublishTime = time.Now()
 	}
+	if req.Id > 0 {
+		tmpHelpDoc, err := help_doc.GetHelpDocById(int(req.Id))
+		if err != nil {
+			br.Msg = "保存失败"
+			br.ErrMsg = "查询帮助文档失败,Err:" + err.Error()
+			return
+		}
+		if tmpHelpDoc.Status != req.Status {
+			req.IsChange = true
+		}
+	}
 
 	if req.Id == 0 {
 		id, e := help_doc.AddHelpDoc(item)