From d3602925206857045b993e67bf82697168bde3c7 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 17 三月 2023 18:01:18 +0800
Subject: [PATCH] 1

---
 ExportMap/cs/XYZUtils.cs |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/ExportMap/cs/XYZUtils.cs b/ExportMap/cs/XYZUtils.cs
index 68fbf40..b026c6e 100644
--- a/ExportMap/cs/XYZUtils.cs
+++ b/ExportMap/cs/XYZUtils.cs
@@ -45,9 +45,9 @@
         /// <summary>
         /// 鑾峰彇鍙戝竷鍦板潃
         /// </summary>
-        public static string GetReleaseUrl(XYZArgs args)
+        public static string GetReleaseUrl(string dircode)
         {
-            return "http://{host}/LFData/2d/tiles/" + args.dircode + "/{z}/{x}/{y}.png";
+            return "http://{host}/LFData/2d/tiles/" + dircode + "/{z}/{x}/{y}.png";
         }
 
         /// <summary>
@@ -84,10 +84,15 @@
             err = ExecCmd(cmd);
 
             if (File.Exists(tifFile)) File.Delete(tifFile);
-
             string viewFile = Path.Combine(xyzPath, "view.html");
+            if (File.Exists(viewFile))
+            {
+                string path = "";
+                InsertToDB(list, args, path);
+                return 1;
+            }
 
-            return File.Exists(viewFile) ? 1 : 0;
+            return 0;
         }
 
         /// <summary>
@@ -172,5 +177,44 @@
 
             return str;
         }
+
+        /// <summary>
+        /// 鎻掑叆鏁版嵁搴�
+        /// </summary>
+        private static void InsertToDB(List<SysMeta> metas, XYZArgs args, string path)
+        {
+            if (PubDBHelper.IsPublish(args.dircode)) return;
+
+            SysPublish sys = NewPublish(metas[0], args);
+            sys.path = path;
+
+            int pubid = PubDBHelper.InsertPublish(sys);
+            if (pubid > 0)
+            {
+                //PubDBHelper.InsertMetaPub(meta.id, pubid);
+            }
+        }
+
+        /// <summary>
+        /// 鍒涘缓鏁版嵁鍙戝竷绫�
+        /// </summary>
+        private static SysPublish NewPublish(SysMeta meta, XYZArgs args)
+        {
+            SysPublish sp = new SysPublish();
+            sp.name = args.name;
+            sp.url = GetReleaseUrl(args.dircode);
+            sp.type = "DOM";
+            sp.status = 3;
+            sp.dirid = args.dircode;
+            sp.depid = args.depcode;
+            sp.min = args.min;
+            sp.max = args.max;
+            sp.json = null;
+            sp.create_user = args.userId;
+            sp.geom = null;
+            sp.bak = null;
+
+            return sp;
+        }
     }
 }

--
Gitblit v1.9.3