zwxi há 11 meses atrás
pai
commit
cf8da7997a
2 ficheiros alterados com 18 adições e 5 exclusões
  1. 11 4
      controllers/help_doc/doc.go
  2. 7 1
      models/help_doc/help_doc.go

+ 11 - 4
controllers/help_doc/doc.go

@@ -68,6 +68,10 @@ func (this *HelpDocController) Add() {
 		}
 	}
 
+	var resp help_doc.HelpDocSaveResp
+	resp.HelpDocId = req.Id
+	resp.ModifyTime = time.Now().Format(utils.FormatDateTime)
+
 	item := new(help_doc.HelpDoc)
 	item.ClassifyId = req.ClassifyId
 	item.Title = req.Title
@@ -85,13 +89,16 @@ func (this *HelpDocController) Add() {
 	}
 
 	if req.Id == 0 {
-		_, err = help_doc.AddHelpDoc(item)
-		if err != nil {
+		id, e := help_doc.AddHelpDoc(item)
+		if e != nil {
+			err = e
 			br.Msg = "新增失败"
 			br.ErrMsg = "保存失败,Err:" + err.Error()
 			return
 		}
-	} else {
+		resp.HelpDocId = id
+		resp.ModifyTime = item.ModifyTime.Format(utils.FormatDateTime)
+	} else if req.IsChange {
 		err = help_doc.EditHelpDoc(item, req.Id)
 		if err != nil {
 			br.Msg = "保存失败"
@@ -107,7 +114,7 @@ func (this *HelpDocController) Add() {
 	}
 	br.Ret = 200
 	br.Success = true
-
+	br.Data = resp
 }
 
 // @Title 获取报告详情接口

+ 7 - 1
models/help_doc/help_doc.go

@@ -52,6 +52,7 @@ type AddHelpDocReq struct {
 	Author        string `description:"作者"`
 	Status        int    `description:"状态:1:未发布,2:已发布"`
 	Content       string `description:"内容"`
+	IsChange      bool   `description:"内容是否改变"`
 	AnchorData    []AnchorList
 	RecommendData []RecommendList
 }
@@ -189,4 +190,9 @@ func GetAllHelpDoc() (items []*HelpDocItem, err error) {
 	sql := `SELECT * FROM help_doc `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
-}
+}
+
+type HelpDocSaveResp struct {
+	HelpDocId  int64  `description:"智能研报ID"`
+	ModifyTime string `description:"修改时间"`
+}