Skip to content

Commit 9d32c32

Browse files
committed
Server:解决验证码过期仍然能用;优化config的关键词;解决缺省类型不支持JDK6;
1 parent f6cf71d commit 9d32c32

7 files changed

Lines changed: 30 additions & 13 deletions

File tree

APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/JSONRequest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public String getTag() {
8484

8585
public static final String KEY_COUNT = "count";
8686
public static final String KEY_PAGE = "page";
87+
public static final String KEY_TOTAL = "total";
8788

8889
public JSONRequest setCount(int count) {
8990
put(KEY_COUNT, count);
@@ -100,6 +101,15 @@ public JSONRequest setPage(int page) {
100101
public int getPage() {
101102
return getIntValue(KEY_PAGE);
102103
}
104+
// private int total;
105+
public JSONRequest setTotal(int total) {
106+
// this.total = total;
107+
put(KEY_TOTAL, total);
108+
return this;
109+
}
110+
public int getTotal() {
111+
return getIntValue(KEY_TOTAL);//total;//
112+
}
103113
//array object >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
104114

105115

APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/TypeValueKeyEntry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class TypeValueKeyEntry extends Entry<String, String> {
2525

2626
private static Map<String, Class<?>> classMap;
2727
static {
28-
classMap = new HashMap<>();
28+
classMap = new HashMap<String, Class<?>>();
2929
classMap.put(boolean.class.getSimpleName(), boolean.class);
3030
classMap.put(int.class.getSimpleName(), int.class);
3131
classMap.put(long.class.getSimpleName(), long.class);
@@ -110,7 +110,7 @@ public static Entry<Class<?>, Object> parseEntry(Map<String, Object> valueMap, S
110110
}
111111
int index = typeValue.contains(":") ? typeValue.indexOf(":") : -1;
112112

113-
Entry<Class<?>, Object> entry = new Entry<>();
113+
Entry<Class<?>, Object> entry = new Entry<Class<?>, Object>();
114114
entry.setKey(classMap.get(index < 0 ? Object.class.getSimpleName() : typeValue.substring(0, index)));
115115
entry.setValue(valueMap == null ? null : valueMap.get(typeValue.substring(index + 1, typeValue.length())));
116116

APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/Controller.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ public String register(@RequestBody String request) {
237237
Verify verify = response.getObject(Verify.class);
238238
//验证码过期
239239
if (verify != null && System.currentTimeMillis() - verify.getDate() > 60000) {
240-
new JSONResponse(new RequestParser(RequestMethod.DELETE).parseResponse(new JSONRequest(
241-
new Verify(phone))));
240+
new RequestParser(RequestMethod.DELETE).parseResponse(new JSONRequest(new Verify(phone))
241+
.setTag(Verify.class.getSimpleName()));
242242
verify = null;
243243
}
244244
//手机号或验证码错误

APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/QueryConfig.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@
3535
public class QueryConfig {
3636
private static final String TAG = "QueryConfig";
3737

38-
public static final List<String> keyList;
38+
public static final List<String> arrayKeyList;
3939
static {
40-
keyList = new ArrayList<String>();
41-
keyList.add(JSONRequest.KEY_COLUMNS);
40+
arrayKeyList = new ArrayList<String>();
41+
arrayKeyList.add(JSONRequest.KEY_COUNT);
42+
arrayKeyList.add(JSONRequest.KEY_PAGE);
43+
}
44+
public static final List<String> tableKeyList;
45+
static {
46+
tableKeyList = new ArrayList<String>();
47+
tableKeyList.add(JSONRequest.KEY_COLUMNS);
4248
}
4349

4450

APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/RequestParser.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public static JSONObject fillTarget(RequestMethod method
332332
Set<String> set = request.keySet();
333333
if ("!".equals(disallows)) {//所有非necessaryColumns,改成 !necessary 更好
334334
if (set != null) {
335-
List<String> disallowList = new ArrayList<>();
335+
List<String> disallowList = new ArrayList<String>();
336336
for (String key : set) {
337337
if (isContainKeyInArray(key, necessaryColumns) == false) {
338338
disallowList.add(key);
@@ -440,8 +440,8 @@ && isInRelationMap(path) == false) {
440440

441441
Set<String> set = request.keySet();
442442
JSONObject transferredRequest = new JSONObject(true);
443-
Map<String, String> functionMap = new LinkedHashMap<>();
444-
Map<String, Object> selfDefineKeyMap = new LinkedHashMap<>();
443+
Map<String, String> functionMap = new LinkedHashMap<String, String>();
444+
Map<String, Object> selfDefineKeyMap = new LinkedHashMap<String, Object>();
445445
if (set != null) {
446446
Object value;
447447
JSONObject result;
@@ -516,7 +516,7 @@ && isInRelationMap(path) == false) {
516516
}
517517
} else {//JSONArray或其它Object,直接填充
518518
transferredRequest.put(key, value);
519-
if (key.startsWith("@") && QueryConfig.keyList.contains(key) == false) {
519+
if (key.startsWith("@") && QueryConfig.tableKeyList.contains(key) == false) {
520520
selfDefineKeyMap.put(key, value);
521521
}//可@key@
522522
if (key.endsWith("()")) {

APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/sql/AccessVerifier.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ public class AccessVerifier {
5353

5454
private static Map<String, RequestMethod[]> accessMap;
5555
static {
56-
//兼容JDK 1.8以上,见getDeclaredAnnotation的@since
5756
accessMap = new HashMap<String, RequestMethod[]>();
57+
58+
//兼容JDK 1.8以上,见getDeclaredAnnotation的@since
5859
accessMap.put(User.class.getSimpleName(), User.class.getDeclaredAnnotation(APIJSONRequest.class).method());
5960
accessMap.put(Work.class.getSimpleName(), Work.class.getDeclaredAnnotation(APIJSONRequest.class).method());
6061
accessMap.put(Moment.class.getSimpleName(), Moment.class.getDeclaredAnnotation(APIJSONRequest.class).method());

APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/sql/QueryHelper3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public List<Column> getColumnList(QueryConfig config) throws SQLException {
175175
if (config == null) {
176176
return null;
177177
}
178-
List<Column> list = new ArrayList<>();
178+
List<Column> list = new ArrayList<Column>();
179179

180180
String columnsString = config.getColumns();
181181
if (StringUtil.isNotEmpty(columnsString, true)) {

0 commit comments

Comments
 (0)