Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
44697277
Commit
44697277
authored
Mar 27, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口禁用
parent
a6619e19
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
performance/Performance.Api/Filters/ActionsFilter.cs
+8
-14
No files found.
performance/Performance.Api/Filters/ActionsFilter.cs
View file @
44697277
...
...
@@ -38,6 +38,14 @@ public ActionsFilter(ILoggerFactory factory, IMemoryCache cache, IHostingEnviron
//记录Request请求
var
kv
=
GetRequestContent
(
request
);
_logger
.
LogInformation
(
$"请求内容
{
request
.
Method
}
:
{
JsonHelper
.
Serialize
(
kv
)}
"
);
//接口禁用
var
disable
=
((
ControllerActionDescriptor
)
context
.
ActionDescriptor
).
MethodInfo
.
GetCustomAttributes
(
typeof
(
DisableAttribute
),
true
);
if
(
disable
.
Length
>
0
)
{
var
response
=
new
ApiResponse
(
ResponseType
.
Disable
,
"接口已禁用"
);
context
.
Result
=
new
ObjectResult
(
response
);
return
;
}
//token验证
var
arry
=
((
ControllerActionDescriptor
)
context
.
ActionDescriptor
).
MethodInfo
.
GetCustomAttributes
(
typeof
(
NoVerifyAttribute
),
true
);
if
(
arry
.
Length
==
0
)
...
...
@@ -50,20 +58,6 @@ public ActionsFilter(ILoggerFactory factory, IMemoryCache cache, IHostingEnviron
context
.
Result
=
new
ObjectResult
(
response
);
return
;
}
//var activeuid = kv.GetValue<Nullable<int>>("activeuid");
//if (!activeuid.HasValue)
//{
// var response = new ApiResponse(ResponseType.TokenError, "Token无效");
// context.Result = new ObjectResult(response);
// return;
//}
}
var
disable
=
((
ControllerActionDescriptor
)
context
.
ActionDescriptor
).
MethodInfo
.
GetCustomAttributes
(
typeof
(
DisableAttribute
),
true
);
if
(
disable
.
Length
>
0
)
{
var
response
=
new
ApiResponse
(
ResponseType
.
Disable
,
"接口已禁用"
);
context
.
Result
=
new
ObjectResult
(
response
);
return
;
}
//验证请求参数
if
(!
context
.
ModelState
.
IsValid
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment