feat: 用户累计充值可得免费播放全集权限
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package com.sqx.common.utils;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
|
||||
/**
|
||||
* Redis所有Keys
|
||||
*
|
||||
*/
|
||||
public class RedisKeys {
|
||||
|
||||
public static final String PAY_FREE_WATCH_KEY = "pay:free:watch:";
|
||||
|
||||
public static String getSysConfigKey(String key){
|
||||
return "sys:config:" + key;
|
||||
}
|
||||
@@ -13,4 +17,12 @@ public class RedisKeys {
|
||||
public static String getDateKey(String key){
|
||||
return "date:" + key;
|
||||
}
|
||||
|
||||
public static String getPayFreeWatchKey(Long userId) {
|
||||
return PAY_FREE_WATCH_KEY + DateUtil.today() + ":" + userId;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(DateUtil.today());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,20 @@ public class RedisUtils {
|
||||
if(expire != NOT_EXPIRE){
|
||||
redisTemplate.expire(key, expire, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean setIfAbsent(String key, Object value, long expire){
|
||||
Boolean absent = valueOperations.setIfAbsent(key, toJson(value));
|
||||
if (Boolean.FALSE.equals(absent)) {
|
||||
return false;
|
||||
}
|
||||
if(expire != NOT_EXPIRE){
|
||||
redisTemplate.expire(key, expire, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public void set(String key, Object value){
|
||||
|
||||
Reference in New Issue
Block a user