api model use record

This commit is contained in:
2023-03-28 06:33:48 +08:00
parent b5e4d57772
commit 4d0f8e20a6
8 changed files with 68 additions and 175 deletions
+7 -12
View File
@@ -25,7 +25,10 @@ namespace SimApi.Helpers
/// <returns></returns>
public string Login(string id, string type = "user", string token = null)
{
return Login(id, new[] { type }, token);
return Login(id, new[]
{
type
}, token);
}
/// <summary>
@@ -36,15 +39,8 @@ namespace SimApi.Helpers
/// <returns></returns>
public string Login(string id, string[] type, string uuid = null)
{
if (uuid == null)
{
uuid = Guid.NewGuid().ToString();
}
var loginItem = new SimApiLoginItem
{
Id = id,
Type = type
};
uuid ??= Guid.NewGuid().ToString();
var loginItem = new SimApiLoginItem(id, type);
Cache.SetString(uuid, JsonSerializer.Serialize(loginItem));
return uuid;
}
@@ -60,6 +56,5 @@ namespace SimApi.Helpers
Cache.Remove(uuid);
}
}
}
}
}