Skip to content

Commit 20b220c

Browse files
committed
Server:同步eclipse版至idea版
1 parent 2476dc7 commit 20b220c

File tree

6 files changed

+20
-22
lines changed

6 files changed

+20
-22
lines changed

APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/APIJSONApplication.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public static void main(String[] args) throws Exception {
4141
}
4242
System.out.println("\n完成测试:远程函数 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
4343

44-
// Structure.init();
4544

4645
System.out.println("\n\n\n开始测试:请求校验 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
4746
try {

APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/Controller.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public String delete(@RequestBody String request, HttpSession session) {
158158
* @see {@link RequestMethod#GET}
159159
*/
160160
@RequestMapping("get/{request}")
161-
public String open_get(@PathVariable String request, HttpSession session) {
161+
public String openGet(@PathVariable String request, HttpSession session) {
162162
try {
163163
request = URLDecoder.decode(request, StringUtil.UTF_8);
164164
} catch (Exception e) {
@@ -175,7 +175,7 @@ public String open_get(@PathVariable String request, HttpSession session) {
175175
* @see {@link RequestMethod#HEAD}
176176
*/
177177
@RequestMapping("head/{request}")
178-
public String open_head(@PathVariable String request, HttpSession session) {
178+
public String openHead(@PathVariable String request, HttpSession session) {
179179
try {
180180
request = URLDecoder.decode(request, StringUtil.UTF_8);
181181
} catch (Exception e) {
@@ -676,7 +676,7 @@ public static JSONObject newIllegalArgumentResult(JSONObject requestObject, Stri
676676
@PostMapping("put/password")
677677
public JSONObject putPassword(@RequestBody String request){
678678
JSONObject requestObject = null;
679-
String old_password;
679+
String oldPassword;
680680
String verify;
681681

682682
int type = Verify.TYPE_PASSWORD;
@@ -687,7 +687,7 @@ public JSONObject putPassword(@RequestBody String request){
687687
String password;
688688
try {
689689
requestObject = Parser.parseRequest(request, PUT);
690-
old_password = StringUtil.getString(requestObject.getString(OLD_PASSWORD));
690+
oldPassword = StringUtil.getString(requestObject.getString(OLD_PASSWORD));
691691
verify = StringUtil.getString(requestObject.getString(VERIFY));
692692

693693
requestObject.remove(OLD_PASSWORD);
@@ -717,20 +717,20 @@ public JSONObject putPassword(@RequestBody String request){
717717
}
718718

719719

720-
if (StringUtil.isPassword(old_password)) {
720+
if (StringUtil.isPassword(oldPassword)) {
721721
if (userId <= 0) { //手机号+验证码不需要userId
722722
return Parser.extendErrorResult(requestObject, new IllegalArgumentException(ID + ":value 中value不合法!"));
723723
}
724-
if (old_password.equals(password)) {
724+
if (oldPassword.equals(password)) {
725725
return Parser.extendErrorResult(requestObject, new ConflictException("新旧密码不能一样!"));
726726
}
727727

728728
//验证旧密码
729729
Privacy privacy = new Privacy(userId);
730730
if (type == Verify.TYPE_PASSWORD) {
731-
privacy.setPassword(old_password);
731+
privacy.setPassword(oldPassword);
732732
} else {
733-
privacy.setPayPassword(old_password);
733+
privacy.setPayPassword(oldPassword);
734734
}
735735
JSONResponse response = new JSONResponse(
736736
new Parser(HEAD, true).parseResponse(

APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/FunctionList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.util.Map;
1919

2020
//TODO 新增 @FunctionList ,被它注解过的List可以传到 FuntionUtil.invoke(FunctionList list, ...)
21-
/**可远程调用的函数列表
21+
/**可远程调用的函数列表,暴露功能和使用方式,而不是具体的实现细节。
2222
* @author Lemon
2323
*/
2424
public interface FunctionList {

APIJSON-Java-Server/APIJSON-Idea/src/main/java/zuo/biao/apijson/server/ObjectParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public ObjectParser(@NotNull JSONObject request, String parentPath, int type, St
148148
COMPILE_MAP = new HashMap<String, Pattern>();
149149
COMPILE_MAP.put("phone", StringUtil.PATTERN_PHONE);
150150
COMPILE_MAP.put("email", StringUtil.PATTERN_EMAIL);
151-
COMPILE_MAP.put("id_number", StringUtil.PATTERN_ID_CARD);
151+
COMPILE_MAP.put("idCard", StringUtil.PATTERN_ID_CARD);
152152
}
153153

154154
protected Map<String, String> corrected;
@@ -398,7 +398,7 @@ protected boolean onParse(@NotNull String key, @NotNull Object value) throws Exc
398398
}
399399

400400

401-
//TODO 需要锁表来保证获取到的 [] 不会在写入前被修改
401+
//TODO 改用 MySQL json_add,json_remove,json_contains 等函数!
402402
/**PUT key:[]
403403
* @param key
404404
* @param array

APIJSON-Java-Server/APIJSON-Idea/src/main/java/zuo/biao/apijson/server/sql/SQLConfig.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@
7171
public class SQLConfig {
7272
private static final String TAG = "SQLConfig";
7373

74-
public static final String MYSQL_URI = "jdbc:mysql://localhost:3306";//TODO 改成你自己的
75-
public static final String MYSQL_SCHEMA = "sys";//TODO 改成你自己的
76-
public static final String MYSQL_ACCOUNT = "root";//TODO 改成你自己的
77-
public static final String MYSQL_PASSWORD = "apijson";//TODO 改成你自己的
7874

7975

8076
public static final String SCHEMA_INFORMATION = "`information_schema`";
@@ -203,7 +199,7 @@ public String getSchema() {
203199
}
204200
public static String getSchema(String schema) {
205201
if (StringUtil.isEmpty(schema, true)) {
206-
schema = MYSQL_SCHEMA; //非默认Schema必须要有
202+
schema = "sys"; //非默认Schema必须要有
207203
}
208204
return schema;
209205
}
@@ -1027,8 +1023,8 @@ private static String getConditionString(String column, String table, SQLConfig
10271023
// //order: id+ -> id >= idOfStartIndex; id- -> id <= idOfStartIndex >>>>>>>>>>>>>>>>>>
10281024
//
10291025
//
1030-
// //结果错误!SELECT * FROM linking_member.mes_member_user_test AS t0 INNER JOIN
1031-
// (SELECT id FROM linking_member.mes_member_user_test ORDER BY date ASC LIMIT 20, 10) AS t1 ON t0.id = t1.id
1026+
// //结果错误!SELECT * FROM Test AS t0 INNER JOIN
1027+
// (SELECT id FROM Test ORDER BY date ASC LIMIT 20, 10) AS t1 ON t0.id = t1.id
10321028
// //common case, inner join
10331029
// condition += config.getLimitString();
10341030
// return table + " AS t0 INNER JOIN (SELECT id FROM " + condition + ") AS t1 ON t0.id = t1.id";
@@ -1117,7 +1113,7 @@ public static SQLConfig newSQLConfig(RequestMethod method, String table, JSONObj
11171113

11181114
column = StringUtil.getString(column);
11191115
if (column.isEmpty() && RequestMethod.isHeadMethod(method, true) == false) {
1120-
column = "column_name,column_type,is_nullable,column_default,column_comment";
1116+
column = "column_name,column_type,column_default,column_comment";
11211117
}
11221118
}
11231119

APIJSON-Java-Server/APIJSON-Idea/src/main/java/zuo/biao/apijson/server/sql/SQLExecutor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
public class SQLExecutor {
3939
private static final String TAG = "SQLExecutor";
4040

41+
public static final String MYSQL_URI = "jdbc:mysql://localhost:3306";//TODO 改成你自己的
42+
public static final String MYSQL_ACCOUNT = "root";//TODO 改成你自己的
43+
public static final String MYSQL_PASSWORD = "apijson";//TODO 改成你自己的
4144

4245
//访问一次后丢失,可能因为static导致内存共享,别的地方改变了内部对象的值
4346
// private static final Map<String, Map<Integer, JSONObject>> staticCacheMap;
@@ -63,8 +66,8 @@ public class SQLExecutor {
6366
*/
6467
private synchronized Connection getConnection() throws Exception {
6568
Log.i(TAG, "成功加载MySQL驱动!");
66-
return DriverManager.getConnection(SQLConfig.MYSQL_URI + "?useUnicode=true&characterEncoding=UTF-8&user="
67-
+ SQLConfig.MYSQL_ACCOUNT + "&password=" + SQLConfig.MYSQL_PASSWORD);
69+
return DriverManager.getConnection(MYSQL_URI + "?useUnicode=true&characterEncoding=UTF-8&user="
70+
+ MYSQL_ACCOUNT + "&password=" + MYSQL_PASSWORD);
6871
}
6972

7073
/**保存缓存

0 commit comments

Comments
 (0)