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
be3e59b0
Commit
be3e59b0
authored
Sep 26, 2024
by
许润龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改:活动视频、直播数据详情数据接口
parent
5684616e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
FawOpenController.java
...afanticar/afantiopenapi/controller/FawOpenController.java
+4
-4
BaseService.java
...java/com/afanticar/afantiopenapi/service/BaseService.java
+16
-1
No files found.
src/main/java/com/afanticar/afantiopenapi/controller/FawOpenController.java
View file @
be3e59b0
...
@@ -145,7 +145,7 @@ public class FawOpenController extends BaseController {
...
@@ -145,7 +145,7 @@ public class FawOpenController extends BaseController {
@ApiOperation
(
value
=
"抖音活动视频数据信息"
,
notes
=
"抖音活动视频数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"抖音活动视频数据信息"
,
notes
=
"抖音活动视频数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/douyin/aweme/list"
)
@PostMapping
(
"/activity/douyin/aweme/list"
)
public
BaseResponse
<
BasePageVO
<
HongqiActivityAwemeVO
>>
getDouyinActivityAwemeData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
public
BaseResponse
<
BasePageVO
<
HongqiActivityAwemeVO
>>
getDouyinActivityAwemeData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
BaseResponse
check
=
baseService
.
base
Limit
(
dataType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
pageApi
Limit
(
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
@@ -159,7 +159,7 @@ public class FawOpenController extends BaseController {
...
@@ -159,7 +159,7 @@ public class FawOpenController extends BaseController {
@ApiOperation
(
value
=
"抖音活动直播数据信息"
,
notes
=
"抖音活动直播数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"抖音活动直播数据信息"
,
notes
=
"抖音活动直播数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/douyin/live/list"
)
@PostMapping
(
"/activity/douyin/live/list"
)
public
BaseResponse
<
BasePageVO
<
HongqiActivityLiveVO
>>
getDouyinActivityLiveData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
public
BaseResponse
<
BasePageVO
<
HongqiActivityLiveVO
>>
getDouyinActivityLiveData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
BaseResponse
check
=
baseService
.
base
Limit
(
dataType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
pageApi
Limit
(
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
@@ -173,7 +173,7 @@ public class FawOpenController extends BaseController {
...
@@ -173,7 +173,7 @@ public class FawOpenController extends BaseController {
@ApiOperation
(
value
=
"快手活动视频数据信息"
,
notes
=
"快手活动视频数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"快手活动视频数据信息"
,
notes
=
"快手活动视频数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/kuaishou/aweme/list"
)
@PostMapping
(
"/activity/kuaishou/aweme/list"
)
public
BaseResponse
<
BasePageVO
<
HongqiActivityAwemeVO
>>
getKuaishouActivityAwemeData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
public
BaseResponse
<
BasePageVO
<
HongqiActivityAwemeVO
>>
getKuaishouActivityAwemeData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
BaseResponse
check
=
baseService
.
base
Limit
(
dataType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
pageApi
Limit
(
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
@@ -187,7 +187,7 @@ public class FawOpenController extends BaseController {
...
@@ -187,7 +187,7 @@ public class FawOpenController extends BaseController {
@ApiOperation
(
value
=
"快手活动直播数据信息"
,
notes
=
"快手活动直播数据"
,
produces
=
"application/json"
)
@ApiOperation
(
value
=
"快手活动直播数据信息"
,
notes
=
"快手活动直播数据"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/kuaishou/live/list"
)
@PostMapping
(
"/activity/kuaishou/live/list"
)
public
BaseResponse
<
BasePageVO
<
HongqiActivityLiveVO
>>
getKuaishouActivityLiveData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
public
BaseResponse
<
BasePageVO
<
HongqiActivityLiveVO
>>
getKuaishouActivityLiveData
(
@RequestBody
@Validated
FawActivityDTO
dto
)
{
BaseResponse
check
=
baseService
.
base
Limit
(
dataType
,
limit
,
limitPeriod
);
BaseResponse
check
=
baseService
.
pageApi
Limit
(
dataType
,
limit
,
limitPeriod
);
if
(
check
!=
null
)
{
if
(
check
!=
null
)
{
return
check
;
return
check
;
}
}
...
...
src/main/java/com/afanticar/afantiopenapi/service/BaseService.java
View file @
be3e59b0
...
@@ -42,11 +42,26 @@ public class BaseService {
...
@@ -42,11 +42,26 @@ public class BaseService {
String
header
=
"token"
;
String
header
=
"token"
;
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
);
if
(!
rateLimiter
.
tryAcquire
(
1
,
waiting
,
TimeUnit
.
MILLISECONDS
))
{
if
(!
rateLimiter
.
tryAcquire
(
1
,
waiting
,
TimeUnit
.
MILLISECONDS
))
{
return
BaseController
.
error
(
"10010"
,
"您的请求太过频繁,请稍后再试!"
);
return
BaseController
.
error
(
"10010"
,
"您的请求太过频繁,请稍后再试!"
);
}
}
return
null
;
return
null
;
}
}
public
BaseResponse
pageApiLimit
(
String
dataType
,
Integer
limit
,
Integer
limitPeriod
)
{
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
// String header = "token";
// String fawKey = String.format("%s:%s:limit", dataType, header);
// RRateLimiter rateLimiter = redissonClient.getRateLimiter(fawKey);
// rateLimiter.trySetRate(RateType.OVERALL, limit, limitPeriod, RateIntervalUnit.SECONDS);
// if (!rateLimiter.tryAcquire(1, waiting, TimeUnit.MILLISECONDS)) {
// return BaseController.error("10010", "您的请求太过频繁,请稍后再试!");
// }
return
null
;
}
}
}
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