| | |
| | | } |
| | | } |
| | | |
| | | [HttpGet] |
| | | public int DelAll() |
| | | { |
| | | try |
| | | { |
| | | return ImgDAL.DelAll(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | [HttpPost] |
| | | public int Insert([FromBody] Img img) |
| | | { |
| | |
| | | } |
| | | |
| | | [HttpPost] |
| | | public Task<IEnumerable<FileDesc>> Post() |
| | | public Task<IEnumerable<FileDesc>> Upload() |
| | | { |
| | | string root = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, uploadPath); |
| | | if (!Directory.Exists(root)) Directory.CreateDirectory(root); |
| | |
| | | |
| | | string md5 = Tools.CalcFileMD5(f.LocalFileName); |
| | | string newName = md5 + info.Extension; |
| | | string newFile = Path.Combine(root, uploadPath, newName); |
| | | string newFile = Path.Combine(root, newName); |
| | | |
| | | Img img = new Img(); |
| | | img.name = info.Name; |
| | | img.path = uploadPath + "\\" + newName; |
| | | img.geom = Tools.GetImgGps(f.LocalFileName); |
| | | List<string> pz = Tools.GetImgGps(f.LocalFileName); |
| | | Img img = new Img(info.Name, uploadPath + "/" + newName, string.Empty); |
| | | if (null != pz) img.SetXYZ(pz[0], pz[1], pz[2]); |
| | | |
| | | if (!File.Exists(newFile)) File.Move(f.LocalFileName, newFile); |
| | | FileDesc desc = new FileDesc(info.Name, info.Length); |
| | | if (File.Exists(newFile)) |
| | | File.Delete(f.LocalFileName); |
| | | else |
| | | File.Move(f.LocalFileName, newFile); |
| | | |
| | | int rows = ImgDAL.Insert(img); |
| | | |
| | | infos.Add(new FileDesc(info.Name, info.Length)); |
| | | if (rows > 0) infos.Add(desc); |
| | | } |
| | | |
| | | return infos; |
| | |
| | | } |
| | | |
| | | [HttpGet] |
| | | public string GetGps() |
| | | public List<string> GetGps() |
| | | { |
| | | return Tools.GetImgGps(@"D:\SEM\病害示例_pos\1.jpg"); |
| | | } |