generated from root/miduo_server
master
parent
c5c64b3edb
commit
290547394e
|
@ -2,10 +2,13 @@ package com.jmfy;
|
||||||
|
|
||||||
import com.jmfy.Handler.BaseHandler;
|
import com.jmfy.Handler.BaseHandler;
|
||||||
import com.jmfy.Handler.ManagerManager;
|
import com.jmfy.Handler.ManagerManager;
|
||||||
|
import com.jmfy.controller.ManagerController;
|
||||||
import com.jmfy.redisProperties.RedisAutoConfiguration;
|
import com.jmfy.redisProperties.RedisAutoConfiguration;
|
||||||
import com.jmfy.thrift.pool.ThriftPoolUtils;
|
import com.jmfy.thrift.pool.ThriftPoolUtils;
|
||||||
import com.jmfy.util.KProducer;
|
import com.jmfy.util.KProducer;
|
||||||
import com.jmfy.util.RedisUtil;
|
import com.jmfy.util.RedisUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
|
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
|
||||||
|
@ -16,13 +19,16 @@ import java.util.Map;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {MongoAutoConfiguration.class,MongoDataAutoConfiguration.class})
|
@SpringBootApplication(exclude = {MongoAutoConfiguration.class,MongoDataAutoConfiguration.class})
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(Application.class, args);
|
ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(Application.class, args);
|
||||||
|
|
||||||
//初使化连接池util类
|
//初使化连接池util类
|
||||||
ThriftPoolUtils.getInstance().initContext(configurableApplicationContext);
|
ThriftPoolUtils.getInstance().initContext(configurableApplicationContext);
|
||||||
// ManagerManager handlerManager = ManagerManager.getInstance();
|
// ManagerManager handlerManager = ManagerManager.getInstance();
|
||||||
KProducer kProducer = configurableApplicationContext.getBean(KProducer.class);
|
// KProducer kProducer = configurableApplicationContext.getBean(KProducer.class);
|
||||||
KProducer.init();
|
KProducer.init();
|
||||||
//redis初始化
|
//redis初始化
|
||||||
RedisAutoConfiguration redisAutoConfiguration = configurableApplicationContext.getBean(RedisAutoConfiguration.class);
|
RedisAutoConfiguration redisAutoConfiguration = configurableApplicationContext.getBean(RedisAutoConfiguration.class);
|
||||||
|
@ -31,5 +37,6 @@ public class Application {
|
||||||
// for (BaseHandler handler : commandHanderMap.values()){
|
// for (BaseHandler handler : commandHanderMap.values()){
|
||||||
// handlerManager.addHandler(handler);
|
// handlerManager.addHandler(handler);
|
||||||
// }
|
// }
|
||||||
|
LOGGER.info("======> delivery server start success ...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,15 +32,10 @@ public class ManagerController {
|
||||||
Enumeration paramNames = request.getParameterNames();
|
Enumeration paramNames = request.getParameterNames();
|
||||||
while (paramNames.hasMoreElements()) {
|
while (paramNames.hasMoreElements()) {
|
||||||
String paramName = (String) paramNames.nextElement();
|
String paramName = (String) paramNames.nextElement();
|
||||||
|
|
||||||
String[] paramValues = request.getParameterValues(paramName);
|
String[] paramValues = request.getParameterValues(paramName);
|
||||||
if (paramValues.length == 1) {
|
String paramValue = paramValues[0];
|
||||||
String paramValue = paramValues[0];
|
map.put(paramName, paramValue);
|
||||||
if (paramValue.length() != 0) {
|
LOGGER.info("parameter:" + paramName + "=" + paramValue);
|
||||||
System.out.println("参数:" + paramName + "=" + paramValue);
|
|
||||||
map.put(paramName, paramValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// String app_metadata = new StringBuffer()
|
// String app_metadata = new StringBuffer()
|
||||||
|
@ -68,34 +63,6 @@ public class ManagerController {
|
||||||
int online = Integer.parseInt(serverParam[5]);
|
int online = Integer.parseInt(serverParam[5]);
|
||||||
String serverOrder = serverParam[6];
|
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 openid = map.get("openid");
|
||||||
String payitem = map.get("payitem");
|
String payitem = map.get("payitem");
|
||||||
String billno = map.get("billno");
|
String billno = map.get("billno");
|
||||||
|
@ -103,6 +70,26 @@ public class ManagerController {
|
||||||
String channel_id = map.get("channel_id");
|
String channel_id = map.get("channel_id");
|
||||||
String token = map.get("token");
|
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);
|
CUser cUser = cuserDao.findUserInfo(gameServer,userId);
|
||||||
String ip;
|
String ip;
|
||||||
String port;
|
String port;
|
||||||
|
@ -137,6 +124,7 @@ public class ManagerController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getServiceKey(String serviceName, String host, String port) {
|
public static String getServiceKey(String serviceName, String host, String port) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
return sb.append(serviceName).append("|")
|
return sb.append(serviceName).append("|")
|
||||||
|
|
Loading…
Reference in New Issue