Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
afanti-open-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
java-ms
afanti-open-api
Commits
0a54e567
Commit
0a54e567
authored
May 04, 2023
by
陈炎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
红旗数据api-优化4
parent
0e98bcdb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
CommonDataController.java
...nticar/afantiopenapi/controller/CommonDataController.java
+2
-2
BaseService.java
...java/com/afanticar/afantiopenapi/service/BaseService.java
+1
-4
No files found.
src/main/java/com/afanticar/afantiopenapi/controller/CommonDataController.java
View file @
0a54e567
...
@@ -59,7 +59,7 @@ public class CommonDataController extends BaseController {
...
@@ -59,7 +59,7 @@ public class CommonDataController extends BaseController {
@GetMapping
(
"/activity"
)
@GetMapping
(
"/activity"
)
public
BaseResponse
<
BasePageVO
<
ActivityInfoVO
>>
getActionData
(
HttpServletRequest
request
,
@Max
(
value
=
500
,
message
=
"单页数据page_size过大"
)
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"100"
,
required
=
false
)
Integer
pageSize
,
public
BaseResponse
<
BasePageVO
<
ActivityInfoVO
>>
getActionData
(
HttpServletRequest
request
,
@Max
(
value
=
500
,
message
=
"单页数据page_size过大"
)
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"100"
,
required
=
false
)
Integer
pageSize
,
@RequestParam
(
name
=
"current_page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
)
{
@RequestParam
(
name
=
"current_page"
,
defaultValue
=
"1"
,
required
=
false
)
Integer
pageNum
)
{
BaseResponse
check
=
baseService
.
baseLimit
(
request
,
dateType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
baseLimit
(
dateType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
@@ -70,7 +70,7 @@ public class CommonDataController extends BaseController {
...
@@ -70,7 +70,7 @@ public class CommonDataController extends BaseController {
@ApiOperation
(
value
=
"获取token"
,
notes
=
"token数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"获取token"
,
notes
=
"token数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/token"
)
@PostMapping
(
"/token"
)
public
BaseResponse
<
TokenVO
>
getToken
(
@RequestBody
@Valid
TokenDTO
dto
)
{
public
BaseResponse
<
TokenVO
>
getToken
(
@RequestBody
@Valid
TokenDTO
dto
)
{
BaseResponse
check
=
baseService
.
baseLimit
(
null
,
dateType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
baseLimit
(
dateType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
...
src/main/java/com/afanticar/afantiopenapi/service/BaseService.java
View file @
0a54e567
...
@@ -38,11 +38,8 @@ public class BaseService {
...
@@ -38,11 +38,8 @@ public class BaseService {
return
null
;
return
null
;
}
}
public
BaseResponse
baseLimit
(
HttpServletRequest
request
,
String
dataType
,
Integer
limit
,
Integer
limitPeriod
)
{
public
BaseResponse
baseLimit
(
String
dataType
,
Integer
limit
,
Integer
limitPeriod
)
{
String
header
=
"token"
;
String
header
=
"token"
;
if
(
request
!=
null
)
{
header
=
(
String
)
request
.
getAttribute
(
BaseController
.
header
);
}
String
fawKey
=
String
.
format
(
"%s:%s:limit"
,
dataType
,
header
);
String
fawKey
=
String
.
format
(
"%s:%s:limit"
,
dataType
,
header
);
RRateLimiter
rateLimiter
=
redissonClient
.
getRateLimiter
(
fawKey
);
RRateLimiter
rateLimiter
=
redissonClient
.
getRateLimiter
(
fawKey
);
rateLimiter
.
trySetRate
(
RateType
.
OVERALL
,
limit
,
limitPeriod
,
RateIntervalUnit
.
SECONDS
);
rateLimiter
.
trySetRate
(
RateType
.
OVERALL
,
limit
,
limitPeriod
,
RateIntervalUnit
.
SECONDS
);
...
...
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