コード例 #1
0
  public AccountInfo check(AccountInfo acc) {
    // TODO Auto-generated method stub
    if (!NetCheck.isConnected(context)) {
      acc.state = NET_FAIL;
      acc.tip = state2Tip(acc.state, "");
      log(acc.tip);
      return acc;
    }
    log(context.getString(R.string.logStart));
    initClient();
    D.e(">>>>check start , name : " + acc.name);
    log(context.getString(R.string.logName) + acc.name);
    log(context.getString(R.string.logLogining));
    acc = loginIn(acc);
    if (acc.state == SUCCESS) { // 登录成功,未签到
      log(context.getString(R.string.logLoginSuccess));
      // 签到
      log(context.getString(R.string.logChecking));
      acc = checkIn(acc);
      if (acc.state == SUCCESS) { // 签到成功
        acc.lastCheck = System.currentTimeMillis();
        log(context.getString(R.string.logCheckinSuccess));
        log(context.getString(R.string.logTime) + DateHelper.longToString(acc.lastCheck));
      } else { // 签到失败
        acc.tip = state2Tip(acc.state, "");
        // log(context.getString(R.string.logCheckinFail));
        log(acc.tip);
      }
    } else if (acc.state == IS_CHECKED) { // 登录成功,已签到
      log(context.getString(R.string.logLoginSuccess));
      log(context.getString(R.string.logCheckined));
      acc.lastCheck = System.currentTimeMillis();
      log(context.getString(R.string.logCheckinSuccess));
      log(context.getString(R.string.logTime) + DateHelper.longToString(acc.lastCheck));
    } else { // 未知错误
      acc.tip = state2Tip(acc.state, "");
      // log(context.getString(R.string.logCheckinFail));
      log(acc.tip);
    }

    shutdown();
    D.e(">>>>check end , state : " + acc.state + " , tip : " + acc.tip);
    log(context.getString(R.string.logEnd));
    return acc;
  }