记得上下班打卡 | git大法好,push需谨慎

Commit 3aca768f authored by jiangxiulong's avatar jiangxiulong

预约用户才可购买

parent 41e552af
......@@ -69,6 +69,12 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
return ResponseDto.failure("您还未开通数字账户~");
}
// 若开启了预约 判断用户是否预约
boolean userAboutAut = nftOrderUtils.getUserAboutAut(payParam.getSkuId(), uid);
if (!userAboutAut) {
return ResponseDto.failure("此数字藏品仅限预约用户购买~");
}
// 是否存在此商品信息 是否隐藏
String skuId = payParam.getSkuId();
int number = 1;
......
......@@ -176,6 +176,32 @@ public class GoblinNftOrderUtils {
return (int) redisUtil.decr(redisKey, number);
}
// skuId 是否开启预约
public boolean getValueBySkuId(String skuId) {
String redisKey = GoblinRedisConst.ANTICIPATE_VALUE_SKUID.concat(skuId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return false;
} else {
return true;
}
}
// 是否预约过 没开启true
public boolean getUserAboutAut(String skuId, String uid) {
boolean valueBySkuId = getValueBySkuId(skuId);
if (valueBySkuId) {
String redisKey = GoblinRedisConst.USER_ANTICIPATE_STATE.concat(skuId).concat(uid);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return false;
} else {
return true;
}
} else {
return true;
}
}
/**
* 使用平台优惠券 只支持代金券
*
......
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