Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IoTSharp
IoTSharp
提交
60f56e8b
IoTSharp
项目概览
IoTSharp
/
IoTSharp
12 个月 前同步成功
通知
15
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
60f56e8b
编写于
2月 08, 2022
作者:
W
wq1234wq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
用户注册,Device增加DeviceIdentity导航属性
上级
68169110
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
2667 addition
and
67 deletion
+2667
-67
IoTSharp.Data.MySQL/Migrations/20220204061936_add.Designer.cs
...harp.Data.MySQL/Migrations/20220204061936_add.Designer.cs
+1978
-0
IoTSharp.Data.MySQL/Migrations/20220204061936_add.cs
IoTSharp.Data.MySQL/Migrations/20220204061936_add.cs
+294
-0
IoTSharp.Data.MySQL/Migrations/ApplicationDbContextModelSnapshot.cs
...ata.MySQL/Migrations/ApplicationDbContextModelSnapshot.cs
+51
-30
IoTSharp.Data/ApplicationDbContext.cs
IoTSharp.Data/ApplicationDbContext.cs
+1
-1
IoTSharp.Data/Device.cs
IoTSharp.Data/Device.cs
+2
-0
IoTSharp.Data/DeviceIdentity.cs
IoTSharp.Data/DeviceIdentity.cs
+2
-0
IoTSharp.Data/Flow.cs
IoTSharp.Data/Flow.cs
+3
-0
IoTSharp.Data/FlowRule.cs
IoTSharp.Data/FlowRule.cs
+5
-0
IoTSharp/ClientApp/src/app/routes/passport/login/login.component.html
...entApp/src/app/routes/passport/login/login.component.html
+7
-1
IoTSharp/ClientApp/src/app/routes/passport/login/login.component.ts
...lientApp/src/app/routes/passport/login/login.component.ts
+1
-1
IoTSharp/ClientApp/src/app/routes/passport/register/register.component.html
.../src/app/routes/passport/register/register.component.html
+5
-2
IoTSharp/ClientApp/src/app/routes/passport/register/register.component.ts
...pp/src/app/routes/passport/register/register.component.ts
+98
-23
IoTSharp/Controllers/AccountController.cs
IoTSharp/Controllers/AccountController.cs
+88
-0
IoTSharp/Controllers/CustomersController.cs
IoTSharp/Controllers/CustomersController.cs
+6
-1
IoTSharp/Controllers/DevicesController.cs
IoTSharp/Controllers/DevicesController.cs
+8
-8
IoTSharp/Controllers/MenuController.cs
IoTSharp/Controllers/MenuController.cs
+111
-0
IoTSharp/IoTSharp.xml
IoTSharp/IoTSharp.xml
+7
-0
未找到文件。
IoTSharp.Data.MySQL/Migrations/20220204061936_add.Designer.cs
0 → 100644
浏览文件 @
60f56e8b
此差异已折叠。
点击以展开。
IoTSharp.Data.MySQL/Migrations/20220204061936_add.cs
0 → 100644
浏览文件 @
60f56e8b
using
System
;
using
Microsoft.EntityFrameworkCore.Migrations
;
#
nullable
disable
namespace
IoTSharp.Data.MySql.Migrations
{
public
partial
class
add
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_DeviceIdentities_Device_DeviceId"
,
table
:
"DeviceIdentities"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_DeviceIdentities_DeviceId"
,
table
:
"DeviceIdentities"
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"Type"
,
table
:
"TelemetryData"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
Annotation
(
"Relational:ColumnOrder"
,
5
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"DataSide"
,
table
:
"TelemetryData"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
Annotation
(
"Relational:ColumnOrder"
,
4
);
migrationBuilder
.
AlterColumn
<
DateTime
>(
name
:
"DateTime"
,
table
:
"TelemetryData"
,
type
:
"timestamp"
,
nullable
:
false
,
oldClrType
:
typeof
(
DateTime
),
oldType
:
"timestamp"
)
.
Annotation
(
"Relational:ColumnOrder"
,
3
);
migrationBuilder
.
AlterColumn
<
string
>(
name
:
"KeyName"
,
table
:
"TelemetryData"
,
type
:
"varchar(255)"
,
nullable
:
false
,
oldClrType
:
typeof
(
string
),
oldType
:
"varchar(255)"
)
.
Annotation
(
"MySql:CharSet"
,
"utf8mb4"
)
.
Annotation
(
"Relational:ColumnOrder"
,
2
)
.
OldAnnotation
(
"MySql:CharSet"
,
"utf8mb4"
);
migrationBuilder
.
AlterColumn
<
Guid
>(
name
:
"DeviceId"
,
table
:
"TelemetryData"
,
type
:
"char(36)"
,
nullable
:
false
,
collation
:
"ascii_general_ci"
,
oldClrType
:
typeof
(
Guid
),
oldType
:
"char(36)"
)
.
Annotation
(
"Relational:ColumnOrder"
,
1
)
.
OldAnnotation
(
"Relational:Collation"
,
"ascii_general_ci"
);
migrationBuilder
.
AlterColumn
<
Guid
>(
name
:
"DeviceId"
,
table
:
"DeviceIdentities"
,
type
:
"char(36)"
,
nullable
:
false
,
defaultValue
:
new
Guid
(
"00000000-0000-0000-0000-000000000000"
),
collation
:
"ascii_general_ci"
,
oldClrType
:
typeof
(
Guid
),
oldType
:
"char(36)"
,
oldNullable
:
true
)
.
OldAnnotation
(
"Relational:Collation"
,
"ascii_general_ci"
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"Type"
,
table
:
"DataStorage"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
Annotation
(
"Relational:ColumnOrder"
,
5
);
migrationBuilder
.
AlterColumn
<
DateTime
>(
name
:
"DateTime"
,
table
:
"DataStorage"
,
type
:
"timestamp"
,
nullable
:
false
,
oldClrType
:
typeof
(
DateTime
),
oldType
:
"timestamp"
)
.
Annotation
(
"Relational:ColumnOrder"
,
3
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"DataSide"
,
table
:
"DataStorage"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
Annotation
(
"Relational:ColumnOrder"
,
4
);
migrationBuilder
.
AlterColumn
<
string
>(
name
:
"KeyName"
,
table
:
"DataStorage"
,
type
:
"varchar(255)"
,
nullable
:
false
,
oldClrType
:
typeof
(
string
),
oldType
:
"varchar(255)"
)
.
Annotation
(
"MySql:CharSet"
,
"utf8mb4"
)
.
Annotation
(
"Relational:ColumnOrder"
,
2
)
.
OldAnnotation
(
"MySql:CharSet"
,
"utf8mb4"
);
migrationBuilder
.
AlterColumn
<
Guid
>(
name
:
"DeviceId"
,
table
:
"DataStorage"
,
type
:
"char(36)"
,
nullable
:
false
,
collation
:
"ascii_general_ci"
,
oldClrType
:
typeof
(
Guid
),
oldType
:
"char(36)"
)
.
Annotation
(
"Relational:ColumnOrder"
,
1
)
.
OldAnnotation
(
"Relational:Collation"
,
"ascii_general_ci"
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"Catalog"
,
table
:
"DataStorage"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
Annotation
(
"Relational:ColumnOrder"
,
0
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_DeviceIdentities_DeviceId"
,
table
:
"DeviceIdentities"
,
column
:
"DeviceId"
,
unique
:
true
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_DeviceIdentities_Device_DeviceId"
,
table
:
"DeviceIdentities"
,
column
:
"DeviceId"
,
principalTable
:
"Device"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropForeignKey
(
name
:
"FK_DeviceIdentities_Device_DeviceId"
,
table
:
"DeviceIdentities"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_DeviceIdentities_DeviceId"
,
table
:
"DeviceIdentities"
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"Type"
,
table
:
"TelemetryData"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
5
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"DataSide"
,
table
:
"TelemetryData"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
4
);
migrationBuilder
.
AlterColumn
<
DateTime
>(
name
:
"DateTime"
,
table
:
"TelemetryData"
,
type
:
"timestamp"
,
nullable
:
false
,
oldClrType
:
typeof
(
DateTime
),
oldType
:
"timestamp"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
3
);
migrationBuilder
.
AlterColumn
<
string
>(
name
:
"KeyName"
,
table
:
"TelemetryData"
,
type
:
"varchar(255)"
,
nullable
:
false
,
oldClrType
:
typeof
(
string
),
oldType
:
"varchar(255)"
)
.
Annotation
(
"MySql:CharSet"
,
"utf8mb4"
)
.
OldAnnotation
(
"MySql:CharSet"
,
"utf8mb4"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
2
);
migrationBuilder
.
AlterColumn
<
Guid
>(
name
:
"DeviceId"
,
table
:
"TelemetryData"
,
type
:
"char(36)"
,
nullable
:
false
,
collation
:
"ascii_general_ci"
,
oldClrType
:
typeof
(
Guid
),
oldType
:
"char(36)"
)
.
OldAnnotation
(
"Relational:Collation"
,
"ascii_general_ci"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
1
);
migrationBuilder
.
AlterColumn
<
Guid
>(
name
:
"DeviceId"
,
table
:
"DeviceIdentities"
,
type
:
"char(36)"
,
nullable
:
true
,
collation
:
"ascii_general_ci"
,
oldClrType
:
typeof
(
Guid
),
oldType
:
"char(36)"
)
.
OldAnnotation
(
"Relational:Collation"
,
"ascii_general_ci"
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"Type"
,
table
:
"DataStorage"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
5
);
migrationBuilder
.
AlterColumn
<
DateTime
>(
name
:
"DateTime"
,
table
:
"DataStorage"
,
type
:
"timestamp"
,
nullable
:
false
,
oldClrType
:
typeof
(
DateTime
),
oldType
:
"timestamp"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
3
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"DataSide"
,
table
:
"DataStorage"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
4
);
migrationBuilder
.
AlterColumn
<
string
>(
name
:
"KeyName"
,
table
:
"DataStorage"
,
type
:
"varchar(255)"
,
nullable
:
false
,
oldClrType
:
typeof
(
string
),
oldType
:
"varchar(255)"
)
.
Annotation
(
"MySql:CharSet"
,
"utf8mb4"
)
.
OldAnnotation
(
"MySql:CharSet"
,
"utf8mb4"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
2
);
migrationBuilder
.
AlterColumn
<
Guid
>(
name
:
"DeviceId"
,
table
:
"DataStorage"
,
type
:
"char(36)"
,
nullable
:
false
,
collation
:
"ascii_general_ci"
,
oldClrType
:
typeof
(
Guid
),
oldType
:
"char(36)"
)
.
OldAnnotation
(
"Relational:Collation"
,
"ascii_general_ci"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
1
);
migrationBuilder
.
AlterColumn
<
int
>(
name
:
"Catalog"
,
table
:
"DataStorage"
,
type
:
"int"
,
nullable
:
false
,
oldClrType
:
typeof
(
int
),
oldType
:
"int"
)
.
OldAnnotation
(
"Relational:ColumnOrder"
,
0
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_DeviceIdentities_DeviceId"
,
table
:
"DeviceIdentities"
,
column
:
"DeviceId"
);
migrationBuilder
.
AddForeignKey
(
name
:
"FK_DeviceIdentities_Device_DeviceId"
,
table
:
"DeviceIdentities"
,
column
:
"DeviceId"
,
principalTable
:
"Device"
,
principalColumn
:
"Id"
);
}
}
}
IoTSharp.Data.MySQL/Migrations/ApplicationDbContextModelSnapshot.cs
浏览文件 @
60f56e8b
...
...
@@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
#
nullable
disable
namespace
IoTSharp.Data.MySql.Migrations
{
[
DbContext
(
typeof
(
ApplicationDbContext
))]
...
...
@@ -14,8 +16,8 @@ namespace IoTSharp.Data.MySql.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"
Relational:MaxIdentifierLength"
,
64
)
.
HasAnnotation
(
"
ProductVersion"
,
"5.0.12"
);
.
HasAnnotation
(
"
ProductVersion"
,
"6.0.1"
)
.
HasAnnotation
(
"
Relational:MaxIdentifierLength"
,
64
);
modelBuilder
.
Entity
(
"IoTSharp.Data.AuditLog"
,
b
=>
{
...
...
@@ -382,22 +384,28 @@ namespace IoTSharp.Data.MySql.Migrations
modelBuilder
.
Entity
(
"IoTSharp.Data.DataStorage"
,
b
=>
{
b
.
Property
<
int
>(
"Catalog"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
)
.
HasColumnOrder
(
0
);
b
.
Property
<
Guid
>(
"DeviceId"
)
.
HasColumnType
(
"char(36)"
);
.
HasColumnType
(
"char(36)"
)
.
HasColumnOrder
(
1
);
b
.
Property
<
string
>(
"KeyName"
)
.
HasColumnType
(
"varchar(255)"
);
.
HasColumnType
(
"varchar(255)"
)
.
HasColumnOrder
(
2
);
b
.
Property
<
int
>(
"DataSide"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
)
.
HasColumnOrder
(
4
);
b
.
Property
<
DateTime
>(
"DateTime"
)
.
HasColumnType
(
"timestamp"
);
.
HasColumnType
(
"timestamp"
)
.
HasColumnOrder
(
3
);
b
.
Property
<
int
>(
"Type"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
)
.
HasColumnOrder
(
5
);
b
.
Property
<
byte
[
]>
(
"Value_Binary"
)
.
HasColumnType
(
"longblob"
);
...
...
@@ -654,7 +662,7 @@ namespace IoTSharp.Data.MySql.Migrations
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"char(36)"
);
b
.
Property
<
Guid
?
>(
"DeviceId"
)
b
.
Property
<
Guid
>(
"DeviceId"
)
.
HasColumnType
(
"char(36)"
);
b
.
Property
<
string
>(
"IdentityId"
)
...
...
@@ -669,7 +677,8 @@ namespace IoTSharp.Data.MySql.Migrations
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"DeviceId"
);
b
.
HasIndex
(
"DeviceId"
)
.
IsUnique
();
b
.
ToTable
(
"DeviceIdentities"
);
});
...
...
@@ -1363,19 +1372,24 @@ namespace IoTSharp.Data.MySql.Migrations
modelBuilder
.
Entity
(
"IoTSharp.Data.TelemetryData"
,
b
=>
{
b
.
Property
<
Guid
>(
"DeviceId"
)
.
HasColumnType
(
"char(36)"
);
.
HasColumnType
(
"char(36)"
)
.
HasColumnOrder
(
1
);
b
.
Property
<
string
>(
"KeyName"
)
.
HasColumnType
(
"varchar(255)"
);
.
HasColumnType
(
"varchar(255)"
)
.
HasColumnOrder
(
2
);
b
.
Property
<
DateTime
>(
"DateTime"
)
.
HasColumnType
(
"timestamp"
);
.
HasColumnType
(
"timestamp"
)
.
HasColumnOrder
(
3
);
b
.
Property
<
int
>(
"DataSide"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
)
.
HasColumnOrder
(
4
);
b
.
Property
<
int
>(
"Type"
)
.
HasColumnType
(
"int"
);
.
HasColumnType
(
"int"
)
.
HasColumnOrder
(
5
);
b
.
Property
<
byte
[
]>
(
"Value_Binary"
)
.
HasColumnType
(
"longblob"
);
...
...
@@ -1473,7 +1487,7 @@ namespace IoTSharp.Data.MySql.Migrations
.
IsUnique
()
.
HasDatabaseName
(
"RoleNameIndex"
);
b
.
ToTable
(
"AspNetRoles"
);
b
.
ToTable
(
"AspNetRoles"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>"
,
b
=>
...
...
@@ -1496,7 +1510,7 @@ namespace IoTSharp.Data.MySql.Migrations
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"AspNetRoleClaims"
);
b
.
ToTable
(
"AspNetRoleClaims"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUser"
,
b
=>
...
...
@@ -1560,7 +1574,7 @@ namespace IoTSharp.Data.MySql.Migrations
.
IsUnique
()
.
HasDatabaseName
(
"UserNameIndex"
);
b
.
ToTable
(
"AspNetUsers"
);
b
.
ToTable
(
"AspNetUsers"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserClaim<string>"
,
b
=>
...
...
@@ -1583,7 +1597,7 @@ namespace IoTSharp.Data.MySql.Migrations
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"AspNetUserClaims"
);
b
.
ToTable
(
"AspNetUserClaims"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserLogin<string>"
,
b
=>
...
...
@@ -1605,7 +1619,7 @@ namespace IoTSharp.Data.MySql.Migrations
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"AspNetUserLogins"
);
b
.
ToTable
(
"AspNetUserLogins"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserRole<string>"
,
b
=>
...
...
@@ -1620,7 +1634,7 @@ namespace IoTSharp.Data.MySql.Migrations
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"AspNetUserRoles"
);
b
.
ToTable
(
"AspNetUserRoles"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserToken<string>"
,
b
=>
...
...
@@ -1639,7 +1653,7 @@ namespace IoTSharp.Data.MySql.Migrations
b
.
HasKey
(
"UserId"
,
"LoginProvider"
,
"Name"
);
b
.
ToTable
(
"AspNetUserTokens"
);
b
.
ToTable
(
"AspNetUserTokens"
,
(
string
)
null
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.AttributeLatest"
,
b
=>
...
...
@@ -1649,18 +1663,18 @@ namespace IoTSharp.Data.MySql.Migrations
b
.
HasDiscriminator
().
HasValue
(
2
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.
TelemetryLatest
"
,
b
=>
modelBuilder
.
Entity
(
"IoTSharp.Data.
Gateway
"
,
b
=>
{
b
.
HasBaseType
(
"IoTSharp.Data.D
ataStorag
e"
);
b
.
HasBaseType
(
"IoTSharp.Data.D
evic
e"
);
b
.
HasDiscriminator
().
HasValue
(
4
);
b
.
HasDiscriminator
().
HasValue
(
1
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.
Gateway
"
,
b
=>
modelBuilder
.
Entity
(
"IoTSharp.Data.
TelemetryLatest
"
,
b
=>
{
b
.
HasBaseType
(
"IoTSharp.Data.D
evic
e"
);
b
.
HasBaseType
(
"IoTSharp.Data.D
ataStorag
e"
);
b
.
HasDiscriminator
().
HasValue
(
1
);
b
.
HasDiscriminator
().
HasValue
(
4
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.AuditLog"
,
b
=>
...
...
@@ -1754,8 +1768,10 @@ namespace IoTSharp.Data.MySql.Migrations
modelBuilder
.
Entity
(
"IoTSharp.Data.DeviceIdentity"
,
b
=>
{
b
.
HasOne
(
"IoTSharp.Data.Device"
,
"Device"
)
.
WithMany
()
.
HasForeignKey
(
"DeviceId"
);
.
WithOne
(
"DeviceIdentity"
)
.
HasForeignKey
(
"IoTSharp.Data.DeviceIdentity"
,
"DeviceId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"Device"
);
});
...
...
@@ -1933,6 +1949,11 @@ namespace IoTSharp.Data.MySql.Migrations
b
.
Navigation
(
"Devices"
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.Device"
,
b
=>
{
b
.
Navigation
(
"DeviceIdentity"
);
});
modelBuilder
.
Entity
(
"IoTSharp.Data.DeviceModel"
,
b
=>
{
b
.
Navigation
(
"DeviceModelCommands"
);
...
...
IoTSharp.Data/ApplicationDbContext.cs
浏览文件 @
60f56e8b
...
...
@@ -26,7 +26,7 @@ namespace IoTSharp.Data
protected
override
void
OnModelCreating
(
ModelBuilder
modelBuilder
)
{
modelBuilder
.
Entity
<
Device
>().
HasOne
(
c
=>
c
.
DeviceIdentity
).
WithOne
(
c
=>
c
.
Device
).
HasForeignKey
<
DeviceIdentity
>(
c
=>
c
.
DeviceId
);
modelBuilder
.
Entity
<
DataStorage
>().
HasKey
(
c
=>
new
{
c
.
Catalog
,
c
.
DeviceId
,
c
.
KeyName
});
modelBuilder
.
Entity
<
DataStorage
>().
HasIndex
(
c
=>
c
.
Catalog
);
modelBuilder
.
Entity
<
DataStorage
>().
HasIndex
(
c
=>
new
{
c
.
Catalog
,
c
.
DeviceId
});
...
...
IoTSharp.Data/Device.cs
浏览文件 @
60f56e8b
...
...
@@ -56,6 +56,8 @@ namespace IoTSharp.Data
public
DeviceModel
?
DeviceModel
{
get
;
set
;
}
public
Guid
?
DeviceModelId
{
get
;
set
;
}
public
DeviceIdentity
DeviceIdentity
{
get
;
set
;
}
//public DateTime? CreateDateTime { get; set; }
//public string? CreateMonth { get; set; }
...
...
IoTSharp.Data/DeviceIdentity.cs
浏览文件 @
60f56e8b
...
...
@@ -38,5 +38,7 @@ namespace IoTSharp.Data
[
Newtonsoft
.
Json
.
JsonIgnore
]
[
Required
]
public
Device
Device
{
get
;
set
;
}
public
Guid
DeviceId
{
get
;
set
;
}
}
}
\ No newline at end of file
IoTSharp.Data/Flow.cs
浏览文件 @
60f56e8b
...
...
@@ -36,6 +36,9 @@ namespace IoTSharp.Data
public
Guid
Createor
{
get
;
set
;
}
public
RuleTaskExecutor
Executor
{
get
;
set
;
}
}
}
\ No newline at end of file
IoTSharp.Data/FlowRule.cs
浏览文件 @
60f56e8b
...
...
@@ -23,7 +23,12 @@ namespace IoTSharp.Data
public
string
DefinitionsXml
{
get
;
set
;
}
public
Guid
ParentRuleId
{
get
;
set
;
}
public
double
SubVersion
{
get
;
set
;
}
public
double
Version
{
get
;
set
;
}
public
Guid
CreateId
{
get
;
set
;
}
public
MountType
MountType
{
get
;
set
;
}
public
Tenant
Tenant
{
get
;
set
;
}
public
Guid
TenantId
{
get
;
set
;
}
}
}
IoTSharp/ClientApp/src/app/routes/passport/login/login.component.html
浏览文件 @
60f56e8b
...
...
@@ -22,13 +22,19 @@
<label
nz-checkbox
formControlName=
"remember"
>
{{ 'app.login.remember-me' | translate }}
</label>
</nz-col>
<nz-col
[nzSpan]=
"12"
class=
"text-right"
>
<a
class=
"forgot"
(click)=
"msg.error('can\'t help you')"
>
{{ 'app.login.forgot-password' | translate }}
</a>
<a
class=
"forgot"
(click)=
"msg.error('can\'t help you')"
>
{{ 'app.login.forgot-password' | translate }}
</a>
|
<a
class=
"forgot"
routerLink=
"/passport/register"
[queryParams]=
"{'type': 'register'}"
>
{{ 'app.register.register' | translate }}
</a>
</nz-col>
</nz-form-item>
<nz-form-item>
<button
nz-button
type=
"submit"
nzType=
"primary"
nzSize=
"large"
[nzLoading]=
"http.loading"
nzBlock
>
{{ 'app.login.login' | translate }}
</button>
</nz-form-item>
</form>
IoTSharp/ClientApp/src/app/routes/passport/login/login.component.ts
浏览文件 @
60f56e8b
...
...
@@ -49,7 +49,7 @@ export class UserLoginComponent implements OnDestroy {
if
(
x
.
code
===
10000
)
{
if
(
x
.
data
.
installed
)
{
}
else
{
this
.
router
.
navigateByUrl
(
'
/passport/register
'
);
this
.
router
.
navigateByUrl
(
'
/passport/register
?type=install
'
);
}
}
else
{
this
.
notification
.
error
(
'
请求错误
'
,
'
Api请求不正确
'
);
...
...
IoTSharp/ClientApp/src/app/routes/passport/register/register.component.html
浏览文件 @
60f56e8b
...
...
@@ -4,9 +4,11 @@
<nz-form-item>
<nz-form-control
[nzErrorTip]=
"mailErrorTip"
>
<nz-input-group
nzSize=
"large"
nzAddonBeforeIcon=
"user"
>
<input
nz-input
formControlName=
"email"
placeholder=
"用户邮箱"
/>
<input
nz-input
formControlName=
"email"
placeholder=
"用户邮箱"
/>
</nz-input-group>
<ng-template
#mailErrorTip
let-i
>
<ng-container
*ngIf=
"i.errors[0]==='1'"
>
邮箱已存在
</ng-container>
<ng-container
*ngIf=
"i.errors?.required"
>
{{ 'validation.email.required' | translate }}
</ng-container>
<ng-container
*ngIf=
"i.errors?.email"
>
{{ 'validation.email.wrong-format' | translate }}
</ng-container>
</ng-template>
...
...
@@ -86,6 +88,7 @@
<input
nz-input
formControlName=
"tenantEMail"
placeholder=
"租户邮箱"
/>
</nz-input-group>
<ng-template
#tenantEMailErrorTip
let-i
>
<ng-container
*ngIf=
"i.errors[0]==='1'"
>
邮箱已存在
</ng-container>
<ng-container
*ngIf=
"i.errors?.required"
>
{{ 'validation.tenantEMail.required' | translate }}
</ng-container>
<ng-container
*ngIf=
"i.errors?.email"
>
{{ 'validation.tenantEMail.wrong-format' | translate }}
</ng-container>
</ng-template>
...
...
@@ -96,7 +99,7 @@
<nz-input-group
nzSize=
"large"
nzAddonBeforeIcon=
"user"
>
<input
nz-input
formControlName=
"customerEMail"
placeholder=
"客户邮箱"
/>
</nz-input-group>
<ng-template
#customerEMailErrorTip
let-i
>
<ng-template
#customerEMailErrorTip
let-i
>
<ng-container
*ngIf=
"i.errors[0]==='1'"
>
邮箱已存在
</ng-container>
<ng-container
*ngIf=
"i.errors?.required"
>
{{ 'validation.customerEMail.required' | translate }}
</ng-container>
<ng-container
*ngIf=
"i.errors?.email"
>
{{ 'validation.customerEMail.wrong-format' | translate }}
</ng-container>
</ng-template>
...
...
IoTSharp/ClientApp/src/app/routes/passport/register/register.component.ts
浏览文件 @
60f56e8b
import
{
ReturnStatement
}
from
'
@angular/compiler
'
;
import
{
Component
,
OnDestroy
}
from
'
@angular/core
'
;
import
{
AbstractControl
,
FormBuilder
,
FormControl
,
FormGroup
,
Validators
}
from
'
@angular/forms
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
{
ActivatedRoute
,
Router
}
from
'
@angular/router
'
;
import
{
_HttpClient
}
from
'
@delon/theme
'
;
import
{
NzSafeAny
}
from
'
ng-zorro-antd/core/types
'
;
import
{
NzMessageService
}
from
'
ng-zorro-antd/message
'
;
import
{
NzNotificationService
}
from
'
ng-zorro-antd/notification
'
;
import
{
map
}
from
'
rxjs/operators
'
;
import
{
AppMessage
}
from
'
../../common/AppMessage
'
;
@
Component
({
selector
:
'
passport-register
'
,
...
...
@@ -12,20 +15,70 @@ import { NzNotificationService } from 'ng-zorro-antd/notification';
styleUrls
:
[
'
./register.component.less
'
],
})
export
class
UserRegisterComponent
implements
OnDestroy
{
constructor
(
fb
:
FormBuilder
,
private
router
:
Router
,
public
http
:
_HttpClient
,
public
msg
:
NzMessageService
,
public
notification
:
NzNotificationService
,)
{
this
.
form
=
fb
.
group
({
email
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
,
Validators
.
email
]],
Password
:
[
''
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
UserRegisterComponent
.
checkPassword
.
bind
(
this
)]],
confirm
:
[
''
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
UserRegisterComponent
.
passwordEquar
]],
mobilePrefix
:
[
'
+86
'
],
CustomerName
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
]],
tenantName
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
]],
tenantEMail
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
,
Validators
.
email
]],
customerEMail
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
,
Validators
.
email
]],
phoneNumber
:
[
'
15911111111
'
,
[
Validators
.
required
,
Validators
.
pattern
(
/^1
\d{10}
$/
)]],
registertype
:
String
=
'
install
'
constructor
(
fb
:
FormBuilder
,
private
router
:
Router
,
public
http
:
_HttpClient
,
public
msg
:
NzMessageService
,
public
notification
:
NzNotificationService
,
private
_router
:
ActivatedRoute
,
)
{
this
.
_router
.
queryParams
.
subscribe
(
x
=>
{
this
.
registertype
=
x
.
type
;
if
(
x
&&
x
.
type
===
'
install
'
)
{
this
.
form
=
fb
.
group
({
email
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
,
Validators
.
email
]],
Password
:
[
''
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
UserRegisterComponent
.
checkPassword
.
bind
(
this
)]],
confirm
:
[
''
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
UserRegisterComponent
.
passwordEquar
]],
mobilePrefix
:
[
'
+86
'
],
CustomerName
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
]],
tenantName
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
]],
tenantEMail
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
,
Validators
.
email
]],
customerEMail
:
[
'
iotmaster@iotsharp.net
'
,
[
Validators
.
required
,
Validators
.
email
]],
phoneNumber
:
[
'
15911111111
'
,
[
Validators
.
required
,
Validators
.
pattern
(
/^1
\d{10}
$/
)]],
});
}
else
{
this
.
registertype
=
'
register
'
this
.
form
=
fb
.
group
({
email
:
[
''
,
[
Validators
.
required
,
Validators
.
email
,],[
this
.
emailValidator
]],
Password
:
[
''
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
UserRegisterComponent
.
checkPassword
.
bind
(
this
)]],
confirm
:
[
''
,
[
Validators
.
required
,
Validators
.
minLength
(
6
),
UserRegisterComponent
.
passwordEquar
]],
mobilePrefix
:
[
'
+86
'
],
CustomerName
:
[
''
,
[
Validators
.
required
]],
tenantName
:
[
''
,
[
Validators
.
required
]],
tenantEMail
:
[
''
,
[
Validators
.
required
,
Validators
.
email
],[
this
.
tenantmailValidator
]],
customerEMail
:
[
''
,
[
Validators
.
required
,
Validators
.
email
],[
this
.
customerEmailValidator
]],
phoneNumber
:
[
''
,
[
Validators
.
required
,
Validators
.
pattern
(
/^1
\d{10}
$/
)]],
});
}
});
}
emailValidator
=
(
control
:
FormControl
)
=>
this
.
checkemail
(
control
.
value
,
3
)
customerEmailValidator
=
(
control
:
FormControl
)
=>
this
.
checkemail
(
control
.
value
,
2
)
tenantmailValidator
=
(
control
:
FormControl
)
=>
this
.
checkemail
(
control
.
value
,
1
)
checkemail
(
email
:
String
,
type
:
Number
){
return
this
.
http
.
get
<
AppMessage
>
(
'
api/account/checkExist?email=
'
+
email
+
'
&type=
'
+
type
)
.
pipe
(
map
(
x
=>
x
.
data
?
'
1
'
:
null
)
)
}
// #region fields
get
mail
():
AbstractControl
{
...
...
@@ -119,17 +172,39 @@ export class UserRegisterComponent implements OnDestroy {
if
(
this
.
form
.
invalid
)
{
return
;
}
this
.
http
.
post
(
'
api/Installer/Install?_allow_anonymous=true
'
,
data
).
subscribe
((
x
)
=>
{
if
(
x
.
code
===
10000
){
if
(
x
.
data
.
installed
)
{
this
.
router
.
navigateByUrl
(
'
/passport/login?_allow_anonymous=true
'
);
}
else
{
this
.
router
.
navigateByUrl
(
'
/passport/login?_allow_anonymous=true
'
);
}
}
else
{
this
.
notification
.
error
(
'
错误
'
,
x
.
msg
);
if
(
this
.
registertype
===
'
install
'
){
this
.
http
.
post
(
'
api/Installer/Install?_allow_anonymous=true
'
,
data
).
subscribe
((
x
)
=>
{
if
(
x
.
code
===
10000
)
{
if
(
x
.
data
.
installed
)
{
this
.
router
.
navigateByUrl
(
'
/passport/login?_allow_anonymous=true
'
);
}
else
{
this
.
router
.
navigateByUrl
(
'
/passport/login?_allow_anonymous=true
'
);
}
});
}
else
{
this
.
notification
.
error
(
'
错误
'
,
x
.
msg
);
}
});
}
else
{
this
.
http
.
post
(
'
api/account/create?_allow_anonymous=true
'
,
data
).
subscribe
((
x
)
=>
{
if
(
x
.
code
===
10000
)
{
if
(
x
.
data
.
installed
)
{
this
.
router
.
navigateByUrl
(
'
/passport/login?_allow_anonymous=true
'
);
}
else
{
this
.
router
.
navigateByUrl
(
'
/passport/login?_allow_anonymous=true
'
);
}
}
else
{
this
.
notification
.
error
(
'
错误
'
,
x
.
msg
);
}
});
}
}
ngOnDestroy
():
void
{
...
...
IoTSharp/Controllers/AccountController.cs
浏览文件 @
60f56e8b
...
...
@@ -261,6 +261,70 @@ namespace IoTSharp.Controllers
}
return
new
ApiResult
<
LoginResult
>(
ApiCode
.
InValidData
,
""
,
null
);
}
/// <summary>
/// 注册新的租户,客户,以及用户
/// </summary>
/// <param name="model"></param>
/// <returns >返回登录结果</returns>
[
AllowAnonymous
]
[
HttpPost
]
public
async
Task
<
ApiResult
<
LoginResult
>>
Create
([
FromBody
]
InstallDto
model
)
{
var
tenant
=
_context
.
Tenant
.
FirstOrDefault
(
t
=>
t
.
EMail
==
model
.
TenantEMail
);
var
customer
=
_context
.
Customer
.
FirstOrDefault
(
t
=>
t
.
Email
==
model
.
CustomerEMail
);
if
(
tenant
==
null
&&
customer
==
null
)
{
tenant
=
new
Tenant
()
{
Id
=
Guid
.
NewGuid
(),
Name
=
model
.
TenantName
,
EMail
=
model
.
TenantEMail
};
customer
=
new
Customer
()
{
Id
=
Guid
.
NewGuid
(),
Name
=
model
.
CustomerName
,
Email
=
model
.
CustomerEMail
};
customer
.
Tenant
=
tenant
;
tenant
.
Customers
=
new
List
<
Customer
>();
tenant
.
Customers
.
Add
(
customer
);
_context
.
Tenant
.
Add
(
tenant
);
_context
.
Customer
.
Add
(
customer
);
await
_context
.
SaveChangesAsync
();
}
IdentityUser
user
=
await
_userManager
.
FindByEmailAsync
(
model
.
Email
);
if
(
user
==
null
)
{
user
=
new
IdentityUser
{
Email
=
model
.
Email
,
UserName
=
model
.
Email
,
PhoneNumber
=
model
.
PhoneNumber
};
var
result
=
await
_userManager
.
CreateAsync
(
user
,
model
.
Password
);
if
(
result
.
Succeeded
)
{
await
_signInManager
.
SignInAsync
(
user
,
false
);
await
_signInManager
.
UserManager
.
AddClaimAsync
(
user
,
new
Claim
(
ClaimTypes
.
Email
,
model
.
Email
));
await
_signInManager
.
UserManager
.
AddClaimAsync
(
user
,
new
Claim
(
IoTSharpClaimTypes
.
Customer
,
customer
.
Id
.
ToString
()));
await
_signInManager
.
UserManager
.
AddClaimAsync
(
user
,
new
Claim
(
IoTSharpClaimTypes
.
Tenant
,
tenant
.
Id
.
ToString
()));
await
_signInManager
.
UserManager
.
AddToRoleAsync
(
user
,
nameof
(
UserRole
.
Anonymous
));
await
_signInManager
.
UserManager
.
AddToRoleAsync
(
user
,
nameof
(
UserRole
.
NormalUser
));
await
_signInManager
.
UserManager
.
AddToRoleAsync
(
user
,
nameof
(
UserRole
.
CustomerAdmin
));
await
_signInManager
.
UserManager
.
AddToRoleAsync
(
user
,
nameof
(
UserRole
.
TenantAdmin
));
return
new
ApiResult
<
LoginResult
>(
ApiCode
.
Success
,
"注册成功"
,
null
);
}
else
{
throw
new
Exception
(
string
.
Join
(
','
,
result
.
Errors
.
ToList
().
Select
(
ie
=>
$"code=
{
ie
.
Code
}
,msg=
{
ie
.
Description
}
"
)));
}
}
var
rship
=
new
Relationship
{
IdentityUser
=
_context
.
Users
.
Find
(
user
.
Id
),
Customer
=
_context
.
Customer
.
Find
(
customer
.
Id
),
Tenant
=
_context
.
Tenant
.
Find
(
tenant
.
Id
)
};
_context
.
Add
(
rship
);
await
_context
.
SaveChangesAsync
();
return
new
ApiResult
<
LoginResult
>(
ApiCode
.
InValidData
,
""
,
null
);
}
/// <summary>
/// 返回客户所属用户列表
/// </summary>
...
...
@@ -374,6 +438,30 @@ namespace IoTSharp.Controllers
return
new
ApiResult
<
bool
>(
ApiCode
.
InValidData
,
"password length must great than six character"
,
false
);
}
[
AllowAnonymous
]
[
HttpGet
]
public
ApiResult
<
bool
>
CheckExist
(
string
email
,
int
type
)
{
if
(
string
.
IsNullOrEmpty
(
email
))
{
return
new
ApiResult
<
bool
>(
ApiCode
.
Success
,
"OK"
,
false
);
}
else
{
switch
(
type
)
{
case
1
:
return
new
ApiResult
<
bool
>(
ApiCode
.
Success
,
"OK"
,
_context
.
Tenant
.
Any
(
c
=>
c
.
EMail
.
ToLower
()
==
email
.
ToLower
()));
case
2
:
return
new
ApiResult
<
bool
>(
ApiCode
.
Success
,
"OK"
,
_context
.
Customer
.
Any
(
c
=>
c
.
Email
.
ToLower
()
==
email
.
ToLower
()));
case
3
:
return
new
ApiResult
<
bool
>(
ApiCode
.
Success
,
"OK"
,
_context
.
Users
.
Any
(
c
=>
c
.
Email
.
ToLower
()
==
email
.
ToLower
()));
}
return
new
ApiResult
<
bool
>(
ApiCode
.
Success
,
"OK"
,
false
);
}
}
}
}
\ No newline at end of file
IoTSharp/Controllers/CustomersController.cs
浏览文件 @
60f56e8b
...
...
@@ -12,6 +12,7 @@ using System.Linq;
using
System.Linq.Dynamic.Core
;
using
System.Linq.Expressions
;
using
System.Threading.Tasks
;
using
IoTSharp.Extensions
;
using
Customer
=
IoTSharp
.
Data
.
Customer
;
namespace
IoTSharp.Controllers
...
...
@@ -57,7 +58,11 @@ namespace IoTSharp.Controllers
public
async
Task
<
ApiResult
<
PagedData
<
Customer
>>>
GetCustomers
([
FromBody
]
CustomerParam
m
)
{
Expression
<
Func
<
Customer
,
bool
>>
condition
=
x
=>
x
.
Tenant
.
Id
==
m
.
tenantId
;
var
profile
=
await
this
.
GetUserProfile
();
Expression
<
Func
<
Customer
,
bool
>>
condition
=
x
=>
x
.
Tenant
.
Id
==
profile
.
Tenant
;
//var f = from c in _context.Customer where c.Tenant.Id == select c;
//if (!f.Any())
...
...
IoTSharp/Controllers/DevicesController.cs
浏览文件 @
60f56e8b
...
...
@@ -101,15 +101,15 @@ namespace IoTSharp.Controllers
public
async
Task
<
ApiResult
<
PagedData
<
DeviceDetailDto
>>>
GetDevices
([
FromQuery
]
DeviceParam
m
)
{
var
profile
=
await
this
.
GetUserProfile
();
if
(
m
.
limit
>
0
)
{
try
{
Expression
<
Func
<
Device
,
bool
>>
condition
=
x
=>
x
.
Customer
.
Id
==
m
.
customerId
&&
x
.
Status
>
-
1
;
Expression
<
Func
<
Device
,
bool
>>
condition
=
x
=>
x
.
Customer
.
Id
==
m
.
customerId
&&
x
.
Status
>
-
1
&&
x
.
Tenant
.
Id
==
profile
.
Tenant
;
if
(!
string
.
IsNullOrEmpty
(
m
.
Name
))
{
condition
=
condition
.
And
(
x
=>
x
.
Name
.
Contains
(
m
.
Name
));
...
...
@@ -119,21 +119,21 @@ namespace IoTSharp.Controllers
return
new
ApiResult
<
PagedData
<
DeviceDetailDto
>>(
ApiCode
.
Success
,
"OK"
,
new
PagedData
<
DeviceDetailDto
>
{
total
=
await
_context
.
Device
.
CountAsync
(
condition
),
rows
=
await
_context
.
Device
.
OrderByDescending
(
c
=>
c
.
LastActive
).
Where
(
condition
).
Skip
((
m
.
offset
)
*
m
.
limit
).
Take
(
m
.
limit
).
Join
(
_context
.
DeviceIdentities
,
x
=>
x
.
Id
,
y
=>
y
.
Device
.
Id
,
(
x
,
y
)
=>
new
DeviceDetailDto
()
rows
=
_context
.
Device
.
Include
(
c
=>
c
.
DeviceIdentity
).
OrderByDescending
(
c
=>
c
.
LastActive
).
Where
(
condition
).
Skip
((
m
.
offset
)
*
m
.
limit
).
Take
(
m
.
limit
).
ToList
().
Select
(
x
=>
new
DeviceDetailDto
()
{
Id
=
x
.
Id
,
Name
=
x
.
Name
,
LastActive
=
x
.
LastActive
,
IdentityId
=
y
.
IdentityId
,
IdentityValue
=
y
.
IdentityType
==
IdentityType
.
X509Certificate
?
""
:
y
.
IdentityValue
,
IdentityId
=
x
.
DeviceIdentity
?
.
IdentityId
,
IdentityValue
=
x
.
DeviceIdentity
?.
IdentityType
==
IdentityType
.
X509Certificate
?
""
:
x
.
DeviceIdentity
?
.
IdentityValue
,
Tenant
=
x
.
Tenant
,
Customer
=
x
.
Customer
,
DeviceType
=
x
.
DeviceType
,
Online
=
x
.
Online
,
Owner
=
x
.
Owner
,
Timeout
=
x
.
Timeout
,
IdentityType
=
y
.
IdentityType
}).
ToList
Async
()
IdentityType
=
x
.
DeviceIdentity
?.
IdentityType
??
IdentityType
.
AccessToken
}).
ToList
()
});
}
catch
(
Exception
e
)
...
...
IoTSharp/Controllers/MenuController.cs
浏览文件 @
60f56e8b
...
...
@@ -163,6 +163,117 @@ namespace IoTSharp.Controllers
}
);
}
else
if
(
profile
.
Roles
.
FirstOrDefault
()?.
Contains
(
"TenantAdmin"
)
??
false
)
{
return
new
ApiResult
<
dynamic
>(
ApiCode
.
Success
,
"OK"
,
new
{
menu
=
new
[]
{
new
{
text
=
"主导航"
,
i18n
=
"主导航"
,
group
=
true
,
hideInBreadcrumb
=
true
,
children
=
new
[]
{
new
{
text
=
"仪表盘"
,
i18n
=
"仪表盘"
,
icon
=
"anticon-dashboard"
,
children
=
new
[]
{
new
{
text
=
"仪表盘"
,
i18n
=
""
,
link
=
"/dashboard/v1"
}
}
},
new
{
text
=
"租户管理"
,
i18n
=
""
,
icon
=
"anticon-cloud"
,
children
=
new
[]
{
new
{
text
=
"租户列表"
,
i18n
=
""
,
link
=
"/iot/tenant/tenantlist"
}
}
},
new
{
text
=
"客户管理"
,
i18n
=
""
,
icon
=
"anticon-appstore"
,
children
=
new
[]
{
new
{
text
=
"客户列表"
,
i18n
=
""
,
link
=
"/iot/customer/customerlist"
}
}
},
new
{
text
=
"用户管理"
,
i18n
=
""
,
icon
=
"anticon-user"
,
children
=
new
[]
{
new
{
text
=
"用户列表"
,
i18n
=
""
,
link
=
"/iot/user/userlist"
}
}
},
new
{
text
=
"设备管理"
,
i18n
=
""
,
icon
=
"anticon-database"
,
children
=
new
[]
{
/* new { text = "型号管理", i18n = "",link="/iot/devicemodel/devicemodellist" },*/
new
{
text
=
"设备管理"
,
i18n
=
""
,
link
=
"/iot/device/devicelist"
},
new
{
text
=
"网关配置器"
,
i18n
=
""
,
link
=
"/iot/device/devicegraph"
},
},
},
new
{
text
=
"规则链 "
,
i18n
=
""
,
icon
=
"anticon-fork"
,
children
=
new
[]
{
//new { text = "设备列表", i18n = "", link = "/iot/device/devicelist" },
new
{
text
=
"设计器"
,
i18n
=
""
,
link
=
"/iot/flow/flowlist"
},
new
{
text
=
"脚本管理"
,
i18n
=
""
,
link
=
"/iot/flow/scriptlist"
},
new
{
text
=
"组件管理"
,
i18n
=
""
,
link
=
"/iot/flow/componentlist"
},
new
{
text
=
"事件"
,
i18n
=
""
,
link
=
"/iot/flow/flowevents"
},
new
{
text
=
"执行器"
,
i18n
=
""
,
link
=
"/iot/flow/taskexecutorlist"
},
new
{
text
=
"订阅"
,
i18n
=
""
,
link
=
"/iot/flow/subscriptionlist"
},
}
},
}
}
},
funcs
=
Enumerable
.
Range
(
0
,
500
),
username
=
profile
.
Name
,
AppName
=
"iotsharp"
,
Modules
=
new
[]
{
"kanban"
,
"statistics"
,
"lists"
,
//"warning"
},
// 用户首页模块
Email
=
profile
.
Email
.
FirstOrDefault
(),
Comstomer
=
profile
.
Comstomer
,
Tenant
=
profile
.
Tenant
,
Logo
=
""
}
);
}
return
new
ApiResult
<
dynamic
>(
ApiCode
.
Success
,
"OK"
,
null
);
}
...
...
IoTSharp/IoTSharp.xml
浏览文件 @
60f56e8b
...
...
@@ -84,6 +84,13 @@
<param
name=
"model"
></param>
<returns
>
返回登录结果
</returns>
</member>
<member
name=
"M:IoTSharp.Controllers.AccountController.Create(IoTSharp.Dtos.InstallDto)"
>
<summary>
注册新的租户,客户,以及用户
</summary>
<param
name=
"model"
></param>
<returns
>
返回登录结果
</returns>
</member>
<member
name=
"M:IoTSharp.Controllers.AccountController.All(System.Guid)"
>
<summary>
返回客户所属用户列表
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录