Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fzm-joying
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lei
fzm-joying
Commits
3d8eab2f
Commit
3d8eab2f
authored
Jul 09, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入测试环境配置
parent
8646021d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
266 additions
and
7 deletions
+266
-7
application-test.yml
joying-admin/src/main/resources/application-test.yml
+104
-0
logback-spring.xml
joying-admin/src/main/resources/logback-spring.xml
+9
-0
NftServiceImpl.java
...main/java/com/fzm/common/service/impl/NftServiceImpl.java
+24
-6
application-test.yml
joying-portal/src/main/resources/application-test.yml
+116
-0
application.yml
joying-portal/src/main/resources/application.yml
+4
-1
logback-spring.xml
joying-portal/src/main/resources/logback-spring.xml
+9
-0
joying.sql
sql/joying.sql
+0
-0
No files found.
joying-admin/src/main/resources/application-test.yml
0 → 100644
View file @
3d8eab2f
server
:
port
:
8002
spring
:
application
:
name
:
joying-admin
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
datasource
:
url
:
jdbc:mysql://172.16.101.135:3306/fzm_joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
123456
platform
:
mysql
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
filters
:
stat ,wall
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat
:
true
redis
:
host
:
172.16.101.136
port
:
6379
password
:
123456
lettuce
:
pool
:
# 连接池最大连接数(使用负值表示没有限制) 默认 8
max-active
:
100
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1
max-wait
:
-1
# 连接池中的最大空闲连接 默认 8
max-idle
:
8
# 连接池中的最小空闲连接 默认 0
min-idle
:
0
cache
:
# 整合SpringCache,redis作为缓存类型
type
:
redis
redis
:
# 缓存失效时间
time-to-live
:
86400000
# sa-token配置
sa-token
:
# token名称 (同时也是cookie名称)
token-name
:
Authorization
# token有效期,单位s, -1代表永不过期
timeout
:
7200
# token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
activity-timeout
:
3600
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share
:
false
# token风格
#token-style: uuid
# 是否输出操作日志
is-log
:
false
tokenPrefix
:
Bearer
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent
:
false
swagger
:
title
:
乐映影视
description
:
乐映影视后台管理系统RESTFUL API
version
:
1.0.0
base-package
:
com.fzm.admin.controller
base-path
:
/**
enabled
:
true
globalOperationParameters
:
-
description
:
Authorization
modelRef
:
string
name
:
Authorization
parameterType
:
header
required
:
false
contact
:
name
:
tangtuo
email
:
ttuo@33.com
chain
:
para
:
rpc-url
:
http://172.16.101.133:8801
withhold-addr
:
1Ae6FfgdYJn6LLaqDoRjwga3j4TTmMq3t7
withhold-key
:
a4c49dcb35e0032dc8db5891dc81481943b68fc558ce93ce74d0382c1d104934
title
:
user.p.joying.
admin
:
16naUoLwjNUgMhGVRmL3xTVpCso2DJp8JZ
admin-key
:
8cd19e9bf39055f95e3e33cc1e08b9f9fc2e9be48a5b3a4d401e64041c97aec7
contract-name
:
user.evm.0xd996a3a866c577596df260844a045a068ec5accd8d71ccaa3d578c9617ec5490
contract-address
:
1iDWTHZQxPES4hLveZRcwJH6AMaMfZfZZ
aliyun
:
oss
:
app-key
:
LTAI5tHGn7cVJdEtihTFLSeB
app-secret
:
XYmfBSbLaZoblGXZwIXkbhfBD7a1eg
end-point
:
oss-cn-hangzhou.aliyuncs.com
simple-bucket
:
test-nft
encrypt-bucket
:
test-nft-2
joying-admin/src/main/resources/logback-spring.xml
View file @
3d8eab2f
...
@@ -13,6 +13,9 @@
...
@@ -13,6 +13,9 @@
<springProfile
name=
"dev"
>
<springProfile
name=
"dev"
>
<property
name=
"LOG_HOME"
value=
"logs"
/>
<property
name=
"LOG_HOME"
value=
"logs"
/>
</springProfile>
</springProfile>
<springProfile
name=
"test"
>
<property
name=
"LOG_HOME"
value=
"logs"
/>
</springProfile>
<!-- 彩色日志 -->
<!-- 彩色日志 -->
...
@@ -118,6 +121,11 @@
...
@@ -118,6 +121,11 @@
<appender-ref
ref=
"DOCKER_LOGS"
/>
<appender-ref
ref=
"DOCKER_LOGS"
/>
<appender-ref
ref=
"INFO_FILE"
/>
<appender-ref
ref=
"INFO_FILE"
/>
</springProfile>
</springProfile>
<springProfile
name=
"test"
>
<!-- <appender-ref ref="CONSOLE" />-->
<appender-ref
ref=
"DOCKER_LOGS"
/>
<appender-ref
ref=
"INFO_FILE"
/>
</springProfile>
</root>
</root>
</configuration>
</configuration>
\ No newline at end of file
joying-common/src/main/java/com/fzm/common/service/impl/NftServiceImpl.java
View file @
3d8eab2f
...
@@ -2,6 +2,8 @@ package com.fzm.common.service.impl;
...
@@ -2,6 +2,8 @@ package com.fzm.common.service.impl;
import
cn.dev33.satoken.stp.StpUtil
;
import
cn.dev33.satoken.stp.StpUtil
;
import
cn.fzm.chain.simplesdk.client.ParaChainClient
;
import
cn.fzm.chain.simplesdk.client.ParaChainClient
;
import
cn.fzm.chain.simplesdk.constant.TxStatusEnum
;
import
cn.fzm.chain.simplesdk.model.TxResult
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
...
@@ -81,23 +83,21 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
...
@@ -81,23 +83,21 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
nftDto
.
setId
(
nft
.
getId
());
nftDto
.
setId
(
nft
.
getId
());
nftDto
.
setFileHash
(
nft
.
getFileHash
());
nftDto
.
setFileHash
(
nft
.
getFileHash
());
return
nftDto
;
return
nftDto
;
/*
*/
}
}
@Override
@Override
public
Boolean
publish
(
NftDto
nftDto
)
{
public
Boolean
publish
(
NftDto
nftDto
)
{
// 获取用户的私钥
User
user
=
userService
.
getById
(
StpUtil
.
getLoginIdAsInt
());
User
user
=
userService
.
getById
(
StpUtil
.
getLoginIdAsInt
());
String
wallet
=
user
.
getWallet
();
String
wallet
=
user
.
getWallet
();
String
privkey
=
paraChainClient
.
walletDumpPrivkey
(
user
.
getWallet
());
// 获取用户的私钥
String
privkey
=
paraChainClient
.
walletDumpPrivkey
(
wallet
);
// 发行nft
String
txHash
=
paraChainClient
.
evmPublishNFT1155
(
contractName
,
wallet
,
privkey
,
1
,
true
);
String
txHash
=
paraChainClient
.
evmPublishNFT1155
(
contractName
,
wallet
,
privkey
,
1
,
true
);
if
(
StringUtils
.
isBlank
(
txHash
)
||
!
txHash
.
contains
(
"-"
))
{
if
(
StringUtils
.
isBlank
(
txHash
)
||
!
txHash
.
contains
(
"-"
))
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"nft发行失败"
);
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"nft发行失败"
);
}
}
String
[]
split
=
txHash
.
split
(
"-"
);
String
[]
split
=
txHash
.
split
(
"-"
);
String
hash
=
split
[
0
];
long
tokenId
=
Long
.
parseLong
(
split
[
1
]);
long
tokenId
=
Long
.
parseLong
(
split
[
1
]);
Nft
nft
=
getById
(
nftDto
.
getId
());
Nft
nft
=
getById
(
nftDto
.
getId
());
// 构建上链信息
// 构建上链信息
...
@@ -108,9 +108,11 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
...
@@ -108,9 +108,11 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
String
tokenInfo
=
JsonUtil
.
toJson
(
map
);
String
tokenInfo
=
JsonUtil
.
toJson
(
map
);
log
.
info
(
"加密上链数据: {}"
,
tokenInfo
);
log
.
info
(
"加密上链数据: {}"
,
tokenInfo
);
String
tradeHash
=
paraChainClient
.
evmSetTokenInfo
(
contractName
,
tokenId
,
tokenInfo
,
wallet
,
privkey
,
true
);
String
tradeHash
=
paraChainClient
.
evmSetTokenInfo
(
contractName
,
tokenId
,
tokenInfo
,
wallet
,
privkey
,
true
);
System
.
out
.
println
(
hash
.
equals
(
tradeHash
));
if
(
StringUtils
.
isBlank
(
tradeHash
))
{
if
(
StringUtils
.
isBlank
(
tradeHash
))
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"nft发行失败"
);
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
"nft发行失败"
);
}
}
paraChainClient
.
cycleConfirmTxWithHash
(
hash
,
true
,
1200
);
nft
.
setNftHash
(
split
[
0
]);
nft
.
setNftHash
(
split
[
0
]);
nft
.
setTokenId
(
tokenId
);
nft
.
setTokenId
(
tokenId
);
nft
.
setPublishTime
(
new
Date
());
nft
.
setPublishTime
(
new
Date
());
...
@@ -118,6 +120,22 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
...
@@ -118,6 +120,22 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
return
updateById
(
nft
);
return
updateById
(
nft
);
}
}
public
Boolean
checkResult
(
String
nftHash
)
{
TxResult
txResult
=
paraChainClient
.
confirmTxWithGrpTxHash
(
nftHash
);
if
(
TxStatusEnum
.
RUNNING
.
equals
(
txResult
.
getStatus
()))
{
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
checkResult
(
nftHash
);
}
if
(
TxStatusEnum
.
FAIL
.
equals
(
txResult
.
getStatus
()))
{
throw
GlobalException
.
newException
(
ResultCode
.
FAILED
,
String
.
format
(
"nft发行失败,原因是:{}"
,
txResult
.
getErrMsg
()));
}
return
true
;
}
@Override
@Override
public
List
<
Nft
>
list
(
Integer
pageNum
,
Integer
pageSize
,
Integer
categoryId
)
{
public
List
<
Nft
>
list
(
Integer
pageNum
,
Integer
pageSize
,
Integer
categoryId
)
{
return
nftMapper
.
list
(
pageNum
,
pageSize
,
categoryId
);
return
nftMapper
.
list
(
pageNum
,
pageSize
,
categoryId
);
...
...
joying-portal/src/main/resources/application-test.yml
0 → 100644
View file @
3d8eab2f
server
:
port
:
8001
spring
:
main
:
allow-bean-definition-overriding
:
true
#当遇到同样名字的时候,是否允许覆盖注册
datasource
:
url
:
jdbc:mysql://172.16.101.135:3306/fzm_joying_test?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username
:
root
password
:
123456
platform
:
mysql
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
time-between-eviction-runs-millis
:
60000
min-evictable-idle-time-millis
:
300000
validation-query
:
SELECT 1 FROM DUAL
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
pool-prepared-statements
:
false
max-pool-prepared-statement-per-connection-size
:
20
filters
:
stat ,wall
connection-properties
:
druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat
:
true
redis
:
host
:
172.16.101.136
port
:
6379
password
:
123456
lettuce
:
pool
:
# 连接池最大连接数(使用负值表示没有限制) 默认 8
max-active
:
100
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1
max-wait
:
-1
# 连接池中的最大空闲连接 默认 8
max-idle
:
8
# 连接池中的最小空闲连接 默认 0
min-idle
:
0
cache
:
# 整合SpringCache,redis作为缓存类型
type
:
redis
rabbitmq
:
host
:
172.16.101.135
port
:
5672
username
:
admin
password
:
admin
listener
:
simple
:
####开启手动签收
acknowledge-mode
:
manual
# sa-token配置
sa-token
:
# token名称 (同时也是cookie名称)
token-name
:
Authorization
# token有效期,单位s 默认30天, -1代表永不过期
timeout
:
86400
# token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
activity-timeout
:
3600
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share
:
false
# token风格
#token-style: uuid
# 是否输出操作日志
is-log
:
true
tokenPrefix
:
Bearer
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent
:
false
swagger
:
title
:
乐映影视
description
:
乐映影视门户系统RESTFUL API
version
:
1.0.0
base-package
:
com.fzm.portal.controller
base-path
:
/**
enabled
:
true
globalOperationParameters
:
-
description
:
Authorization
modelRef
:
string
name
:
Authorization
parameterType
:
header
required
:
false
contact
:
name
:
tangtuo
email
:
ttuo@33.com
sms
:
app-key
:
Yiru
app-secret
:
mx5oaR^RY8!(ziHn
message-login-codetype
:
quick
email-login-codetype
:
quick
voice-login-codetype
:
quick
send-sms-url
:
http://118.31.52.32/send/sms2
validate-code-url
:
http://118.31.52.32/validate/code
chain
:
para
:
rpc-url
:
http://172.16.101.133:8801
withhold-addr
:
1Ae6FfgdYJn6LLaqDoRjwga3j4TTmMq3t7
withhold-key
:
a4c49dcb35e0032dc8db5891dc81481943b68fc558ce93ce74d0382c1d104934
title
:
user.p.joying.
admin
:
16naUoLwjNUgMhGVRmL3xTVpCso2DJp8JZ
admin-key
:
8cd19e9bf39055f95e3e33cc1e08b9f9fc2e9be48a5b3a4d401e64041c97aec7
contract-name
:
user.evm.0xd996a3a866c577596df260844a045a068ec5accd8d71ccaa3d578c9617ec5490
contract-address
:
1iDWTHZQxPES4hLveZRcwJH6AMaMfZfZZ
aliyun
:
oss
:
app-key
:
LTAI5tHGn7cVJdEtihTFLSeB
app-secret
:
XYmfBSbLaZoblGXZwIXkbhfBD7a1eg
end-point
:
oss-cn-hangzhou.aliyuncs.com
simple-bucket
:
test-nft
encrypt-bucket
:
test-nft-2
joying-portal/src/main/resources/application.yml
View file @
3d8eab2f
...
@@ -3,7 +3,10 @@ spring:
...
@@ -3,7 +3,10 @@ spring:
active
:
local
active
:
local
application
:
application
:
name
:
joying-portal
name
:
joying-portal
servlet
:
multipart
:
max-file-size
:
1GB
max-request-size
:
10GB
jackson
:
jackson
:
time-zone
:
GMT+8
time-zone
:
GMT+8
date-format
:
yyyy-MM-dd HH:mm:ss
date-format
:
yyyy-MM-dd HH:mm:ss
...
...
joying-portal/src/main/resources/logback-spring.xml
View file @
3d8eab2f
...
@@ -15,6 +15,9 @@
...
@@ -15,6 +15,9 @@
<springProfile
name=
"dev"
>
<springProfile
name=
"dev"
>
<property
name=
"LOG_HOME"
value=
"logs"
/>
<property
name=
"LOG_HOME"
value=
"logs"
/>
</springProfile>
</springProfile>
<springProfile
name=
"test"
>
<property
name=
"LOG_HOME"
value=
"logs"
/>
</springProfile>
<!-- 彩色日志 -->
<!-- 彩色日志 -->
...
@@ -120,6 +123,11 @@
...
@@ -120,6 +123,11 @@
<appender-ref
ref=
"DOCKER_LOGS"
/>
<appender-ref
ref=
"DOCKER_LOGS"
/>
<appender-ref
ref=
"INFO_FILE"
/>
<appender-ref
ref=
"INFO_FILE"
/>
</springProfile>
</springProfile>
<springProfile
name=
"test"
>
<!-- <appender-ref ref="CONSOLE" />-->
<appender-ref
ref=
"DOCKER_LOGS"
/>
<appender-ref
ref=
"INFO_FILE"
/>
</springProfile>
</root>
</root>
</configuration>
</configuration>
\ No newline at end of file
sql/joying.sql
View file @
3d8eab2f
This diff is collapsed.
Click to expand it.
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