瀏覽代碼

报告短链拼上标题

hsun 1 周之前
父節點
當前提交
94ae8f1ef1
共有 3 個文件被更改,包括 7 次插入0 次删除
  1. 4 0
      controllers/report.go
  2. 1 0
      models/report.go
  3. 2 0
      services/report_v2.go

+ 4 - 0
controllers/report.go

@@ -2007,6 +2007,10 @@ func (this *ReportController) ShareGenerate() {
 		br.ErrMsg = "参数解析失败, Err: " + e.Error()
 		return
 	}
+	reportItem, _ := models.GetReportByReportId(req.ReportId)
+	if reportItem != nil && reportItem.Title != "" {
+		req.Title = reportItem.Title
+	}
 
 	link, err := services.GetReportShareUrlToken(req, this.SysUser.AdminId)
 	if err != nil || link == "" {

+ 1 - 0
models/report.go

@@ -1846,6 +1846,7 @@ b.classify_id_first = c.classify_id
 type ReportShartUrlReq struct {
 	Url      string `description:"分享链接"`
 	ReportId int    `description:"报告ID"`
+	Title    string `description:"报告标题"`
 }
 
 type ReportShartUrlResp struct {

+ 2 - 0
services/report_v2.go

@@ -1454,6 +1454,8 @@ func GetReportShareUrlToken(req models.ReportShartUrlReq, adminId int) (linkToke
 		}
 		hashUrl := utils.MurmurHash64([]byte(linkToken))
 		linkToken = utils.ConvertNumToBase62(hashUrl)
+		// 拼上报告标题
+		linkToken = fmt.Sprintf("%s %s", linkToken, req.Title)
 
 		ok = utils.Rc.IsExist(utils.CACHE_REPORT_SHARE_ORIGIN_Url + linkToken)
 		if !ok {