Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
browser-backend
Commits
826c9ab4
Commit
826c9ab4
authored
Sep 30, 2020
by
huangjiamin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购买后将海外的IP添加KCP端口号 + own白名单
parent
b06977e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+1
-5
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+7
-1
No files found.
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
826c9ab4
...
@@ -670,7 +670,7 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -670,7 +670,7 @@ public class IpResourceServiceImpl implements IpResourceService {
// 1. 如果 ip 资源的 addr 非空
// 1. 如果 ip 资源的 addr 非空
if
(
StringUtils
.
isNotBlank
(
x
.
getAddr
()))
{
if
(
StringUtils
.
isNotBlank
(
x
.
getAddr
()))
{
// 1.1 锁定时间在 2分钟内 且 IpType 为 VENDOR 且 (IP资源状态 为 0:正常 或 2:即将过期)
// 1.1 锁定时间在 2分钟内 且 IpType 为 VENDOR 且 (IP资源状态 为 0:正常 或 2:即将过期)
if
(
x
.
getLockTimestamp
()
>=
Instant
.
now
().
minusSeconds
(
2
*
60
).
toEpochMilli
()
&&
x
.
getIpType
()
==
IpType
.
VENDOR
&&
(
x
.
getStatus
()
==
0
||
x
.
getStatus
()
==
2
))
{
if
(
x
.
getLockTimestamp
()
>=
Instant
.
now
().
minusSeconds
(
1
*
60
).
toEpochMilli
()
&&
x
.
getIpType
()
==
IpType
.
VENDOR
&&
(
x
.
getStatus
()
==
0
||
x
.
getStatus
()
==
2
))
{
x
.
setStatus
(
3
);
x
.
setStatus
(
3
);
// 1.2 ip资源在未来七天内到期,且 ip 资源的状态不是 3(正在分配)、5(已失效)、6(未分配),则将 ip 资源设置为 2(即将过期)
// 1.2 ip资源在未来七天内到期,且 ip 资源的状态不是 3(正在分配)、5(已失效)、6(未分配),则将 ip 资源设置为 2(即将过期)
...
@@ -713,10 +713,6 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -713,10 +713,6 @@ public class IpResourceServiceImpl implements IpResourceService {
x
.
setStatus
(
3
);
x
.
setStatus
(
3
);
}
}
if
(
x
.
isSpecialLine
()
&&
x
.
getStatus
()
==
0
&&
x
.
getPurchasedTime
()
>
(
Instant
.
now
().
minusSeconds
(
14
*
60
).
toEpochMilli
()))
{
x
.
setSpecialLine
(
false
);
}
// 3. 如果 ip 资源的 status 为 3(正在分配)
// 3. 如果 ip 资源的 status 为 3(正在分配)
if
(
x
.
getStatus
()
==
3
)
{
if
(
x
.
getStatus
()
==
3
)
{
x
.
setAddr
(
""
);
x
.
setAddr
(
""
);
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
826c9ab4
...
@@ -394,10 +394,16 @@ public class ShopServiceImpl implements ShopService {
...
@@ -394,10 +394,16 @@ public class ShopServiceImpl implements ShopService {
ipResourceDto
=
new
IpResourceDto
(
ipResource
,
null
,
false
);
ipResourceDto
=
new
IpResourceDto
(
ipResource
,
null
,
false
);
}
}
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
ipResource
.
getRegion
())
&&
region
.
contains
(
ipResource
.
getRegion
())){
//海外设置KCP端口
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
ipResource
.
getRegion
())
&&
region
.
contains
(
ipResource
.
getRegion
()))
{
ipResourceDto
.
setSecondaryProxyPort
(
"20020"
);
ipResourceDto
.
setSecondaryProxyPort
(
"20020"
);
}
}
//刚购买14分钟内的专线设置为不可用
if
(
ipResource
.
getStatus
()
==
0
&&
ipResource
.
getPurchasedTime
()
>
(
Instant
.
now
().
minusSeconds
(
14
*
60
).
toEpochMilli
()))
{
ipResource
.
setSpecialLine
(
false
);
}
// 3. 封装 ShopResultDto 信息并返回
// 3. 封装 ShopResultDto 信息并返回
return
ShopResultDto
.
of
(
shop
,
userShop
.
getGroupId
(),
ipResourceDto
);
return
ShopResultDto
.
of
(
shop
,
userShop
.
getGroupId
(),
ipResourceDto
);
}
}
...
...
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