| | |
| | | using System; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.CodeAnalysis.CSharp.Syntax; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using static System.Net.WebRequestMethods; |
| | | |
| | | namespace Gs.Toolbox |
| | | { |
| | | public static class UtilityHelper |
| | | { |
| | | public static Guid? GetGuid(string? str) { |
| | | /// <summary> |
| | | /// string 转guid |
| | | /// </summary> |
| | | /// <param name="str"></param> |
| | | /// <returns></returns> |
| | | public static Guid? GetGuid(string? str) |
| | | { |
| | | if (string.IsNullOrEmpty(str)) |
| | | return null; |
| | | return Guid.Parse(str); |
| | | } |
| | | /// <summary> |
| | | /// 读取userGuid,orgGuid |
| | | /// </summary> |
| | | /// <param name="_http"></param> |
| | | /// <returns></returns> |
| | | public static (string?, string?) GetUserGuidAndOrgGuid(IHttpContextAccessor _http) |
| | | { |
| | | try |
| | | { |
| | | string _token = _http.HttpContext.Request.Headers["token"]; |
| | | string[] _ary = _token.Split("~"); |
| | | return (_ary[0], _ary[1]); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Gs.Toolbox.LogHelper.Debug("GetUserGuidAndOrgGuid:", ex.Message); |
| | | return (null, null); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |