Commit 1b6c2d10 authored by tangtuo's avatar tangtuo

Merge branch 'dev_1.0.0' into test_v1.0.0

parents ede1fcab 382a5a1b
...@@ -29,7 +29,7 @@ public class RedisConstant { ...@@ -29,7 +29,7 @@ public class RedisConstant {
/** /**
* 纪念版nft领取成员列表 * 纪念版nft领取成员列表
*/ */
public static final String COMMEMORATE_NFT_MEMBERS_PREFIX = "commemorate-nft:members:"; public static final String COMMEMORATE_NFT_MEMBERS_PREFIX = "commemorateNft:members:";
......
...@@ -119,12 +119,9 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper, ...@@ -119,12 +119,9 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper,
} }
// 先判断当前用户有没有领取过此纪念版nft // 先判断当前用户有没有领取过此纪念版nft
if (redisUtil.zScore(RedisConstant.COMMEMORATE_NFT_MEMBERS_PREFIX + id, user.getId().toString()) != null) { if (redisUtil.sIsMember(RedisConstant.COMMEMORATE_NFT_MEMBERS_PREFIX + id, user.getId().toString())) {
throw GlobalException.newException(ResultCode.FAILED, "此纪念版nft每个用户只能领取一次"); throw GlobalException.newException(ResultCode.FAILED, "此纪念版nft每个用户只能领取一次");
} }
/*if (redisUtil.sIsMember(RedisConstant.COMMEMORATE_NFT_MEMBERS_PREFIX + id, user.getId().toString())) {
throw GlobalException.newException(ResultCode.FAILED, "此纪念版nft每个用户只能领取一次");
}*/
// 获取此纪念版nft发行数的信号量 // 获取此纪念版nft发行数的信号量
RSemaphore semaphore = redisson.getSemaphore(RedisConstant.COMMEMORATE_NFT_PREFIX + id); RSemaphore semaphore = redisson.getSemaphore(RedisConstant.COMMEMORATE_NFT_PREFIX + id);
// 判断纪念版nft有没有被领取完 // 判断纪念版nft有没有被领取完
...@@ -164,8 +161,7 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper, ...@@ -164,8 +161,7 @@ public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper,
nft.setIsCommemorate(SystemConstant.BOOLEAN_DATA_TRUE); nft.setIsCommemorate(SystemConstant.BOOLEAN_DATA_TRUE);
nftService.save(nft); nftService.save(nft);
// 领取完毕,把当前用户id加入到纪念版nft的领取记录中 // 领取完毕,把当前用户id加入到纪念版nft的领取记录中
redisUtil.zAdd(RedisConstant.COMMEMORATE_NFT_MEMBERS_PREFIX + id, user.getId().toString(), availablePermits); redisUtil.sAdd(RedisConstant.COMMEMORATE_NFT_MEMBERS_PREFIX + id, user.getId().toString());
//redisUtil.sAdd(RedisConstant.COMMEMORATE_NFT_MEMBERS_PREFIX + id, user.getId().toString());
return true; return true;
} finally { } finally {
lock.unlock(); lock.unlock();
......
...@@ -96,7 +96,7 @@ public class CommemorateNftController { ...@@ -96,7 +96,7 @@ public class CommemorateNftController {
return ResponseModel.success(result); return ResponseModel.success(result);
} }
@Authentication //@Authentication
@GetMapping("/get/{id}") @GetMapping("/get/{id}")
@ApiOperation(value = "纪念版nft详情页") @ApiOperation(value = "纪念版nft详情页")
public ResponseModel<CommemorateNftVo> getById(@PathVariable Integer id, @RequestHeader String Authorization) { public ResponseModel<CommemorateNftVo> getById(@PathVariable Integer id, @RequestHeader String Authorization) {
......
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