forked from 16it/MasterChief
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApiBaseController.cs
32 lines (27 loc) · 922 Bytes
/
ApiBaseController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Web.Http;
using MasterChief.DotNet.ProjectTemplate.WebApi.Helper;
using MasterChief.DotNet4.Utilities.Common;
namespace MasterChief.DotNet.ProjectTemplate.WebApi
{
/// <summary>
/// WebApi 基类
/// </summary>
public class ApiBaseController : ApiController
{
#region Properties
/// <summary>
/// 当前通道ID
/// </summary>
public Guid CurrentAppId => Request.GetUriOrHeaderValue("Access_appId").ToGuidOrDefault();
/// <summary>
/// 当前令牌
/// </summary>
public string CurrentToken => Request.GetUriOrHeaderValue("Access_token").ToStringOrDefault(string.Empty);
/// <summary>
/// 当前用户
/// </summary>
public Guid CurrentUserId => Request.GetUriOrHeaderValue("Access_userId").ToGuidOrDefault();
#endregion Properties
}
}