From f8b72890dcf7a53e798e1f56a3629f79959da24b Mon Sep 17 00:00:00 2001
From: TommyLemon <1184482681@qq.com>
Date: Wed, 1 Mar 2017 11:43:18 +0800
Subject: [PATCH] =?UTF-8?q?Server=EF=BC=9A=E4=BC=98=E5=8C=96=E6=B3=A8?=
=?UTF-8?q?=E9=87=8A=EF=BC=8C=E7=99=BB=E5=BD=95=E5=AF=86=E7=A0=81apijson12?=
=?UTF-8?q?3=E6=94=B9=E4=B8=BAapijson=EF=BC=9BClient=EF=BC=9A=E8=B0=83?=
=?UTF-8?q?=E6=95=B4=E8=8E=B7=E5=8F=96Wallet=E7=9A=84=E8=AF=B7=E6=B1=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../APIJSONDemoApp/res/layout/query_activity.xml | 2 +-
.../APIJSONDemoApp/src/apijson/demo/RequestUtil.java | 6 +++---
.../APIJSONDemoApp/src/apijson/demo/ui/QueryActivity.java | 7 +++++--
.../java/zuo/biao/apijson/server/sql/AccessVerifier.java | 5 ++++-
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/res/layout/query_activity.xml b/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/res/layout/query_activity.xml
index 46cad86a..7e70465b 100644
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/res/layout/query_activity.xml
+++ b/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/res/layout/query_activity.xml
@@ -43,7 +43,7 @@
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/src/apijson/demo/RequestUtil.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/src/apijson/demo/RequestUtil.java
index b6193f16..efd442d4 100644
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/src/apijson/demo/RequestUtil.java
+++ b/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/src/apijson/demo/RequestUtil.java
@@ -96,15 +96,15 @@ public class RequestUtil {
}
public static JSONObject newAccessErrorRequest(long id) {
- return new JSONRequest(new Wallet().setUserId(id <= 0 ? 38710 : id));
+ return new JSONRequest(new Wallet().setUserId(id <= 0 ? 38710 : id)).setTag(Wallet.class.getSimpleName());
}
public static JSONObject newAccessPermittedRequest(long id) {
JSONRequest request = new JSONRequest();
request.put(new Wallet().setUserId(id <= 0 ? 38710 : id));
request.put("currentUserId", 38710);
- request.put("payPassword", "123456");
- return request;
+ request.put("loginPassword", "apijson");
+ return request.setTag(Wallet.class.getSimpleName());
}
}
diff --git a/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/src/apijson/demo/ui/QueryActivity.java b/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/src/apijson/demo/ui/QueryActivity.java
index b5ba1db0..ebb16de1 100644
--- a/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/src/apijson/demo/ui/QueryActivity.java
+++ b/APIJSON(Android)/APIJSON(ADT)/APIJSONDemoApp/src/apijson/demo/ui/QueryActivity.java
@@ -88,8 +88,8 @@ public class QueryActivity extends Activity implements OnHttpResponseListener {
public static final int TYPE_RELY = 12;
public static final int TYPE_ARRAY = 13;
public static final int TYPE_COMPLEX = 14;
- public static final int TYPE_ACCESS_ERROR = 15;
- public static final int TYPE_ACCESS_PERMITTED = 16;
+ public static final int TYPE_ACCESS_ERROR = 5;
+ public static final int TYPE_ACCESS_PERMITTED = 6;
@@ -217,6 +217,9 @@ public class QueryActivity extends Activity implements OnHttpResponseListener {
return "put";
case TYPE_DELETE:
return "delete";
+ case TYPE_ACCESS_ERROR:
+ case TYPE_ACCESS_PERMITTED:
+ return "post_get";
default:
return "get";
}
diff --git a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/sql/AccessVerifier.java b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/sql/AccessVerifier.java
index b8af0f19..7dc39185 100644
--- a/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/sql/AccessVerifier.java
+++ b/APIJSON(Server)/APIJSON(Eclipse_JEE)/src/main/java/zuo/biao/apijson/server/sql/AccessVerifier.java
@@ -35,9 +35,12 @@ public class AccessVerifier {
private static Map accessMap;
+ /**初始化,建议在Applicaiton的onCreate方法中调用
+ */
public static void init() {
accessMap = new HashMap();
accessMap.put("User", RequestMethod.values());
+ accessMap.put("Work", RequestMethod.values());
accessMap.put("Moment", RequestMethod.values());
accessMap.put("Comment", RequestMethod.values());
accessMap.put("Wallet", new RequestMethod[]{POST_GET, POST, PUT, DELETE});
@@ -184,7 +187,7 @@ public class AccessVerifier {
*/
public static String getLoginPassword(long userId) {
// TODO 查询并返回对应userId的登录密码
- return "apijson123";//仅测试用
+ return "apijson";//仅测试用
}
/**获取支付密码