🥕 fix(Core): 去掉移除空格判断逻辑,防止接收不规范数据
This commit is contained in:
parent
07e85a9900
commit
e62b5bd652
@ -81,7 +81,7 @@ public class DictAttribute : ValidationAttribute, ITransient
|
|||||||
// 6. 单选校验
|
// 6. 单选校验
|
||||||
if (!Multiple)
|
if (!Multiple)
|
||||||
{
|
{
|
||||||
var valStr = value?.ToString()?.Trim();
|
var valStr = value?.ToString();
|
||||||
if (string.IsNullOrEmpty(valStr) || !dictHashSet.Contains(valStr))
|
if (string.IsNullOrEmpty(valStr) || !dictHashSet.Contains(valStr))
|
||||||
{
|
{
|
||||||
return new ValidationResult($"提示:{ErrorMessage}|字典【{DictTypeCode}】不包含【{value}】!");
|
return new ValidationResult($"提示:{ErrorMessage}|字典【{DictTypeCode}】不包含【{value}】!");
|
||||||
@ -92,7 +92,7 @@ public class DictAttribute : ValidationAttribute, ITransient
|
|||||||
// 7. 多选校验
|
// 7. 多选校验
|
||||||
if (value is string stringValue)
|
if (value is string stringValue)
|
||||||
{
|
{
|
||||||
var codes = stringValue.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
var codes = stringValue.Split(',');
|
||||||
foreach (var code in codes)
|
foreach (var code in codes)
|
||||||
{
|
{
|
||||||
if (!dictHashSet.Contains(code))
|
if (!dictHashSet.Contains(code))
|
||||||
@ -108,7 +108,7 @@ public class DictAttribute : ValidationAttribute, ITransient
|
|||||||
{
|
{
|
||||||
foreach (var item in listValue)
|
foreach (var item in listValue)
|
||||||
{
|
{
|
||||||
var itemStr = item?.ToString()?.Trim();
|
var itemStr = item?.ToString();
|
||||||
if (string.IsNullOrEmpty(itemStr) || !dictHashSet.Contains(itemStr))
|
if (string.IsNullOrEmpty(itemStr) || !dictHashSet.Contains(itemStr))
|
||||||
{
|
{
|
||||||
return new ValidationResult($"提示:{ErrorMessage}|字典【{DictTypeCode}】不包含【{item}】!");
|
return new ValidationResult($"提示:{ErrorMessage}|字典【{DictTypeCode}】不包含【{item}】!");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user