diff --git a/projects/Infrastructure/Infrastructure.csproj b/projects/Infrastructure/Infrastructure.csproj
index d9328188..b629af16 100644
--- a/projects/Infrastructure/Infrastructure.csproj
+++ b/projects/Infrastructure/Infrastructure.csproj
@@ -9,22 +9,21 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/projects/IoT.Shared/IoT.Shared.csproj b/projects/IoT.Shared/IoT.Shared.csproj
index 4ae6758c..2d297af1 100644
--- a/projects/IoT.Shared/IoT.Shared.csproj
+++ b/projects/IoT.Shared/IoT.Shared.csproj
@@ -1,32 +1,32 @@
-
- netcoreapp3.1
- true
- true
- $(DefaultItemExcludes);wwwroot\**\*
- true
- false
- false
-
+
+ netcoreapp3.1
+ true
+ true
+ $(DefaultItemExcludes);wwwroot\**\*
+ true
+ false
+ false
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/projects/IoTCenter/Api/DeviceController.cs b/projects/IoTCenter/Api/DeviceController.cs
index 157e15f6..db86cc33 100644
--- a/projects/IoTCenter/Api/DeviceController.cs
+++ b/projects/IoTCenter/Api/DeviceController.cs
@@ -70,8 +70,12 @@ namespace IoTCenter.Api.Controllers
var hours = Convert.ToInt32(DateTime.Now.ToString("%z"));
using var client = new InfluxClient(new Uri(url), usr, pwd);
var days = Convert.ToInt32(model.Time.TrimEnd('d'));
- var group = days == 1 ? "1m" : (days == 7 ? "10m" : "1h");
- var query = $"select last({model.Key}) from {measurementName} where time>now() - {days}d and DeviceNumber = '{model.Number}' group by time({group}) fill(none)";
+ var group = model.Group;
+ if (string.IsNullOrEmpty(group))
+ {
+ group = days == 1 ? "1m" : (days == 7 ? "10m" : "1h");
+ }
+ var query = $"select last({model.Key}) from {measurementName} where time>now() - {days}d and DeviceNumber = '{model.Number}' group by time({group}) fill(none) tz('Asia/Shanghai')";
var result = client.ReadAsync(dbName, query).Result;
var rows = result.Results.FirstOrDefault()?
.Series.FirstOrDefault()?
diff --git a/projects/IoTCenter/Controllers/AccountController.cs b/projects/IoTCenter/Controllers/AccountController.cs
index ce76e3aa..eb46ca2e 100644
--- a/projects/IoTCenter/Controllers/AccountController.cs
+++ b/projects/IoTCenter/Controllers/AccountController.cs
@@ -114,5 +114,12 @@ namespace IoTCenter.Controllers
var url = registerUrl.SetParam("returnUrl", fullReturnUrl);
return Redirect(url);
}
+
+ [AllowAnonymous]
+ public IActionResult CasLogin(string ticket)
+ {
+ //this._cfg[""]
+ return Redirect(this._cfg["http://221.194.113.154:8100/"]);
+ }
}
}
\ No newline at end of file
diff --git a/projects/IoTCenter/ViewModels/ChartDataRequest.cs b/projects/IoTCenter/ViewModels/ChartDataRequest.cs
index 46441a05..fc3268f7 100644
--- a/projects/IoTCenter/ViewModels/ChartDataRequest.cs
+++ b/projects/IoTCenter/ViewModels/ChartDataRequest.cs
@@ -12,5 +12,7 @@ namespace IoTCenter.ViewModels
[Required(ErrorMessage = nameof(RequiredAttribute))]
public string Time { get; set; }
+
+ public string Group { get; set; }
}
}
\ No newline at end of file
diff --git a/projects/IoTCenter/appsettings.Docker.json b/projects/IoTCenter/appsettings.Docker.json
index 5cd23c15..d3f1ad22 100644
--- a/projects/IoTCenter/appsettings.Docker.json
+++ b/projects/IoTCenter/appsettings.Docker.json
@@ -7,8 +7,8 @@
"mysql": "Server=172.172.0.30;Port=3306;Database=iotcenter;Uid=root;Pwd=root;",
"redis": "redis:6379,allowAdmin=true",
"srs": "http://172.172.0.60:1985",
- "JobServer": "http://172.172.0.10/JobServer",
- "JobCallBack": "http://172.172.0.10/IoTCenter/api/v1/Api/ExecTimer"
+ "JobServer": "http://172.172.0.12/JobServer",
+ "JobCallBack": "http://172.172.0.12/IoTCenter/api/v1/Api/ExecTimer"
},
"influxdb": {
"url": "http://172.172.0.50:8086",
diff --git a/projects/IoTDameon/.gitignore b/projects/IoTDameon/.gitignore
new file mode 100644
index 00000000..cd5894bd
--- /dev/null
+++ b/projects/IoTDameon/.gitignore
@@ -0,0 +1,18 @@
+*.bak
+*.suo
+*.db
+*.db-shm
+*.db-wal
+*.user
+.vs
+obj
+Obj
+bin
+Bin
+debug
+Debug
+release
+Release
+Logs
+logs
+node_modules
\ No newline at end of file
diff --git a/projects/IoTDameon/Controllers/HomeController.cs b/projects/IoTDameon/Controllers/HomeController.cs
new file mode 100644
index 00000000..291b801e
--- /dev/null
+++ b/projects/IoTDameon/Controllers/HomeController.cs
@@ -0,0 +1,37 @@
+using Microsoft.AspNetCore.Mvc;
+using Nwc.XmlRpc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Threading.Tasks;
+
+namespace IoTDameon.Controllers
+{
+ public class HomeController : Controller
+ {
+ private IHttpClientFactory _httpClientFactory;
+
+ public HomeController(IHttpClientFactory httpClientFactory)
+ {
+ _httpClientFactory = httpClientFactory;
+ }
+
+ public IActionResult Index()
+ {
+ var client = new XmlRpcRequest();
+ client.MethodName = "supervisor.getState";
+ try
+ {
+ Console.WriteLine("Request: " + client);
+ var response = client.Send("http://usr:pwd@iot.edusoa.com:9001/RPC2");
+ Console.WriteLine("Response: " + response);
+ }
+ catch (Exception ex)
+ {
+ return Content(ex.ToString());
+ }
+ return Content("");
+ }
+ }
+}
\ No newline at end of file
diff --git a/projects/IoTDameon/IoTDameon.csproj b/projects/IoTDameon/IoTDameon.csproj
new file mode 100644
index 00000000..7292475a
--- /dev/null
+++ b/projects/IoTDameon/IoTDameon.csproj
@@ -0,0 +1,14 @@
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/projects/IoTDameon/Program.cs b/projects/IoTDameon/Program.cs
new file mode 100644
index 00000000..26fb9b95
--- /dev/null
+++ b/projects/IoTDameon/Program.cs
@@ -0,0 +1,35 @@
+using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Serilog;
+using System;
+using System.IO;
+using System.Text;
+
+namespace IoTDameon
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ Console.OutputEncoding = Encoding.UTF8;
+ var config = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
+ .AddJsonFile("appsettings.json", optional: true)
+ .Build();
+ WebHost.CreateDefaultBuilder(args)
+ .UseConfiguration(config)
+ .ConfigureLogging((c, o) =>
+ {
+ Log.Logger = new LoggerConfiguration()
+ .ReadFrom.Configuration(config)
+ .WriteTo.Console()
+ .WriteTo.File("logs/log.txt", rollOnFileSizeLimit: true, fileSizeLimitBytes: 100 * 1024 * 1024, rollingInterval: RollingInterval.Infinite)
+ .CreateLogger();
+ o.AddSerilog();
+ })
+ .UseStartup()
+ .Build()
+ .Run();
+ }
+ }
+}
\ No newline at end of file
diff --git a/projects/IoTDameon/Properties/launchSettings.json b/projects/IoTDameon/Properties/launchSettings.json
new file mode 100644
index 00000000..40695eff
--- /dev/null
+++ b/projects/IoTDameon/Properties/launchSettings.json
@@ -0,0 +1,27 @@
+{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:8003",
+ "sslPort": 0
+ }
+ },
+ "profiles": {
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IoTDameon": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "applicationUrl": "http://localhost:8003",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/projects/IoTDameon/Startup.cs b/projects/IoTDameon/Startup.cs
new file mode 100644
index 00000000..f1dc3516
--- /dev/null
+++ b/projects/IoTDameon/Startup.cs
@@ -0,0 +1,63 @@
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using System;
+
+namespace IoTDameon
+{
+ public class Startup
+ {
+ public Startup(IConfiguration configuration)
+ {
+ Configuration = configuration;
+ }
+
+ private readonly string _origins = "AllowAllHeaders";
+ public IConfiguration Configuration { get; }
+
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddCors(options => options.AddPolicy(_origins,
+ builder =>
+ {
+ builder.SetIsOriginAllowed(o => true).AllowAnyMethod().AllowAnyHeader().AllowCredentials();
+ })
+ );
+
+ services.AddHttpClient();
+
+ services.AddControllersWithViews();
+ }
+
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ {
+ if (env.IsDevelopment())
+ {
+ app.UseDeveloperExceptionPage();
+ }
+ else
+ {
+ app.UseExceptionHandler("/Error");
+ }
+
+ string basePath = this.Configuration.GetValue("BasePath", "");
+
+ app.UsePathBase(basePath);
+
+ app.UseCors(_origins);
+
+ app.UseStaticFiles();
+
+ app.UseRouting();
+
+ app.UseEndpoints(endpoints =>
+ {
+ endpoints.MapControllerRoute(
+ name: "default",
+ pattern: "{controller=Home}/{action=Index}/{id?}");
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/projects/IoTDameon/appsettings.Development.json b/projects/IoTDameon/appsettings.Development.json
new file mode 100644
index 00000000..8983e0fc
--- /dev/null
+++ b/projects/IoTDameon/appsettings.Development.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ }
+}
diff --git a/projects/IoTDameon/appsettings.json b/projects/IoTDameon/appsettings.json
new file mode 100644
index 00000000..60f08eb9
--- /dev/null
+++ b/projects/IoTDameon/appsettings.json
@@ -0,0 +1,11 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ },
+ "AllowedHosts": "*",
+ "server.urls": "http://*:8003"
+}
\ No newline at end of file
diff --git a/projects/IoTDameon/wwwroot/favicon.ico b/projects/IoTDameon/wwwroot/favicon.ico
new file mode 100644
index 00000000..a3a79998
Binary files /dev/null and b/projects/IoTDameon/wwwroot/favicon.ico differ
diff --git a/projects/IoTNode/IoTNode.csproj b/projects/IoTNode/IoTNode.csproj
index 75908c72..7dbd8307 100644
--- a/projects/IoTNode/IoTNode.csproj
+++ b/projects/IoTNode/IoTNode.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/projects/Version.cs b/projects/Version.cs
index dabb0ec9..3ed47744 100644
--- a/projects/Version.cs
+++ b/projects/Version.cs
@@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyInformationalVersion("1.0.0.0814d1")]
\ No newline at end of file
+[assembly: AssemblyInformationalVersion("1.0.0.0818d1")]
\ No newline at end of file
diff --git a/projects/WebMVC/WebMVC.csproj b/projects/WebMVC/WebMVC.csproj
index 932f3e56..81a5b8e0 100644
--- a/projects/WebMVC/WebMVC.csproj
+++ b/projects/WebMVC/WebMVC.csproj
@@ -6,6 +6,6 @@
-
+
\ No newline at end of file
diff --git a/projects/WebSPA/WebSPA.csproj b/projects/WebSPA/WebSPA.csproj
index 9ac7e1be..df21dc51 100644
--- a/projects/WebSPA/WebSPA.csproj
+++ b/projects/WebSPA/WebSPA.csproj
@@ -6,6 +6,6 @@
-
+
\ No newline at end of file
diff --git a/projects/projects.sln b/projects/projects.sln
index c78a84cd..3b09b09e 100644
--- a/projects/projects.sln
+++ b/projects/projects.sln
@@ -42,6 +42,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebSPA", "WebSPA\WebSPA.csp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JobServer", "JobServer\JobServer.csproj", "{6E2766D8-9ECF-469E-8662-A20F673E52CC}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IoTDameon", "IoTDameon\IoTDameon.csproj", "{60596088-3C4E-4EA2-933A-B66CD269845B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -160,6 +162,18 @@ Global
{6E2766D8-9ECF-469E-8662-A20F673E52CC}.Release|iPhone.Build.0 = Release|Any CPU
{6E2766D8-9ECF-469E-8662-A20F673E52CC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{6E2766D8-9ECF-469E-8662-A20F673E52CC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Release|iPhone.Build.0 = Release|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {60596088-3C4E-4EA2-933A-B66CD269845B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -174,9 +188,10 @@ Global
{C66B39B3-D863-4651-99CD-74104CA65C47} = {11BCB5F9-0020-463A-92FB-BC25E2A0BF75}
{6F839910-580D-4CD1-A0C0-6FAF542B4480} = {11BCB5F9-0020-463A-92FB-BC25E2A0BF75}
{6E2766D8-9ECF-469E-8662-A20F673E52CC} = {E1681DC3-9AC2-4FF6-B3DE-37EF826E6F8A}
+ {60596088-3C4E-4EA2-933A-B66CD269845B} = {AE34E06D-C5C7-44BC-B168-85808318516C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {0B7095FB-5E70-4EF8-805A-CB4A91AE4B0A}
BuildVersion_StartDate = 2000/1/1
+ SolutionGuid = {0B7095FB-5E70-4EF8-805A-CB4A91AE4B0A}
EndGlobalSection
EndGlobal
diff --git a/publish/build.ps1 b/publish/build.ps1
index 91954d0f..28101e0e 100644
--- a/publish/build.ps1
+++ b/publish/build.ps1
@@ -11,8 +11,8 @@ Remove-Item ./dist/linux-x64/publish/apps/srs/objs/nginx/html/live/*.png -recurs
Remove-Item ./dist/linux-x64/publish/apps/srs/objs/nginx/html/live/*.m3u8 -recurse -force
Remove-Item ./dist/linux-x64/publish/apps/srs/objs/nginx/html/live/*.ts -recurse -force
-Copy-Item ../projects/WebMVC/wwwroot ./dist/linux-x64/publish/apps/WebMVC/wwwroot -recurse
-Copy-Item ../projects/WebSPA/wwwroot ./dist/linux-x64/publish/apps/WebSPA/wwwroot -recurse
+Copy-Item ../projects/WebMVC/wwwroot/* ./dist/linux-x64/publish/apps/WebMVC/wwwroot -recurse
+Copy-Item ../projects/WebSPA/wwwroot/* ./dist/linux-x64/publish/apps/WebSPA/wwwroot -recurse
dotnet publish ../projects/UserCenter/UserCenter.csproj -c Release -r linux-x64 -o ../publish/dist/linux-x64/publish/apps/UserCenter
dotnet publish ../projects/JobServer/JobServer.csproj -c Release -r linux-x64 -o ../publish/dist/linux-x64/publish/apps/JobServer
diff --git a/publish/src/linux-x64/publish/docker-compose.yml b/publish/src/linux-x64/publish/docker-compose.yml
index 287f9d77..591038c0 100644
--- a/publish/src/linux-x64/publish/docker-compose.yml
+++ b/publish/src/linux-x64/publish/docker-compose.yml
@@ -30,8 +30,8 @@ services:
volumes:
- ./docker/conf/website/nginx.conf:/etc/nginx/nginx.conf
- ./docker/log/website:/var/log/nginx
- - ./apps/WebMVC/wwwroot:/usr/share/nginx/html/desktop
- - ./apps/WebSPA/wwwroot:/usr/share/nginx/html/mobile
+ - ./apps/WebMVC/wwwroot:/root/nginx/html/desktop
+ - ./apps/WebSPA/wwwroot:/root/nginx/html/mobile
networks:
default:
ipv4_address: 172.172.0.10
diff --git a/publish/src/linux-x64/publish/docker/conf/website/nginx.conf b/publish/src/linux-x64/publish/docker/conf/website/nginx.conf
index 3889a8ef..a7a6ebdc 100644
--- a/publish/src/linux-x64/publish/docker/conf/website/nginx.conf
+++ b/publish/src/linux-x64/publish/docker/conf/website/nginx.conf
@@ -24,9 +24,9 @@ http {
server_name localhost;
location / {
- root /usr/share/nginx/html/desktop;
+ root /root/nginx/html/desktop;
if ($http_user_agent ~* "(mobile|android|ipad|iphone|ipod|tablet)") {
- root /usr/share/nginx/html/mobile;
+ root /root/nginx/html/mobile;
}
index index.html;
}