master
mashiyu 2018-02-28 16:04:04 +08:00
parent c5c64b3edb
commit 290547394e
2 changed files with 32 additions and 37 deletions

View File

@ -2,10 +2,13 @@ package com.jmfy;
import com.jmfy.Handler.BaseHandler;
import com.jmfy.Handler.ManagerManager;
import com.jmfy.controller.ManagerController;
import com.jmfy.redisProperties.RedisAutoConfiguration;
import com.jmfy.thrift.pool.ThriftPoolUtils;
import com.jmfy.util.KProducer;
import com.jmfy.util.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
@ -16,13 +19,16 @@ import java.util.Map;
@SpringBootApplication(exclude = {MongoAutoConfiguration.class,MongoDataAutoConfiguration.class})
public class Application {
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(Application.class, args);
//初使化连接池util类
ThriftPoolUtils.getInstance().initContext(configurableApplicationContext);
// ManagerManager handlerManager = ManagerManager.getInstance();
KProducer kProducer = configurableApplicationContext.getBean(KProducer.class);
// KProducer kProducer = configurableApplicationContext.getBean(KProducer.class);
KProducer.init();
//redis初始化
RedisAutoConfiguration redisAutoConfiguration = configurableApplicationContext.getBean(RedisAutoConfiguration.class);
@ -31,5 +37,6 @@ public class Application {
// for (BaseHandler handler : commandHanderMap.values()){
// handlerManager.addHandler(handler);
// }
LOGGER.info("======> delivery server start success ...");
}
}

View File

@ -32,15 +32,10 @@ public class ManagerController {
Enumeration paramNames = request.getParameterNames();
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
if (paramValues.length == 1) {
String paramValue = paramValues[0];
if (paramValue.length() != 0) {
System.out.println("参数:" + paramName + "=" + paramValue);
map.put(paramName, paramValue);
}
}
String paramValue = paramValues[0];
map.put(paramName, paramValue);
LOGGER.info("parameter" + paramName + "=" + paramValue);
}
// String app_metadata = new StringBuffer()
@ -68,34 +63,6 @@ public class ManagerController {
int online = Integer.parseInt(serverParam[5]);
String serverOrder = serverParam[6];
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");
@ -103,6 +70,26 @@ public class ManagerController {
String channel_id = map.get("channel_id");
String token = map.get("token");
String final_appkey;
if (online == 0 && plat == 1){
final_appkey = YsjConstant.Midas_Buy_Android_Appkey;
}else if (online == 0 && plat == 0){
final_appkey = YsjConstant.Midas_Buy_Ios_Appkey;
}else if (online == 1 && plat == 0){
final_appkey = YsjConstant.Midas_Buy_Ios_Appkey_Test;
}else {
final_appkey = YsjConstant.Midas_Buy_Android_Appkey_Test;
}
boolean checkSign = SnsSigCheck.verifySig("GET", "/delivery/manager", map, final_appkey+"&", sig);
if (!checkSign){
JsonResult jsonResult = new JsonResult();
jsonResult.setRet(5);
jsonResult.setMsg("sign error");
return jsonResult;
}
CUser cUser = cuserDao.findUserInfo(gameServer,userId);
String ip;
String port;
@ -137,6 +124,7 @@ public class ManagerController {
}
}
public static String getServiceKey(String serviceName, String host, String port) {
StringBuilder sb = new StringBuilder();
return sb.append(serviceName).append("|")