iap支付发货

master
mashiyu 2018-06-08 11:21:13 +08:00
parent 1556ae6316
commit 528a33aa9a
3 changed files with 64 additions and 81 deletions

View File

@ -40,96 +40,75 @@ public class IAPManagerController {
} }
String sig = map.get("sig"); String sig = map.get("sig");
String[] serverParam = map.get("channel_id").split("-");
int gameServer = Integer.parseInt(serverParam[serverParam.length-5]);
int userId = Integer.parseInt(serverParam[serverParam.length-4]);
int goodsId = Integer.parseInt(serverParam[serverParam.length-3]);
int sendBox = Integer.parseInt(serverParam[serverParam.length-2]);
String openid = map.get("openid");
String payitem = map.get("payitem");
String billno = map.get("billno");
String amt = map.get("amt");
String channel_id = map.get("channel_id");
String token = map.get("token");
String final_appkey; String final_appkey;
// if (online == 0){ if (sendBox == 0){
// final_appkey = YsjConstant.Midas_Buy_Ios_Appkey; final_appkey = YsjConstant.Midas_Buy_Ios_Appkey;
// }else { }else {
final_appkey = YsjConstant.Midas_Buy_Ios_Appkey_Test; final_appkey = YsjConstant.Midas_Buy_Ios_Appkey_Test;
// } }
LOGGER.info("final_appkey : "+ final_appkey);
boolean checkSign = SnsSigCheck.verifySig("GET", "/delivery/iapmanager", map, final_appkey+"&", sig); boolean checkSign = SnsSigCheck.verifySig("GET", "/delivery/iapmanager", map, final_appkey+"&", sig);
if (!checkSign){ if (!checkSign){
JsonResult jsonResult = new JsonResult();
jsonResult.setRet(5);
jsonResult.setMsg("sign error");
LOGGER.info("sign error ..."); LOGGER.info("sign error ...");
LOGGER.info("======> end midas request...");
return jsonResult;
} }
LOGGER.info("checkSign Success !!! "); LOGGER.info("checkSign Success !!! ");
CUser cUser = cuserDao.findUserInfo(gameServer,userId);
LOGGER.info("cUser : "+ cUser.toString());
String ip;
String port;
//TODO RPC 发货
Result result = null;
if (cUser != null){
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().iapDeliveryGood(openid,userId,payitem,billno,amt,channel_id,token);
result = rPCClient.getClient().testdeliveryGood(userId,"1002#200#2");
LOGGER.info("after RPC ... ");
} catch (Exception e) {
e.printStackTrace();
} finally {
rPCClient.returnObject(serviceKey);
}
}
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();
jsonResult.setRet(0); jsonResult.setRet(result.getResultCode());
jsonResult.setMsg("ok"); jsonResult.setMsg(result.getResultMsg());
LOGGER.info("======>test ok iap end midas request..."); LOGGER.info("RPC result : ResultCode : "+ result.getResultCode()+"; ResultMsg : "+ result.getResultMsg());
LOGGER.info("======> end midas request...");
return jsonResult; return jsonResult;
// String sig = map.get("sig");
// String[] serverParam = map.get("appmeta").split("\\*");
// int plat = Integer.parseInt(serverParam[0]);
// int channel = Integer.parseInt(serverParam[1]);
// int gameServer = Integer.parseInt(serverParam[2]);
// int area = Integer.parseInt(serverParam[3]);
// int userId = Integer.parseInt(serverParam[4]);
// int online = Integer.parseInt(serverParam[5]);
// String serverOrder = serverParam[6];
// String openid = map.get("openid");
// String payitem = map.get("payitem");
// String billno = map.get("billno");
// String amt = map.get("amt");
// String channel_id = map.get("channel_id");
// String token = map.get("token");
//
// String final_appkey;
// if (online == 0){
// final_appkey = YsjConstant.Midas_Buy_Ios_Appkey;
// }else {
// final_appkey = YsjConstant.Midas_Buy_Ios_Appkey_Test;
// }
//
// LOGGER.info("final_appkey : "+ final_appkey);
//
// boolean checkSign = SnsSigCheck.verifySig("GET", "/delivery/iapmanager", 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 发货
// Result result = null;
// if (cUser != null){
// 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 {
// rPCClient.returnObject(serviceKey);
// }
// }
//
// 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();

View File

@ -17,9 +17,9 @@ public class YsjConstant {
public static String Midas_Buy_Ios_Appid = "1450013495"; public static String Midas_Buy_Ios_Appid = "1450013495";
public static String Midas_Buy_Android_Appkey = "l3JABkBf3iOWXGlFomyr9v8zTGMIFc27"; // public static String Midas_Buy_Android_Appkey = "l3JABkBf3iOWXGlFomyr9v8zTGMIFc27";
// public static String Midas_Buy_Android_Appkey = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR";//TODO public static String Midas_Buy_Android_Appkey = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR";//TODO
public static String Midas_Buy_Android_Appkey_Test = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR"; public static String Midas_Buy_Android_Appkey_Test = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR";

View File

@ -10,5 +10,9 @@ service RPCRequestIFace{
Result deliveryGood(1:string openid, 2:i32 userId, 3:string payitem, 4:string billno, 5:string amt, Result deliveryGood(1:string openid, 2:i32 userId, 3:string payitem, 4:string billno, 5:string amt,
6:string channel_id, 7:string token, 8:string serverOrder) throws (1:common.InvalidOperException ouch); 6:string channel_id, 7:string token, 8:string serverOrder) throws (1:common.InvalidOperException ouch);
Result iapDeliveryGood(1:string openid, 2:i32 userId, 3:string payitem, 4:string billno, 5:string amt,
6:string channel_id, 7:string token) throws (1:common.InvalidOperException ouch);
Result testdeliveryGood(1:i32 userId, 2:string payitem) throws (1:common.InvalidOperException ouch); Result testdeliveryGood(1:i32 userId, 2:string payitem) throws (1:common.InvalidOperException ouch);
} }