Exemplo n.º 1
0
  /**
   * SDK-登录验证
   *
   * @author mp
   * @date 2015-7-1 上午10:04:25
   * @param accessToken
   * @return @Description
   */
  public static String verifyLoginState(String accessToken) {

    // 组织URL
    String url = ParamConfig.getSdkValue("baidu", "normalUrl");

    LogUtil.out(url);

    // 组织参数 格式为:name1=value1&name2=value2
    StringBuilder paramBuilder = new StringBuilder();
    paramBuilder.append("AppID=").append(ParamConfig.getSdkValue("baidu", "appId")).append("&");
    paramBuilder.append("AccessToken=").append(accessToken).append("&");
    paramBuilder
        .append("Sign=")
        .append(
            EncryptUtil.md5Hex(
                ParamConfig.getSdkValue("baidu", "appId")
                    + accessToken
                    + ParamConfig.getSdkValue("baidu", "appsecret")));

    LogUtil.out(paramBuilder.toString());

    String result = "";

    result = Sdk.sendPost(url, paramBuilder.toString());

    LogUtil.out(result);

    return result;
  }
Exemplo n.º 2
0
  public void run() {
    long currTime = System.currentTimeMillis();
    while (running) {
      try {
        currTime = System.currentTimeMillis();
        lastHeartbeat = currTime;
        if (heartbeat == null) {
          return;
        }
        heartbeat.run(currTime);
        if (currTime > logTime) {
          logTime = currTime + LOG_OFFSET;
          LogUtil.warn(getName());
        }

      } catch (Exception e) {
        LogUtil.error(getName() + "-事件线程抛出异常", e);
      }
      try {
        synchronized (this) {
          wait(SLEEP_TIME);
        }
      } catch (InterruptedException e) {
        LogUtil.error(getName() + "-sleep抛出异常", e);
      }
    }
    LogUtil.error(getName() + "线程退出");
    running = false;
  }
Exemplo n.º 3
0
 @Override
 public void run() {
   try {
     DALFactory.getInstRankDantaDAL().update(data, 0);
   } catch (Exception e) {
     LogUtil.error("更新当日丹塔排行数据异常", e);
   }
 }
Exemplo n.º 4
0
 public boolean isOvertime(long currTime) {
   boolean overtime = currTime - lastHeartbeat > OVERTIME;
   if (overtime) {
     LogUtil.error(
         (currTime - lastHeartbeat)
             + " , "
             + OVERTIME
             + " --ThreadOvertime "
             + this
             + ", "
             + getRunningName());
   }
   return overtime;
 }
Exemplo n.º 5
0
 /**
  * 物品出售
  *
  * @author mp
  * @date 2014-8-4 上午10:04:05
  * @param msgMap
  * @param channelId @Description
  */
 public void sell(HashMap<String, Object> msgMap, String channelId) {
   try {
     HandlerFactory.getThingHandler().sell(msgMap, channelId);
   } catch (Exception e) {
     LogUtil.error(
         "instPlayerId = "
             + PlayerMapUtil.getPlayerIdByChannelId(channelId)
             + ", "
             + DictMap.sysMsgRuleMap.get((int) msgMap.get("header") + "").getName()
             + ",  "
             + msgMap,
         e);
     e.printStackTrace();
     MessageUtil.sendFailMsg(channelId, msgMap, errorHint(msgMap));
   }
 }