generated from root/miduo_server
fix
parent
32525c518b
commit
a46f5408c0
|
@ -12,13 +12,19 @@ import com.jmfy.util.MD5Util;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
@ -38,6 +44,7 @@ public class RechargeController {
|
|||
return JsonUtil.getInstence().getGson().toJson(resultVo);
|
||||
}
|
||||
String source = parameterMap.keySet().iterator().next();
|
||||
source = source.replaceAll(" ", "+");
|
||||
LOGGER.info(source);
|
||||
RechargeRequestBean rechargeRequestBean = gson.fromJson(source, RechargeRequestBean.class);
|
||||
|
||||
|
@ -149,12 +156,20 @@ public class RechargeController {
|
|||
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IllegalAccessException {
|
||||
public static void main(String[] args) throws IllegalAccessException, UnsupportedEncodingException {
|
||||
Gson gson = new Gson();
|
||||
String s = " {\"state\":1,\"data\":{\"order_id\":\"20190904175557100535799811006\",\"uid\":\"1403838368.sy37\",\"pchannel\":\"sy37\",\"appid\":\"129213\",\"serverID\":\"10081\",\"currency\":\"RMB\",\"ext\":\"MTQwMzgzODM2OC5zeTM3XzFfMV8yMDAwMDU5OV8xMDA4MV\\/mmIbku5HkuYvlt4U=\",\"productID\":\"1\",\"orderTime\":1567590971,\"pchannelOrderID\":\"05C43221160078D834EBA72CA1A6085A\",\"sign\":\"2bd918a44c1d2b10f4546a7f327844e6\"}}";
|
||||
RechargeRequestBean rechargeRequestBean = gson.fromJson(s, RechargeRequestBean.class);
|
||||
String s = "{\"state\":1,\"data\":{\"order_id\":\"+++20190912124458975449570483241\",\"uid\":\"1413971220.sy37\",\"pchannel\":\"sy37\",\"appid\":\"129213\",\"serverID\":\"10011\",\"currency\":\"RMB\",\"ext\":\"MTQxMzk3MTIyMC5zeTM3XzRfMTk4XzIwMDAwNTM0XzEwMDExX+aIkueBtQ==\",\"productID\":\"4\",\"orderTime\":1568263503,\"pchannelOrderID\":\"2B07319FAF8E71D60BD8FE365ED1AFF0_688209754\",\"sign\":\"9893e743c2907054056ba6f9b0dce54f\"}}";
|
||||
|
||||
String encode = URLEncoder.encode(s, StandardCharsets.US_ASCII.toString());
|
||||
byte[] bytes = encode.getBytes("utf-8");
|
||||
for(int i=0;i<bytes.length;i++){
|
||||
System.out.print(bytes[i]);
|
||||
}
|
||||
String decode = URLDecoder.decode(encode, "utf-8");
|
||||
System.out.println(decode);
|
||||
/* RechargeRequestBean rechargeRequestBean = gson.fromJson(s, RechargeRequestBean.class);
|
||||
String mySign = getMySign(rechargeRequestBean);
|
||||
System.out.println(mySign);
|
||||
System.out.println(mySign);*/
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue