Commit ea854d0c authored by tangtuo's avatar tangtuo

整合Redisson

nft加入发行人地址字段
parent 3a0a4f59
......@@ -83,6 +83,12 @@
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
</dependency>
</dependencies>
<properties>
......
......@@ -28,6 +28,9 @@ public class Nft extends BaseEntity {
@ApiModelProperty("用户id")
private Integer userId;
@ApiModelProperty("发行人地址")
private String publishAddress;
@NotBlank(message = "名称不能为空")
@Length(max = 20, message = "名称最大长度为20")
@ApiModelProperty("名称")
......
......@@ -72,7 +72,7 @@ public class NftVo {
this.synopsis = nft.getSynopsis();
this.publisher = user.getNickname();
this.avatar = user.getAvatar();
this.wallet = user.getWallet();
this.wallet = nft.getPublishAddress();
this.publishTime = DateUtil.format(nft.getPublishTime(), "yyyy/MM/dd HH:mm:ss");
this.isArchives = nft.getIsArchives();
this.isGrant = nft.getIsGrant();
......
......@@ -127,6 +127,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
nft.setTokenId(tokenId);
nft.setPublishTime(new Date());
nft.setNftId(nftDto.getNftId());
nft.setPublishAddress(wallet);
updateById(nft);
// 如果用户是第一次发行作品,把用户的isPublish修改成1,并清空用户统计的缓存信息
if (SystemConstant.BOOLEAN_DATA_FALSE.equals(user.getIsPublish())) {
......
package com.fzm.portal.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
/**
* @author tangtuo
* @date 2021/7/19 10:25
* <p>
* 集群版redisson客户端配置
* </p>
*/
@Profile({"prod"})
@Configuration
public class RedissonClusterConfig {
}
package com.fzm.portal.config;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import javax.annotation.Resource;
/**
* @author tangtuo
* @date 2021/7/19 10:25
* <p>
* 单机版redisson客户端配置
* </p>
*/
@Profile({"dev", "local", "test"})
@Configuration
public class RedissonSingleConfig {
@Resource
RedisProperties redisProperties;
@Bean
public RedissonClient redisson() {
Config config = new Config();
config.useSingleServer().
setAddress(String.format("redis://%s:%s", redisProperties.getHost(), redisProperties.getPort())).
setPassword(redisProperties.getPassword());
RedissonClient redisson = Redisson.create(config);
return redisson;
}
}
......@@ -98,6 +98,13 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.16.0</version>
</dependency>
</dependencies>
</dependencyManagement>
......
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