|
@@ -21,6 +21,7 @@ import (
|
|
etaTrialService "eta/eta_api/services/eta_trial"
|
|
etaTrialService "eta/eta_api/services/eta_trial"
|
|
"eta/eta_api/utils"
|
|
"eta/eta_api/utils"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "regexp"
|
|
"sort"
|
|
"sort"
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
@@ -6745,13 +6746,25 @@ func (this *EdbInfoController) ChartImageSetBySvg() {
|
|
br.Ret = 408
|
|
br.Ret = 408
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ picType := this.GetString("PicType")
|
|
imgData := this.GetString("Img")
|
|
imgData := this.GetString("Img")
|
|
if imgData == "" {
|
|
if imgData == "" {
|
|
br.Msg = "图片参数错误"
|
|
br.Msg = "图片参数错误"
|
|
br.ErrMsg = "图片参数错误,Img Is Empty"
|
|
br.ErrMsg = "图片参数错误,Img Is Empty"
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if strings.ToLower(picType) == "png" {
|
|
|
|
+ b, _ := regexp.MatchString(`^data:\s*image\/(\w+);base64,`, imgData)
|
|
|
|
+ if !b {
|
|
|
|
+ br.Msg = "图片格式不正确"
|
|
|
|
+ br.ErrMsg = "图片格式不正确"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ re, _ := regexp.Compile(`^data:\s*image\/(\w+);base64,`)
|
|
|
|
+ base64Str := re.ReplaceAllString(imgData, "")
|
|
|
|
+ base64Str = strings.Replace(base64Str, " ", "", -1)
|
|
|
|
+ imgData = base64Str
|
|
|
|
+ }
|
|
edbInfoId, _ := this.GetInt("EdbInfoId", 0)
|
|
edbInfoId, _ := this.GetInt("EdbInfoId", 0)
|
|
if edbInfoId <= 0 {
|
|
if edbInfoId <= 0 {
|
|
br.Msg = "指标参数错误"
|
|
br.Msg = "指标参数错误"
|