灵动sdk接入

master
zhangshanxue 2020-07-26 21:12:21 +08:00
parent ab746d58b6
commit a3eaa2d977
2 changed files with 14 additions and 2 deletions

View File

@ -47,7 +47,7 @@ public class MHTRechargeController {
@RequestMapping(value = "/MHTcallback") @RequestMapping(value = "/MHTcallback")
public String MHTcallback( HttpServletRequest request) throws Exception { public String MHTcallback( HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request); HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap2(request);
if(parameterMap.isEmpty()) { if(parameterMap.isEmpty()) {
LOGGER.info( "data is null"); LOGGER.info( "data is null");
return "FAIL"; return "FAIL";
@ -64,7 +64,7 @@ public class MHTRechargeController {
// } // }
String response = "SUCCESS"; String response = "SUCCESS";
try { try {
String consumerid = parameterMap.get("consumerid"); String consumerid = request.getParameterValues("consumerid")[0];
String consumerName =parameterMap.get("consumername"); String consumerName =parameterMap.get("consumername");
String gameCurrency ="0"; String gameCurrency ="0";
String mhtOrderAmt =parameterMap.get("mhtOrderAmt"); String mhtOrderAmt =parameterMap.get("mhtOrderAmt");

View File

@ -39,6 +39,18 @@ public class JsonUtil {
public Gson getGson() { public Gson getGson() {
return gson; return gson;
} }
public HashMap<String, String> getParameterMap2(HttpServletRequest request) throws IOException {
HashMap<String, String> map = new HashMap();
Enumeration paramNames = request.getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
String paramValue = paramValues[0];
map.put(paramName, paramValue);
LOGGER.info("parameter :"+paramName +"= {} " , paramValue);
}
return map;
}
public HashMap<String, String> getParameterMap(HttpServletRequest request) throws IOException { public HashMap<String, String> getParameterMap(HttpServletRequest request) throws IOException {
HashMap<String, String> map = new HashMap(); HashMap<String, String> map = new HashMap();