mirror of
https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
synced 2025-10-30 01:46:18 +08:00
xml config support & multi-step command matcher
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package love.sola.netsupport.config;
|
||||
|
||||
import lombok.ToString;
|
||||
import love.sola.netsupport.sql.TableConfig;
|
||||
|
||||
/**
|
||||
* ***********************************************
|
||||
@@ -13,6 +14,10 @@ public class Settings {
|
||||
|
||||
public static Settings I;
|
||||
|
||||
static {
|
||||
I = TableConfig.getSettings();
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONFIGURATIONS
|
||||
// -------------------------------------------- //
|
||||
@@ -21,10 +26,10 @@ public class Settings {
|
||||
public String Wechat_Token;
|
||||
public String Wechat_AesKey;
|
||||
|
||||
public int Check_Spam_Cache_Expire_Time;
|
||||
public int Check_Spam_Interval;
|
||||
|
||||
//No arg constructor for Yaml.loadAs
|
||||
public Settings() {
|
||||
I = this;
|
||||
}
|
||||
public Settings() { I = this; }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package love.sola.netsupport.config;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.ToString;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
@XStreamAlias("wechat-config")
|
||||
@ToString
|
||||
public class WxMpXmlInMemoryConfigStorage extends WxMpInMemoryConfigStorage {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T fromXml(Class<T> clazz, InputStream is) {
|
||||
XStream xstream = XStreamInitializer.getInstance();
|
||||
xstream.alias("wechat-config", clazz);
|
||||
xstream.processAnnotations(clazz);
|
||||
return (T) xstream.fromXML(is);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user