This commit is contained in:
Sola
2016-05-13 11:11:13 +08:00
parent e834fdfb7b
commit b5ccd18a59
17 changed files with 129 additions and 120 deletions

View File

@@ -11,7 +11,7 @@ import java.io.PrintWriter;
/** /**
* @author Sola {@literal <dev@sola.love>} * @author Sola {@literal <dev@sola.love>}
*/ */
@WebServlet(name = "Index",urlPatterns = "/index",loadOnStartup = 1) @WebServlet(name = "Index", urlPatterns = "/index", loadOnStartup = 1)
public class Index extends HttpServlet { public class Index extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

View File

@@ -27,6 +27,7 @@ public class OAuth2 extends HttpServlet {
/** /**
* for {@link love.sola.netsupport.wechat.WxMpServlet#registerCommands} * for {@link love.sola.netsupport.wechat.WxMpServlet#registerCommands}
*
* @param state the state key from open platform callback. * @param state the state key from open platform callback.
* @param handler handler * @param handler handler
*/ */

View File

@@ -32,6 +32,8 @@ public class Settings {
public int User_Wechat_Cache_Expire_Time; public int User_Wechat_Cache_Expire_Time;
//No arg constructor for Yaml.loadAs //No arg constructor for Yaml.loadAs
public Settings() { I = this; } public Settings() {
I = this;
}
} }

View File

@@ -27,7 +27,7 @@ public class Access {
public static final Map<Integer, String> inverseMap = new HashMap<>(); public static final Map<Integer, String> inverseMap = new HashMap<>();
static{ static {
System.out.println("Loading Access..."); System.out.println("Loading Access...");
for (Field field : Access.class.getDeclaredFields()) { for (Field field : Access.class.getDeclaredFields()) {
if (field.getType().isAssignableFrom(Integer.TYPE)) { if (field.getType().isAssignableFrom(Integer.TYPE)) {

View File

@@ -37,7 +37,7 @@ public class Block {
public static final Map<Integer, String> inverseMap = new HashMap<>(); public static final Map<Integer, String> inverseMap = new HashMap<>();
static{ static {
System.out.println("Loading Blocks..."); System.out.println("Loading Blocks...");
for (Field field : Block.class.getDeclaredFields()) { for (Field field : Block.class.getDeclaredFields()) {
if (field.getType().isAssignableFrom(Integer.TYPE)) { if (field.getType().isAssignableFrom(Integer.TYPE)) {

View File

@@ -13,8 +13,7 @@ public enum ISP {
TELECOM(1, "^1[3|4|5|7|8][0-9]{9}$"), TELECOM(1, "^1[3|4|5|7|8][0-9]{9}$"),
UNICOM(2, "ZSZJLAN[0-9]{10}@16900\\.gd"), UNICOM(2, "ZSZJLAN[0-9]{10}@16900\\.gd"),
CHINAMOBILE(3, "^1[3|4|5|7|8][0-9]{9}@139\\.gd$"), CHINAMOBILE(3, "^1[3|4|5|7|8][0-9]{9}@139\\.gd$"),
OTHER(4, ".*"), OTHER(4, ".*"),;
;
private static final Map<String, ISP> NAME_MAP = new HashMap<>(); private static final Map<String, ISP> NAME_MAP = new HashMap<>();
private static final Map<Integer, ISP> ID_MAP = new HashMap<>(); private static final Map<Integer, ISP> ID_MAP = new HashMap<>();
@@ -52,6 +51,8 @@ public enum ISP {
} }
@Override @Override
public String toString() { return name; } public String toString() {
return name;
}
} }

View File

@@ -20,7 +20,7 @@ public class Status {
public static final Map<Integer, String> inverseMap = new HashMap<>(); public static final Map<Integer, String> inverseMap = new HashMap<>();
static{ static {
System.out.println("Loading Status..."); System.out.println("Loading Status...");
for (Field field : Status.class.getDeclaredFields()) { for (Field field : Status.class.getDeclaredFields()) {
if (field.getType().isAssignableFrom(Integer.TYPE)) { if (field.getType().isAssignableFrom(Integer.TYPE)) {

View File

@@ -7,7 +7,7 @@ import java.sql.*;
/** /**
* @author Sola {@literal <dev@sola.love>} * @author Sola {@literal <dev@sola.love>}
*/ */
public class TableConfig extends SQLCore{ public class TableConfig extends SQLCore {
public static final String KEY_SYS = "sys"; public static final String KEY_SYS = "sys";
@@ -18,7 +18,8 @@ public class TableConfig extends SQLCore{
if (rs.next()) { if (rs.next()) {
return gson.fromJson(rs.getString("data"), Settings.class); return gson.fromJson(rs.getString("data"), Settings.class);
} }
} catch (SQLException e) { } } catch (SQLException e) {
}
return null; return null;
} }

View File

@@ -32,7 +32,8 @@ public class Checker {
if (!phone.matches(PHONE_NUMBER_REGEX)) return -1; if (!phone.matches(PHONE_NUMBER_REGEX)) return -1;
try { try {
return Long.parseLong(phone); return Long.parseLong(phone);
} catch (NumberFormatException ignored) { } } catch (NumberFormatException ignored) {
}
return -1; return -1;
} }
@@ -40,7 +41,8 @@ public class Checker {
if (isp == null) return null; if (isp == null) return null;
try { try {
return ISP.fromId(Integer.parseInt(isp)); return ISP.fromId(Integer.parseInt(isp));
} catch (NumberFormatException ignored) { } } catch (NumberFormatException ignored) {
}
return null; return null;
} }
@@ -59,7 +61,8 @@ public class Checker {
return b; return b;
else else
return -1; return -1;
} catch (NumberFormatException ignored) { } } catch (NumberFormatException ignored) {
}
return -1; return -1;
} }
@@ -72,7 +75,8 @@ public class Checker {
return i; return i;
else else
return -1; return -1;
} catch (NumberFormatException ignored) { } } catch (NumberFormatException ignored) {
}
return -1; return -1;
} }

View File

@@ -19,9 +19,11 @@ public class ParseUtil {
.append(lang("Ticket_Info_Id")).append(t.getId()).append("\n") .append(lang("Ticket_Info_Id")).append(t.getId()).append("\n")
.append(lang("Ticket_Info_Desc")).append(t.getDescription()).append("\n") .append(lang("Ticket_Info_Desc")).append(t.getDescription()).append("\n")
.append(lang("Ticket_Info_Submit_Time")).append(dateFormat.format(t.getSubmitTime())).append("\n"); .append(lang("Ticket_Info_Submit_Time")).append(dateFormat.format(t.getSubmitTime())).append("\n");
if (t.getOperator() != null) sb.append(lang("Ticket_Info_Operator")).append(t.getOperator().getId()).append("\n"); if (t.getOperator() != null)
sb.append(lang("Ticket_Info_Operator")).append(t.getOperator().getId()).append("\n");
if (t.getRemark() != null) sb.append(lang("Ticket_Info_Remark")).append(t.getRemark()).append("\n"); if (t.getRemark() != null) sb.append(lang("Ticket_Info_Remark")).append(t.getRemark()).append("\n");
if (t.getUpdateTime() != null) sb.append(lang("Ticket_Info_Update_Time")).append(dateFormat.format(t.getUpdateTime())).append("\n"); if (t.getUpdateTime() != null)
sb.append(lang("Ticket_Info_Update_Time")).append(dateFormat.format(t.getUpdateTime())).append("\n");
sb.append(lang("Ticket_Info_Status")).append(Status.getLocalized(t.getStatus())); sb.append(lang("Ticket_Info_Status")).append(Status.getLocalized(t.getStatus()));
return sb.toString(); return sb.toString();
} }

View File

@@ -98,8 +98,7 @@ public class Redirect {
WARN("weui_icon_warn"), WARN("weui_icon_warn"),
WARN_SAFE("weui_icon_safe_warn"), WARN_SAFE("weui_icon_safe_warn"),
DOWNLOAD("weui_icon_download"), DOWNLOAD("weui_icon_download"),
CANCEL("weui_icon_cancel"), CANCEL("weui_icon_cancel"),;
;
private String value; private String value;

View File

@@ -21,8 +21,7 @@ public enum Command {
CANCEL(3, CancelHandler.class), CANCEL(3, CancelHandler.class),
PROFILE(4, ProfileHandler.class), PROFILE(4, ProfileHandler.class),
LOGIN(10, LoginHandler.class), LOGIN(10, LoginHandler.class),
OPERATOR_INFO(11, OperatorInfoHandler.class), OPERATOR_INFO(11, OperatorInfoHandler.class),;
;
private static final Map<Integer, Command> ID_MAP = new HashMap<>(); private static final Map<Integer, Command> ID_MAP = new HashMap<>();