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
7da93612
Commit
7da93612
authored
Aug 17, 2024
by
chenchao.deng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购买定时任务优化 +浏览器参数配置
parent
f38384e0
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
365 additions
and
127 deletions
+365
-127
CloudPlatformOrder.java
...gec/browserbackend/browser/domain/CloudPlatformOrder.java
+2
-0
IpHistory.java
...va/com/edgec/browserbackend/browser/domain/IpHistory.java
+30
-0
PlatformOptions.java
.../edgec/browserbackend/browser/domain/PlatformOptions.java
+2
-0
IpHistoryRepository.java
...rowserbackend/browser/repository/IpHistoryRepository.java
+19
-0
PlatformOptionsRepository.java
...backend/browser/repository/PlatformOptionsRepository.java
+1
-1
IpResourceServiceImpl.java
...erbackend/browser/service/Impl/IpResourceServiceImpl.java
+1
-1
BrowserTask.java
...va/com/edgec/browserbackend/browser/task/BrowserTask.java
+103
-15
ExpireSoonWarn.java
...com/edgec/browserbackend/browser/task/ExpireSoonWarn.java
+20
-1
AliEcsClient.java
.../com/edgec/browserbackend/common/client/AliEcsClient.java
+34
-0
ipOptions.json
src/main/resources/ipOptions.json
+139
-106
BrowserBackendApplicationTests.java
.../edgec/browserbackend/BrowserBackendApplicationTests.java
+14
-3
No files found.
src/main/java/com/edgec/browserbackend/browser/domain/CloudPlatformOrder.java
View file @
7da93612
...
@@ -33,4 +33,6 @@ public class CloudPlatformOrder {
...
@@ -33,4 +33,6 @@ public class CloudPlatformOrder {
private
String
platformType
;
//云平台类型
private
String
platformType
;
//云平台类型
private
Integer
retryCount
;
//重试次数
}
}
src/main/java/com/edgec/browserbackend/browser/domain/IpHistory.java
0 → 100644
View file @
7da93612
package
com
.
edgec
.
browserbackend
.
browser
.
domain
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
* 分配ip历史记录表
*
* @Author: Chen
* @Date: 2024/08/14
*/
@Getter
@Setter
@NoArgsConstructor
@Document
(
collection
=
"ipHistory"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
IpHistory
{
@Id
private
String
id
;
private
String
ipNo
;
//ipNo
private
String
platformType
;
//云平台类型
private
long
purchasedTime
;
}
src/main/java/com/edgec/browserbackend/browser/domain/PlatformOptions.java
View file @
7da93612
...
@@ -21,6 +21,8 @@ public class PlatformOptions {
...
@@ -21,6 +21,8 @@ public class PlatformOptions {
private
int
weight
;
private
int
weight
;
private
int
platformType
;
private
boolean
deleted
;
private
boolean
deleted
;
private
Map
<
String
,
String
>
subPlatform
;
private
Map
<
String
,
String
>
subPlatform
;
...
...
src/main/java/com/edgec/browserbackend/browser/repository/IpHistoryRepository.java
0 → 100644
View file @
7da93612
package
com
.
edgec
.
browserbackend
.
browser
.
repository
;
import
com.edgec.browserbackend.browser.domain.CloudPlatformConfig
;
import
com.edgec.browserbackend.browser.domain.IpHistory
;
import
com.edgec.browserbackend.browser.domain.Shop
;
import
java.util.List
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
/**
* @Description //购买ip记录 repository
* @Date 2024年8月1日
* @Author Chen
**/
public
interface
IpHistoryRepository
extends
MongoRepository
<
IpHistory
,
String
>
{
List
<
IpHistory
>
findByIpNoAndPurchasedTimeAfter
(
String
ipNo
,
long
purchasedTime
);
}
src/main/java/com/edgec/browserbackend/browser/repository/PlatformOptionsRepository.java
View file @
7da93612
...
@@ -13,5 +13,5 @@ import java.util.List;
...
@@ -13,5 +13,5 @@ import java.util.List;
public
interface
PlatformOptionsRepository
extends
MongoRepository
<
PlatformOptions
,
String
>,
PlatformOptionsRepositoryCustom
{
public
interface
PlatformOptionsRepository
extends
MongoRepository
<
PlatformOptions
,
String
>,
PlatformOptionsRepositoryCustom
{
List
<
PlatformOptions
>
findAllByOrderByWeightDesc
();
List
<
PlatformOptions
>
findAllByOrderByWeightDesc
();
List
<
PlatformOptions
>
findAllByDeletedIsNotOrderByWeightDesc
(
boolean
b
);
List
<
PlatformOptions
>
findAllByDeletedIsNotOrderBy
PlatformTypeAsc
WeightDesc
(
boolean
b
);
}
}
src/main/java/com/edgec/browserbackend/browser/service/Impl/IpResourceServiceImpl.java
View file @
7da93612
...
@@ -766,7 +766,7 @@ public class IpResourceServiceImpl implements IpResourceService {
...
@@ -766,7 +766,7 @@ public class IpResourceServiceImpl implements IpResourceService {
@Override
@Override
public
List
<
PlatformOptions
>
getPlatformOptions
()
{
public
List
<
PlatformOptions
>
getPlatformOptions
()
{
try
{
try
{
List
<
PlatformOptions
>
platformOptions
=
platformOptionsRepository
.
findAllByDeletedIsNotOrderByWeightDesc
(
true
);
List
<
PlatformOptions
>
platformOptions
=
platformOptionsRepository
.
findAllByDeletedIsNotOrderBy
PlatformTypeAsc
WeightDesc
(
true
);
// Collections.sort(platformOptions, Comparator.comparing(PlatformOptions::getWeight).reversed());
// Collections.sort(platformOptions, Comparator.comparing(PlatformOptions::getWeight).reversed());
return
platformOptions
;
return
platformOptions
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/edgec/browserbackend/browser/task/BrowserTask.java
View file @
7da93612
...
@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import
com.aliyun.sdk.service.ecs20140526.models.DeleteInstanceResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.DeleteInstanceResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.DescribeInstancesResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.DescribeInstancesResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.DescribeInstancesResponseBody
;
import
com.aliyun.sdk.service.ecs20140526.models.DescribeInstancesResponseBody
;
import
com.aliyun.sdk.service.ecs20140526.models.DescribeInstancesResponseBody.Instance
;
import
com.aliyun.sdk.service.ecs20140526.models.ModifyInstanceChargeTypeResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.RunInstancesResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.RunInstancesResponse
;
import
com.edgec.browserbackend.account.domain.Account
;
import
com.edgec.browserbackend.account.domain.Account
;
import
com.edgec.browserbackend.account.domain.IpChargeRequestDto
;
import
com.edgec.browserbackend.account.domain.IpChargeRequestDto
;
...
@@ -15,6 +17,7 @@ import com.edgec.browserbackend.account.service.AccountService;
...
@@ -15,6 +17,7 @@ import com.edgec.browserbackend.account.service.AccountService;
import
com.edgec.browserbackend.browser.domain.CloudPlatformConfig
;
import
com.edgec.browserbackend.browser.domain.CloudPlatformConfig
;
import
com.edgec.browserbackend.browser.domain.CloudPlatformOrder
;
import
com.edgec.browserbackend.browser.domain.CloudPlatformOrder
;
import
com.edgec.browserbackend.browser.domain.IpCountRecord
;
import
com.edgec.browserbackend.browser.domain.IpCountRecord
;
import
com.edgec.browserbackend.browser.domain.IpHistory
;
import
com.edgec.browserbackend.browser.domain.IpResource
;
import
com.edgec.browserbackend.browser.domain.IpResource
;
import
com.edgec.browserbackend.browser.domain.IpType
;
import
com.edgec.browserbackend.browser.domain.IpType
;
import
com.edgec.browserbackend.browser.dto.DeleteIpResultDto
;
import
com.edgec.browserbackend.browser.dto.DeleteIpResultDto
;
...
@@ -24,6 +27,7 @@ import com.edgec.browserbackend.browser.dto.ShopRequestDto;
...
@@ -24,6 +27,7 @@ import com.edgec.browserbackend.browser.dto.ShopRequestDto;
import
com.edgec.browserbackend.browser.repository.CloudPlatformConfigRepository
;
import
com.edgec.browserbackend.browser.repository.CloudPlatformConfigRepository
;
import
com.edgec.browserbackend.browser.repository.CloudPlatformOrderRepository
;
import
com.edgec.browserbackend.browser.repository.CloudPlatformOrderRepository
;
import
com.edgec.browserbackend.browser.repository.IpCountRecordRepository
;
import
com.edgec.browserbackend.browser.repository.IpCountRecordRepository
;
import
com.edgec.browserbackend.browser.repository.IpHistoryRepository
;
import
com.edgec.browserbackend.browser.repository.IpResourceRepository
;
import
com.edgec.browserbackend.browser.repository.IpResourceRepository
;
import
com.edgec.browserbackend.browser.service.IpAndShopService
;
import
com.edgec.browserbackend.browser.service.IpAndShopService
;
import
com.edgec.browserbackend.common.client.AliEcsClient
;
import
com.edgec.browserbackend.common.client.AliEcsClient
;
...
@@ -31,6 +35,10 @@ import com.edgec.browserbackend.common.commons.utils.NotifyUtils;
...
@@ -31,6 +35,10 @@ import com.edgec.browserbackend.common.commons.utils.NotifyUtils;
import
com.edgec.browserbackend.common.enums.RegionMappingEnum
;
import
com.edgec.browserbackend.common.enums.RegionMappingEnum
;
import
com.edgec.browserbackend.common.utils.ThreadPoolUtils
;
import
com.edgec.browserbackend.common.utils.ThreadPoolUtils
;
import
com.edgec.browserbackend.common.utils.Trans
;
import
com.edgec.browserbackend.common.utils.Trans
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
okhttp3.*
;
import
okhttp3.*
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -88,6 +96,9 @@ public class BrowserTask {
...
@@ -88,6 +96,9 @@ public class BrowserTask {
@Resource
@Resource
private
CloudPlatformConfigRepository
cloudPlatformConfigRepository
;
private
CloudPlatformConfigRepository
cloudPlatformConfigRepository
;
@Resource
private
IpHistoryRepository
ipHistoryRepository
;
public
Map
<
String
,
String
>
buildGetHeader
()
{
public
Map
<
String
,
String
>
buildGetHeader
()
{
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"Content-Type"
,
"application/json"
);
headers
.
put
(
"Content-Type"
,
"application/json"
);
...
@@ -173,6 +184,7 @@ public class BrowserTask {
...
@@ -173,6 +184,7 @@ public class BrowserTask {
cloudPlatformOrder
.
setPlatformOrderId
(
instanceId
);
cloudPlatformOrder
.
setPlatformOrderId
(
instanceId
);
cloudPlatformOrder
.
setPlatformType
(
"aliyun"
);
cloudPlatformOrder
.
setPlatformType
(
"aliyun"
);
cloudPlatformOrder
.
setRegionId
(
aliRegion
);
cloudPlatformOrder
.
setRegionId
(
aliRegion
);
cloudPlatformOrder
.
setRetryCount
(
0
);
ipResource
.
setStatus
(
3
);
ipResource
.
setStatus
(
3
);
ipResourceRepository
.
save
(
ipResource
);
ipResourceRepository
.
save
(
ipResource
);
cloudPlatformOrderRepository
.
save
(
cloudPlatformOrder
);
cloudPlatformOrderRepository
.
save
(
cloudPlatformOrder
);
...
@@ -235,42 +247,118 @@ public class BrowserTask {
...
@@ -235,42 +247,118 @@ public class BrowserTask {
//查询cloudPlatform
//查询cloudPlatform
List
<
CloudPlatformOrder
>
cloudPlatformOrders
=
cloudPlatformOrderRepository
.
findByOwnerAndIpResourceId
(
List
<
CloudPlatformOrder
>
cloudPlatformOrders
=
cloudPlatformOrderRepository
.
findByOwnerAndIpResourceId
(
ipResource
.
getOwner
(),
ipResource
.
getId
());
ipResource
.
getOwner
(),
ipResource
.
getId
());
if
(
CollectionUtils
.
isEmpty
(
cloudPlatformOrders
)){
if
(
CollectionUtils
.
isEmpty
(
cloudPlatformOrders
))
{
log
.
error
(
"queryIpTask- 查询云平台订单失败:入参:{}"
,
JSON
.
toJSON
(
ipResource
));
log
.
error
(
"queryIpTask- 查询云平台订单失败:入参:{}"
,
JSON
.
toJSON
(
ipResource
));
return
;
return
;
}
}
CloudPlatformOrder
cloudPlatformOrder
=
cloudPlatformOrders
.
get
(
0
);
CloudPlatformOrder
cloudPlatformOrder
=
cloudPlatformOrders
.
get
(
0
);
if
(
"aliyun"
.
equals
(
cloudPlatformOrder
.
getPlatformType
()))
{
if
(
"aliyun"
.
equals
(
cloudPlatformOrder
.
getPlatformType
()))
{
DescribeInstancesResponse
response
=
AliEcsClient
.
getDescribeInstances
(
DescribeInstancesResponse
response
=
AliEcsClient
.
getDescribeInstances
(
ipResource
.
getOwner
(),
cloudPlatformOrder
.
getPlatformOrderId
(),
ipResource
.
getOwner
(),
cloudPlatformOrder
.
getPlatformOrderId
(),
cloudPlatformOrder
.
getRegionId
());
cloudPlatformOrder
.
getRegionId
());
if
(!
response
.
getStatusCode
().
equals
(
200
))
{
if
(!
response
.
getStatusCode
().
equals
(
200
))
{
log
.
error
(
", fail to query ip : {}"
,
JSON
.
toJSON
(
response
.
getBody
()));
log
.
error
(
", fail to query ip : {}"
,
}
JSON
.
toJSON
(
response
.
getBody
()));
}
if
(
Objects
.
nonNull
(
response
.
getBody
())){
DescribeInstancesResponseBody
body
=
response
.
getBody
();
if
(
Objects
.
nonNull
(
response
.
getBody
()))
{
//TODO 查询ip信息并且封装 到期时间还没有明确
//判断是否重复购买
ipResource
.
setAddr
(
body
.
getInstances
().
getInstance
().
get
(
0
).
getPublicIpAddress
().
getIpAddress
().
get
(
0
));
Instance
instance
=
response
.
getBody
().
getInstances
()
.
getInstance
().
get
(
0
);
if
(
instance
.
getInstanceChargeType
().
equals
(
"PrePaid"
))
{
//包年包夜 更新ip状态
ipResource
.
setAddr
(
instance
.
getPublicIpAddress
().
getIpAddress
().
get
(
0
));
ipResource
.
setStatus
(
0
);
ipResource
.
setStatus
(
0
);
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd'T'HH:mmX"
);
//ipResource.setValidTime(Instant.parse(x.getValidTill()).toEpochMilli());
Instant
instant
=
Instant
.
from
(
formatter
.
parse
(
instance
.
getExpiredTime
()));
if
(
StringUtils
.
isNotBlank
(
ipResource
.
getRegion
())
&&
region
.
contains
(
ipResource
.
getRegion
()))
{
ipResource
.
setValidTime
(
instant
.
toEpochMilli
());
if
(
StringUtils
.
isNotBlank
(
ipResource
.
getRegion
())
&&
region
.
contains
(
ipResource
.
getRegion
()))
{
ipResource
.
setProxyUsername
(
ipResource
.
getAddr
());
ipResource
.
setProxyUsername
(
ipResource
.
getAddr
());
ipResource
.
setProxyPassword
(
genRandom
(
3
,
12
));
ipResource
.
setProxyPassword
(
genRandom
(
3
,
12
));
ipResource
.
setSpecialLine
(
true
);
ipResource
.
setSpecialLine
(
true
);
}
}
ipResourceRepository
.
save
(
ipResource
);
ipResourceRepository
.
save
(
ipResource
);
IpHistory
ipHistory
=
new
IpHistory
();
ipHistory
.
setIpNo
(
ipResource
.
getAddr
());
ipHistory
.
setPlatformType
(
cloudPlatformOrder
.
getPlatformType
());
ipHistory
.
setPurchasedTime
(
Instant
.
now
().
toEpochMilli
());
ipHistoryRepository
.
save
(
ipHistory
);
return
;
}
//查询是否为重复ip
String
ipNo
=
instance
.
getPublicIpAddress
().
getIpAddress
()
.
get
(
0
);
LocalDateTime
localDateTime
=
LocalDateTime
.
now
().
minus
(
3
,
ChronoUnit
.
MONTHS
);
Instant
instant
=
localDateTime
.
atZone
(
ZoneId
.
systemDefault
()).
toInstant
();
List
<
IpHistory
>
ipHistoryList
=
ipHistoryRepository
.
findByIpNoAndPurchasedTimeAfter
(
ipNo
,
instant
.
toEpochMilli
());
if
(
CollectionUtils
.
isNotEmpty
(
ipHistoryList
)
&&
(
Objects
.
isNull
(
cloudPlatformOrder
.
getRetryCount
())
||
cloudPlatformOrder
.
getRetryCount
()
<
5
))
{
//重新分配ip(删除旧的 购买新的)
AliEcsClient
.
deleteInstance
(
ipResource
.
getOwner
(),
cloudPlatformOrder
.
getPlatformOrderId
(),
cloudPlatformOrder
.
getRegionId
());
CloudPlatformConfig
config
=
cloudPlatformConfigRepository
.
findByPlatformAndRegionId
(
"ali"
,
cloudPlatformOrder
.
getRegionId
());
RunInstancesResponse
response1
=
AliEcsClient
.
runInstances
(
ipResource
.
getOwner
(),
ipResource
.
getUsername
(),
ipResource
.
getPassword
(),
config
);
if
(
null
==
response1
||
!
response1
.
getStatusCode
()
.
equals
(
200
))
{
log
.
error
(
"queryIpNewTasks, fail to buy ip again : {}"
,
JSON
.
toJSON
(
response
));
}
else
if
(
Objects
.
nonNull
(
response1
.
getBody
()))
{
int
oldRetryCount
=
Objects
.
isNull
(
cloudPlatformOrder
.
getRetryCount
())
?
0
:
cloudPlatformOrder
.
getRetryCount
();
cloudPlatformOrder
.
setRetryCount
(
oldRetryCount
+
1
);
cloudPlatformOrderRepository
.
save
(
cloudPlatformOrder
);
String
instanceId
=
response1
.
getBody
()
.
getInstanceIdSets
().
getInstanceIdSet
().
get
(
0
);
cloudPlatformOrder
.
setPlatformOrderId
(
instanceId
);
ipResource
.
setStatus
(
3
);
ipResourceRepository
.
save
(
ipResource
);
cloudPlatformOrderRepository
.
save
(
cloudPlatformOrder
);
}
}
else
{
//将ip改为包年包月
String
periodUnit
=
ipResource
.
getUnit
().
equals
(
"week"
)
?
"Week"
:
"Month"
;
ModifyInstanceChargeTypeResponse
modifyInstanceChargeTypeResponse
=
AliEcsClient
.
modifyInstanceChargeType
(
ipResource
.
getOwner
(),
periodUnit
,
ipResource
.
getPeriod
(),
cloudPlatformOrder
.
getRegionId
(),
cloudPlatformOrder
.
getPlatformOrderId
());
if
(
null
==
modifyInstanceChargeTypeResponse
||
!
modifyInstanceChargeTypeResponse
.
getStatusCode
()
.
equals
(
200
))
{
//TODO 目前先抛错误 待确认如何解决
log
.
error
(
"queryIpNewTasks, fail to buy ip again : {}"
,
JSON
.
toJSON
(
response
));
}
}
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
NotifyUtils
.
sendMessage
(
"浏览器后端 queryIpTasks() 又炸了,赶紧看啊"
,
e
,
NotifyUtils
.
MsgType
.
WEBHOOK
);
NotifyUtils
.
sendMessage
(
"浏览器后端 queryIpTasks() 又炸了,赶紧看啊"
,
e
,
NotifyUtils
.
MsgType
.
WEBHOOK
);
}
finally
{
}
finally
{
long
end
=
System
.
currentTimeMillis
();
long
end
=
System
.
currentTimeMillis
();
log
.
debug
(
"queryIpTask {} execution time is: "
+
(
end
-
start
)
/
1000
+
"s"
,
ipResource
.
getId
());
log
.
debug
(
"queryIpTask {} execution time is: "
+
(
end
-
start
)
/
1000
+
"s"
,
ipResource
.
getId
());
try
{
try
{
ipResourceRepository
.
unLockTask
(
ipResource
.
getId
());
ipResourceRepository
.
unLockTask
(
ipResource
.
getId
());
}
catch
(
Throwable
th
)
{
}
catch
(
Throwable
th
)
{
...
...
src/main/java/com/edgec/browserbackend/browser/task/ExpireSoonWarn.java
View file @
7da93612
...
@@ -9,6 +9,7 @@ import com.edgec.browserbackend.browser.repository.IpResourceRepository;
...
@@ -9,6 +9,7 @@ import com.edgec.browserbackend.browser.repository.IpResourceRepository;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.commons.error.ClientRequestException
;
import
com.edgec.browserbackend.common.commons.utils.SmsUtils
;
import
com.edgec.browserbackend.common.commons.utils.SmsUtils
;
import
net.javacrumbs.shedlock.core.SchedulerLock
;
import
net.javacrumbs.shedlock.core.SchedulerLock
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -32,6 +33,7 @@ public class ExpireSoonWarn {
...
@@ -32,6 +33,7 @@ public class ExpireSoonWarn {
@SchedulerLock
(
name
=
"ExpireSoonWarnsendMessages"
,
lockAtMostForString
=
"PT600S"
,
lockAtLeastForString
=
"PT600S"
)
@SchedulerLock
(
name
=
"ExpireSoonWarnsendMessages"
,
lockAtMostForString
=
"PT600S"
,
lockAtLeastForString
=
"PT600S"
)
public
void
sendMessages
()
{
public
void
sendMessages
()
{
this
.
sendExpiredIpAccount
(
0
);
this
.
sendExpiredIpAccount
(
0
);
this
.
sendExpiredIpAccount
(
3
);
this
.
sendExpiredIpAccount
(
7
);
this
.
sendExpiredIpAccount
(
7
);
}
}
...
@@ -52,7 +54,24 @@ public class ExpireSoonWarn {
...
@@ -52,7 +54,24 @@ public class ExpireSoonWarn {
if
(
ipResources
!=
null
&&
ipResources
.
size
()
>
0
)
{
if
(
ipResources
!=
null
&&
ipResources
.
size
()
>
0
)
{
Map
<
String
,
List
<
IpResource
>>
map
=
ipResources
.
stream
().
collect
(
Collectors
.
groupingBy
(
IpResource:
:
getOwner
));
Map
<
String
,
List
<
IpResource
>>
map
=
ipResources
.
stream
().
collect
(
Collectors
.
groupingBy
(
IpResource:
:
getOwner
));
for
(
String
key
:
map
.
keySet
())
{
for
(
String
key
:
map
.
keySet
())
{
sendToAccount
(
key
,
day
,
map
.
get
(
key
).
size
(),
map
.
get
(
key
).
stream
().
map
(
x
->
x
.
getAddr
()).
collect
(
Collectors
.
toList
()));
if
(
day
==
7
)
{
List
<
String
>
mouth
=
map
.
get
(
key
).
stream
()
.
filter
(
item
->
item
.
getUnit
().
equals
(
"mouth"
))
.
map
(
IpResource:
:
getAddr
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
mouth
)){
sendToAccount
(
key
,
day
,
map
.
get
(
key
).
size
(),
mouth
);
}
}
else
if
(
day
==
3
){
List
<
String
>
mouth
=
map
.
get
(
key
).
stream
()
.
filter
(
item
->
item
.
getUnit
().
equals
(
"week"
))
.
map
(
IpResource:
:
getAddr
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
mouth
)){
sendToAccount
(
key
,
day
,
map
.
get
(
key
).
size
(),
mouth
);
}
}
else
{
sendToAccount
(
key
,
day
,
map
.
get
(
key
).
size
(),
map
.
get
(
key
).
stream
().
map
(
x
->
x
.
getAddr
()).
collect
(
Collectors
.
toList
()));
}
}
}
}
}
}
}
...
...
src/main/java/com/edgec/browserbackend/common/client/AliEcsClient.java
View file @
7da93612
...
@@ -8,6 +8,8 @@ import com.aliyun.sdk.service.ecs20140526.models.DeleteInstanceRequest;
...
@@ -8,6 +8,8 @@ import com.aliyun.sdk.service.ecs20140526.models.DeleteInstanceRequest;
import
com.aliyun.sdk.service.ecs20140526.models.DeleteInstanceResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.DeleteInstanceResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.DescribeInstancesRequest
;
import
com.aliyun.sdk.service.ecs20140526.models.DescribeInstancesRequest
;
import
com.aliyun.sdk.service.ecs20140526.models.DescribeInstancesResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.DescribeInstancesResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.ModifyInstanceChargeTypeRequest
;
import
com.aliyun.sdk.service.ecs20140526.models.ModifyInstanceChargeTypeResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.RenewInstanceRequest
;
import
com.aliyun.sdk.service.ecs20140526.models.RenewInstanceRequest
;
import
com.aliyun.sdk.service.ecs20140526.models.RenewInstanceResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.RenewInstanceResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.RunInstancesRequest
;
import
com.aliyun.sdk.service.ecs20140526.models.RunInstancesRequest
;
...
@@ -180,4 +182,36 @@ public class AliEcsClient {
...
@@ -180,4 +182,36 @@ public class AliEcsClient {
return
resp
;
return
resp
;
}
}
/**
* 将按量改为包年包月
*/
public
static
ModifyInstanceChargeTypeResponse
modifyInstanceChargeType
(
String
owner
,
String
periodUnit
,
int
period
,
String
regionId
,
String
instanceId
)
{
AsyncClient
client
=
createClient
(
regionId
);
ModifyInstanceChargeTypeResponse
modifyInstanceChargeTypeResponse
=
null
;
try
{
String
instanceIds
=
String
.
format
(
"[\"%s\"]"
,
instanceId
);
ModifyInstanceChargeTypeRequest
modifyInstanceChargeTypeRequest
=
ModifyInstanceChargeTypeRequest
.
builder
()
.
instanceIds
(
instanceIds
)
.
regionId
(
regionId
)
.
instanceChargeType
(
"PrePaid"
)
.
periodUnit
(
periodUnit
)
.
period
(
period
)
.
build
();
log
.
info
(
"调用aliEcs将实例由量改为包年包月,入参:owner:{},regionId:{},periodUnit:{},period:{}, instanceId{}"
,
owner
,
regionId
,
periodUnit
,
period
,
instanceId
);
CompletableFuture
<
ModifyInstanceChargeTypeResponse
>
response
=
client
.
modifyInstanceChargeType
(
modifyInstanceChargeTypeRequest
);
modifyInstanceChargeTypeResponse
=
response
.
get
();
log
.
info
(
"调用aliEcs将实例由量改为包年包月,响应参数:owner:{},response:{}"
,
owner
,
JSON
.
toJSON
(
modifyInstanceChargeTypeResponse
));
}
catch
(
Exception
e
)
{
log
.
error
(
"fail to aliEcs modifyInstanceChargeType {}"
,
e
.
getMessage
());
}
finally
{
client
.
close
();
}
return
modifyInstanceChargeTypeResponse
;
}
}
}
src/main/resources/ipOptions.json
View file @
7da93612
...
@@ -7,44 +7,31 @@
...
@@ -7,44 +7,31 @@
"深圳"
,
"深圳"
,
"广州"
,
"广州"
,
"北京"
,
"北京"
,
"青岛"
,
"张家口"
,
"呼和浩特"
,
"呼和浩特"
,
"乌兰察布"
,
"成都"
,
"成都"
,
"河源"
"河源"
],
],
"港澳台"
:
[
"港澳台"
:
[
"香港"
"
中国
香港"
],
],
"美国"
:
[
"美国"
:
[
"美国随机"
,
"美国随机"
,
"加利福尼亚"
,
"硅谷"
,
"弗吉尼亚"
,
"弗吉尼亚"
"俄勒冈"
,
"俄亥俄"
],
"欧洲"
:
[
"英国-伦敦"
,
"德国-法兰克福"
,
"俄罗斯-莫斯科"
,
"法国-巴黎"
],
],
"亚太"
:
[
"亚太"
:
[
"日本-东京"
,
"新加坡"
,
"新加坡"
,
"澳大利亚-悉尼"
,
"马来西亚-吉隆坡"
,
"马来西亚-吉隆坡"
,
"印度尼西亚-雅加达"
"泰国-曼谷"
,
],
"印度尼西亚-雅加达"
,
"印度"
:
[
"菲律宾-马尼拉"
,
"孟买"
"日本-东京"
,
],
"韩国-首尔"
"美洲"
:
[
"加拿大"
,
"巴西"
],
],
"中东"
:
[
"欧洲"
:
[
"迪拜"
"英国-伦敦"
,
"德国-法兰克福"
],
],
"本地"
:
[
"本地"
:
[
"本地"
"本地"
...
@@ -52,106 +39,82 @@
...
@@ -52,106 +39,82 @@
},
},
"ipPlatForm"
:
{
"ipPlatForm"
:
{
"中国随机"
:
[
"中国随机"
:
[
"阿里云-68-49"
,
"阿里云-28-28"
"腾讯云-68-49"
],
],
"杭州"
:
[
"杭州"
:
[
"阿里云-
68-49
"
"阿里云-
28-28
"
],
],
"上海"
:
[
"上海"
:
[
"阿里云-
68-49
"
"阿里云-
28-28
"
],
],
"深圳"
:
[
"深圳"
:
[
"阿里云-
68-49
"
"阿里云-
28-28
"
],
],
"广州"
:
[
"广州"
:
[
"阿里云-68-49"
,
"阿里云-28-28"
"腾讯云-68-49"
],
],
"北京"
:
[
"北京"
:
[
"阿里云-68-49"
"阿里云-28-28"
],
"青岛"
:
[
"阿里云-68-49"
],
"张家口"
:
[
"阿里云-68-49"
],
],
"呼和浩特"
:
[
"呼和浩特"
:
[
"阿里云-68-49"
"阿里云-28-28"
],
"乌兰察布"
:
[
"阿里云-28-28"
],
],
"成都"
:
[
"成都"
:
[
"阿里云-
68-49
"
"阿里云-
28-28
"
],
],
"河源"
:
[
"河源"
:
[
"阿里云-
68-49
"
"阿里云-
28-28
"
],
],
"香港"
:
[
"
中国
香港"
:
[
"阿里云-
68-49
"
"阿里云-
28-28
"
],
],
"美国随机"
:
[
"美国随机"
:
[
"阿里云-58-49"
,
"阿里云-28-28"
"亚马逊云-58-49"
],
],
"加利福尼亚"
:
[
"硅谷"
:
[
"亚马逊云-58-49"
,
"阿里云-28-28"
"阿里云-58-49"
],
],
"弗吉尼亚"
:
[
"弗吉尼亚"
:
[
"阿里云-58-49"
,
"阿里云-28-28"
"亚马逊云-58-49"
],
"俄勒冈"
:
[
"亚马逊云-58-49"
],
"俄亥俄"
:
[
"亚马逊云-58-49"
],
],
"英国-伦敦"
:
[
"英国-伦敦"
:
[
"阿里云-88-49"
,
"阿里云-28-28"
"亚马逊云-88-49"
],
],
"德国-法兰克福"
:
[
"德国-法兰克福"
:
[
"阿里云-88-49"
,
"阿里云-28-28"
"亚马逊云-88-49"
],
"俄罗斯-莫斯科"
:
[
"腾讯云-88-49"
],
"法国-巴黎"
:
[
"亚马逊云-88-49"
],
"日本-东京"
:
[
"阿里云-88-49"
,
"亚马逊云-88-49"
],
],
"新加坡"
:
[
"新加坡"
:
[
"阿里云-88-49"
"阿里云-28-28"
],
"澳大利亚-悉尼"
:
[
"阿里云-88-49"
,
"亚马逊云-68-49"
],
],
"马来西亚-吉隆坡"
:
[
"马来西亚-吉隆坡"
:
[
"阿里云-88-49"
"阿里云-28-28"
],
"泰国-曼谷"
:
[
"阿里云-28-28"
],
],
"印度尼西亚-雅加达"
:
[
"印度尼西亚-雅加达"
:
[
"阿里云-68-49"
"阿里云-28-28"
],
"菲律宾-马尼拉"
:
[
"阿里云-28-28"
],
],
"
孟买
"
:
[
"
日本-东京
"
:
[
"阿里云-
68-49
"
"阿里云-
28-28
"
],
],
"
加拿大
"
:
[
"
韩国-首尔
"
:
[
"
亚马逊云-68-49
"
"
阿里云-28-28
"
],
],
"
巴西-圣保罗
"
:
[
"
自有
"
:
[
"
亚马逊云-68-49
"
"
自有-2-2
"
],
],
"
迪拜
"
:
[
"
自有专线
"
:
[
"
阿里云-88-49
"
"
自有专线-5-5
"
],
],
"本地"
:
[
"本地"
:
[
"本地
ip
-0-0"
"本地-0-0"
]
]
},
},
"supportedPlatForm"
:
{
"supportedPlatForm"
:
{
...
@@ -333,6 +296,26 @@
...
@@ -333,6 +296,26 @@
"其他平台-0"
"其他平台-0"
]
]
},
},
"乌兰察布"
:
{
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Shopee-1"
,
"Lazada-0"
,
"CDiscount-1"
,
"Joom-1"
,
"Vova-1"
,
"乐天-0"
,
"Ozon-1"
,
"FactoryMarket-1"
,
"PayPal-0"
,
"PayPal(中国)-1"
,
"其他平台-0"
]
},
"成都"
:
{
"成都"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
...
@@ -376,6 +359,7 @@
...
@@ -376,6 +359,7 @@
"香港"
:
{
"香港"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -412,6 +396,7 @@
...
@@ -412,6 +396,7 @@
"美国随机"
:
{
"美国随机"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -428,6 +413,7 @@
...
@@ -428,6 +413,7 @@
],
],
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -443,25 +429,10 @@
...
@@ -443,25 +429,10 @@
"其他平台-0"
"其他平台-0"
]
]
},
},
"
加利福尼亚
"
:
{
"
硅谷
"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"ebay-1"
,
"亚马逊日本-0"
,
"全球速卖通-1"
,
"Wish-1"
,
"Shopee-1"
,
"Lazada-0"
,
"CDiscount-1"
,
"Joom-1"
,
"Vova-1"
,
"乐天-0"
,
"Ozon-1"
,
"FactoryMarket-1"
,
"PayPal-1"
,
"其他平台-0"
],
"亚马逊云"
:
[
"亚马逊-1"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -480,6 +451,7 @@
...
@@ -480,6 +451,7 @@
"弗吉尼亚"
:
{
"弗吉尼亚"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -496,6 +468,7 @@
...
@@ -496,6 +468,7 @@
],
],
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -514,6 +487,7 @@
...
@@ -514,6 +487,7 @@
"俄勒冈"
:
{
"俄勒冈"
:
{
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -532,6 +506,7 @@
...
@@ -532,6 +506,7 @@
"俄亥俄"
:
{
"俄亥俄"
:
{
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -550,6 +525,7 @@
...
@@ -550,6 +525,7 @@
"英国-伦敦"
:
{
"英国-伦敦"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -566,6 +542,7 @@
...
@@ -566,6 +542,7 @@
],
],
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -584,6 +561,7 @@
...
@@ -584,6 +561,7 @@
"德国-法兰克福"
:
{
"德国-法兰克福"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -600,6 +578,7 @@
...
@@ -600,6 +578,7 @@
],
],
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -618,6 +597,7 @@
...
@@ -618,6 +597,7 @@
"俄罗斯-莫斯科"
:
{
"俄罗斯-莫斯科"
:
{
"腾讯云"
:
[
"腾讯云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -636,6 +616,7 @@
...
@@ -636,6 +616,7 @@
"法国-巴黎"
:
{
"法国-巴黎"
:
{
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -654,6 +635,7 @@
...
@@ -654,6 +635,7 @@
"日本-东京"
:
{
"日本-东京"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -670,6 +652,7 @@
...
@@ -670,6 +652,7 @@
],
],
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -689,6 +672,7 @@
...
@@ -689,6 +672,7 @@
"新加坡"
:
{
"新加坡"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -705,6 +689,7 @@
...
@@ -705,6 +689,7 @@
],
],
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -724,6 +709,7 @@
...
@@ -724,6 +709,7 @@
"澳大利亚-悉尼"
:
{
"澳大利亚-悉尼"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -740,6 +726,7 @@
...
@@ -740,6 +726,7 @@
],
],
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -758,6 +745,45 @@
...
@@ -758,6 +745,45 @@
"马来西亚-吉隆坡"
:
{
"马来西亚-吉隆坡"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Shopee-1"
,
"Lazada-0"
,
"CDiscount-1"
,
"Joom-1"
,
"Vova-1"
,
"乐天-0"
,
"Ozon-1"
,
"FactoryMarket-1"
,
"PayPal-1"
,
"其他平台-0"
]
},
"菲律宾-马尼拉"
:
{
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Shopee-1"
,
"Lazada-0"
,
"CDiscount-1"
,
"Joom-1"
,
"Vova-1"
,
"乐天-0"
,
"Ozon-1"
,
"FactoryMarket-1"
,
"PayPal-1"
,
"其他平台-0"
]
},
"韩国-首尔"
:
{
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -776,6 +802,7 @@
...
@@ -776,6 +802,7 @@
"印度尼西亚-雅加达"
:
{
"印度尼西亚-雅加达"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -794,6 +821,7 @@
...
@@ -794,6 +821,7 @@
"孟买"
:
{
"孟买"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -812,6 +840,7 @@
...
@@ -812,6 +840,7 @@
"加拿大"
:
{
"加拿大"
:
{
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -830,6 +859,7 @@
...
@@ -830,6 +859,7 @@
"巴西"
:
{
"巴西"
:
{
"亚马逊云"
:
[
"亚马逊云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -848,6 +878,7 @@
...
@@ -848,6 +878,7 @@
"迪拜"
:
{
"迪拜"
:
{
"阿里云"
:
[
"阿里云"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -866,6 +897,7 @@
...
@@ -866,6 +897,7 @@
"本地"
:
{
"本地"
:
{
"本地"
:
[
"本地"
:
[
"亚马逊-1"
,
"亚马逊-1"
,
"亚马逊日本-0"
,
"ebay-1"
,
"ebay-1"
,
"全球速卖通-1"
,
"全球速卖通-1"
,
"Wish-1"
,
"Wish-1"
,
...
@@ -886,7 +918,7 @@
...
@@ -886,7 +918,7 @@
"1周"
,
"1周"
,
"1个月"
,
"1个月"
,
"3个月"
,
"3个月"
,
"6个月
(送1个月)
"
,
"6个月"
,
"12个月
(送2个月)
"
"12个月"
]
]
}
}
\ No newline at end of file
src/test/java/com/edgec/browserbackend/BrowserBackendApplicationTests.java
View file @
7da93612
package
com
.
edgec
.
browserbackend
;
package
com
.
edgec
.
browserbackend
;
import
com.alibaba.fastjson.JSONObject
;
import
com.aliyun.sdk.service.ecs20140526.models.DeleteInstanceResponse
;
import
com.aliyun.sdk.service.ecs20140526.models.DeleteInstanceResponse
;
import
com.edgec.browserbackend.account.domain.UserBalance
;
import
com.edgec.browserbackend.account.domain.UserBalance
;
import
com.edgec.browserbackend.account.repository.UserBalanceRepository
;
import
com.edgec.browserbackend.account.repository.UserBalanceRepository
;
import
com.edgec.browserbackend.account.service.SmsUtils
;
import
com.edgec.browserbackend.browser.domain.CloudPlatformConfig
;
import
com.edgec.browserbackend.browser.domain.CloudPlatformConfig
;
import
com.edgec.browserbackend.browser.domain.IpHistory
;
import
com.edgec.browserbackend.browser.repository.CloudPlatformConfigRepository
;
import
com.edgec.browserbackend.browser.repository.CloudPlatformConfigRepository
;
import
com.edgec.browserbackend.browser.repository.IpHistoryRepository
;
import
com.edgec.browserbackend.browser.task.BrowserTask
;
import
com.edgec.browserbackend.browser.task.BrowserTask
;
import
com.edgec.browserbackend.common.client.AliEcsClient
;
import
com.edgec.browserbackend.common.client.AliEcsClient
;
import
com.edgec.browserbackend.common.commons.utils.SmsUtils
;
import
com.edgec.browserbackend.common.utils.Aes
;
import
com.edgec.browserbackend.common.utils.Aes
;
import
java.time.Instant
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
@@ -40,12 +44,19 @@ class BrowserBackendApplicationTests {
...
@@ -40,12 +44,19 @@ class BrowserBackendApplicationTests {
//browserTask.queryIpNewTasks();
//browserTask.queryIpNewTasks();
//AliEcsClient.runInstances("111","ceshi11","2222",config);
//AliEcsClient.runInstances("111","ceshi11","2222",config);
//AliEcsClient.getDescribeInstances("测试","i-wz9hf0i13xj6h904k14p","cn-shenzhen");
//AliEcsClient.getDescribeInstances("测试","i-wz9hf0i13xj6h904k14p","cn-shenzhen");
DeleteInstanceResponse
response
=
AliEcsClient
.
deleteInstance
(
"测试"
,
"i-j6ciop90gd68yg5n0sqo"
,
"cn-hongkong"
);
DeleteInstanceResponse
response
=
AliEcsClient
.
deleteInstance
(
"测试"
,
"i-j6cd9fujd6we3dzk8z9e"
,
"cn-hongkong"
);
//AliEcsClient.modifyInstanceChargeType("18711016574","Week",1,"cn-hongkong", "i-j6cd9fujd6we3dzk8z9e");
}
}
@Resource
private
IpHistoryRepository
ipHistoryRepository
;
@Test
@Test
void
test3
()
throws
Exception
{
void
test3
()
throws
Exception
{
SmsUtils
.
sendSmsOTP
(
"18711016574"
);
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"day"
,
"7"
);
param
.
put
(
"amount"
,
"5"
);
SmsUtils
.
sendIpSms
(
"18711016574"
,
SmsUtils
.
SmsTemplateCode
.
IPWILLEXPIRE_EXPIRE
,
param
);
}
}
}
}
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