mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
4.0.3
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.gitee.sop.servercommon.bean;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 获取开放平台请求参数。
|
||||
@@ -9,6 +10,19 @@ import java.util.Date;
|
||||
*/
|
||||
public interface OpenContext {
|
||||
|
||||
/**
|
||||
* 获取某个参数值
|
||||
* @param name 参数名称
|
||||
* @return 没有返回null
|
||||
*/
|
||||
String getParameter(String name);
|
||||
|
||||
/**
|
||||
* 返回所有的请求参数
|
||||
* @return 返回所有的请求参数
|
||||
*/
|
||||
Map<String, Object> getParameterMap();
|
||||
|
||||
/**
|
||||
* 返回appid
|
||||
*
|
||||
|
@@ -5,6 +5,7 @@ import org.apache.commons.lang3.time.DateUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.gitee.sop.servercommon.bean.ParamNames.API_NAME;
|
||||
import static com.gitee.sop.servercommon.bean.ParamNames.APP_AUTH_TOKEN_NAME;
|
||||
@@ -22,7 +23,7 @@ import static com.gitee.sop.servercommon.bean.ParamNames.VERSION_NAME;
|
||||
* @author tanghc
|
||||
*/
|
||||
public class OpenContextImpl implements OpenContext {
|
||||
private JSONObject requestParams;
|
||||
private final JSONObject requestParams;
|
||||
private Object bizObject;
|
||||
|
||||
public OpenContextImpl(JSONObject requestParams) {
|
||||
@@ -33,6 +34,16 @@ public class OpenContextImpl implements OpenContext {
|
||||
this.bizObject = bizObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String name) {
|
||||
return requestParams.getString(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getParameterMap() {
|
||||
return requestParams;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppId() {
|
||||
return requestParams.getString(APP_KEY_NAME);
|
||||
|
Reference in New Issue
Block a user