generated from root/miduo_server
增加ios支付处理
parent
fbd7f01062
commit
1556ae6316
|
@ -0,0 +1,151 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
import com.jmfy.dto.CUserDao;
|
||||
import com.jmfy.dto.JsonResult;
|
||||
import com.jmfy.model.CUser;
|
||||
import com.jmfy.thrift.idl.RPCRequestIFace;
|
||||
import com.jmfy.thrift.idl.Result;
|
||||
import com.jmfy.thrift.pool.ClientAdapterPo;
|
||||
import com.jmfy.thrift.pool.ServiceKey;
|
||||
import com.jmfy.util.YsjConstant;
|
||||
import com.jmfy.util.tencentutil.SnsSigCheck;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
|
||||
@RestController
|
||||
public class IAPManagerController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(IAPManagerController.class);
|
||||
@Resource
|
||||
private CUserDao cuserDao;
|
||||
@RequestMapping(value = "/iapmanager")
|
||||
public JsonResult deliveryGoods(HttpServletRequest request){
|
||||
try {
|
||||
LOGGER.info("======>iap start midas request...");
|
||||
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);
|
||||
}
|
||||
|
||||
String sig = map.get("sig");
|
||||
String final_appkey;
|
||||
// if (online == 0){
|
||||
// final_appkey = YsjConstant.Midas_Buy_Ios_Appkey;
|
||||
// }else {
|
||||
final_appkey = YsjConstant.Midas_Buy_Ios_Appkey_Test;
|
||||
// }
|
||||
|
||||
boolean checkSign = SnsSigCheck.verifySig("GET", "/delivery/iapmanager", map, final_appkey+"&", sig);
|
||||
if (!checkSign){
|
||||
LOGGER.info("sign error ...");
|
||||
}
|
||||
LOGGER.info("checkSign Success !!! ");
|
||||
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setRet(0);
|
||||
jsonResult.setMsg("ok");
|
||||
LOGGER.info("======>test ok iap end midas request...");
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setRet(1);
|
||||
jsonResult.setMsg("system error");
|
||||
LOGGER.info("======> end midas request...");
|
||||
return jsonResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String getServiceKey(String serviceName, String host, String port) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
return sb.append(serviceName).append("|")
|
||||
.append(host).append("|")
|
||||
.append(port).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -12,25 +12,14 @@ public class YsjConstant {
|
|||
public static String Test_Midas_Buy_Goods = "/mpay/buy_goods_m";
|
||||
|
||||
|
||||
public static String Midas_Android_Appid = "1450013210";
|
||||
|
||||
public static String Midas_Ios_Appid = "1450013217";
|
||||
|
||||
public static String Midas_Android_Appkey = "9jmOKYwCiQYPBU56Lf1hsMulaUiUrN0p";
|
||||
|
||||
public static String Midas_Android_Appkey_Test = "8WzVTnfJFDzsaGy5xwNIDKpDYarucl1I";
|
||||
|
||||
public static String Midas_Ios_Appkey = "r01xrc9VAhEVKBCLj9VYyrAV8sFxNDxi";
|
||||
|
||||
public static String Midas_Ios_Appkey_Test = "UiRETrkwHWq9YKBoK9A9ovQxmFTL2bjC";
|
||||
|
||||
|
||||
|
||||
public static String Midas_Buy_Android_Appid = "1450013496";
|
||||
|
||||
public static String Midas_Buy_Ios_Appid = "1450013495";
|
||||
|
||||
public static String Midas_Buy_Android_Appkey = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR";//TODO
|
||||
public static String Midas_Buy_Android_Appkey = "l3JABkBf3iOWXGlFomyr9v8zTGMIFc27";
|
||||
|
||||
// public static String Midas_Buy_Android_Appkey = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR";//TODO
|
||||
|
||||
public static String Midas_Buy_Android_Appkey_Test = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR";
|
||||
|
||||
|
|
Loading…
Reference in New Issue