Browse Source

Merge remote-tracking branch 'origin/master' into debug

Roc 2 weeks ago
parent
commit
bfd1694f42
2 changed files with 16 additions and 5 deletions
  1. 13 4
      controllers/smart_report.go
  2. 3 1
      utils/common.go

+ 13 - 4
controllers/smart_report.go

@@ -174,14 +174,23 @@ func (this *SmartReportController) WechatShareDetail() {
 		return
 	}
 
-	date := strings.Replace(item.CreateTime, "-", "", -1)
-	dateStr := date[4:9]
+	var dateStr string
+	if item.CreateTime != `` {
+		date := strings.Replace(item.CreateTime, "-", "", -1)
+		dateStr = date[4:9]
+	}
 	var shareTitle string
 	// 研报分享抬头
 	if utils.BusinessCode == "E2023080700" || utils.BusinessCode == "E2023080900" || utils.BusinessCode == "E2023080901" {
-		shareTitle = "【第" + strconv.Itoa(item.Stage) + "期|FICC】" + item.Title + "(" + dateStr + ")"
+		shareTitle = "【第" + strconv.Itoa(item.Stage) + "期|FICC】" + item.Title
+		if dateStr != `` {
+			shareTitle += "(" + dateStr + ")"
+		}
 	} else {
-		shareTitle = "【第" + strconv.Itoa(item.Stage) + "期】" + item.Title + "(" + dateStr + ")"
+		shareTitle = "【第" + strconv.Itoa(item.Stage) + "期】" + item.Title
+		if dateStr != `` {
+			shareTitle += "(" + dateStr + ")"
+		}
 	}
 	if v, ok := conf[models.BusinessConfH5ReportShareImg]; ok {
 		resp.H5ReportShareImg = v

+ 3 - 1
utils/common.go

@@ -7,6 +7,7 @@ import (
 	"encoding/hex"
 	"encoding/json"
 	"fmt"
+	"gorm.io/gorm"
 	"image"
 	"image/png"
 	"math"
@@ -201,7 +202,8 @@ func StrListToString(strList []string) (str string) {
 
 // 数据没有记录
 func ErrNoRow() string {
-	return "<QuerySeter> no row found"
+	return gorm.ErrRecordNotFound.Error()
+	//return "<QuerySeter> no row found"
 }
 
 // 校验邮箱格式