generated from root/miduo_server
发货机
parent
9483f79048
commit
3fd282d2dd
|
@ -13,8 +13,9 @@ public class ManagerManager {
|
||||||
|
|
||||||
|
|
||||||
public static ManagerManager getInstance(){
|
public static ManagerManager getInstance(){
|
||||||
if (instance == null)
|
if (instance == null){
|
||||||
instance = new ManagerManager();
|
instance = new ManagerManager();
|
||||||
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ import com.jmfy.thrift.idl.RPCRequestIFace;
|
||||||
import com.jmfy.thrift.idl.Result;
|
import com.jmfy.thrift.idl.Result;
|
||||||
import com.jmfy.thrift.pool.ClientAdapterPo;
|
import com.jmfy.thrift.pool.ClientAdapterPo;
|
||||||
import com.jmfy.thrift.pool.ServiceKey;
|
import com.jmfy.thrift.pool.ServiceKey;
|
||||||
|
import com.jmfy.util.YsjConstant;
|
||||||
|
import com.jmfy.util.tencentutil.SnsSigCheck;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -13,7 +15,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class ManagerController {
|
public class ManagerController {
|
||||||
|
@ -23,7 +24,7 @@ public class ManagerController {
|
||||||
@RequestMapping(value = "/manager")
|
@RequestMapping(value = "/manager")
|
||||||
public JsonResult deliveryGoods(HttpServletRequest request){
|
public JsonResult deliveryGoods(HttpServletRequest request){
|
||||||
try {
|
try {
|
||||||
Map map = new HashMap();
|
HashMap<String, String> map = new HashMap();
|
||||||
Enumeration paramNames = request.getParameterNames();
|
Enumeration paramNames = request.getParameterNames();
|
||||||
while (paramNames.hasMoreElements()) {
|
while (paramNames.hasMoreElements()) {
|
||||||
String paramName = (String) paramNames.nextElement();
|
String paramName = (String) paramNames.nextElement();
|
||||||
|
@ -37,26 +38,80 @@ public class ManagerController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO RPC 发货
|
|
||||||
|
|
||||||
String openid = "test_openid";
|
// String app_metadata = new StringBuffer()
|
||||||
String payitem = "test_payitem";
|
// // ios 0/android 1
|
||||||
String billno = "test_billno";
|
// .append(cbiData.getPlatId()).append("*")
|
||||||
String amt = "test_amt";
|
// //wx:1;qq:2(和idip保持一致)
|
||||||
String appmeta = "test_appmeta";
|
// .append(cbiData.getMyLoginChannel()).append("*")
|
||||||
String channel_id = "test_channel_id";
|
// // 登录的游戏服务器大区id
|
||||||
|
// .append(cbiData.getGameSvrId()).append("*")
|
||||||
|
// // 登录的游戏服务器小区编号
|
||||||
|
// .append(this.coreServerAutoConfiguration.getConfig().getArea()).append("*")
|
||||||
|
// //用户id
|
||||||
|
// .append(cbiData.getUid()).append("*")
|
||||||
|
// //1:内网测试;0:正常线上
|
||||||
|
// .append(this.serverProperties.getIsLAN()).append("*")
|
||||||
|
// //游戏自生成orderid
|
||||||
|
// .append(orderId).toString();
|
||||||
|
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];
|
||||||
|
|
||||||
//TODO 根据大区id和小区id找到对应服的
|
String m_interface;
|
||||||
|
String final_appkey;
|
||||||
|
String final_appId;
|
||||||
|
if (online == 0 && plat == 1){
|
||||||
|
m_interface = YsjConstant.Midas_Buy_Goods;
|
||||||
|
final_appkey = YsjConstant.Midas_Buy_Android_Appkey;
|
||||||
|
final_appId = YsjConstant.Midas_Buy_Android_Appid;
|
||||||
|
}else if (online == 0 && plat == 0){
|
||||||
|
m_interface = YsjConstant.Midas_Buy_Goods;
|
||||||
|
final_appkey = YsjConstant.Midas_Buy_Ios_Appkey;
|
||||||
|
final_appId = YsjConstant.Midas_Buy_Ios_Appid;
|
||||||
|
}else if (online == 1 && plat == 0){
|
||||||
|
m_interface = YsjConstant.Test_Midas_Buy_Goods;
|
||||||
|
final_appkey = YsjConstant.Midas_Buy_Ios_Appkey_Test;
|
||||||
|
final_appId = YsjConstant.Midas_Buy_Ios_Appid;
|
||||||
|
}else {
|
||||||
|
m_interface = YsjConstant.Test_Midas_Buy_Goods;
|
||||||
|
final_appkey = YsjConstant.Midas_Buy_Android_Appkey_Test;
|
||||||
|
final_appId = YsjConstant.Midas_Buy_Android_Appid;
|
||||||
|
}
|
||||||
|
boolean checkSign = SnsSigCheck.verifySig("GET", m_interface, map, final_appkey, sig);
|
||||||
|
if (!checkSign){
|
||||||
|
JsonResult jsonResult = new JsonResult();
|
||||||
|
jsonResult.setRet(5);
|
||||||
|
jsonResult.setMsg("sign error");
|
||||||
|
return jsonResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
|
||||||
|
//TODO 根据大区id和小区id从redis找到对应服的 IP和 Port
|
||||||
String ip = "127.0.0.1";
|
String ip = "127.0.0.1";
|
||||||
String port = "7900";
|
String port = "7900";
|
||||||
|
|
||||||
|
|
||||||
|
//TODO RPC 发货
|
||||||
Result result = null;
|
Result result = null;
|
||||||
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
|
||||||
|
|
||||||
String serviceKey = getServiceKey(ServiceKey.RPCCore,ip,port);
|
String serviceKey = getServiceKey(ServiceKey.RPCCore,ip,port);
|
||||||
try {
|
try {
|
||||||
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
rPCClient = ClientAdapterPo.getClientAdapterPo(serviceKey);
|
||||||
result = rPCClient.getClient().deliveryGood(openid,payitem,billno,amt,appmeta,channel_id);
|
result = rPCClient.getClient().deliveryGood(openid,userId,payitem,billno,amt,channel_id,token,serverOrder);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -70,6 +125,8 @@ public class ManagerController {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
JsonResult jsonResult = new JsonResult();
|
JsonResult jsonResult = new JsonResult();
|
||||||
|
jsonResult.setRet(1);
|
||||||
|
jsonResult.setMsg("system error");
|
||||||
return jsonResult;
|
return jsonResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.jmfy.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Marvin on 2017/10/20.
|
||||||
|
*/
|
||||||
|
public class YsjConstant {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static String Midas_Buy_Goods = "/v3/r/mpay/buy_goods_m";
|
||||||
|
|
||||||
|
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 = "";
|
||||||
|
|
||||||
|
public static String Midas_Buy_Android_Appkey_Test = "LAhW7WH0jVRjGVkj1wL3fG1YJmCcO6TR";
|
||||||
|
|
||||||
|
public static String Midas_Buy_Ios_Appkey = "";
|
||||||
|
|
||||||
|
public static String Midas_Buy_Ios_Appkey_Test = "IJBg5GkaG3bfKhWJPfx8nzBTIwy04Uii";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static String protocol_http = "http";
|
||||||
|
|
||||||
|
public static String protocol_https = "https";
|
||||||
|
|
||||||
|
}
|
|
@ -8,5 +8,6 @@ struct Result {
|
||||||
|
|
||||||
service RPCRequestIFace{
|
service RPCRequestIFace{
|
||||||
|
|
||||||
Result deliveryGood(1:string openid, 2:string payitem, 3:string billno, 5:string amt, 6:string appmeta, 7:string channel_id) throws (1:common.InvalidOperException ouch);
|
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);
|
||||||
}
|
}
|
Loading…
Reference in New Issue