using Nancy; using Nancy.Json; using Nancy.ModelBinding; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace xicheji { public class HomeModule : NancyModule { public HomeModule() { Get("/hello", (req) => { return "ok~"; }); Get("/update-test", (req) => { Program.MainForm.UpdateTest(DateTime.Now); return "ok~"; }); Post("/update-car", (req) => { var requestRoot = this.Bind(); Program.MainForm.UpdateCar(requestRoot.AlarmInfoPlate.result.PlateResult); return JsonConvert.SerializeObject(new { Response_AlarmInfoPlate = new { info = "ok", content = "...", is_pay = "true", } }); }); } } public class RequestRoot { public Alarminfoplate AlarmInfoPlate { get; set; } } public class Alarminfoplate { public Result result { get; set; } } public class Result { public Plateresult PlateResult { get; set; } } public class Plateresult { public string license { get; set; }//车牌号字符串,如 “京AAAAAA” public string imageFile { get; set; }//识别大图片内容经过base64后的字符串,需要开启发送大图片 public ColorType colorType { get; set; } } public enum ColorType { Unknown, Blue, Yellow, White, Black, Green, YellowGreen, } }