From 968e852f1895d1c71434dce404509661fdee8cb2 Mon Sep 17 00:00:00 2001 From: Le Chau Date: Fri, 26 Jun 2020 10:19:33 +0700 Subject: [PATCH] =?UTF-8?q?Th=C3=AAm=20API=20Login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AIParkingApplication/ApiController.cs | 238 +++++++++++++++++++++++++- 1 file changed, 229 insertions(+), 9 deletions(-) diff --git a/AIParkingApplication/ApiController.cs b/AIParkingApplication/ApiController.cs index b3eb64a..032845d 100644 --- a/AIParkingApplication/ApiController.cs +++ b/AIParkingApplication/ApiController.cs @@ -30,21 +30,22 @@ namespace AIParkingApplication } //TODO Old API - public async Task Login(LoginModel loginData) + public async Task Login(LoginModel loginData) { try { HttpResponseMessage response = await httpClient.PostAsJsonAsync("/api/login", loginData); response.EnsureSuccessStatusCode(); - var loginResult = await response.Content.ReadAsAsync(); + var loginResult = await response.Content.ReadAsAsync(); + Console.WriteLine(loginResult.LoginData.StatisticsData.Moto); return loginResult; } catch (Exception ex) { Console.WriteLine($"SendEngineRequest : {ex.Message}"); - return new LoginResponseModel + return new LoginDataModel { - IsLoggedIn = false + IsLoginSuccess = false }; } } @@ -119,6 +120,8 @@ namespace AIParkingApplication } } + + public class ApiPath { [JsonProperty("savelogsin")] //wtf is this from server. @@ -139,11 +142,6 @@ namespace AIParkingApplication } - public class LoginResponseModel - { - [JsonProperty("")] - public bool IsLoggedIn { get; set; } - } public class PlateLogModel { @@ -177,4 +175,226 @@ namespace AIParkingApplication [JsonProperty("frameImage")] public string FrameImageBase64 { get; set; } } + + public class LoginDataModel + { + [JsonProperty("status")] + public bool IsLoginSuccess { get; set; } + + [JsonProperty("data")] + public Data LoginData { get; set; } + } + + public class Data + { + [JsonProperty("userID")] + public int UserID { get; set; } + + [JsonProperty("name")] + public string UserName { get; set; } + + [JsonProperty("configROI")] + public bool IsConfigROI { get; set; } + + [JsonProperty("configSystemLogs")] + public bool IsSaveSystemLogs { get; set; } + + [JsonProperty("api")] + public APIPath APIPath { get; set; } + + [JsonProperty("camera1")] + public CameraData CameraData1 { get; set; } + + [JsonProperty("camera2")] + public CameraData CameraData2 { get; set; } + + [JsonProperty("camera3")] + public CameraData CameraData3 { get; set; } + + [JsonProperty("camera4")] + public CameraData CameraData4 { get; set; } + + [JsonProperty("camera5")] + public CameraData CameraData5 { get; set; } + + [JsonProperty("camera6")] + public CameraData CameraData6 { get; set; } + + [JsonProperty("camera7")] + public CameraData CameraData7 { get; set; } + + [JsonProperty("camera8")] + public CameraData CameraData8 { get; set; } + + [JsonProperty("statistic")] + public Statistics StatisticsData { get; set; } + + [JsonProperty("cascadeConfig")] + public CascadeConfig CascadeConfigData { get; set; } + + [JsonProperty("laneConfig")] + public LaneConfig LaneConfigData { get; set; } + + + } + + public class APIPath + { + [JsonProperty("apiStatistics")] + public APIProperties ApiStatistics { get; set; } + + [JsonProperty("apiPlateRecognize")] + public APIProperties ApiPlateRecognize { get; set; } + + [JsonProperty("apiCheckCard")] + public APIProperties ApiCheckCard { get; set; } + + [JsonProperty("apiSaveLogs")] + public APIProperties ApiSaveLogs { get; set; } + + [JsonProperty("apiUpdateLogs")] + public APIProperties ApiUpdateLogs { get; set; } + + } + + public class APIProperties + { + [JsonProperty("ip")] + public string IP { get; set; } + + [JsonProperty("port")] + public string Port { get; set; } + + [JsonProperty("path")] + public string Path { get; set; } + } + + public class CameraData + { + [JsonProperty("id")] + public int Id { get; set; } + [JsonProperty("gate")] + public int Gate { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + [JsonProperty("type")] + public string Type { get; set; } + [JsonProperty("stream_url")] + public string Stream_url { get; set; } + [JsonProperty("minWidth")] + public double MinWidth { get; set; } + [JsonProperty("maxWidth")] + public double MaxWidth { get; set; } + [JsonProperty("minHeight")] + public double MinHeight { get; set; } + [JsonProperty("maxHeight")] + public double MaxHeight { get; set; } + [JsonProperty("scaleFactor")] + public double ScaleFactor { get; set; } + [JsonProperty("minNeighbors")] + public double MinNeighbors { get; set; } + [JsonProperty("status")] + public double Status { get; set; } + [JsonProperty("isRecognizeCamera")] + public bool IsRecognizeCamera { get; set; } + [JsonProperty("isLongPlate")] + public bool IsLongPlate { get; set; } + [JsonProperty("stt")] + public int Stt { get; set; } + [JsonProperty("roi_config")] + public string Roi_config { get; set; } + [JsonProperty("created_at")] + public int Created_at { get; set; } + [JsonProperty("modified_at")] + public int Modified_at { get; set; } + + + } + + public class Statistics + { + [JsonProperty("moto")] + public string Moto { get; set; } + [JsonProperty("oto")] + public string Oto { get; set; } + [JsonProperty("vip")] + public string Vip { get; set; } + [JsonProperty("total_in")] + public string Total_in { get; set; } + [JsonProperty("total_out")] + public string Total_out { get; set; } + } + + public class CascadeConfig + { + [JsonProperty("minWidthPlate")] + public int MinWidthPlate { get; set; } + + [JsonProperty("maxWidthPlate")] + public int MaxWidthPlate { get; set; } + + [JsonProperty("minHeightPlate")] + public int MinHeightPlate { get; set; } + + [JsonProperty("maxHeightPlate")] + public int MaxHeightPlate { get; set; } + + [JsonProperty("minWidthLongPlate")] + public int MinWidthLongPlate { get; set; } + + [JsonProperty("maxWidthLongPlate")] + public int MaxWidthLongPlate { get; set; } + + [JsonProperty("minHeightLongPlate")] + public int MinHeightLongPlate { get; set; } + + [JsonProperty("maxHeightLongPlate")] + public int MaxHeightLongPlate { get; set; } + + [JsonProperty("scaleFactor")] + public double ScaleFactor { get; set; } + + [JsonProperty("scaleFactorLong")] + public double ScaleFactorLong { get; set; } + + [JsonProperty("minNeighbors")] + public double MinNeighbors { get; set; } + + [JsonProperty("minNeighborsLong")] + public double MinNeighborsLong { get; set; } + + [JsonProperty("timeOut")] + public int TimeOut { get; set; } + + [JsonProperty("logs")] + public int Logs { get; set; } + } + + public class LaneConfig + { + [JsonProperty("laneConfig")] + public LanePosision Posision { get; set; } + } + + public class LanePosision + { + [JsonProperty("left")] + public LaneConfigParam LeftLane { get; set; } + + [JsonProperty("right")] + public LaneConfigParam RightLane { get; set; } + } + + public class LaneConfigParam + { + [JsonProperty("name")] + public string LaneName { get; set; } + + [JsonProperty("default")] + public string DefaultLane { get; set; } + + [JsonProperty("longPlate")] + public bool IsLongPlate { get; set; } + } } +