Browse Source

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

# Conflicts:
#	controllers/chart.go
Roc 2 years ago
parent
commit
12fb0a04b7
2 changed files with 24 additions and 0 deletions
  1. 23 0
      controllers/chart.go
  2. 1 0
      models/chart.go

+ 23 - 0
controllers/chart.go

@@ -175,6 +175,7 @@ func (this *ChartController) ChartInfoDetail() {
 	//	item.EdbType = v.EdbType
 	//	item.LeadValue = v.LeadValue
 	//	item.LeadUnit = v.LeadUnit
+	//	item.LeadUnitEn = GetLeadUnitEn(v.LeadUnit)
 	//	item.ChartStyle = v.ChartStyle
 	//	item.ChartColor = v.ChartColor
 	//	item.ChartWidth = v.ChartWidth
@@ -407,3 +408,25 @@ func GetFrequencyEn(frequency string) (frequencyEn string) {
 	}
 	return
 }
+
+func GetLeadUnitEn(unit string) (unitEn string) {
+	switch unit {
+	case "天":
+		unitEn = "day"
+		return
+	case "周":
+		unitEn = "week"
+		return
+	case "月":
+		unitEn = "month"
+		return
+	case "季":
+		unitEn = "quarter"
+		return
+	case "年":
+		unitEn = "year"
+		return
+	}
+	return
+}
+

+ 1 - 0
models/chart.go

@@ -64,6 +64,7 @@ type ChartEdbInfoMapping struct {
 	EdbType     int     `description:"指标类型:1:基础指标,2:计算指标"`
 	LeadValue   int     `description:"领先值"`
 	LeadUnit    string  `description:"领先单位"`
+	LeadUnitEn  string  `description:"领先英文单位"`
 	ChartStyle  string  `description:"图表类型"`
 	ChartColor  string  `description:"颜色"`
 	ChartWidth  float64 `description:"线条大小"`