| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除文件 |
| | | /// </summary> |
| | | [HttpPost] |
| | | public ResponseMsg<string> DeleteFiles([FromBody]XYZArgs args) |
| | | { |
| | | try |
| | | { |
| | | ResponseMsg<string> msg = checkArgs(args, true); |
| | | if (null != msg) return msg; |
| | | |
| | | string err = null; |
| | | List<int> rs = Tools.DeleteFiles(args, ref err); |
| | | if (null == rs || rs.Count == 0) |
| | | { |
| | | return ResponseMsg<string>.fail(null == err ? "失败" : err); |
| | | } |
| | | |
| | | return ResponseMsg<string>.success("成功", string.Join(",", rs), rs.Count); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); |
| | | return ResponseMsg<string>.fail(ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检查参数 |
| | | /// </summary> |
| | | private ResponseMsg<string> checkArgs(XYZArgs args, bool checkDir = false) |
| | |
| | | { |
| | | if (!ids.Contains(m.id)) PubDBHelper.InsertMetaPub(m.id, pubid, args.userId); |
| | | } |
| | | string json = GetPointZ(args); |
| | | if (!string.IsNullOrEmpty(json)) PubDBHelper.UpdatePublishCoord(pubid, json); |
| | | string geom = GetPointZ(args); |
| | | if (!string.IsNullOrEmpty(geom)) PubDBHelper.UpdatePublishGeom(pubid, geom); |
| | | |
| | | return pubid; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除文件 |
| | | /// </summary> |
| | | public static List<int> DeleteFiles(XYZArgs args, ref string err) |
| | | { |
| | | List<SysPublish> pubs = PubDBHelper.SelectPublishs(args.ids); |
| | | if (null == pubs || pubs.Count == 0) return null; |
| | | |
| | | List<int> list = new List<int>(); |
| | | foreach (SysPublish pub in pubs) |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(pub.url) || string.IsNullOrEmpty(pub.path)) continue; |
| | | |
| | | String path = SGUtils.LFData + "\\" + pub.path.Replace("\\tileset.json", ""); |
| | | if (pub.url.Contains("/SG/") || !Directory.Exists(path)) |
| | | { |
| | | list.Add(pub.id); |
| | | continue; |
| | | } |
| | | |
| | | DelPath(path); |
| | | list.Add(pub.id); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); |
| | | err = ex.Message; |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | [DllImport("ReadLas.dll")] |
| | | public extern static int get_las_cs(string file_name); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 更新发布数据的坐标 |
| | | /// </summary> |
| | | public static int UpdatePublishCoord(int pid, string json) |
| | | public static int UpdatePublishGeom(int pid, string geom) |
| | | { |
| | | string sql = string.Format("update lf.sys_publish set json = @json where id = {0}", pid); |
| | | DbParameter dp = new NpgsqlParameter("@json", json); |
| | | string sql = string.Format("update lf.sys_publish set geom = @geom where id = {0}", pid); |
| | | DbParameter dp = new NpgsqlParameter("@geom", geom); |
| | | |
| | | return Tools.DBHelper.ExecuteNonQuery(sql, dp); |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询发布数据 |
| | | /// </summary> |
| | | public static List<SysPublish> SelectPublishs(List<int> ids) |
| | | { |
| | | string sql = string.Format("select id, name, url, path, type, status, dirid, depid, min, max, json, create_user, create_time, update_user, update_time, st_astext(geom) geom, bak from lf.sys_publish where id in ({0}) order by id desc", string.Join(",", ids)); |
| | | DataTable dt = Tools.DBHelper.GetDataTable(sql); |
| | | List<SysPublish> list = ModelHandler.FillModel<SysPublish>(dt); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取参数列表 |
| | | /// </summary> |
| | | public static List<DbParameter> GetParams<T>(string sql, T t) |
| | |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| | | <script src="js/jquery.1.12.4.js"></script> |
| | | <script> |
| | | var token = "5f98316d-de91-4850-a20f-44080a278115"; |
| | | var token = "dba75438-71f2-4a67-91ef-8919cd9b16cc"; |
| | | |
| | | // Ajax |
| | | function ajax(url, type, data, dataType, contentType, fn) { |
| | |
| | | |
| | | // 测试Terra:10526,10527 |
| | | function toTerra() { |
| | | var data = { token: token, ids: [10526, 10527], min: 0, max: 18, depcode: "00", dircode: "09", userId: 1, name: "BN_GD" }; |
| | | var data = { token: token, ids: [10531], min: 0, max: 18, depcode: "00", dircode: "090000", userId: 1, name: "中缅" }; |
| | | ajax("Convert/ToTerra", "POST", JSON.stringify(data), null, null, function (rs) { |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | console.log(rs); |