fix 配置时间校验分秒
This commit is contained in:
@@ -9,6 +9,7 @@ using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -75,7 +76,7 @@ public class CanteenSettingService : ICanteenSettingService
|
||||
var result = request.Item switch
|
||||
{
|
||||
//TimeOnly
|
||||
CanteenSettingItemEnumType.BusinessSwitchTime => IsValidFormat<TimeOnly>(value),
|
||||
CanteenSettingItemEnumType.BusinessSwitchTime => IsValidFormat<TimeOnly>(value, request.Item),
|
||||
|
||||
//int
|
||||
CanteenSettingItemEnumType.DayEVoucherUseCountMax => IsValidFormat<int>(value),
|
||||
@@ -88,9 +89,9 @@ public class CanteenSettingService : ICanteenSettingService
|
||||
CanteenSettingItemEnumType.InitBalance => IsValidFormat<decimal>(value),
|
||||
|
||||
//bool
|
||||
CanteenSettingItemEnumType.AllowSendAtMeal => IsValidFormat<bool>(value),
|
||||
CanteenSettingItemEnumType.AllowRepeatInOneShift => IsValidFormat<bool>(value),
|
||||
CanteenSettingItemEnumType.AllowCrossTenant => IsValidFormat<bool>(value),
|
||||
CanteenSettingItemEnumType.AllowSendAtMeal => IsValidFormat<bool>(value, request.Item),
|
||||
CanteenSettingItemEnumType.AllowRepeatInOneShift => IsValidFormat<bool>(value,request.Item),
|
||||
CanteenSettingItemEnumType.AllowCrossTenant => IsValidFormat<bool>(value, request.Item),
|
||||
_ => throw new NotImplementedException(),
|
||||
};
|
||||
|
||||
@@ -162,8 +163,29 @@ public class CanteenSettingService : ICanteenSettingService
|
||||
{
|
||||
try
|
||||
{
|
||||
//判断0/1
|
||||
if (type == CanteenSettingItemEnumType.AllowSendAtMeal ||
|
||||
type == CanteenSettingItemEnumType.AllowRepeatInOneShift ||
|
||||
type == CanteenSettingItemEnumType.AllowCrossTenant)
|
||||
{
|
||||
var intvaule = int.Parse(value);
|
||||
if (intvaule == 0 || intvaule == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(type == CanteenSettingItemEnumType.BusinessSwitchTime)
|
||||
{
|
||||
var timeOnly = value.Adapt<TimeOnly>();
|
||||
return timeOnly.Minute == 0 && timeOnly.Second == 0;
|
||||
}
|
||||
//mapster
|
||||
value.Adapt<T>();
|
||||
value.Adapt<T>();
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user