示例#1
0
  // 내순위 조회
  public static void NgcGameMyRank() throws Exception {

    // 내 순위 조회
    String cmd = "NGC_GAME_MYRANK";
    String mdn = "01048109024";

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("ngcIfId", encryptTripleDes(cmd));
    map.put("mdn", encryptTripleDes(mdn)); // 내 순위 조회 요청시 mdn 번호도 넘겨줘야함!

    for (int i = 0; i < gameRankingUrl.length; i++) {
      System.out.println("=================================");

      String rankUrl = gameRankingUrl[i][1];
      String gameName = gameRankingUrl[i][2];

      String result = null;
      try {
        System.out.println("++++++++++++ gameName : " + gameName + " , url : " + rankUrl);
        result = JsonHttpClient.sendHttpPost(rankUrl, JSONObject.fromObject(map));

        try {
          JSONObject jo = JSONObject.fromObject(result);
          String ngcIfId = jo.getString("ngcIfId");
          String resultCode = jo.getString("result");
          String rank = jo.getString("rank");
          String ratio = jo.getString("ratio");

          System.out.println("++++++++++++ ngcIfId : " + ngcIfId);
          System.out.println("++++++++++++ result : " + resultCode);
          System.out.println("++++++++++++ rank : " + rank);
          System.out.println("++++++++++++ ratio : " + ratio);
          System.out.println(
              "++++++++++++ response success JSONObject : "
                  + jo.toString()
                  + " , url : "
                  + rankUrl
                  + ",gameName : "
                  + gameName);
        } catch (Exception e) {
          System.out.println("++++++++++++ JSONObject parseError. gameName : " + gameName);
        }

        System.out.println(
            "++++++++++++ response success Response result : "
                + result
                + " , url : "
                + rankUrl
                + ",gameName : "
                + gameName);
      } catch (Exception ex) {
        System.out.println(
            "++++++++++++ MyRankUrl error. url : " + rankUrl + " , gameName : " + gameName);
      }
    }
  }
示例#2
0
 public static String NGCConnect(String url, JSONObject jsonData) {
   String result = null;
   try {
     System.out.println("url : " + url);
     System.out.println("jsonData : " + jsonData);
     result = JsonHttpClient.sendHttpPost(url, jsonData);
     System.out.println("Response : " + result);
   } catch (Exception ex) {
     System.out.println(ex.toString());
   }
   return result;
 }
示例#3
0
  /**
   * 포트리스 게임을 위한 메서드 <br>
   * 포트리스는 게임자체에서 닉네임 등록이 가능함 <br>
   * 그래서 NGC와 닉네임 연동을 통해 중복 체크 처리. <br>
   *
   * @param gameServerUrl
   * @param mdn
   * @return
   */
  public static HashMap<String, String> checkNickName(String nickName) {
    HashMap<String, String> map = new HashMap<String, String>();
    try {
      map.put("ngcIfId", StringUtils.encryptTripleDes("NGC_USER_NICKNAME"));
      map.put("nickName", StringUtils.encryptTripleDes(nickName));

      String result =
          JsonHttpClient.sendHttpPost(
              "http://211.200.30.165:8088/ngc/ngc_nickname.jsp", JSONObject.fromObject(map));
      JSONObject jo = JSONObject.fromObject(result);
      System.out.println("checkNickName Data : " + result);

      map.put("result", jo.getString("result"));
      map.put("state", jo.getString("state"));
      map.put("ngcIfId", jo.getString("ngcIfId"));
    } catch (Exception e) {
      e.printStackTrace();
      map.put("result", "0");
    }
    System.out.println("" + map.toString());
    return map;
  }
示例#4
0
  // 게임 랭킹 리스트 조회
  public static void NgcGameRank() throws Exception {

    // 랭킹 정보 조회
    String cmd = "NGC_GAME_RANK";

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("ngcIfId", encryptTripleDes(cmd));

    for (int i = 0; i < gameRankingUrl.length; i++) {
      String rankUrl = gameRankingUrl[i][0];

      String result = null;
      System.out.println("=================================");

      try {
        System.out.println(
            "++++++++++++ gameName : " + gameRankingUrl[i][2] + " , url : " + gameRankingUrl[i][0]);
        result = JsonHttpClient.sendHttpPost(rankUrl, JSONObject.fromObject(map));

        JSONArray ja;
        try {
          ja = null;

          JSONObject jo = JSONObject.fromObject(result);
          String ngcIfId = jo.getString("ngcIfId");
          String resultCode = jo.getString("result");
          String totalCount = jo.getString("totalCount");

          ja = jo.getJSONArray("rankList");

          System.out.println("++++++++++++ ngcIfId : " + ngcIfId);
          System.out.println("++++++++++++ result : " + resultCode);
          System.out.println("++++++++++++ totalCount : " + totalCount);
          System.out.println(
              "++++++++++++ response success JSONArray : "
                  + ja.toString()
                  + " , url : "
                  + gameRankingUrl[i][0]
                  + ",gameName : "
                  + gameRankingUrl[i][2]);
        } catch (Exception e) {
          System.out.println(
              "++++++++++++ JSONArray parseError. gameName : " + gameRankingUrl[i][2]);
        }

        System.out.println(
            "++++++++++++ response success Response result : "
                + result
                + " , url : "
                + gameRankingUrl[i][0]
                + ",gameName : "
                + gameRankingUrl[i][2]);
      } catch (Exception ex) {
        System.out.println(
            "++++++++++++ rankUrl error. url : "
                + gameRankingUrl[i][0]
                + " , gameName : "
                + gameRankingUrl[i][2]);
      }
    }
  }