示例#1
0
 /**
  * @Title: handleAuthResp @Description:TODO
  *
  * @param resp void
  */
 private int handleAuthResp(JSONObject resp) {
   try {
     int authCode = Integer.valueOf(ZXSSOJsonHelper.safeGet(resp, "auth-code"));
     if (authCode != 200) {
       return ZXSSOAuthStatus.getStatusFrmSrvCode(authCode);
     }
     String authResp = ZXSSOJsonHelper.safeGet(resp, "auth-resp");
     if (authResp == null) {
       return ZXSSOAuthStatus.CAN_NOT_CONNECT_SERVER;
     }
     JSONObject user = new JSONObject(authResp);
     String token = ZXSSOJsonHelper.safeGet(user, "token");
     ZXSSOAuthImpl.getInstance(null).saveUser(token, authResp);
   } catch (Exception e) {
     Log.e(TAG, "handleAuthResp fail e:" + e);
     return ZXSSOAuthStatus.CAN_NOT_CONNECT_SERVER;
   }
   return ZXSSOAuthStatus.SUCCESS;
 }
  public JSONObject toJson() throws JSONException {
    JSONObject json = new JSONObject();
    ZXSSOJsonHelper.safePut(json, JSONKEY_UID, ucuid);
    ZXSSOJsonHelper.safePut(json, JSONKEY_FROMAPPID, fromAppID);
    ZXSSOJsonHelper.safePut(json, JSONKEY_TOAPPID, toAppID);
    ZXSSOJsonHelper.safePut(json, JSONKEY_FROMCREDIT, fromCredit);
    ZXSSOJsonHelper.safePut(json, JSONKEY_TOCREDIT, toCredit);
    ZXSSOJsonHelper.safePut(json, JSONKEY_FROMAMOUNT, fromAmount);
    ZXSSOJsonHelper.safePut(json, JSONKEY_TOAMOUNT, toAmount);

    return json;
  }
示例#3
0
 /**
  * @Title: handleDmpResult @Description:TODO
  *
  * @param resp
  * @throws JSONException void
  */
 private int handleDmpResult(JSONObject dmp) {
   try {
     String retcode = ZXSSOJsonHelper.safeGet(dmp, "ret_code");
     if ("2001".equals(retcode)) {
       return ZXSSOAuthStatus.SUCCESS;
     } else if ("2002".equals(retcode)) {
       return ZXSSOAuthStatus.REG_USERINFO_EXIST;
     } else if ("2003".equals(retcode)) {
       return ZXSSOAuthStatus.VIP_REG_FAIL;
     }
   } catch (Exception e) {
     Log.e(TAG, "handleDmpResult fail e:" + e);
   }
   return ZXSSOAuthStatus.VIP_REG_FAIL;
 }