|
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
+import com.fdkankan.openApi.constant.CountType;
|
|
|
import com.fdkankan.openApi.constant.RedisKey;
|
|
|
import com.fdkankan.openApi.entity.system.UserAuthInfo;
|
|
|
import com.fdkankan.openApi.exception.ApiBusinessException;
|
|
@@ -58,7 +59,7 @@ public class UserAuthInfoInfoServiceImpl extends ServiceImpl<IUserAuthInfoMapper
|
|
|
userAuthService.save(userAuthInfo);
|
|
|
|
|
|
//设置redis缓存
|
|
|
- this.setReidsCount(userAuthInfo.getAppKey(), null, true);
|
|
|
+ this.setReidsCount(userAuthInfo.getAppKey(), CountType.NO_LIMIT.code(), null);
|
|
|
|
|
|
return userAuthInfo;
|
|
|
}
|
|
@@ -146,14 +147,20 @@ public class UserAuthInfoInfoServiceImpl extends ServiceImpl<IUserAuthInfoMapper
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void setReidsCount(String appKey, Integer count, boolean isInfinite) {
|
|
|
- if(isInfinite){
|
|
|
+ public void setReidsCount(String appKey, Integer type, Integer count) {
|
|
|
+ if(type == CountType.NO_LIMIT.code()){
|
|
|
redisUtil.sSet(RedisKey.API_METHOD_COUNT_INFINITE, appKey);
|
|
|
redisUtil.del(String.format(RedisKey.API_METHOD_COUNT, appKey));
|
|
|
return;
|
|
|
}
|
|
|
redisUtil.setRemove(RedisKey.API_METHOD_COUNT_INFINITE, appKey);
|
|
|
- redisUtil.incr(String.format(RedisKey.API_METHOD_COUNT, appKey), count);
|
|
|
+ if(type == CountType.ADD.code()){
|
|
|
+ redisUtil.incr(String.format(RedisKey.API_METHOD_COUNT, appKey), count);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(type == CountType.REDUCE.code()){
|
|
|
+ redisUtil.decr(String.format(RedisKey.API_METHOD_COUNT, appKey), count);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|