This commit is contained in:
2024-03-21 18:28:51 +08:00
parent 68e5dda2b8
commit 59585e6369
7 changed files with 93 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
package net.tccn.base;
import org.redkale.convert.json.JsonConvert;
import org.redkale.net.http.RestMapping;
import org.redkale.service.Service;
import org.redkale.source.CacheMemorySource;
@@ -21,9 +20,9 @@ public class BaseService implements Service {
@Resource(name = "SERVER_ROOT")
protected File webroot;
public Logger logger = Logger.getLogger(this.getClass().getSimpleName());
protected Logger logger = Logger.getLogger(this.getClass().getSimpleName());
public static boolean isWinos = System.getProperty("os.name").contains("Window");
protected static boolean isWinos = System.getProperty("os.name").contains("Window");
@Resource(name = "cache")
protected static CacheMemorySource cacheSource = new CacheMemorySource("cache");
@@ -31,13 +30,12 @@ public class BaseService implements Service {
@Resource(name = "APP_HOME")
protected File APP_HOME;
public static Properties prop = new Properties();
protected static Properties prop = new Properties();
protected static TplKit tplKit = TplKit.use(true);
private static boolean tplInit = false;
@RestMapping(ignore = true)
public <T> T getT(String key, Class<T> clazz, Supplier<T> supplier) {
protected <T> T getT(String key, Class<T> clazz, Supplier<T> supplier) {
Object obj = cacheSource.getAndRefresh(key, 1000 * 60 * 3, clazz);
if (obj != null) {
return (T) obj;
@@ -50,12 +48,11 @@ public class BaseService implements Service {
return t;
}
@RestMapping(ignore = true)
public String platId(String token) {
protected String platId(String token) {
return MetaKit.getPlatId(token);
}
public boolean isEmpty(Object obj) {
protected boolean isEmpty(Object obj) {
return Utils.isEmpty(obj);
}
}