mirror of
https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
synced 2025-10-30 01:46:18 +08:00
@@ -17,7 +17,6 @@
|
||||
|
||||
package love.sola.netsupport.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -42,15 +41,19 @@ public class Cortana {
|
||||
String[] replies;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Rule {
|
||||
String[] regexp;
|
||||
String[] replies;
|
||||
|
||||
public Rule() {
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class RawConfig {
|
||||
Map<String, Rule> rules;
|
||||
|
||||
public RawConfig() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,40 +17,48 @@
|
||||
|
||||
package love.sola.netsupport.config;
|
||||
|
||||
import lombok.ToString;
|
||||
import love.sola.netsupport.sql.TableConfig;
|
||||
|
||||
/**
|
||||
* @author Sola {@literal <dev@sola.love>}
|
||||
*/
|
||||
@ToString
|
||||
public class Settings {
|
||||
|
||||
public static final int MAX_DESC_LENGTH = 255;
|
||||
public static final int MAX_DESC_LENGTH = 255;
|
||||
|
||||
public static Settings I;
|
||||
public static Settings I;
|
||||
|
||||
static {
|
||||
I = TableConfig.getSettings();
|
||||
}
|
||||
static {
|
||||
I = TableConfig.getSettings();
|
||||
}
|
||||
|
||||
public String Wechat_AppId;
|
||||
public String Wechat_Secret;
|
||||
public String Wechat_Token;
|
||||
public String Wechat_AesKey;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONFIGURATIONS
|
||||
// -------------------------------------------- //
|
||||
public String Wechat_AppId;
|
||||
public String Wechat_Secret;
|
||||
public String Wechat_Token;
|
||||
public String Wechat_AesKey;
|
||||
public int Check_Spam_Cache_Expire_Time;
|
||||
public int Check_Spam_Interval;
|
||||
|
||||
public int Check_Spam_Cache_Expire_Time;
|
||||
public int Check_Spam_Interval;
|
||||
public int User_Session_Max_Inactive;
|
||||
public int User_Wechat_Cache_Expire_Time;
|
||||
|
||||
public int User_Session_Max_Inactive;
|
||||
public int User_Wechat_Cache_Expire_Time;
|
||||
|
||||
//No arg constructor for Yaml.loadAs
|
||||
public Settings() {
|
||||
I = this;
|
||||
}
|
||||
//No arg constructor for Yaml.loadAs
|
||||
public Settings() {
|
||||
I = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Settings{" +
|
||||
"Wechat_AppId='" + Wechat_AppId + '\'' +
|
||||
", Wechat_Secret='" + Wechat_Secret + '\'' +
|
||||
", Wechat_Token='" + Wechat_Token + '\'' +
|
||||
", Wechat_AesKey='" + Wechat_AesKey + '\'' +
|
||||
", Check_Spam_Cache_Expire_Time=" + Check_Spam_Cache_Expire_Time +
|
||||
", Check_Spam_Interval=" + Check_Spam_Interval +
|
||||
", User_Session_Max_Inactive=" + User_Session_Max_Inactive +
|
||||
", User_Wechat_Cache_Expire_Time=" + User_Wechat_Cache_Expire_Time +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ 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;
|
||||
|
||||
@@ -29,15 +28,14 @@ import java.io.InputStream;
|
||||
* @author chanjarster
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
@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