|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.alipay.api.AlipayClient;
|
|
|
import com.alipay.api.domain.AlipayTradeRefundModel;
|
|
|
import com.alipay.api.internal.util.AlipaySignature;
|
|
|
@@ -112,21 +113,19 @@ public class RegisterOrderDonServiceImpl extends ServiceImpl<RegisterOrderDonMap
|
|
|
* @date 2022-11-07 3:34 PM
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean isFree(long userId, String platform) {
|
|
|
- int count = count(Wrappers.lambdaQuery(RegisterOrderDon.class)
|
|
|
- .eq(RegisterOrderDon::getUserId, userId)
|
|
|
- .ne(RegisterOrderDon::getStatus, RegisterOrderDon.Status.noPayment)
|
|
|
- .eq(RegisterOrderDon::getIsFree, true));
|
|
|
- if(count > 0){
|
|
|
+ public boolean isFree(long userId, String platform, String code) {
|
|
|
+
|
|
|
+ SysConfig sysConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, "spotify_free_code"));
|
|
|
+ if (sysConfig == null) {
|
|
|
return false;
|
|
|
- }
|
|
|
- Long num = redisService.decr(RedisKey.SPOTIFY_FREE_NUM, 1L);
|
|
|
- if(num >= 0){
|
|
|
- return true;
|
|
|
}else {
|
|
|
- redisService.incr(RedisKey.SPOTIFY_FREE_NUM, 1L);
|
|
|
+ if (JSONUtil.isJsonArray(sysConfig.getSysValue())) {
|
|
|
+ List<String> list = JSONUtil.parseArray(sysConfig.getSysValue()).toList(String.class);
|
|
|
+ return list.contains(code);
|
|
|
+ }else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
- return false;
|
|
|
}
|
|
|
|
|
|
/**
|