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
2d3838af
Commit
2d3838af
authored
Mar 27, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增禁用特性
parent
9ae0577b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
performance/Performance.Api/Filters/ActionsFilter.cs
+10
-0
performance/Performance.DtoModels/ResponseType.cs
+1
-0
No files found.
performance/Performance.Api/Filters/ActionsFilter.cs
View file @
2d3838af
...
...
@@ -58,6 +58,13 @@ public ActionsFilter(ILoggerFactory factory, IMemoryCache cache, IHostingEnviron
// 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
)
{
...
...
@@ -132,4 +139,7 @@ public ActionsFilter(ILoggerFactory factory, IMemoryCache cache, IHostingEnviron
[
AttributeUsage
(
AttributeTargets
.
Method
)]
public
class
NoVerifyAttribute
:
Attribute
{
}
[
AttributeUsage
(
AttributeTargets
.
Method
|
AttributeTargets
.
Class
)]
public
class
DisableAttribute
:
Attribute
{
}
}
performance/Performance.DtoModels/ResponseType.cs
View file @
2d3838af
...
...
@@ -12,5 +12,6 @@ public enum ResponseType
TokenError
=
4
,
NotFound
=
5
,
ParameterError
=
6
,
Disable
=
7
,
}
}
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