From 07e314b0c8a89f242788e33035483ab0b9a1f543 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Tue, 29 Oct 2019 17:12:13 +0800 Subject: [PATCH] update Former-commit-id: 8fb4f36cd698e099f34ee381d03f4103c1a46f37 --- projects/Infrastructure/Data/EfDbContext.cs | 5 +- projects/Infrastructure/Infrastructure.csproj | 2 - projects/Infrastructure/Web/BaseStartup.cs | 13 +- .../IoTCenter/Controllers/AppController.cs | 14 +- .../IoTCenter/appsettings.Development.json | 3 +- projects/IoTCenter/appsettings.json | 1 - projects/IoTCenter/iotcenter.db | Bin 573440 -> 573440 bytes projects/IoTCenter/wwwroot/node.mobile.html | 1 + .../StreamingAssets/wwwroot/images.meta | 8 - .../wwwroot/lib/admin-lte.meta | 8 - .../wwwroot/lib/bootstrap.meta | 8 - .../Assets/StreamingAssets/wwwroot/node.html | 367 ++++++++++-------- projects/IoTNode/appsettings.Development.json | 3 +- projects/IoTNode/iotnode.db | Bin 516096 -> 516096 bytes .../StudyCenter/appsettings.Development.json | 3 +- projects/StudyCenter/appsettings.json | 1 - .../UserCenter/appsettings.Development.json | 3 +- projects/UserCenter/appsettings.json | 1 - 18 files changed, 232 insertions(+), 209 deletions(-) create mode 100644 projects/IoTCenter/wwwroot/node.mobile.html delete mode 100644 projects/IoTClient/Assets/StreamingAssets/wwwroot/images.meta delete mode 100644 projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/admin-lte.meta delete mode 100644 projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/bootstrap.meta diff --git a/projects/Infrastructure/Data/EfDbContext.cs b/projects/Infrastructure/Data/EfDbContext.cs index ca6c9abf..f25b7dc9 100644 --- a/projects/Infrastructure/Data/EfDbContext.cs +++ b/projects/Infrastructure/Data/EfDbContext.cs @@ -11,7 +11,10 @@ namespace Infrastructure.Data { public class EfDbContext : DbContext { - public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); }); + public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => + { + //builder.AddConsole(); + }); public EfDbContext(DbContextOptions options) : base(options) { diff --git a/projects/Infrastructure/Infrastructure.csproj b/projects/Infrastructure/Infrastructure.csproj index 28d5daee..e2f0e669 100644 --- a/projects/Infrastructure/Infrastructure.csproj +++ b/projects/Infrastructure/Infrastructure.csproj @@ -16,8 +16,6 @@ - - diff --git a/projects/Infrastructure/Web/BaseStartup.cs b/projects/Infrastructure/Web/BaseStartup.cs index 5786c338..d0015af1 100644 --- a/projects/Infrastructure/Web/BaseStartup.cs +++ b/projects/Infrastructure/Web/BaseStartup.cs @@ -44,6 +44,7 @@ namespace Infrastructure.Web private readonly bool _useMiniProfiler; private string _connectionString; private bool _useSqlite; + private readonly string _origins = "AllowAllHeaders"; public BaseStartup(IConfiguration configuration, IWebHostEnvironment env) { @@ -55,11 +56,7 @@ namespace Infrastructure.Web public virtual void ConfigureServices(IServiceCollection services) { services.AddSingleton(_cfg as IConfigurationRoot); - if (this._useMiniProfiler) - { - services.AddMiniProfiler(o => o.RouteBasePath = "/profiler").AddEntityFramework(); - } - services.AddCors(options => options.AddPolicy("CorsPolicy", + services.AddCors(options => options.AddPolicy(_origins, builder => { builder.SetIsOriginAllowed(o => true) @@ -216,18 +213,14 @@ namespace Infrastructure.Web app.UseExceptionHandler("/Error"); app.UseStatusCodePagesWithReExecute("/Error"); } - if (this._useMiniProfiler) - { - app.UseMiniProfiler(); - } app.UseStaticFiles(); app.UseRouting(); + app.UseCors(_origins); var localizationOption = app.ApplicationServices.GetService>(); app.UseRequestLocalization(localizationOption.Value); app.UseSession(); this.UseAuthentication(app); this.UseSwagger(app); - app.UseCors("CorsPolicy"); this.UseScheduler(app); app.UseEndpoints(endpoints => { diff --git a/projects/IoTCenter/Controllers/AppController.cs b/projects/IoTCenter/Controllers/AppController.cs index 77752d8e..a1bcd378 100644 --- a/projects/IoTCenter/Controllers/AppController.cs +++ b/projects/IoTCenter/Controllers/AppController.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; -using Newtonsoft.Json; +using Microsoft.Extensions.Hosting; using System; using System.Collections.Generic; using System.IO; @@ -23,6 +23,7 @@ namespace IoTCenter.Controllers [Device] public class AppController : Controller { + private readonly IHostEnvironment _env; private readonly IConfiguration _configuration; private readonly IJwtHelper _jwtHelper; private readonly IRepository _categoryRepo; @@ -35,7 +36,9 @@ namespace IoTCenter.Controllers private readonly IRepository _liveRecordRepo; private readonly IHubContext _hub; - public AppController(IConfiguration configuration, + public AppController( + IHostEnvironment env, + IConfiguration configuration, IJwtHelper jwtHelper, IRepository categoryRepo, IRepository productRepo, @@ -47,6 +50,7 @@ namespace IoTCenter.Controllers IRepository liveRecordRepo, IHubContext hub) { + this._env = env; this._configuration = configuration; this._jwtHelper = jwtHelper; this._categoryRepo = categoryRepo; @@ -114,6 +118,12 @@ namespace IoTCenter.Controllers return Json(model); } + public IActionResult GetTemplate(string template) + { + return Content(System.IO.File.ReadAllText(Path.Combine(this._env.ContentRootPath, "wwwroot", template))); + } + + // public IActionResult GetSceneList(string token) { var userName = this._jwtHelper.GetPayload(token)["UserName"].ToString(); diff --git a/projects/IoTCenter/appsettings.Development.json b/projects/IoTCenter/appsettings.Development.json index 24378348..4b4f5614 100644 --- a/projects/IoTCenter/appsettings.Development.json +++ b/projects/IoTCenter/appsettings.Development.json @@ -5,6 +5,5 @@ "System": "Information", "Microsoft": "Warning" } - }, - "UseMiniProfiler": false + } } \ No newline at end of file diff --git a/projects/IoTCenter/appsettings.json b/projects/IoTCenter/appsettings.json index 7a438f4e..fedd9adc 100644 --- a/projects/IoTCenter/appsettings.json +++ b/projects/IoTCenter/appsettings.json @@ -6,7 +6,6 @@ "Microsoft": "Warning" } }, - "UseMiniProfiler": false, "ConnectionStrings": { "database.mysql.connection": "Server=127.0.0.1;Port=3306;Database=iotcenter;Uid=root;Pwd=root;", "database.sqlite.connection": "Data Source=iotcenter.db" diff --git a/projects/IoTCenter/iotcenter.db b/projects/IoTCenter/iotcenter.db index 1d15477e07ae848b486071dcc52dbb4527aa6046..1eb5e4d94e4d37caa7d3534f93efc31de91f6706 100644 GIT binary patch delta 203 zcmZo@P;O{Y-oO^X+{3^>{on$2jm-)HzWmayp$w9`=EB0ls=5pu97T+La6ZH23GwMo z32h0CZ3#?m3CwK?EZY)T*&i^nZs%}dGiG8kF`Dk+$YwIV(232O#X`@(bovG-Hgm?1 z=`Wnva`;#|7)lwGMI{-9B{?`kr*Cv;Qkg!_lZ}tjaQZq=HWQX?OPk{jEtuD tIs?rya{=l$+@9ycX2Z&2sAp-s9jH)-jmf~Y{fs{w5VLPT34^R?wk1#K z^gLgnDHf(+ndxROK&_VB^IX_$SXqqpEG)LK^JJ4@W3n)7KjY5^#O&M8_;Z*P0091- BHp~D3 diff --git a/projects/IoTCenter/wwwroot/node.mobile.html b/projects/IoTCenter/wwwroot/node.mobile.html new file mode 100644 index 00000000..0620a8a1 --- /dev/null +++ b/projects/IoTCenter/wwwroot/node.mobile.html @@ -0,0 +1 @@ +//复制移动端node.html的template节点内容到此,作为修改的基础 \ No newline at end of file diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/images.meta b/projects/IoTClient/Assets/StreamingAssets/wwwroot/images.meta deleted file mode 100644 index 5ac512d2..00000000 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/images.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 312c27f5d95ac3b43a5743a8f9429113 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/admin-lte.meta b/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/admin-lte.meta deleted file mode 100644 index 0e5348c5..00000000 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/admin-lte.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 894e429dfa5e1b249896a9ae637fc67b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/bootstrap.meta b/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/bootstrap.meta deleted file mode 100644 index 0826b82f..00000000 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/lib/bootstrap.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 932b2ebc2bdf493478f3277c9c6214f0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html b/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html index ea564d77..9d7c77fb 100644 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html +++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/node.html @@ -22,98 +22,100 @@
- + -