功能调试接口
parent
4da48e9d63
commit
9b68a313c1
|
@ -127,6 +127,20 @@ public class RedisUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定缓存失效时间
|
||||
* 测试方法,允许负数,直接过期
|
||||
* @param key 键
|
||||
* @param time 时间(毫秒)
|
||||
*/
|
||||
public void expireMillsDel(String key, long time) {
|
||||
try {
|
||||
redisTemplate.expire(key, time, TimeUnit.MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据key 获取过期时间
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.arena.LuofuLogic;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SystemTimeUpdateTest {
|
||||
public static void main(String[] args) throws InterruptedException, IOException {
|
||||
// 修改系统时间
|
||||
updateTime("2019-05-13 13:45:00");
|
||||
// redis 过期修改
|
||||
String key = LuofuLogic.getLuofuRobotKey(1);
|
||||
RedisUtil.getInstence().expireMills(key, LuofuLogic.calNextInitRankTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统时间
|
||||
* @param time 2024-05-13 13:45:00
|
||||
*/
|
||||
private static void updateTime(String time) throws IOException, InterruptedException {
|
||||
String[] strings = time.split(" ");
|
||||
// 设定要修改的时间
|
||||
String newDate = strings[0];
|
||||
String newTime = strings[1];
|
||||
|
||||
// 构建修改时间的命令
|
||||
String setDateCommand = "cmd /c date " + newDate;
|
||||
String setTimeCommand = "cmd /c time " + newTime;
|
||||
|
||||
// 执行命令
|
||||
Process setTimeProcess = Runtime.getRuntime().exec(setTimeCommand);
|
||||
Process setDateProcess = Runtime.getRuntime().exec(setDateCommand);
|
||||
|
||||
// 等待命令执行完成
|
||||
setTimeProcess.waitFor();
|
||||
setDateProcess.waitFor();
|
||||
|
||||
System.out.println("时间修改成功");
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
String format = MessageFormat.format("目标层数不存在,类型:{0},当前层数:{1},要挑战层数:{2},uid:{3}", 1111, 123123, 23123, 32523523);
|
||||
System.out.println(format);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue