|
@@ -38,6 +38,7 @@ using System.Numerics;
|
|
|
using System.Security.Cryptography;
|
|
|
using System.Runtime.InteropServices;
|
|
|
using System.Runtime.CompilerServices;
|
|
|
+using System.IdentityModel.Tokens.Jwt;
|
|
|
|
|
|
namespace TEAMModelBI.Controllers.BITest
|
|
|
{
|
|
@@ -719,6 +720,11 @@ namespace TEAMModelBI.Controllers.BITest
|
|
|
return Ok(new { state = 200, pydays, days, strends , str_strend1, str_strend2 , ste });
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 计算天数
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="jsonElement"></param>
|
|
|
+ /// <returns></returns>
|
|
|
[HttpPost("get-dateday")]
|
|
|
public async Task<IActionResult> GetDateDay(JsonElement jsonElement)
|
|
|
{
|
|
@@ -769,6 +775,25 @@ namespace TEAMModelBI.Controllers.BITest
|
|
|
|
|
|
}
|
|
|
|
|
|
+ [HttpPost("get-xauth")]
|
|
|
+ public async Task<IActionResult> GetXAuth()
|
|
|
+ {
|
|
|
+ string authHeader = this.Request.Headers["Authorization"];//Header中的token
|
|
|
+ string _auth = HttpContext.GetXAuth("AuthToken");
|
|
|
+ string id = null;
|
|
|
+ string name = null;
|
|
|
+
|
|
|
+ if (!string.IsNullOrWhiteSpace(_auth) && JwtAuthExtension.ValidateApiToken(_auth, _option.JwtSecretKey))
|
|
|
+ {
|
|
|
+ var jwt = new JwtSecurityTokenHandler().ReadJwtToken(_auth);
|
|
|
+ id = jwt.Payload.Sub;
|
|
|
+ name = jwt.Claims.FirstOrDefault(claim => claim.Type.Equals("name"))?.Value;
|
|
|
+ }
|
|
|
+ return Ok(new { state = 200, id, name });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
public class strend
|
|
|
{
|