Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mall-server
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
yimu
mall-server
Commits
88cc1592
Commit
88cc1592
authored
Dec 29, 2021
by
wlx@33.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化转赠
parent
ef38da45
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
UserAssetTransferRecordServiceImpl.java
...sset/service/impl/UserAssetTransferRecordServiceImpl.java
+3
-2
UserAssetTransferConsumer.java
...l/server/front/mq/consumer/UserAssetTransferConsumer.java
+3
-2
TranDto.java
...ava/com/fzm/mall/server/front/order/model/po/TranDto.java
+5
-0
No files found.
mall-server-front/src/main/java/com/fzm/mall/server/front/asset/service/impl/UserAssetTransferRecordServiceImpl.java
View file @
88cc1592
...
...
@@ -96,7 +96,7 @@ public class UserAssetTransferRecordServiceImpl extends ServiceImpl<UserAssetTra
/**
* 链上转账
*/
transferInChain
(
user
.
getAddress
(),
record
.
getCoin
(),
record
.
getToAddress
(),
record
.
getNum
(),
record
.
getTransferRecordId
(),
hash
,
tokenId
);
transferInChain
(
user
.
getAddress
(),
record
.
getCoin
(),
record
.
getToAddress
(),
record
.
getNum
(),
record
.
getTransferRecordId
(),
hash
,
tokenId
,
sku
.
getCoinName
()
);
}
}
...
...
@@ -127,7 +127,7 @@ public class UserAssetTransferRecordServiceImpl extends ServiceImpl<UserAssetTra
* @param toAddress
* @param num
*/
private
void
transferInChain
(
String
fromAddress
,
String
coin
,
String
toAddress
,
Integer
num
,
String
transferRecordId
,
String
hash
,
Long
tokenId
)
{
private
void
transferInChain
(
String
fromAddress
,
String
coin
,
String
toAddress
,
Integer
num
,
String
transferRecordId
,
String
hash
,
Long
tokenId
,
String
goodsCoin
)
{
/**
* 如果配置为不走链,则不操作链上资产
*/
...
...
@@ -144,6 +144,7 @@ public class UserAssetTransferRecordServiceImpl extends ServiceImpl<UserAssetTra
tranDto
.
setTableType
(
TranDto
.
USER_ASSET_TRANSFER
);
tranDto
.
setHash
(
hash
);
tranDto
.
setTokenId
(
tokenId
);
tranDto
.
setGoodsCoin
(
goodsCoin
);
producer
.
sendTTL
(
JSON
.
toJSONString
(
tranDto
),
QueueTTLTypeEnum
.
MALL_USER_ASSET_TRANSFER_TTL
,
5
*
1000
);
}
...
...
mall-server-front/src/main/java/com/fzm/mall/server/front/mq/consumer/UserAssetTransferConsumer.java
View file @
88cc1592
...
...
@@ -141,7 +141,7 @@ public class UserAssetTransferConsumer {
* 成功:增加接收方的资产
* 失败:不做任何操作
*/
updateReciverAsset
(
transferRecord
,
successed
);
updateReciverAsset
(
transferRecord
,
successed
,
tranDto
.
getGoodsCoin
()
);
/**
* 转赠流水记录
...
...
@@ -217,7 +217,7 @@ public class UserAssetTransferConsumer {
}
}
private
void
updateReciverAsset
(
UserAssetTransferRecord
transferRecord
,
boolean
successed
)
{
private
void
updateReciverAsset
(
UserAssetTransferRecord
transferRecord
,
boolean
successed
,
String
goodsCoin
)
{
if
(!
successed
)
{
return
;
}
...
...
@@ -232,6 +232,7 @@ public class UserAssetTransferConsumer {
receiveAsset
.
setUid
(
transferRecord
.
getToUid
());
receiveAsset
.
setType
(
1
);
receiveAsset
.
setAmount
(
reNumber
);
receiveAsset
.
setGoodsCoin
(
goodsCoin
);
boolean
reSave
=
userAssetService
.
save
(
receiveAsset
);
if
(!
reSave
)
{
log
.
error
(
"save asset fail, uid:"
+
receiveAsset
.
getUid
()
+
"coin:"
+
receiveAsset
.
getCoin
());
...
...
mall-server-front/src/main/java/com/fzm/mall/server/front/order/model/po/TranDto.java
View file @
88cc1592
...
...
@@ -58,4 +58,9 @@ public class TranDto {
* 1.外部nft;2.内部nft;3.内部普通
*/
private
Integer
coinType
;
/**
* 复制的nft商品币前缀(原外部NFT)
*/
private
String
goodsCoin
;
}
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