将配置转换时间的时区设置由写死改成提到配置文件中
This commit is contained in:
@@ -7,6 +7,10 @@ import java.util.Map;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
public final class Constants {
|
||||
/**
|
||||
* 当前时区
|
||||
*/
|
||||
public static final int TIME_ZONE = ConfigUtils.getIntProperty("time_zone", 8);
|
||||
/**
|
||||
* 区域GK类型
|
||||
*/
|
||||
|
||||
@@ -255,7 +255,7 @@ public abstract class BaseService {
|
||||
public JsonElement serialize(Date src, Type type,
|
||||
JsonSerializationContext context) {
|
||||
String format = "yyyy-MM-dd'T'HH:mm:ss.SSS";
|
||||
long time= ((Date) src).getTime()-8*60*60*1000;
|
||||
long time= ((Date) src).getTime()-Constants.TIME_ZONE*60*60*1000;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
return new JsonPrimitive(sdf.format(time));
|
||||
}
|
||||
|
||||
@@ -279,3 +279,5 @@ ssl_ca_region=ssl_ca
|
||||
ssl_ip_region=ssl_ip
|
||||
#存在与表达式的关键字特殊分隔符
|
||||
keyword_expr=***and***
|
||||
#时区
|
||||
time_zone=8
|
||||
Reference in New Issue
Block a user