@@ -167,6 +167,38 @@ func (this *ChartInfoController) ChartInfoAdd() {
return
}
+ // 来源字数校验
+ type SourcesFrom struct {
+ Text string `json:"text"`
+ }
+
+ if req.SourcesFrom != "" && len(req.SourcesFrom) > 0 {
+ var sourcesFrom SourcesFrom
+ err = json.Unmarshal([]byte(req.SourcesFrom), &sourcesFrom)
+ if err != nil {
+ return
+ if len(sourcesFrom.Text) > 50 {
+ br.Msg = "字数已达上限!"
+ br.ErrMsg = "来源文本字数已达上限,请修改!"
+ // 说明字数校验
+ if req.Instructions != "" && len(req.Instructions) > 0 {
+ var instructions SourcesFrom
+ err = json.Unmarshal([]byte(req.Instructions), &instructions)
+ if len(instructions.Text) > 100 {
+ br.ErrMsg = "说明文本字数已达上限,请修改!"
chartInfo, err, errMsg, isSendEmail := data.AddChartInfo(req, sysUser.AdminId, sysUser.RealName, this.Lang)
if err != nil {
br.Msg = "保存失败"