Пример #1
0
  /**
   * 게임 접속
   *
   * @param param
   */
  public String gameJoin() {

    m_ifLogger.info("gameJoin start.");

    jsonParam.viewParamInfo();

    GameParam param = (GameParam) jsonParam;
    // GameService gameService = GameService.getInstance();
    HashMap<String, Object> map = new HashMap<String, Object>();

    try {

      param.setNgcIfId(StringUtils.decryptTripleDes(param.getNgcIfId()));
      param.setProductId(StringUtils.decryptTripleDes(param.getProductId()));
      param.setMdn(StringUtils.decryptTripleDes(param.getMdn()));

      m_ifLogger.info(
          "gameJoin paramInfo. getNgcIfId : "
              + param.getNgcIfId()
              + " , getProductId : "
              + param.getProductId()
              + " , getMdn : "
              + param.getMdn());

      UserParam userParam = new UserParam();
      userParam.setMdn(param.getMdn());
      UserVO userVo = new UserVO();
      userVo = UserService.getInstance().findUser(userParam);

      if (userVo != null) {
        // gameService.gameJoin(param);

        map.put("ngcIfId", param.getNgcIfId());
        map.put("result", ReturnCode.REQ_SUCCESS);
        map.put("userId", userVo.getUserId());
        map.put("nickname", userVo.getNickName());
        jsonResult = JSONObject.fromObject(map);
      } else {
        jsonResult = super.getResultErrorJSON(param.getNgcIfId(), ReturnCode.USER_NOT_REGISTER);
      }

    } catch (Exception e) {
      m_ifLogger.error(e.getMessage(), e);

      jsonResult = super.getResultErrorJSON(param.getNgcIfId(), ReturnCode.SYSTEM_ERROR);
      super.setMessage(e.getMessage());
    }

    m_ifLogger.info("gameJoin end. jsonResult : " + jsonResult.toString(2));

    return SUCCESS;
  }
Пример #2
0
  /**
   * 게임종료
   *
   * @return
   */
  public String gameOut() {

    m_ifLogger.info("gameOut start.");

    jsonParam.viewParamInfo();

    GameParam param = (GameParam) jsonParam;
    // GameService gameService = GameService.getInstance();
    HashMap<String, Object> map = new HashMap<String, Object>();

    try {
      param.setNgcIfId(StringUtils.decryptTripleDes(param.getNgcIfId()));
      param.setProductId(StringUtils.decryptTripleDes(param.getProductId()));
      param.setMdn(StringUtils.decryptTripleDes(param.getMdn()));

      m_ifLogger.info(
          "gameOut paramInfo. getNgcIfId : "
              + param.getNgcIfId()
              + " , getProductId : "
              + param.getProductId()
              + " , getMdn : "
              + param.getMdn());

      // gameService.gameOut(param);

      map.put("ngcIfId", param.getNgcIfId());
      map.put("result", ReturnCode.REQ_SUCCESS);

      jsonResult = JSONObject.fromObject(map);

    } catch (Exception e) {
      m_ifLogger.error(e.getMessage(), e);

      jsonResult = super.getResultErrorJSON(param.getNgcIfId(), ReturnCode.SYSTEM_ERROR);
      super.setMessage(e.getMessage());
    }

    m_ifLogger.info("gameOut end. jsonResult : " + jsonResult.toString(2));

    return SUCCESS;
  }
Пример #3
0
  /**
   * gameMain.jsp 모두호출
   *
   * @param
   * @return List
   * @throws
   */
  public String gameMain() throws UserServiceException {

    m_traceLogger.info("gameMain() start......");

    // 인기게임 현재 페이지 번호
    String pGameCurPage = CommUtils.checkNull(getParameter("pGamePageNum"), "1");

    // 추천친구맺기에서 선택한 친구 ID
    String friendUserId = CommUtils.checkNull(getParameter("fid"));

    try {
      m_userVo = m_sessionManager.getUser(getRequest());

      DataMap dataMap = getDataMap();

      // 추천네트워크게임 param
      GameParam rGameParam = new GameParam();
      rGameParam.setLcdSize(DataMap.getLcdSizeValue(dataMap)); // LCD SIZE (176,240)
      rGameParam.setTouchSupport((String) dataMap.get(DataMap.MAP_TOUCH_SUPPORT)); // touch 지원여부
      rGameParam.setModel((String) dataMap.get(DataMap.MAP_DEVICE_MODEL)); // 단말 모델명

      // 인기게임 param
      GameParam pGameParam = new GameParam();
      pGameParam.setLcdSize(DataMap.getLcdSizeValue(dataMap)); // LCD SIZE (176,240)
      pGameParam.setTouchSupport((String) dataMap.get(DataMap.MAP_TOUCH_SUPPORT)); // touch 지원여부
      pGameParam.setModel((String) dataMap.get(DataMap.MAP_DEVICE_MODEL)); // 단말 모델명
      pGameParam.setStartPos(pGameCurPage);
      pGameParam.setReadCount(POPULARGAMELIST_READCOUNT); // 보여줄 인기게임목록 갯수

      // 단말기 lcd 사이즈 추출
      int lcdSize = getUserLCDSize(getRequest());

      if (DataMap.LCDSIZE_176 == lcdSize) { // 176size일 경우 추천 게임리스트 4개 노출
        rGameParam.setReadCount("4");
      } else if (DataMap.LCDSIZE_240 == lcdSize) { // 240size일 경우 추천 게임리스트 6개노출
        rGameParam.setReadCount("6");
      }

      // 인기게임리스트 count
      int totPopularGameCount = GameMainService.getInstance().getPopularGameListCount(pGameParam);

      // 인기게임리스트 이전, 다음페이지 구하기
      int popularGameReadCount = Integer.parseInt(POPULARGAMELIST_READCOUNT);
      int popularGameCurPage = Integer.parseInt(pGameCurPage);
      int popularGameTotalPageNum = totPopularGameCount / popularGameReadCount;
      if (totPopularGameCount % popularGameReadCount != 0) popularGameTotalPageNum++;

      // 전체 페이지가 현재 페이지보다 많다면 다음페이지 번호 입력
      if (popularGameTotalPageNum > popularGameCurPage) {
        m_nextPageNum = popularGameCurPage + 1;
      }

      // 현재 페이지가 1보다 크면 이전페이지 번호 입력
      if (popularGameCurPage > 1) {
        m_prevPageNum = popularGameCurPage - 1;
      }

      /* 인기게임리스트  */
      m_selectPopularGameList = GameMainService.getInstance().getPopularGameList(pGameParam);
      /* 추천게임리스트 */
      m_selectRecommandGameList = GameMainService.getInstance().getRecommandGameList(rGameParam);
      /* 이벤트 / 공지 */
      m_eventVO = EventService.getInstance().getSimpleEventNoticeList();
      /* 배너 이미지 */
      m_bannerImg = BannerService.getInstance().getSelectBannerImg();

      // 메인에 표시할 인기게임 제목 길이 제한
      if (m_selectPopularGameList != null) {
        for (int i = 0; i < m_selectPopularGameList.size(); i++) {
          Game gameTemp = (Game) m_selectPopularGameList.get(i);
          String popularGameTitle = CommUtils.checkNull(gameTemp.getTitle(), "");
          int cutStrLength = 0;
          if (dataMap != null) {
            Integer lcdSizeWrap = (Integer) dataMap.get(DataMap.MAP_LCDSIZE);
            if (lcdSizeWrap != null) {
              if (lcdSizeWrap.intValue() == DataMap.LCDSIZE_176) {
                cutStrLength = 6;
              } else if (lcdSizeWrap.intValue() == DataMap.LCDSIZE_240) {
                cutStrLength = 7;
              } else if (lcdSizeWrap.intValue() == DataMap.LCDSIZE_320) {
                cutStrLength = 7;
              }
              ((Game) m_selectPopularGameList.get(i))
                  .setTitle(StringUtils.cutStringLimitLength(popularGameTitle, cutStrLength));
            }
          }
        }
      }

      // 메인에 표시할 이벤트, 공지 제목 길이 제한
      if (m_eventVO != null) {
        String titleEventNotice = CommUtils.checkNull(m_eventVO.getTitle(), "");
        int cutStrLength = 0;
        if (dataMap != null) {
          Integer lcdSizeWrap = (Integer) dataMap.get(DataMap.MAP_LCDSIZE);
          if (lcdSizeWrap != null) {
            if (lcdSizeWrap.intValue() == DataMap.LCDSIZE_176) {
              cutStrLength = 8;
            } else if (lcdSizeWrap.intValue() == DataMap.LCDSIZE_240) {
              cutStrLength = 12;
            } else if (lcdSizeWrap.intValue() == DataMap.LCDSIZE_320) {
              cutStrLength = 12;
            }
            m_eventVO.setTitle(StringUtils.cutStringLimitLength(titleEventNotice, cutStrLength));
          }
        }
      } // end of if

      if (m_userVo != null) {
          /* 추천친구리스트 : 로그인 사용자 */
        Friend friendParam = new Friend();
        friendParam.setMyUserId(m_userVo.getUserId());
        friendParam.setFriendUserId(friendUserId);

        if (friendUserId.equals("")) {
          m_friendList = m_ngcIFController.getRecommandFriendList(m_userVo.getUserId());
        } else {
          // 추천친구리스트에 추가된 친구 추가
          m_friendList = m_ngcIFController.getGameMainFriend(friendParam);
        }

        // 알림이 가입여부 boolean
        if (m_userVo != null) {
          if (NGCConst.USER_NOTIFY_SETTING.equalsIgnoreCase(m_userVo.getNotify())) {
            m_isNotifyJoin = true;
          }
        }

      } else {
          /* 추천친구리스트 : 비로그인 사용자 */
        m_friendList = m_ngcIFController.getRecommandFriendList(null);
      }
    } catch (GameMainServiceException e) {
      m_traceLogger.error(e.getMessage());
      return ERROR;
    } catch (EventServiceException e) {
      m_traceLogger.error(e.getMessage());
      return ERROR;
    } catch (BannerServiceException e) {
      m_traceLogger.error(e.getMessage());
      return ERROR;
    } catch (FriendServiceException e) {
      m_traceLogger.error(e.getMessage());
      return ERROR;
    } catch (Exception e) {
      m_traceLogger.error(e.getMessage(), e);
      return ERROR;
    }

    m_traceLogger.info("gameMain() end......");

    return SUCCESS;
  }