Forráskód Böngészése

😎优化代码生成 感谢 @KaneLeung

zuohuaijun 2 éve
szülő
commit
11377813f9

+ 2 - 0
Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs

@@ -56,6 +56,8 @@ public class CustomViewEngine : ViewEngineModel
 
     public string GetColumnNetType(object tbName, object colName)
     {
+        if (tbName == null || colName == null) return null;
+
         var config = App.GetOptions<DbConnectionOptions>().ConnectionConfigs.FirstOrDefault(u => u.ConfigId.ToString() == ConfigId);
         ColumnList = GetColumnListByTableName(tbName.ToString());
         var col = ColumnList.Where(c => (config.DbSettings.EnableUnderLine

+ 1 - 1
Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs

@@ -368,7 +368,7 @@ public class SysCodeGenService : IDynamicApiController, ITransient
             if (File.Exists(downloadPath))
                 File.Delete(downloadPath);
             ZipFile.CreateFromDirectory(zipPath, downloadPath);
-            return new { url = $"{CommonUtil.GetLocalhost()}/CodeGen/{input.TableName}.zip" };
+            return new { url = $"{App.HttpContext.Request.Scheme}://{App.HttpContext.Request.Host.Value}/CodeGen/{input.TableName}.zip" };
         }
     }