generated from root/miduo_server
test
parent
290547394e
commit
fbd7f01062
|
@ -28,6 +28,7 @@ public class ManagerController {
|
|||
@RequestMapping(value = "/manager")
|
||||
public JsonResult deliveryGoods(HttpServletRequest request){
|
||||
try {
|
||||
LOGGER.info("======> start midas request...");
|
||||
HashMap<String, String> map = new HashMap();
|
||||
Enumeration paramNames = request.getParameterNames();
|
||||
while (paramNames.hasMoreElements()) {
|
||||
|
@ -35,7 +36,7 @@ public class ManagerController {
|
|||
String[] paramValues = request.getParameterValues(paramName);
|
||||
String paramValue = paramValues[0];
|
||||
map.put(paramName, paramValue);
|
||||
LOGGER.info("parameter:" + paramName + "=" + paramValue);
|
||||
LOGGER.info("parameter : " + paramName + "=" + paramValue);
|
||||
}
|
||||
|
||||
// String app_metadata = new StringBuffer()
|
||||
|
@ -81,16 +82,21 @@ public class ManagerController {
|
|||
final_appkey = YsjConstant.Midas_Buy_Android_Appkey_Test;
|
||||
}
|
||||
|
||||
LOGGER.info("final_appkey : "+ final_appkey);
|
||||
|
||||
boolean checkSign = SnsSigCheck.verifySig("GET", "/delivery/manager", map, final_appkey+"&", sig);
|
||||
if (!checkSign){
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setRet(5);
|
||||
jsonResult.setMsg("sign error");
|
||||
LOGGER.info("sign error ...");
|
||||
LOGGER.info("======> end midas request...");
|
||||
return jsonResult;
|
||||
}
|
||||
LOGGER.info("checkSign Success !!! ");
|
||||
|
||||
CUser cUser = cuserDao.findUserInfo(gameServer,userId);
|
||||
LOGGER.info("cUser : "+ cUser.toString());
|
||||
String ip;
|
||||
String port;
|
||||
//TODO RPC 发货
|
||||
|
@ -99,11 +105,17 @@ public class ManagerController {
|
|||
String[] split = cUser.getCoreAddress().split(":");
|
||||
ip = split[0];
|
||||
port = split[1];
|
||||
|
||||
LOGGER.info("RPC address --> IP : "+ ip + "; PORT : "+ port);
|
||||
|
||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
||||
String serviceKey = getServiceKey(ServiceKey.RPCCore,ip,port);
|
||||
LOGGER.info("serviceKey : "+ serviceKey);
|
||||
try {
|
||||
LOGGER.info("before RPC ... ");
|
||||
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
||||
result = rPCClient.getClient().deliveryGood(openid,userId,payitem,billno,amt,channel_id,token,serverOrder);
|
||||
LOGGER.info("after RPC ... ");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
@ -114,12 +126,15 @@ public class ManagerController {
|
|||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setRet(result.getResultCode());
|
||||
jsonResult.setMsg(result.getResultMsg());
|
||||
LOGGER.info("RPC result : ResultCode : "+ result.getResultCode()+"; ResultMsg : "+ result.getResultMsg());
|
||||
LOGGER.info("======> end midas request...");
|
||||
return jsonResult;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setRet(1);
|
||||
jsonResult.setMsg("system error");
|
||||
LOGGER.info("======> end midas request...");
|
||||
return jsonResult;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -613,4 +613,64 @@ public class CUser {
|
|||
public void setCoreAddress(String coreAddress) {
|
||||
this.coreAddress = coreAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CUser{" +
|
||||
"id=" + id +
|
||||
", userName='" + userName + '\'' +
|
||||
", sUserId=" + sUserId +
|
||||
", permission=" + permission +
|
||||
", level=" + level +
|
||||
", exp=" + exp +
|
||||
", vipLevel=" + vipLevel +
|
||||
", img='" + img + '\'' +
|
||||
", createTime=" + createTime +
|
||||
", lastLoginTime=" + lastLoginTime +
|
||||
", cumulativeOnlineTime=" + cumulativeOnlineTime +
|
||||
", dayOnlineTime=" + dayOnlineTime +
|
||||
", QQBatchTime=" + QQBatchTime +
|
||||
", curStamina=" + curStamina +
|
||||
", maxStamina=" + maxStamina +
|
||||
", gold=" + gold +
|
||||
", gem=" + gem +
|
||||
", sysGem=" + sysGem +
|
||||
", honorPoint=" + honorPoint +
|
||||
", friendHeart=" + friendHeart +
|
||||
", banTime=" + banTime +
|
||||
", banReason='" + banReason + '\'' +
|
||||
", vipFlushTime=" + vipFlushTime +
|
||||
", systemSetting='" + systemSetting + '\'' +
|
||||
", totalForces=" + totalForces +
|
||||
", awardLevelSet=" + awardLevelSet +
|
||||
", medal=" + medal +
|
||||
", areaId=" + areaId +
|
||||
", shield=" + shield +
|
||||
", shieldTime=" + shieldTime +
|
||||
", shieldCause='" + shieldCause + '\'' +
|
||||
", awardStaminaTime=" + awardStaminaTime +
|
||||
", vipAwardSet=" + vipAwardSet +
|
||||
", populationUpperLimit=" + populationUpperLimit +
|
||||
", isFirstFail=" + isFirstFail +
|
||||
", noviceGuideId='" + noviceGuideId + '\'' +
|
||||
", danmu='" + danmu + '\'' +
|
||||
", takeStaminaMap=" + takeStaminaMap +
|
||||
", captainId='" + captainId + '\'' +
|
||||
", skipNewer=" + skipNewer +
|
||||
", CumLoginTime=" + CumLoginTime +
|
||||
", online=" + online +
|
||||
", drawDailyTime=" + drawDailyTime +
|
||||
", drawDailyState=" + drawDailyState +
|
||||
", isPrivilege=" + isPrivilege +
|
||||
", privilegedLoginTime=" + privilegedLoginTime +
|
||||
", recall=" + recall +
|
||||
", cumulativeRecharge=" + cumulativeRecharge +
|
||||
", skinGold=" + skinGold +
|
||||
", head=" + head +
|
||||
", headFrame=" + headFrame +
|
||||
", clientVersion='" + clientVersion + '\'' +
|
||||
", recNoticeTime=" + recNoticeTime +
|
||||
", coreAddress='" + coreAddress + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ public class YsjConstant {
|
|||
|
||||
public static String Midas_Buy_Ios_Appid = "1450013495";
|
||||
|
||||
public static String Midas_Buy_Android_Appkey = "";
|
||||
public static String Midas_Buy_Android_Appkey = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR";//TODO
|
||||
|
||||
public static String Midas_Buy_Android_Appkey_Test = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR";
|
||||
|
||||
public static String Midas_Buy_Ios_Appkey = "";
|
||||
public static String Midas_Buy_Ios_Appkey = "IJBg5GkaG3bfKhWJPfx8nzBTIwy04Uii";//TODO
|
||||
|
||||
public static String Midas_Buy_Ios_Appkey_Test = "IJBg5GkaG3bfKhWJPfx8nzBTIwy04Uii";
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@ package com.jmfy.util.tencentutil;
|
|||
|
||||
// urlencode
|
||||
|
||||
import com.jmfy.controller.ManagerController;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
@ -128,6 +132,8 @@ public class SnsSigCheck
|
|||
return buffer.toString();
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SnsSigCheck.class);
|
||||
|
||||
public static boolean verifySig(String method, String url_path, HashMap<String, String> params, String secret, String sig) throws OpensnsException
|
||||
{
|
||||
// 确保不含sig
|
||||
|
@ -139,6 +145,9 @@ public class SnsSigCheck
|
|||
// 计算签名
|
||||
String sig_new = makeSig(method, url_path, params, secret);
|
||||
|
||||
LOGGER.info(" request sign : "+ sig);
|
||||
LOGGER.info(" sig_new :"+ sig_new);
|
||||
|
||||
// 对比和腾讯返回的签名
|
||||
return sig_new.equals(sig);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue