diff --git a/Attributes/YYAuthAttribute.cs b/Attributes/YYAuthAttribute.cs
index 08752b2..7307aa3 100644
--- a/Attributes/YYAuthAttribute.cs
+++ b/Attributes/YYAuthAttribute.cs
@@ -41,7 +41,7 @@ namespace YYApi.Attributes
throw new YYApiException(401);
}
//检测用户类型
- if (!Types.Contains(loginInfo.Type))
+ if (Types.Intersect(loginInfo.Type).Count() == 0)
{
throw new YYApiException(403);
}
diff --git a/Communications/YYLoginItem.cs b/Communications/YYLoginItem.cs
index 44a7883..0923526 100644
--- a/Communications/YYLoginItem.cs
+++ b/Communications/YYLoginItem.cs
@@ -9,6 +9,6 @@ namespace YYApi.Communications
//登录用户的ID
public int Id { get; set; }
//登录用户来源
- public string Type { get; set; }
+ public string[] Type { get; set; }
}
}
diff --git a/Helpers/YYAuth.cs b/Helpers/YYAuth.cs
index efd9a9e..b8b1bad 100644
--- a/Helpers/YYAuth.cs
+++ b/Helpers/YYAuth.cs
@@ -24,6 +24,17 @@ namespace YYApi.Helpers
///
///
public string Set(int id, string type = "user")
+ {
+ return Set(id, new[] { type });
+ }
+
+ ///
+ /// 产生一个TOken并记录用户ID角色[多角色]
+ ///
+ ///
+ ///
+ ///
+ public string Set(int id, string[] type)
{
var uuid = Guid.NewGuid().ToString();
var loginItem = new YYLoginItem