Skip to content

Commit 34d74f9

Browse files
committed
远程函数首个参数从 current 重命名为 curObj
1 parent 27b0462 commit 34d74f9

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/demo/DemoFunctionParser.java

+25-25
Original file line numberDiff line numberDiff line change
@@ -48,34 +48,34 @@ public DemoFunctionParser(RequestMethod method, String tag, int version, JSONObj
4848
super(method, tag, version, request, session);
4949
}
5050

51-
public Visitor<Long> getCurrentUser(@NotNull JSONObject current) {
51+
public Visitor<Long> getCurrentUser(@NotNull JSONObject curObj) {
5252
return DemoVerifier.getVisitor(getSession());
5353
}
5454

55-
public Long getCurrentUserId(@NotNull JSONObject current) {
55+
public Long getCurrentUserId(@NotNull JSONObject curObj) {
5656
return DemoVerifier.getVisitorId(getSession());
5757
}
5858

59-
public List<Long> getCurrentUserIdAsList(@NotNull JSONObject current) {
59+
public List<Long> getCurrentUserIdAsList(@NotNull JSONObject curObj) {
6060
List<Long> list = new ArrayList<>(1);
6161
list.add(DemoVerifier.getVisitorId(getSession()));
6262
return list;
6363
}
6464

65-
public List<Long> getCurrentContactIdList(@NotNull JSONObject current) {
66-
Visitor<Long> user = getCurrentUser(current);
65+
public List<Long> getCurrentContactIdList(@NotNull JSONObject curObj) {
66+
Visitor<Long> user = getCurrentUser(curObj);
6767
return user == null ? null : user.getContactIdList();
6868
}
6969

7070

7171
/**
72-
* @param current
72+
* @param curObj
7373
* @param idList
7474
* @return
7575
* @throws Exception
7676
*/
77-
public void verifyIdList(@NotNull JSONObject current, @NotNull String idList) throws Exception {
78-
Object obj = current.get(idList);
77+
public void verifyIdList(@NotNull JSONObject curObj, @NotNull String idList) throws Exception {
78+
Object obj = curObj.get(idList);
7979
if (obj == null) {
8080
return;
8181
}
@@ -98,13 +98,13 @@ public void verifyIdList(@NotNull JSONObject current, @NotNull String idList) th
9898

9999

100100
/**
101-
* @param current
101+
* @param curObj
102102
* @param urlList
103103
* @return
104104
* @throws Exception
105105
*/
106-
public void verifyURLList(@NotNull JSONObject current, @NotNull String urlList) throws Exception {
107-
Object obj = current.get(urlList);
106+
public void verifyURLList(@NotNull JSONObject curObj, @NotNull String urlList) throws Exception {
107+
Object obj = curObj.get(urlList);
108108
if (obj == null) {
109109
return;
110110
}
@@ -127,14 +127,14 @@ public void verifyURLList(@NotNull JSONObject current, @NotNull String urlList)
127127

128128

129129
/**
130-
* @param current
130+
* @param curObj
131131
* @param momentId
132132
* @return
133133
* @throws Exception
134134
*/
135-
public int deleteCommentOfMoment(@NotNull JSONObject current, @NotNull String momentId) throws Exception {
136-
long mid = current.getLongValue(momentId);
137-
if (mid <= 0 || current.getIntValue(JSONResponse.KEY_COUNT) <= 0) {
135+
public int deleteCommentOfMoment(@NotNull JSONObject curObj, @NotNull String momentId) throws Exception {
136+
long mid = curObj.getLongValue(momentId);
137+
if (mid <= 0 || curObj.getIntValue(JSONResponse.KEY_COUNT) <= 0) {
138138
return 0;
139139
}
140140

@@ -155,13 +155,13 @@ public int deleteCommentOfMoment(@NotNull JSONObject current, @NotNull String mo
155155

156156

157157
/**删除评论的子评论
158-
* @param current
158+
* @param curObj
159159
* @param toId
160160
* @return
161161
*/
162-
public int deleteChildComment(@NotNull JSONObject current, @NotNull String toId) throws Exception {
163-
long tid = current.getLongValue(toId);
164-
if (tid <= 0 || current.getIntValue(JSONResponse.KEY_COUNT) <= 0) {
162+
public int deleteChildComment(@NotNull JSONObject curObj, @NotNull String toId) throws Exception {
163+
long tid = curObj.getLongValue(toId);
164+
if (tid <= 0 || curObj.getIntValue(JSONResponse.KEY_COUNT) <= 0) {
165165
return 0;
166166
}
167167

@@ -223,23 +223,23 @@ private JSONArray getChildCommentIdList(long tid) {
223223

224224

225225
/**TODO 仅用来测试 "key-()":"getIdList()" 和 "key()":"getIdList()"
226-
* @param current
226+
* @param curObj
227227
* @return JSONArray 只能用JSONArray,用long[]会在SQLConfig解析崩溃
228228
* @throws Exception
229229
*/
230-
public JSONArray getIdList(@NotNull JSONObject current) {
230+
public JSONArray getIdList(@NotNull JSONObject curObj) {
231231
return new JSONArray(new ArrayList<Object>(Arrays.asList(12, 15, 301, 82001, 82002, 38710)));
232232
}
233233

234234

235235
/**TODO 仅用来测试 "key-()":"verifyAccess()"
236-
* @param current
236+
* @param curObj
237237
* @return
238238
* @throws Exception
239239
*/
240-
public Object verifyAccess(@NotNull JSONObject current) throws Exception {
241-
long userId = current.getLongValue(JSONRequest.KEY_USER_ID);
242-
String role = current.getString(JSONRequest.KEY_ROLE);
240+
public Object verifyAccess(@NotNull JSONObject curObj) throws Exception {
241+
long userId = curObj.getLongValue(JSONRequest.KEY_USER_ID);
242+
String role = curObj.getString(JSONRequest.KEY_ROLE);
243243
if (AbstractVerifier.OWNER.equals(role) && userId != (Long) DemoVerifier.getVisitorId(getSession())) {
244244
throw new IllegalAccessException("登录用户与角色OWNER不匹配!");
245245
}

0 commit comments

Comments
 (0)