fix 移除多余代码
This commit is contained in:
@@ -24,7 +24,7 @@ public class OrderAddRequest : IValidatableObject
|
||||
/// <summary>
|
||||
/// 档案号/QrCode/学工号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "人员档案号/QrCode/学工号不能为空/userId")]
|
||||
[Required(ErrorMessage = "人员档案号/QrCode/学工号/userId 不能为空")]
|
||||
public string UserUniqueNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -33,12 +33,6 @@ public class OrderAddRequest : IValidatableObject
|
||||
[EnumDataType(typeof(BalanceRecordSourceEnumType))]
|
||||
public BalanceRecordSourceEnumType Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 收入/支出
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(BalanceRecordTypeEnumType))]
|
||||
public BalanceRecordTypeEnumType? Type { get; set; } = BalanceRecordTypeEnumType.Out;
|
||||
|
||||
/// <summary>
|
||||
/// 金额
|
||||
/// </summary>
|
||||
@@ -54,8 +48,7 @@ public class OrderAddRequest : IValidatableObject
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
//处理金额
|
||||
Amount = Type == BalanceRecordTypeEnumType.In ? Math.Abs(Amount) : -Math.Abs(Amount);
|
||||
|
||||
Amount = -Math.Abs(Amount);
|
||||
|
||||
//在线就以API时间为准
|
||||
if (!IsOffline)
|
||||
@@ -63,19 +56,9 @@ public class OrderAddRequest : IValidatableObject
|
||||
CostDateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
if (Type == BalanceRecordTypeEnumType.Out)
|
||||
if (DeviceUniqueNo.IsEmpty())
|
||||
{
|
||||
if (DeviceUniqueNo.IsEmpty())
|
||||
{
|
||||
yield return new ValidationResult("设备唯一号不能为空", new[] { nameof(DeviceUniqueNo) });
|
||||
}
|
||||
}
|
||||
else if (Type == BalanceRecordTypeEnumType.In)
|
||||
{
|
||||
//if ((int)Source < (int)BalanceRecordSourceEnumType.Wechat)
|
||||
//{
|
||||
// yield return new ValidationResult($"不支持来源{Source.GetDescription()}", new[] { nameof(Source) });
|
||||
//}
|
||||
yield return new ValidationResult("设备号不能为空", new[] { nameof(DeviceUniqueNo) });
|
||||
}
|
||||
|
||||
yield break;
|
||||
|
||||
Reference in New Issue
Block a user