示例#1
0
文件: UserUC.java 项目: s-Heart/Sdk
	@SuppressWarnings("unchecked")
	public MessageReturn checkSid(String sid, int gameIdp, int serverIdp, int channelIdp, int channelSubIdp, int mobiledeviceIdp,
			int statisticAnalysisIdp) {
		MessageReturn messageReturn = new MessageReturn();

		final int gameId = gameIdp;
		final int serverId = serverIdp;
		final int channelId = channelIdp;
		final int channelSubId = channelSubIdp;
		final int mobiledeviceId = mobiledeviceIdp;
		final int statisticAnalysisId = statisticAnalysisIdp;
		LogHelper.log("UserUc->checkSid gameId:" + String.valueOf(gameId));
		LogHelper.log("UserUc->checkSid serverId:" + String.valueOf(serverId));

		String checkSidUrl = "http://payunite.ulaoda.com/UCCheckSid.ashx?sid=" + sid + "&gameId=" + gameId;
		LogHelper.log("UserUc->checkSid url:" + checkSidUrl);
		Map<String, String> retMap = null;
		try {
			String retValue = Utility.getWebContent(checkSidUrl);
			if (!Utility.isEmpty(retValue)) {
				retMap = (Map<String, String>) JSONObject.parseObject(retValue, Map.class);
			} else {
				LogHelper.log("UserUc->checkSid retMap is empty:" + checkSidUrl);
			}
		} catch (IOException e) {
			e.printStackTrace();
			LogHelper.log("UserUc->checkSid exception:" + e.getMessage());
		}

		if (retMap != null) {
			int errNo = Utility.getInt(retMap.get("ErrNo"));
			if (errNo < 0) {
				messageReturn.setErr(errNo, retMap.get("ErrMsg"));
			} else {
				Map<String, String> tempMap = new HashMap<String, String>();
				String ucid = retMap.get("ucid");
				tempMap.put("UserId", retMap.get("ucid"));
				tempMap.put("UserName", retMap.get("nickName"));

				final String channelUserId = tempMap.get("UserId");

				// 模拟登录
				new Thread() {
					public void run() {
						LogHelper.log("UserUc->checkSid thread begin" + String.valueOf(serverId));
						UserUnite.getInstance().login(gameId, serverId, channelId, channelSubId, channelUserId, mobiledeviceId,
								statisticAnalysisId);
						LogHelper.log("UserUc->checkSid thread end" + String.valueOf(serverId));
					}
				}.start();

				// 针对于傲剑游戏提供的时间签名
				setTimeSignForAojian(messageReturn, gameId, tempMap, channelId, ucid);
			}
		}
		return messageReturn;
	}
示例#2
0
	/**
	 * 获取游戏接口参数列表
	 * 
	 * @param queryModel 
	 *        查询用户实体
	 * @param totalCount 
	 *        返回总数量
	 * @param isAll 
	 *        是否获取所有数据,false、否;true、是;
	 * @param pageIndex 
	 *        页码,从1开始(>=1)
	 * @param pageSize 
	 *        每页显示数量
	 * @param fldSort 
	 *        排序字段,默认""则按照主键编号排序
	 * @param sortType 
	 *        排序方法,0为升序,1为降序
	 * @return 游戏接口参数列表
     */
	public List<wh.game.model.GameInterfaceParams> getList(wh.game.model.GameInterfaceParams queryModel, RefObject<Integer> totalCount, 
		boolean isAll, int pageIndex, int pageSize, String fldSort, int sortType) throws Exception {
		List<wh.game.model.GameInterfaceParams> list = new ArrayList<wh.game.model.GameInterfaceParams>();
		if (Utility.isEmpty(fldSort)) {
			fldSort = "";
		}
		
		Map<String, Object> inParameters = new HashMap<String, Object>();
		inParameters.put("IsAll", isAll);
		inParameters.put("PageIndex", pageIndex);
		inParameters.put("PageSize", pageSize);
		inParameters.put("FldSort", fldSort);
		inParameters.put("SortType", sortType);
		
		inParameters.put("GameInterfaceParamsId", queryModel.getGameInterfaceParamsId());
		inParameters.put("GameInterfaceId", queryModel.getGameInterfaceId());
		inParameters.put("GameId", queryModel.getGameId());
		inParameters.put("ParamName", queryModel.getParamName());
		inParameters.put("ParamValue", queryModel.getParamValue());
		inParameters.put("ParamExplain", queryModel.getParamExplain());
		inParameters.put("SignType", queryModel.getSignType());
		inParameters.put("SignIndex", queryModel.getSignIndex());
		inParameters.put("ParamType", queryModel.getParamType());
		inParameters.put("ParamInType", queryModel.getParamInType());
		inParameters.put("ParamOutType", queryModel.getParamOutType());
		inParameters.put("SignFormatValue", queryModel.getSignFormatValue());
		
		Map<String, Integer> outParameters = new HashMap<String, Integer>();
		outParameters.put("ErrNo", java.sql.Types.INTEGER);
		outParameters.put("ErrMsg", java.sql.Types.NVARCHAR);
		outParameters.put("TotalCount", java.sql.Types.INTEGER);
		
        int parasCount = inParameters.size() + outParameters.size();
		StringBuilder sbBuilder = new StringBuilder();
		for (int i = 0; i < parasCount; i++) {
			if (0 == i) {
				sbBuilder.append("?");
			}
			else {
				sbBuilder.append(",?");
			}
		}
		
		ResultSet rs = null;
		CallableStatement cstmt = null;
		int errNo = 0;
		String errMsg = "";
		try {
			rs = SQLHelper.runProcedure(Config.CONNECTION_STRING_ULD, "{call WH_Game_GameInterfaceParams_GetList(" + sbBuilder.toString() + ")}",
					inParameters, outParameters);
			if (rs != null) {
				while (rs.next()) {
					list.add(getModel(rs));
				}
				
				cstmt = (CallableStatement)rs.getStatement();
				errNo = cstmt.getInt("ErrNo");
				errMsg = cstmt.getString("ErrMsg");
				totalCount.argvalue = cstmt.getInt("TotalCount");
			}
		} catch (Exception e) {
			throw new Exception(e.getMessage(), e);
		} finally {
			SQLHelper.closeAll(cstmt);
		}
		
		MyErr.checkErr(errNo, errMsg);
		return list;
	}