Commit e31a3201 authored by tangtuo's avatar tangtuo

Merge branch 'dev_1.2.0' into test_v1.2.0

parents f280ea01 ca149f47
......@@ -4,9 +4,9 @@ spring:
main:
allow-bean-definition-overriding: true
datasource:
url: jdbc:mysql://rm-uf65dutlz01018ctc33150.mysql.rds.aliyuncs.com:3306/joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username: inmvochain
password: db$95872!com@inmvo
url: jdbc:mysql://rm-uf652555t10p7cj27.mysql.rds.aliyuncs.com:3306/joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username: inmvo_china
password: U2FsdGVkX19J0YHIUWXWgPh1C5R0=
platform: mysql
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
......@@ -27,9 +27,9 @@ spring:
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat: true
redis:
host: r-uf65vh5nip6yjfgtcn.redis.rds.aliyuncs.com
host: r-uf61gaz5hcnys2gbdo.redis.rds.aliyuncs.com
port: 6379
password: db$95872!com@inmvo
password: U2FsdGVkX19J0YHIUWXWgPh1C5R0=
lettuce:
pool:
# 连接池最大连接数(使用负值表示没有限制) 默认 8
......@@ -65,14 +65,14 @@ swagger:
chain:
para:
rpc-url: http://47.243.127.76:8901
rpc-url: http://47.75.126.72:8901
withhold-addr: 1Ae6FfgdYJn6LLaqDoRjwga3j4TTmMq3t7
withhold-key: a4c49dcb35e0032dc8db5891dc81481943b68fc558ce93ce74d0382c1d104934
title: user.p.FilmChain
admin: 16naUoLwjNUgMhGVRmL3xTVpCso2DJp8JZ
admin-key: 8cd19e9bf39055f95e3e33cc1e08b9f9fc2e9be48a5b3a4d401e64041c97aec7
contract-name: user.evm.0xd996a3a866c577596df260844a045a068ec5accd8d71ccaa3d578c9617ec5490
contract-address: 1iDWTHZQxPES4hLveZRcwJH6AMaMfZfZZ
withhold-key: 0xa4c49dcb35e0032dc8db5891dc81481943b68fc558ce93ce74d0382c1d104934
title: user.p.FilmChain.
admin: 1N2ABERwHgxGhebVw6fVSwaQ5uLAysmGEu
admin-key: 0x4e92bda2477ded0e7c07a9e3acd2370de8d7401c68cc83ee8376806db3121e77
contract-name: user.evm.0x1adc08f04fbc0cda9fb45a6b36b317d4fed9715f68314b754ce1e22ea681cd28
contract-address: 1JoYQKtT6PwtfZWqTFPPdAksQ7jB2JRAPw
aliyun:
oss:
......
......@@ -179,15 +179,11 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
if (!smsUtil.validateCode(getCodeType(param.getCodeType()), user.getTelephone(), param.getCode(), param.getCodeType())) {
throw GlobalException.newException(ResultCode.TRANSFER_ERROR, "短信验证码校验失败");
}
// 校验接收人的个人信息
User receiveUser = userService.getUserByWallet(param.getReceiveWallet());
if (receiveUser == null) {
throw GlobalException.newException(ResultCode.TRANSFER_ERROR, "接手人非本系统注册用户,暂不支持转让");
}
// 不能自己向自己转让nft
/*// 不能自己向自己转让nft
if (user.getWallet().equals(receiveUser.getWallet())) {
throw GlobalException.newException(ResultCode.TRANSFER_ERROR, "不能向自己转让nft");
}
}*/
String abi = "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"}],\"name\":\"TransferBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"TransferSingle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"value\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"URI\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"name\":\"balanceOfBatch\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getTokenInfo\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeBatchTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"tokenInfo\",\"type\":\"string\"}],\"name\":\"setTokenInfo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"uri\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]";
String tokenInfo = paraChainClient.evmGetTokenInfoNew(abi, contractAddr, nft.getTokenId(), user.getWallet());
// 转让nft
......@@ -204,9 +200,11 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
if (StringUtils.isBlank(realHash)) {
throw GlobalException.newException(ResultCode.TRANSFER_ERROR);
}
// 校验接收人的个人信息
User receiveUser = userService.getUserByWallet(param.getReceiveWallet());
// 修改nft的拥有者用户id
Nft transferNft = new Nft().
setUserId(receiveUser.getId()).
setUserId(receiveUser != null ? receiveUser.getId() : null).
setTransferHash(realHash);
transferNft.setId(nft.getId());
updateById(transferNft);
......@@ -217,7 +215,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
setNftHash(nft.getNftHash()).
setTransferHash(realHash).
setFromAddress(user.getWallet()).
setToAddress(receiveUser.getWallet());
setToAddress(param.getReceiveWallet());
nftTransferRecordService.save(record);
return true;
}
......
......@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
......@@ -34,6 +35,7 @@ import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.faceid.v20180301.FaceidClient;
import com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationRequest;
import com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.crypto.password.PasswordEncoder;
......@@ -51,6 +53,7 @@ import java.util.List;
* @author tangtuo
* @date 2021/6/23 15:15
*/
@Slf4j
@Service
@Transactional(rollbackFor = RuntimeException.class)
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
......@@ -232,6 +235,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
BASE64Encoder base64Encoder = new BASE64Encoder();
String encode = "data:image/jpg;base64," + base64Encoder.encode(cardPictureFront.getBytes());
IdCardOCRVerificationResponse response = TencentApi.idCardOCRVerification(encode);
log.info("实名认证结果:{}", JSONUtil.toJsonStr(response));
Integer status;
if (IdCardVerificationResponse.SUCCESS.getCode().equals(response.getResult())) {
// 验证成功上传身份证证件
......@@ -253,6 +257,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
.set("auth_status", status)
.eq("id", userId);
update(userUpdateWrapper);
if (AuthStatusEnum.SUCCESS.getStatus().equals(status)) {
redisUtil.delete("user::statistic");
}
return response;
}
......
......@@ -91,9 +91,6 @@ public class SmsUtil {
* @return
*/
public Boolean validateCode(String codetype, String mobile, String code, String type) {
if ("8888".equals(code)){
return true;
}
String timestamp = getTimestamp();
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("t", type);
......
......@@ -4,7 +4,7 @@
<select id="list" resultType="com.fzm.common.entity.Nft">
select * from tb_nft
where status = 1 and is_commemorate=0 and nft_hash != ''
where status = 1 and is_commemorate=0 and nft_hash != '' and user_id is not null
<if test="categoryId != null and categoryId > 0">
and category_id=#{categoryId}
</if>
......@@ -26,7 +26,7 @@
<foreach collection="list" item="id" separator=",">
#{id}
</foreach>
)
) and a.user_id is not null
</select>
<select id="page" resultType="com.fzm.common.entity.vo.NftListVo">
......
......@@ -4,9 +4,9 @@ spring:
main:
allow-bean-definition-overriding: true
datasource:
url: jdbc:mysql://rm-uf65dutlz01018ctc33150.mysql.rds.aliyuncs.com:3306/joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username: inmvochain
password: db$95872!com@inmvo
url: jdbc:mysql://rm-uf652555t10p7cj27.mysql.rds.aliyuncs.com:3306/joying?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8
username: inmvo_china
password: U2FsdGVkX19J0YHIUWXWgPh1C5R0=
platform: mysql
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
......@@ -27,9 +27,9 @@ spring:
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
useGlobalDataSourceStat: true
redis:
host: r-uf65vh5nip6yjfgtcn.redis.rds.aliyuncs.com
host: r-uf61gaz5hcnys2gbdo.redis.rds.aliyuncs.com
port: 6379
password: db$95872!com@inmvo
password: U2FsdGVkX19J0YHIUWXWgPh1C5R0=
lettuce:
pool:
# 连接池最大连接数(使用负值表示没有限制) 默认 8
......@@ -77,14 +77,14 @@ sms:
chain:
para:
rpc-url: http://47.243.127.76:8901
rpc-url: http://47.75.126.72:8901
withhold-addr: 1Ae6FfgdYJn6LLaqDoRjwga3j4TTmMq3t7
withhold-key: a4c49dcb35e0032dc8db5891dc81481943b68fc558ce93ce74d0382c1d104934
withhold-key: 0xa4c49dcb35e0032dc8db5891dc81481943b68fc558ce93ce74d0382c1d104934
title: user.p.FilmChain.
admin: 1N2ABERwHgxGhebVw6fVSwaQ5uLAysmGEu
admin-key: 4e92bda2477ded0e7c07a9e3acd2370de8d7401c68cc83ee8376806db3121e77
contract-name: user.evm.0x4285f54e72e85c6a3a45179bee61179cd0e661497bfa0403148abf640c3b71ab
contract-address: 1AihcmFHyEtVShYSXNEfRQEhKKde6SyzoJ
admin-key: 0x4e92bda2477ded0e7c07a9e3acd2370de8d7401c68cc83ee8376806db3121e77
contract-name: user.evm.0x1adc08f04fbc0cda9fb45a6b36b317d4fed9715f68314b754ce1e22ea681cd28
contract-address: 1JoYQKtT6PwtfZWqTFPPdAksQ7jB2JRAPw
aliyun:
oss:
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment