zoulei 1 year ago
parent
commit
34709f6044

+ 2 - 4
XdCxRhDW.App/CorTools/DetectToolForm.cs

@@ -228,8 +228,7 @@ namespace XdCxRhDW.App.CorTools
             {
                 dto.file1 = HttpHelper.UploadFile(btnFile1.Text, baseUrl + "File/UploadFileAsync");
                 dto.fsHz = double.Parse(tefs.Text) * 1e6;
-                var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
-                var dmcResult = HttpHelper.PostRequest<IEnumerable<DetectResDto>>(baseUrl + "DetectCg/DetectCalc", content);
+                var dmcResult = HttpHelper.PostRequest<IEnumerable<DetectResDto>>(baseUrl + "DetectCg/DetectCalc", dto);
                 if (dmcResult != null)
                 {
                     gridSource.Clear();
@@ -347,10 +346,9 @@ namespace XdCxRhDW.App.CorTools
             gridSource.Clear();
             foreach (var xcitem in xcorrs)
             {
-                var content = new StringContent(JsonConvert.SerializeObject(xcitem), System.Text.Encoding.UTF8, "application/json");
                 try
                 {
-                    var result = HttpHelper.PostRequest<CpuCgResDto>(baseUrl+ "DetectCg/CpuCgCalc", content);
+                    var result = HttpHelper.PostRequest<CpuCgResDto>(baseUrl+ "DetectCg/CpuCgCalc", xcitem);
                     if (result != null)
                     {
                         gridSource.Add(new CafResult()

+ 2 - 4
XdCxRhDW.App/CorTools/XlCalculateForm.cs

@@ -98,8 +98,7 @@ namespace XdCxRhDW.App.CorTools
                     {
                         string url = string.Format("http://{0}:{1}/Api/Xl/CalcMult", IpHelper.GetLocalIp(), settings.HttpPort);
                         var XlCalcMultDto = new XlCalcMultDto() { tleStr = txtTle.Text, start = startTime, end = endTime, spanSeconds = (int)txtSpanSeconds.EditValue };
-                        var content = new StringContent(JsonConvert.SerializeObject(XlCalcMultDto), System.Text.Encoding.UTF8, "application/json");
-                        var ephRes = HttpHelper.PostRequest<List<SatEphDto>>(url, content);
+                        var ephRes = HttpHelper.PostRequest<List<SatEphDto>>(url, XlCalcMultDto);
                         list.AddRange(ephRes);
                         gridView.RefreshData();
                     }
@@ -107,8 +106,7 @@ namespace XdCxRhDW.App.CorTools
                     {
                         string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
                         var XlCalcDto = new XlCalcDto() { tleStr = txtTle.Text, dt = Convert.ToDateTime(txtStartTime.EditValue) };
-                        var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
-                        var ephRes = HttpHelper.PostRequest<SatEphDto>(url, content);
+                        var ephRes = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
                         list.Add(ephRes);
                         gridView.RefreshData();
                     }

+ 29 - 10
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -255,10 +255,11 @@ namespace XdCxRhDW.App.UserControl
                 DxHelper.MsgBoxHelper.ShowError("加载任务信息异常");
             }
             gridHomeTask.DataSource = list;
-            gridView1.Columns["TaskName"].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near;
+            gridView1.Columns[nameof(TaskInfo.TaskName)].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near;
             this.svgImageCollection1.Add("Stopped", SvgHelper.CreateCycle("#1E8B58"));
             this.svgImageCollection1.Add("Running", SvgHelper.CreateCycle("#2E8B57"));
             gridView1.CustomDrawCell += GridView1_CustomDrawCell;
+            gridView1.CustomColumnDisplayText += GridView1_CustomColumnDisplayText;
             using (RHDWContext db = new RHDWContext())
             {
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
@@ -297,9 +298,21 @@ namespace XdCxRhDW.App.UserControl
             WaitHelper.CloseForm();
         }
 
+        private void GridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
+        {
+            if (e.Column.FieldName == nameof(TaskInfo.Freq))
+            {
+                e.DisplayText = $"{(long)e.Value / 1e6}MHz";
+            }
+            else if (e.Column.FieldName == nameof(TaskInfo.Band))
+            {
+                e.DisplayText = $"{(int)e.Value / 1e6}MHz";
+            }
+        }
+
         private void GridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
         {
-            if (e.Column.FieldName == "TaskName" && (EnumTaskState)gridView1.GetRowCellValue(e.RowHandle, "TaskState") == EnumTaskState.Running)
+            if (e.Column.FieldName == nameof(TaskInfo.TaskName)&& (EnumTaskState)gridView1.GetRowCellValue(e.RowHandle, nameof(TaskInfo.TaskState)) == EnumTaskState.Running)
             {
                 var palette = SvgPaletteHelper.GetSvgPalette(this.LookAndFeel, ObjectState.Normal);
                 e.Cache.DrawSvgImage(svgImageCollection1[1], new Rectangle(new Point(e.Bounds.X + 4, e.Bounds.Y + (e.Bounds.Height - 16) / 2), new Size(16, 16)), palette);
@@ -330,9 +343,9 @@ namespace XdCxRhDW.App.UserControl
                 toolTipController1.HideHint();
                 return;
             }
-            if (hitInfo.Column.FieldName == "TaskName")
+            if (hitInfo.Column.FieldName == nameof(TaskInfo.TaskName))
             {
-                var state = (EnumTaskState)gridView1.GetRowCellValue(hitInfo.RowHandle, "TaskState");
+                var state = (EnumTaskState)gridView1.GetRowCellValue(hitInfo.RowHandle, nameof(TaskInfo.TaskState));
                 if (state == EnumTaskState.Running)
                     e.Info = new ToolTipControlInfo(hitInfo.RowHandle, "执行中");
             }
@@ -341,7 +354,7 @@ namespace XdCxRhDW.App.UserControl
         private void gridView1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
         {
             if (gridView1.FocusedRowHandle < 0) return;
-            var state = (EnumTaskState)gridView1.GetFocusedRowCellValue("TaskState");
+            var state = (EnumTaskState)gridView1.GetFocusedRowCellValue(nameof(TaskInfo.TaskState));
             btnStart.Enabled = state == EnumTaskState.Stopped;
             btnStop.Enabled = state == EnumTaskState.Running;
             popupMenu1.ShowPopup(MousePosition);
@@ -445,6 +458,12 @@ namespace XdCxRhDW.App.UserControl
                         var find = await db.TaskInfos.Where(p => p.ID == editItem.ID).FirstOrDefaultAsync();
                         find.TaskName = editItem.TaskName;
                         find.PosType = editItem.PosType;
+                        find.UpdateTime = DateTime.Now;
+                        find.Freq = editItem.Freq;
+                        find.Band = editItem.Band;
+                        find.MainSat = editItem.MainSat;
+                        find.Adja1Sat= editItem.Adja1Sat;
+                        find.Adja2Sat= editItem.Adja2Sat;
                         await db.SaveChangesAsync();
                     }
                     gridView1.RefreshData();
@@ -702,29 +721,29 @@ namespace XdCxRhDW.App.UserControl
                     case EnumPosResType.X1D1CX:
                         X1D1GDOPParam x1D1GdopParam = new X1D1GDOPParam(item);
                         x1D1GdopParam.mapControl1 = mapControl1;
-                        DxHelper.PopupHelper.ShowPopup(x1D1GdopParam, mapControl1, mapControl1.Width / 4);
+                        DxHelper.PopupHelper.ShowPopup(x1D1GdopParam, layoutControl1, 400);
                         break;
                     case EnumPosResType.X2D1:
                     case EnumPosResType.X2D1NoRef:
                         X2D1GDOPParam x2D1GdopParam = new X2D1GDOPParam(item);
                         x2D1GdopParam.mapControl1 = mapControl1;
-                        DxHelper.PopupHelper.ShowPopup(x2D1GdopParam, mapControl1, mapControl1.Width / 4);
+                        DxHelper.PopupHelper.ShowPopup(x2D1GdopParam, layoutControl1, 400);
                         break;
                     case EnumPosResType.X3:
                     case EnumPosResType.X3NoRef:
                         X3GDOPParam x3GdopParam = new X3GDOPParam(item);
                         x3GdopParam.mapControl1 = mapControl1;
-                        DxHelper.PopupHelper.ShowPopup(x3GdopParam, mapControl1, mapControl1.Width / 4);
+                        DxHelper.PopupHelper.ShowPopup(x3GdopParam, layoutControl1, 400);
                         break;
                     case EnumPosResType.X3TwoDfo:
                         X3DFGDOPParam x3DFGdopParam = new X3DFGDOPParam(item);
                         x3DFGdopParam.mapControl1 = mapControl1;
-                        DxHelper.PopupHelper.ShowPopup(x3DFGdopParam, mapControl1, mapControl1.Width / 4);
+                        DxHelper.PopupHelper.ShowPopup(x3DFGdopParam, layoutControl1, 400);
                         break;
                     case EnumPosResType.X2Dfo:
                         X2DFGDOPParam x2DFGdopParam = new X2DFGDOPParam(item);
                         x2DFGdopParam.mapControl1 = mapControl1;
-                        DxHelper.PopupHelper.ShowPopup(x2DFGdopParam, mapControl1, mapControl1.Width / 4);
+                        DxHelper.PopupHelper.ShowPopup(x2DFGdopParam, layoutControl1, 400);
                         break;
                     default:
                         break;

+ 26 - 23
XdCxRhDW.Core/HttpHelper.cs

@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using System.Net.Http;
+using System.Security.Policy;
 using System.Text;
 using System.Threading.Tasks;
 using XdCxRhDw.Dto;
@@ -13,38 +14,21 @@ namespace XdCxRhDW.Core
 {
     public class HttpHelper
     {
-        ///// <summary>
-        ///// 
-        ///// </summary>
-        ///// <param name="url"></param>
-        ///// <param name="data"></param>
-        ///// <returns></returns>
-        //public static string PostRequest(string url, HttpContent data)
-        //{
-        //    var handler = new HttpClientHandler() { UseCookies = false };
-        //    HttpClient client = new HttpClient(handler);
-        //    client.Timeout = TimeSpan.FromSeconds(10);
-        //    var message = new HttpRequestMessage(HttpMethod.Post, url);
-        //    message.Content = data;
-        //    var response = client.SendAsync(message).Result;
-        //    response.EnsureSuccessStatusCode();
-        //    var result = response.Content.ReadAsStringAsync().Result;
-        //    return result;
-        //}
         /// <summary>
         /// 
         /// </summary>
         /// <typeparam name="T"></typeparam>
         /// <param name="url"></param>
-        /// <param name="data"></param>
+        /// <param name="dto">dto对象</param>
         /// <returns></returns>
-        public static T PostRequest<T>(string url, HttpContent data)
+        public static T PostRequest<T>(string url, object dto)
         {
+            var content = new StringContent(JsonConvert.SerializeObject(dto), System.Text.Encoding.UTF8, "application/json");
             var handler = new HttpClientHandler() { UseCookies = false };
             HttpClient client = new HttpClient(handler);
             client.Timeout = TimeSpan.FromSeconds(20);
             var message = new HttpRequestMessage(HttpMethod.Post, url);
-            message.Content = data;
+            message.Content = content;
 
             var response = client.SendAsync(message).Result;
             response.EnsureSuccessStatusCode();
@@ -59,6 +43,8 @@ namespace XdCxRhDW.Core
                 throw new Exception(AjaxResult.msg);
             }
         }
+
+
         public static string UploadFile(string localFile, string uploadUrl)
         {
             try
@@ -68,8 +54,25 @@ namespace XdCxRhDW.Core
                 MultipartFormDataContent content = new MultipartFormDataContent();
                 ByteArrayContent fileContent = new ByteArrayContent(fileBytes);
                 content.Add(fileContent, "file", Path.GetFileName(localFile));
-                var filedto = HttpHelper.PostRequest<FileUploadResDto>(uploadUrl, content);
-                return filedto.FileName;
+
+                var handler = new HttpClientHandler() { UseCookies = false };
+                HttpClient client = new HttpClient(handler);
+                client.Timeout = TimeSpan.FromSeconds(20);
+                var message = new HttpRequestMessage(HttpMethod.Post, uploadUrl);
+                message.Content = content;
+
+                var response = client.SendAsync(message).Result;
+                response.EnsureSuccessStatusCode();
+                var result = response.Content.ReadAsStringAsync().Result;
+                var AjaxResult = JsonConvert.DeserializeObject<AjaxResult<FileUploadResDto>>(result);
+                if (AjaxResult.code == 200)
+                {
+                    return AjaxResult.data.FileName;
+                }
+                else
+                {
+                    throw new Exception(AjaxResult.msg);
+                }
             }
             catch
             {

+ 2 - 2
XdCxRhDW.Repostory/Model/TaskInfo.cs

@@ -32,10 +32,10 @@ namespace XdCxRhDW.Repostory.Model
         [Display(Name = "邻星2", AutoGenerateField = false)]
         public int? Adja2Sat { get; set; }
 
-        [Display(Name = "上行频点(Hz)")]
+        [Display(Name = "上行频点")]
         public long Freq { get; set; }
 
-        [Display(Name = "信号带宽(Hz)")]
+        [Display(Name = "信号带宽")]
         public int Band { get; set; }
 
     }

+ 21 - 1
XdCxRhDW.WebApi/Controllers/BaseController.cs

@@ -3,6 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.Configuration;
 using System.Diagnostics;
+using System.IO;
 using System.Linq;
 using System.Net.Http;
 using System.Text;
@@ -18,7 +19,26 @@ namespace XdCxRhDW.WebApi.Controllers
     /// </summary>
     [RoutePrefix("")]
     public class BaseController : ApiController
-    { 
+    {
+        private readonly string uploadFolder;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public BaseController()
+        {
+            this.uploadFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot");
+        }
+
+        /// <summary>
+        /// 返回本地文件
+        /// </summary>
+        /// <param name="fileName"></param>
+        /// <returns></returns>
+        protected string GetLocalFile(string fileName)
+        {
+            return Path.Combine(this.uploadFolder, fileName);
+        }
         /// <summary>
         /// 返回成功
         /// </summary>

+ 3 - 88
XdCxRhDW.WebApi/Controllers/DetectCgController.cs

@@ -19,16 +19,6 @@ namespace XdCxRhDW.WebApi.Controllers
     /// </summary>
     public class DetectCgController : BaseController
     {
-        private readonly string uploadFolder;
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public DetectCgController()
-        {
-            this.uploadFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot");
-        }
-
         /// <summary>
         /// CPU参估计算
         /// </summary>
@@ -38,14 +28,8 @@ namespace XdCxRhDW.WebApi.Controllers
         [CustomValidation(typeof(CpuCgDto), "Validate")]
         public async Task<AjaxResult<CpuCgResDto>> CpuCgCalc(CpuCgDto dto)
         {
-            dto.file1 = Path.Combine(uploadFolder, dto.file1);
-            dto.file2 = Path.Combine(uploadFolder, dto.file2);
-            var vpres = ValidateCalcParam(dto);
-            if (!vpres.Item1)
-            {
-                Serilog.Log.Warning(vpres.Item2);
-                return Error<CpuCgResDto>(vpres.Item2);
-            }
+            dto.file1 = GetLocalFile(dto.file1);
+            dto.file2 = GetLocalFile(dto.file2);
             XcorrStruct xItem = new XcorrStruct();
             xItem.file1 = dto.file1;
             xItem.file2 = dto.file2;
@@ -126,14 +110,7 @@ namespace XdCxRhDW.WebApi.Controllers
         [HttpPost]
         public async Task<AjaxResult<IEnumerable<DetectResDto>>> DetectCalc(DetectDto dto)
         {
-            var token = Request.GetCorrelationId().ToString();
-            dto.file1 = Path.Combine(uploadFolder, dto.file1);
-            var vpres = ValidateDetectParam(dto);
-            if (!vpres.Item1)
-            {
-                Serilog.Log.Warning(vpres.Item2);
-                return Error<IEnumerable<DetectResDto>>(vpres.Item2);
-            }
+            dto.file1 = GetLocalFile(dto.file1);
             List<DetectResDto> list = new List<DetectResDto>();
             try
             {
@@ -144,7 +121,6 @@ namespace XdCxRhDW.WebApi.Controllers
                     DetectResDto detectRes = new DetectResDto(dmcItem.Start, dmcItem.Length, dmcItem.UserName);
                     detectRes.File1 = dto.file1;
                     detectRes.TimeMs = dmcItem.Times;
-                    detectRes.Token = token;
                     list.Add(detectRes);
 
                 }
@@ -167,66 +143,5 @@ namespace XdCxRhDW.WebApi.Controllers
             return Success<IEnumerable<DetectResDto>>(list);
 
         }
-
-        private (bool, string) ValidateCalcParam(CpuCgDto dto)
-        {
-            if (dto == null)
-            {
-                return (false, "参估计算参数格式错误!");
-            }
-            if (string.IsNullOrEmpty(dto.file1))
-            {
-                return (false, "参估计算参数数据文件[file1]不能为空!");
-            }
-            if (string.IsNullOrEmpty(dto.file2))
-            {
-                return (false, "参估计算参数数据文件[file2]不能为空!");
-            }
-            if (!File.Exists(dto.file1))
-            {
-                return (false, $"参估计算参数数据文件[{Path.GetFileName(dto.file1)}]不存在!");
-            }
-            if (!File.Exists(dto.file2))
-            {
-                return (false, $"参估计算参数数据文件[{Path.GetFileName(dto.file2)}]不存在!");
-            }
-            if (dto.dtRange <= 0)
-            {
-                return (false, "参估计算参数时差范围[dtRange]不能小于等于0!");
-            }
-            if (dto.smpStart < 0)
-            {
-                return (false, "参估计算参数开始样点[smpStart]不能小于0!");
-            }
-            if (dto.smpCount < 0)
-            {
-                return (false, "参估计算参数样点数[smpCount]不能小于0!");
-            }
-            return (true, string.Empty);
-        }
-
-        private (bool, string) ValidateDetectParam(DetectDto dto)
-        {
-            if (dto == null)
-            {
-                return (false, "检测计算参数格式错误!");
-            }
-            if (string.IsNullOrEmpty(dto.file1))
-            {
-                return (false, "检测计算参数数据文件[file1]不能为空!");
-            }
-            if (!File.Exists(dto.file1))
-            {
-                return (false, $"检测计算参数数据文件[{dto.file1}]不存在!");
-            }
-            bool containsValue = Enum.IsDefined(typeof(DmcType), dto.dmcType);
-            if (!containsValue)
-            {
-                return (false, $"检测计算参数[dmcType]检测类型值{dto.dmcType}不存在!");
-            }
-
-            return (true, string.Empty);
-        }
-
     }
 }

+ 18 - 36
XdCxRhDW.WebApi/Controllers/PosController.cs

@@ -128,8 +128,7 @@ namespace XdCxRhDW.App.WebAPI
                 var settings = await db.SysSetings.FirstOrDefaultAsync();
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
                 string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
-                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
-                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -296,12 +295,10 @@ namespace XdCxRhDW.App.WebAPI
                 string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };               
-                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
-                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
-                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, content2);
+                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -463,12 +460,10 @@ namespace XdCxRhDW.App.WebAPI
                 string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
-                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
-                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
-                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, content2);
+                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -641,12 +636,10 @@ namespace XdCxRhDW.App.WebAPI
                 string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
-                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
-                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
-                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, content2);
+                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -834,16 +827,13 @@ namespace XdCxRhDW.App.WebAPI
                 string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
-                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
-                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
-                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, content2);
+                var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
 
                 var XlCalcDto3 = new XlCalcDto() { tleStr = xlInfo3.TwoLine, dt = dto.SigTime };
-                var content3 = new StringContent(JsonConvert.SerializeObject(XlCalcDto3), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, content3);
+                var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto3);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1018,16 +1008,13 @@ namespace XdCxRhDW.App.WebAPI
                 string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
-                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
-                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
-                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, content2);
+                var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
 
                 var XlCalcDto3 = new XlCalcDto() { tleStr = xlInfo3.TwoLine, dt = dto.SigTime };
-                var content3 = new StringContent(JsonConvert.SerializeObject(XlCalcDto3), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, content3);
+                var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto3);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1217,16 +1204,13 @@ namespace XdCxRhDW.App.WebAPI
                 string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
-                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
-                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
-                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, content2);
+                var ephAdja1 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
 
                 var XlCalcDto3 = new XlCalcDto() { tleStr = xlInfo3.TwoLine, dt = dto.SigTime };
-                var content3 = new StringContent(JsonConvert.SerializeObject(XlCalcDto3), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, content3);
+                var ephAdja2 = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto3);
 
 
                 var StationRes = db.StationRes.Add(new StationRes()
@@ -1417,12 +1401,10 @@ namespace XdCxRhDW.App.WebAPI
                 string url = string.Format("http://{0}:{1}/Api/Xl/Calc", IpHelper.GetLocalIp(), settings.HttpPort);
 
                 var XlCalcDto = new XlCalcDto() { tleStr = xlInfo1.TwoLine, dt = dto.SigTime };
-                var content = new StringContent(JsonConvert.SerializeObject(XlCalcDto), System.Text.Encoding.UTF8, "application/json");
-                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, content);
+                var ephMain = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto);
 
                 var XlCalcDto2 = new XlCalcDto() { tleStr = xlInfo2.TwoLine, dt = dto.SigTime };
-                var content2 = new StringContent(JsonConvert.SerializeObject(XlCalcDto2), System.Text.Encoding.UTF8, "application/json");
-                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, content2);
+                var ephAdja = HttpHelper.PostRequest<SatEphDto>(url, XlCalcDto2);
 
                 var StationRes = db.StationRes.Add(new StationRes()
                 {

+ 36 - 5
XdCxRhDW.WebApi/Startup.cs

@@ -35,6 +35,8 @@ using Autofac.Core;
 using Microsoft.Owin.FileSystems;
 using Microsoft.Owin.StaticFiles;
 using System.Threading.Tasks;
+using System.Diagnostics;
+using System.Web.Http.Controllers;
 
 [assembly: OwinStartup(typeof(XdCxRhDW.WebApi.Startup))]
 
@@ -54,7 +56,7 @@ namespace XdCxRhDW.WebApi
             //启用目录浏览和静态文件
             Directory.CreateDirectory("wwwroot");
             var physicalFileSystem = new PhysicalFileSystem(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot"));//目录浏览物理地址
-           
+
             var options = new FileServerOptions
             {
                 RequestPath = new PathString("/wwwroot"),//目录浏览地址
@@ -70,8 +72,10 @@ namespace XdCxRhDW.WebApi
             IEnumerable<ModelValidatorProvider> modelValidatorProviders = config.Services.GetModelValidatorProviders();
             DataAnnotationsModelValidatorProvider provider = (DataAnnotationsModelValidatorProvider)
                     modelValidatorProviders.Single(x => x is DataAnnotationsModelValidatorProvider);
-            provider.RegisterDefaultValidatableObjectAdapter(typeof(CustomModelValidator));
 
+            //var provider2 = (DataMemberModelValidatorProvider)
+            //  modelValidatorProviders.Single(x => x is DataMemberModelValidatorProvider);
+            provider.RegisterDefaultValidatableObjectAdapter(typeof(CustomModelValidator));
             JsonSerializerSettings setting = new JsonSerializerSettings()
             {
                 //日期类型默认格式化处理
@@ -94,6 +98,7 @@ namespace XdCxRhDW.WebApi
             config.Formatters.Remove(config.Formatters.XmlFormatter);
 
             config.Filters.Add(new HandlerErrorAttribute());
+            config.Filters.Add(new ValidateFilter());
 
             //config.Routes.MapHttpRoute("DefaultApiWithId", "Api/{controller}/{id}", new { id = RouteParameter.Optional }, new { id = @"\d+" });
             config.Routes.MapHttpRoute("DefaultApiWithAction", "Api/{controller}/{action}");
@@ -179,6 +184,30 @@ namespace XdCxRhDW.WebApi
                 }
             }
         }
+        class ValidateFilter : IActionFilter
+        {
+            public bool AllowMultiple { get; }
+
+            public Task<HttpResponseMessage> ExecuteActionFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation)
+            {
+                if (!actionContext.ModelState.IsValid)
+                {
+                    return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)
+                    {
+                        Content = new StringContent(
+                        JsonConvert.SerializeObject(
+                        new AjaxResult
+                        {
+                            code = 0,
+                            data = null,
+                            msg = actionContext.ModelState.Values?.Last()?.Errors?.Last()?.ErrorMessage
+                        }), Encoding.UTF8, "application/json")
+                    });
+                }
+                return continuation();
+
+            }
+        }
         class HandlerErrorAttribute : ExceptionFilterAttribute
         {
             /// <summary>
@@ -205,7 +234,7 @@ namespace XdCxRhDW.WebApi
                         code = 0,
                         data = null,
                         msg = msg
-                    }), Encoding.UTF8, "text/json")
+                    }), Encoding.UTF8, "application/json")
                 });
             }
         };
@@ -425,7 +454,7 @@ namespace XdCxRhDW.WebApi
             return string.Join(",", list);
         }
     }
-    public class CustomModelValidator : ModelValidator
+    class CustomModelValidator : ModelValidator
     {
         public CustomModelValidator(IEnumerable<ModelValidatorProvider> modelValidatorProviders) : base(modelValidatorProviders)
         {
@@ -436,7 +465,7 @@ namespace XdCxRhDW.WebApi
         {
             if (metadata.IsComplexType && metadata.Model == null)
             {
-                return new List<ModelValidationResult> { new ModelValidationResult { MemberName = metadata.GetDisplayName(), Message = "请求参数对象不能为空" } };
+                return new List<ModelValidationResult> { new ModelValidationResult { MemberName = metadata.GetDisplayName(), Message = "请求参数对象不能为空" } };
             }
 
             if (typeof(IValidatableObject).IsAssignableFrom(metadata.ModelType))
@@ -447,6 +476,7 @@ namespace XdCxRhDW.WebApi
                     var modelValidationResults = new List<ModelValidationResult>();
                     foreach (var result in validationResult)
                     {
+                        if (result == null) continue;
                         modelValidationResults.Add(new ModelValidationResult
                         {
                             MemberName = string.Join(",", result.MemberNames),
@@ -462,4 +492,5 @@ namespace XdCxRhDW.WebApi
             return GetModelValidator(ValidatorProviders).Validate(metadata, container);
         }
     }
+
 }

+ 50 - 0
XdCxRhDw.Dto/Attribute/FileMustExistAttribute.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDw.Dto.Attribute
+{
+    /// <summary>
+    /// 文件存在性验证,会验证本地文件是否存在
+    /// </summary>
+    public class FileMustExistAttribute : ValidationAttribute
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public FileMustExistAttribute()
+        {
+        }
+        /// <summary>
+        /// 文件验证
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public override bool IsValid(object value)
+        {
+            if (value.GetType() != typeof(string))
+            {
+                throw new Exception($"{nameof(FileMustExistAttribute)}只能用于string类型!");
+            }
+            string fileName = value.ToString();
+            if(string.IsNullOrWhiteSpace(fileName) ) 
+            {
+                ErrorMessage= "字段 {0} 值不能为空";
+                return false;
+            }
+            if (fileName.Contains("\\") || fileName.Contains("/"))
+            {
+                ErrorMessage = $"文件[{value}]格式错误,必须是上传后返回的名称";
+                return false;
+            }
+            ErrorMessage = $"文件[{value}]不存在,请先上传";
+            string localFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", fileName);
+            return File.Exists(localFile);
+        }
+    }
+}

+ 63 - 0
XdCxRhDw.Dto/Attribute/Pow2Attribute.cs

@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDw.Dto.Attribute
+{
+    /// <summary>
+    /// 2的N次方限制
+    /// </summary>
+    public class Pow2Attribute : ValidationAttribute
+    {
+        /// <summary>
+        /// 是否包含零,默认不包含
+        /// </summary>
+        public bool IncludeZero { get; set; } = false;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public Pow2Attribute()
+        {
+        }
+        /// <summary>
+        /// 2的N次方验证
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public override bool IsValid(object value)
+        {
+            ErrorMessage = "字段 {0} 必须是2的N次方";
+            if (IncludeZero)
+            {
+                ErrorMessage += "或者0";
+            }
+            if (value.GetType() == typeof(double))
+            {
+                double val = (double)value;
+                int ivalue = (int)val;
+                return IsPow2(ivalue);
+            }
+            else if (value.GetType() == typeof(int))
+            {
+                int val = (int)value;
+                return IsPow2(val);
+            }
+            else
+            {
+                throw new Exception($"{nameof(Pow2Attribute)}只能用于int或double类型!");
+            }
+
+        }
+
+        private bool IsPow2(int val)
+        {
+            var res = val & (val - 1);
+            return res == 0;
+        }
+    }
+}

+ 243 - 0
XdCxRhDw.Dto/Attribute/RangeAttribute.cs

@@ -0,0 +1,243 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XdCxRhDw.Dto
+{
+    /// <summary>
+    /// int或枚举类型范围限制,默认不包含最小值,包含最大值
+    /// </summary>
+    public class RangeIntAttribute : ValidationAttribute
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public RangeIntAttribute()
+        {
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="min"></param>
+        public RangeIntAttribute(int min)
+        {
+            this.Min = min;
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="min"></param>
+        /// <param name="max"></param>
+        public RangeIntAttribute(int min, int max)
+        {
+            this.Min = min;
+            this.Max = max;
+        }
+        /// <summary>
+        /// 最小值(为Null不会验证最小值)
+        /// </summary>
+        public int? Min { get; set; }
+
+        /// <summary>
+        /// 最大值(为Null不会验证最大值)
+        /// </summary>
+        public int? Max { get; set; }
+
+        /// <summary>
+        /// 是否包含最小值(默认不包含最小值)
+        /// </summary>
+        public bool IncludeMin { get; set; } = false;
+
+        /// <summary>
+        /// 是否包含最大值(默认包含最大值)
+        /// </summary>
+        public bool IncludeMax { get; set; } = true;
+
+        /// <summary>
+        /// Range验证
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public override bool IsValid(object value)
+        {
+            if (value.GetType() != typeof(int) && !value.GetType().IsEnum)
+            {
+                throw new Exception($"{nameof(RangeIntAttribute)}只能用于int或枚举类型!");
+            }
+            var val = (int)value;
+            if (Min == null && Max == null) return true;
+            else if (Min != null && Max != null)
+            {
+
+                if (IncludeMin && IncludeMax)
+                {
+                    ErrorMessage = "字段 {0} 范围" + $"[{Min},{Max}]";
+                    return val >= Min && val <= Max;
+                }
+                else if (IncludeMin && !IncludeMax)
+                {
+                    ErrorMessage = "字段 {0} 范围" + $"[{Min},{Max})";
+                    return val >= Min && val < Max;
+                }
+                else if (!IncludeMin && IncludeMax)
+                {
+                    ErrorMessage = "字段 {0} 范围" + $"({Min},{Max}]";
+                    return val > Min && val <= Max;
+                }
+                else
+                {
+                    ErrorMessage = "字段 {0} 范围" + $"({Min},{Max})";
+                    return val > Min && val < Max;
+                }
+
+            }
+            else if (Min != null && Max == null)
+            {
+                if (IncludeMin)
+                {
+                    ErrorMessage = "字段 {0} 必须大于等于" + $"{Min}";
+                    return val >= Min;
+                }
+                else
+                {
+                    ErrorMessage = "字段 {0} 必须大于" + $"{Min}";
+                    return val > Min;
+                }
+            }
+            else//Min==null&&Max!=null
+            {
+                if (IncludeMax)
+                {
+                    ErrorMessage = "字段 {0} 必须小于等于" + $"{Max}";
+                    return val <= Max;
+                }
+                else
+                {
+                    ErrorMessage = "字段 {0} 必须小于" + $"{Max}";
+                    return val < Max;
+                }
+            }
+        }
+    }
+
+    /// <summary>
+    /// double类型范围限制,默认不包含最小值,包含最大值
+    /// </summary>
+    public class RangeDoubleAttribute : ValidationAttribute
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public RangeDoubleAttribute()
+        {
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="min"></param>
+        public RangeDoubleAttribute(double min)
+        {
+            this.Min = min;
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="min"></param>
+        /// <param name="max"></param>
+        public RangeDoubleAttribute(double min, double max)
+        {
+            this.Min = min;
+            this.Max = max;
+        }
+        /// <summary>
+        /// 最小值(为Null不会验证最小值)
+        /// </summary>
+        public double? Min { get; set; }
+
+        /// <summary>
+        /// 最大值(为Null不会验证最大值)
+        /// </summary>
+        public double? Max { get; set; }
+
+        /// <summary>
+        /// 是否包含最小值(默认不包含最小值)
+        /// </summary>
+        public bool IncludeMin { get; set; } = false;
+
+        /// <summary>
+        /// 是否包含最大值(默认包含最大值)
+        /// </summary>
+        public bool IncludeMax { get; set; } = true;
+
+        /// <summary>
+        /// Range验证
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public override bool IsValid(object value)
+        {
+            if (value.GetType() != typeof(double))
+            {
+                throw new Exception($"{nameof(RangeDoubleAttribute)}只能用于double类型!");
+            }
+            var val = (double)value;
+            if (Min == null && Max == null) return true;
+            else if (Min != null && Max != null)
+            {
+
+                if (IncludeMin && IncludeMax)
+                {
+                    ErrorMessage = "字段 {0} 范围" + $"[{Min},{Max}]";
+                    return val >= Min && val <= Max;
+                }
+                else if (IncludeMin && !IncludeMax)
+                {
+                    ErrorMessage = "字段 {0} 范围" + $"[{Min},{Max})";
+                    return val >= Min && val < Max;
+                }
+                else if (!IncludeMin && IncludeMax)
+                {
+                    ErrorMessage = "字段 {0} 范围" + $"({Min},{Max}]";
+                    return val > Min && val <= Max;
+                }
+                else
+                {
+                    ErrorMessage = "字段 {0} 范围" + $"({Min},{Max})";
+                    return val > Min && val < Max;
+                }
+
+            }
+            else if (Min != null && Max == null)
+            {
+                if (IncludeMin)
+                {
+                    ErrorMessage = "字段 {0} 必须大于等于" + $"{Min}";
+                    return val >= Min;
+                }
+                else
+                {
+                    ErrorMessage = "字段 {0} 必须大于" + $"{Min}";
+                    return val > Min;
+                }
+            }
+            else//Min==null&&Max!=null
+            {
+                if (IncludeMax)
+                {
+                    ErrorMessage = "字段 {0} 必须小于等于" + $"{Max}";
+                    return val <= Max;
+                }
+                else
+                {
+                    ErrorMessage = "字段 {0} 必须小于" + $"{Max}";
+                    return val < Max;
+                }
+            }
+        }
+    }
+}

+ 22 - 2
XdCxRhDw.Dto/CpuCgDto.cs

@@ -2,43 +2,49 @@
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
+using System.IO;
 using System.Linq;
 using System.Runtime.Serialization;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Markup;
+using XdCxRhDw.Dto.Attribute;
 
 namespace XdCxRhDw.Dto
 {
     /// <summary>
     /// CPU参估参数
     /// </summary>
-    public class CpuCgDto
+    public class CpuCgDto : IValidatableObject
     {
         /// <summary>
         /// 上传后返回的文件名
         /// </summary>
+        [FileMustExist]
         public string file1 { get; set; }
 
         /// <summary>
         /// 上传后返回的文件名
         /// </summary>
+        [FileMustExist]
         public string file2 { get; set; }
 
         /// <summary>
         /// 开始样点
         /// </summary>
-        [Range(2, 4)]
+        [RangeInt(0, IncludeMin = true)]
         public int smpStart { get; set; }
 
         /// <summary>
         /// 样点数(0表示文件末尾)
         /// </summary>
+        [RangeInt(0, IncludeMin = true)]
         public int smpCount { get; set; }
 
         /// <summary>
         /// 采样率(Hz)
         /// </summary>
+        [RangeDouble(0, 100e6)]
         public double samplingRate { get; set; }
 
         /// <summary>
@@ -49,17 +55,31 @@ namespace XdCxRhDw.Dto
         /// <summary>
         /// 时差范围(us)
         /// </summary>
+        [RangeDouble(0, 100000)]
         public double dtRange { get; set; }
 
         /// <summary>
         /// 频差范围(单位Hz,默认16384)
         /// </summary>
+        [Pow2]
         public double dfRange { get; set; } = 16384;
 
         /// <summary>
         /// 信噪比门限dB
         /// </summary>
+        [RangeDouble(10, 50, IncludeMin = true)]
         public double snrThreshold { get; set; }
 
+        /// <summary>
+        /// 模型参数自定义验证(复杂的验证逻辑在这里面写)
+        /// </summary>
+        /// <param name="validationContext"></param>
+        /// <returns></returns>
+        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
+        {
+            //if (this.Age<18)
+            //    yield return new ValidationResult("你太年轻了", new[] { nameof(this.Age) });
+            yield return null;
+        }
     }
 }

+ 8 - 4
XdCxRhDw.Dto/DetectDto.cs

@@ -5,27 +5,31 @@ using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using XdCxRhDw.Dto.Attribute;
 
 namespace XdCxRhDw.Dto
 {
-  /// <summary>
-  /// 检测计算DTO
-  /// </summary>
+    /// <summary>
+    /// 检测计算DTO
+    /// </summary>
     public class DetectDto
     {
         /// <summary>
         /// 调用Upload接口上传文件后返回的文件名
         /// </summary>
-        [DefaultValue("hello word!")]
+        [FileMustExist]
         public string file1 { get; set; }
+
         /// <summary>
         /// 检测类型
         /// </summary>
+        [RangeInt(1, 3, IncludeMin = true)]
         public DmcType dmcType { get; set; }
 
         /// <summary>
         /// 采样率 Hz
         /// </summary>
+        [RangeDouble(0, 100e6)]
         public double fsHz { get; set; }
     }
     /// <summary>

+ 0 - 4
XdCxRhDw.Dto/DetectResDto.cs

@@ -53,9 +53,5 @@ namespace XdCxRhDw.Dto
         /// </summary>
         public int TimeMs { get; set; }
 
-        /// <summary>
-        /// 标识
-        /// </summary>
-        public string Token { get; set; }
     }
 }

+ 3 - 0
XdCxRhDw.Dto/XdCxRhDw.Dto.csproj

@@ -47,6 +47,9 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Attribute\FileMustExistAttribute.cs" />
+    <Compile Include="Attribute\Pow2Attribute.cs" />
+    <Compile Include="Attribute\RangeAttribute.cs" />
     <Compile Include="CpuCgDto.cs" />
     <Compile Include="AjaxResult.cs" />
     <Compile Include="FileDownloadDto.cs" />