/**
* 请求区服列表
* @param request
* @param channel
* @return
* @throws Exception
*/
@RequestMapping(value = "/get_servlist", produces = {"application/json;charset=UTF-8"})
@ResponseBody
public String getServlist(HttpServletRequest request) throws Exception {
try {
log.info("---------------------------------------------------------------------");
Map<String, Object> params = Servlets.getParametersStartingWith(request, "");
log.info("易接 请求区服列表参数:"+ request.getRequestURI() + " :" + params.toString());
String sign = request.getParameter("sign");
String time = request.getParameter("time");
String back_login_type = request.getParameter("back_login_type");
String redirectUrl = "http://127.0.0.1:" + request.getLocalPort();// 端口号
String uid = request.getParameter("uid"); // 玩家唯一标志 //sdk返回的用户标识
String channelCode = request.getParameter("channelCode");
//签名验证生成sign
String verify_sign = CoreUtil.md5sign(PLATFORM, time, channelCode);
log.info("接收的sign:"+sign);
log.info("验证的sign:"+verify_sign);
// 内部签名验证
if (StringUtils.equals(sign, verify_sign)){
String ip = InetAddressUtil.getAddressFromRequest(request); // 得到访问的IP
String res = GMStartupListener.getServerList(userInfoService, uid, channelCode, redirectUrl, back_login_type, ip);
log.info("易接 "+ channelCode+ " --下发区服列表:" + res);
log.info("--------------------------------- 易接 "+ channelCode+ " 下发区服列表 -----------------------------------");
return res;
} else {
// //验证失败
log.info("内部签名验证失败");
log.info("----------------------------------- 内部签名验证失败! -------------------------------------");
return "{\"ret\":\"-1\",\"msg\":\"内部签名验证失败\"}";
}
} catch (Exception e) {
e.printStackTrace();
log.error("系统错误:", e);
log.info("-------------------------------- 系统错误! ----------------------------------------------");
return "{\"ret\":\"-1\",\"msg\":\"系统错误\"}";
}
}