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
ab375c07
Commit
ab375c07
authored
Sep 29, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'staging' into 'master'
购买后将海外的IP添加KCP端口号 + own白名单 See merge request
!186
parents
657320f5
f11be822
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
13 deletions
+27
-13
AccountDto.java
...a/com/edgec/browserbackend/account/domain/AccountDto.java
+9
-6
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+7
-7
ShopServiceImpl.java
.../browserbackend/browser/service/Impl/ShopServiceImpl.java
+11
-0
No files found.
src/main/java/com/edgec/browserbackend/account/domain/AccountDto.java
View file @
ab375c07
...
...
@@ -42,7 +42,7 @@ public class AccountDto {
private
List
<
String
>
whiteList
=
new
ArrayList
<>();
private
List
<
String
>
user
WhiteList
=
new
ArrayList
<>();
private
List
<
String
>
own
WhiteList
=
new
ArrayList
<>();
private
ShopSummary
shopSummary
;
...
...
@@ -71,7 +71,10 @@ public class AccountDto {
this
.
setToken
(
account
.
getToken
());
this
.
setPermission
(
account
.
getPermission
());
this
.
setWhiteList
(
account
.
getWhiteList
());
this
.
setUserWhiteList
(
account
.
getWhiteList
());
List
<
String
>
ownWhiteList
=
new
ArrayList
<>(
account
.
getWhiteList
());
ownWhiteList
.
add
(
"google.com/recaptcha"
);
ownWhiteList
.
add
(
"google.com/js"
);
this
.
setOwnWhiteList
(
ownWhiteList
);
this
.
setQueryIpUrlList
(
account
.
getQueryIpUrlList
());
if
(
account
.
getPromotion
()
!=
null
)
{
this
.
setPromotion
(
account
.
getPromotion
());
...
...
@@ -260,11 +263,11 @@ public class AccountDto {
this
.
promotionCode
=
promotionCode
;
}
public
List
<
String
>
get
User
WhiteList
()
{
return
user
WhiteList
;
public
List
<
String
>
get
Own
WhiteList
()
{
return
own
WhiteList
;
}
public
void
set
UserWhiteList
(
List
<
String
>
user
WhiteList
)
{
this
.
userWhiteList
=
user
WhiteList
;
public
void
set
OwnWhiteList
(
List
<
String
>
own
WhiteList
)
{
this
.
ownWhiteList
=
own
WhiteList
;
}
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
ab375c07
...
...
@@ -273,6 +273,7 @@ public class IpResourceServiceImpl implements IpResourceService {
// 只要 申请的 ip 地域不是在 大陆,则一定会执行下面 if 中的代码块
boolean
condition1
=
StringUtils
.
isNotBlank
(
ipResource
.
getRegion
())
&&
region
.
contains
(
ipResource
.
getRegion
());
boolean
condition2
=
ipResourceRequestDto
.
getVendor
().
equals
(
"own"
)
&&
ipResource
.
isSpecialLine
();
if
(
condition1
||
condition2
)
{
ipResource
.
setProxyUsername
(
ipResource
.
getAddr
());
ipResource
.
setProxyPassword
(
genRandom
(
3
,
12
));
...
...
@@ -639,9 +640,6 @@ public class IpResourceServiceImpl implements IpResourceService {
return
ipOperationResultDto
;
}
/**********************************************************************************
* todo - D E V E L O P M E N T *
**********************************************************************************/
@Override
public
IpPageResultDto
getIpList
(
String
username
,
int
groupType
,
int
page
,
int
amount
,
IpFilterDto
ipFilterDto
)
{
// 获取当前用户的账户
...
...
@@ -711,10 +709,14 @@ public class IpResourceServiceImpl implements IpResourceService {
}
// 2. 如果 ip 资源的 status 为 6(未分配) 或者 ( ip资源为专线 且 purchasedTime(购买IP的时间) 在 14 分钟内)
if
(
x
.
getStatus
()
==
6
||
(
x
.
isSpecialLine
()
&&
x
.
getPurchasedTime
()
>
(
Instant
.
now
().
minusSeconds
(
14
*
60
).
toEpochMilli
()))
)
{
if
(
x
.
getStatus
()
==
6
)
{
x
.
setStatus
(
3
);
}
if
(
x
.
isSpecialLine
()
&&
x
.
getStatus
()
==
0
&&
x
.
getPurchasedTime
()
>
(
Instant
.
now
().
minusSeconds
(
14
*
60
).
toEpochMilli
()))
{
x
.
setSpecialLine
(
false
);
}
// 3. 如果 ip 资源的 status 为 3(正在分配)
if
(
x
.
getStatus
()
==
3
)
{
x
.
setAddr
(
""
);
...
...
@@ -826,9 +828,7 @@ public class IpResourceServiceImpl implements IpResourceService {
return
false
;
}
/**********************************************************************************
* todo - D E V E L O P M E N T *
**********************************************************************************/
@Override
public
IpResourceDto
queryIp
(
String
username
,
IpResourceRequestDto
ipResourceRequestDto
)
{
Account
account
=
accountRepository
.
findByName
(
username
).
orElseThrow
(()
->
new
ClientRequestException
(
AccountErrorCode
.
NAMENOTEXIST
));
...
...
src/main/java/com/edgec/browserbackend/browser/service/Impl/ShopServiceImpl.java
View file @
ab375c07
...
...
@@ -363,6 +363,13 @@ public class ShopServiceImpl implements ShopService {
}
}
public
static
List
<
String
>
region
=
Arrays
.
asList
(
"asiapa"
,
"hongkong"
,
"japan"
,
"s-korea"
,
"us"
,
"malaysia"
,
"yajiada"
,
"singapore"
,
"australia"
,
"germany"
,
"uk"
,
"brazil"
,
"moscow"
,
"canada"
,
"france"
,
"sweden"
,
"s-korea"
,
"india"
,
"meast"
,
"brazil"
,
"virginia"
,
"ohio"
,
"california"
,
"oregon"
,
"ireland"
,
"london"
,
"ireland"
);
@Override
public
ShopResultDto
queryShop
(
String
username
,
String
shopId
)
{
// 1. 校验 账户、商铺、IP资源、usershop 信息
...
...
@@ -387,6 +394,10 @@ public class ShopServiceImpl implements ShopService {
ipResourceDto
=
new
IpResourceDto
(
ipResource
,
null
,
false
);
}
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
ipResource
.
getRegion
())
&&
region
.
contains
(
ipResource
.
getRegion
())){
ipResourceDto
.
setSecondaryProxyPort
(
"20020"
);
}
// 3. 封装 ShopResultDto 信息并返回
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