generated from root/miduo_server
fix response
parent
7ceac5f191
commit
4a5eee2c64
|
@ -23,7 +23,6 @@ import java.io.UnsupportedEncodingException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -40,8 +39,8 @@ public class RechargeController {
|
||||||
public String callback( HttpServletRequest request) throws Exception {
|
public String callback( HttpServletRequest request) throws Exception {
|
||||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||||
if(parameterMap.isEmpty()) {
|
if(parameterMap.isEmpty()) {
|
||||||
ResultVo resultVo = new ResultVo(8, "data is null");
|
LOGGER.info( "data is null");
|
||||||
return JsonUtil.getInstence().getGson().toJson(resultVo);
|
return "data is null";
|
||||||
}
|
}
|
||||||
String source = parameterMap.keySet().iterator().next();
|
String source = parameterMap.keySet().iterator().next();
|
||||||
source = source.replaceAll(" ", "+");
|
source = source.replaceAll(" ", "+");
|
||||||
|
@ -50,8 +49,8 @@ public class RechargeController {
|
||||||
|
|
||||||
RechargeRequestBean.DataBean data = rechargeRequestBean.getData();
|
RechargeRequestBean.DataBean data = rechargeRequestBean.getData();
|
||||||
if(data == null){
|
if(data == null){
|
||||||
ResultVo resultVo = new ResultVo(8, "data is null");
|
LOGGER.info( "data is null");
|
||||||
return JsonUtil.getInstence().getGson().toJson(resultVo);
|
return "data is null";
|
||||||
}
|
}
|
||||||
String orderId =data.getOrder_id();
|
String orderId =data.getOrder_id();
|
||||||
String userId = data.getUid();
|
String userId = data.getUid();
|
||||||
|
@ -63,21 +62,19 @@ public class RechargeController {
|
||||||
|
|
||||||
if (!sig.equals(sign)){
|
if (!sig.equals(sign)){
|
||||||
LOGGER.info("callback==>roleUid={},sin derify fail,mine sign={} ",userId,sig);
|
LOGGER.info("callback==>roleUid={},sin derify fail,mine sign={} ",userId,sig);
|
||||||
ResultVo resultVo = new ResultVo(9, "sign fail");
|
return "sign fail";
|
||||||
return JsonUtil.getInstence().getGson().toJson(resultVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CUserInfo cUserInfo = cuserDao.findUserByOpenIdAndUidInfo(userId,serverID);
|
CUserInfo cUserInfo = cuserDao.findUserByOpenIdAndUidInfo(userId,serverID);
|
||||||
if(cUserInfo == null || !userId.equals(cUserInfo.getOpenId()) ){
|
if(cUserInfo == null || !userId.equals(cUserInfo.getOpenId()) ){
|
||||||
ResultVo resultVo = new ResultVo(10, "该用户无此角色");
|
LOGGER.info( "该用户无此角色");
|
||||||
return JsonUtil.getInstence().getGson().toJson(resultVo);
|
return "该用户无此角色";
|
||||||
}
|
}
|
||||||
|
|
||||||
CPayOrder cPayOrder = cuserDao.getCpayOrderByOrderId(orderId);
|
CPayOrder cPayOrder = cuserDao.getCpayOrderByOrderId(orderId);
|
||||||
ResultVo resultVo;
|
String response = "SUCCESS";
|
||||||
if (cPayOrder != null) {
|
if (cPayOrder != null) {
|
||||||
LOGGER.info("callback==>creditId={},uId={} orderId is exit!!!",cUserInfo.getId(),cUserInfo.getOpenId());
|
LOGGER.info("callback==>creditId={},uId={} orderId is exit!!!",cUserInfo.getId(),cUserInfo.getOpenId());
|
||||||
resultVo = new ResultVo(1, "SUCCESS");
|
|
||||||
} else {
|
} else {
|
||||||
DateFormat dateTimeformat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
DateFormat dateTimeformat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
String date = dateTimeformat.format(new Date());
|
String date = dateTimeformat.format(new Date());
|
||||||
|
@ -115,12 +112,11 @@ public class RechargeController {
|
||||||
if (result != null && result.getResultCode() == 1) {
|
if (result != null && result.getResultCode() == 1) {
|
||||||
LOGGER.info(" callback==>RPC result : ResultCode : " + result.getResultCode() + "; ResultMsg : " + result.getResultMsg());
|
LOGGER.info(" callback==>RPC result : ResultCode : " + result.getResultCode() + "; ResultMsg : " + result.getResultMsg());
|
||||||
cuserDao.addCpayOrder(cPayOrder);
|
cuserDao.addCpayOrder(cPayOrder);
|
||||||
resultVo = new ResultVo(1, "SUCCESS");
|
|
||||||
} else {
|
} else {
|
||||||
resultVo = new ResultVo(11, "fail!!!!");
|
response = "fail";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return JsonUtil.getInstence().getGson().toJson(resultVo);
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class JsonUtil {
|
||||||
|
|
||||||
}
|
}
|
||||||
map.put(key, paramValue);
|
map.put(key, paramValue);
|
||||||
LOGGER.info("parameter : {} " + key);
|
LOGGER.info("parameter : {} " , key);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,6 @@ public class MD5Util {
|
||||||
if (i < 16) buf.append("0");
|
if (i < 16) buf.append("0");
|
||||||
buf.append(Integer.toHexString(i));
|
buf.append(Integer.toHexString(i));
|
||||||
}
|
}
|
||||||
System.out.println("32result: " + buf.toString());// 32位的加密
|
|
||||||
System.out.println("16result: " + buf.toString().substring(8, 24));// 16位的加密
|
|
||||||
|
|
||||||
return buf.toString().toLowerCase();
|
return buf.toString().toLowerCase();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue