Package com.qq.open.weibo.bean.result

Examples of com.qq.open.weibo.bean.result.WeiBoAddResultBean


   
    // 获取接口数据
    String jsonData = oqu.doPost(OpenQqConstants.WEIBO_ADD_T_URL, this.getAddWeiBoData(paramBean));
   
    // 接口返回数据
    WeiBoAddResultBean resultBean = this.jsonToResultBean(jsonData);
   
    // 日志
    log.info("发布一条微博消息 结束...");
   
    return resultBean;
View Full Code Here


   * @return 转换后的数据
   * @throws JSONException
   */
  private WeiBoAddResultBean jsonToResultBean(String jsonData) throws JSONException {
 
    WeiBoAddResultBean resultBean = new WeiBoAddResultBean();
   
    JSONObject jsonObj;
    try {
      jsonObj = new JSONObject(jsonData);
     
      // 添加微博失败的场合
      if (jsonObj.getInt("ret") != 0) {
        // 错误标识
        resultBean.setErrorFlg(true);
       
        // 错误编号
        resultBean.setErrorCode(jsonObj.get("errcode").toString());
       
        // 错误信息
        resultBean.setErrorMes(jsonObj.getString("msg"));
       
      } else {
        // 获取微博数据
        JSONObject jsonDataObj = new JSONObject(jsonObj.getJSONObject("data").toString());
       
        // 获取微博ID
        resultBean.setAddWeiBoId(jsonDataObj.get("id").toString());
       
        // 获取微博发布时间
        resultBean.setAddWeiBoDate(oqu.timeStampToDate(jsonDataObj.get("time").toString()));
      }
    } catch (JSONException e) {
      e.printStackTrace();
      // 日志
      log.error("addT 异常,json数据是:" + jsonData);
View Full Code Here

   
    paramBean.setLatitude("121.640625");
   
    WeiBoAddT addT = new WeiBoAddT();
   
    WeiBoAddResultBean resultBean = addT.addT(paramBean);
   
   
    System.out.println(resultBean.getAddWeiBoId());
    System.out.println(resultBean.getAddWeiBoDate());
  }
View Full Code Here

   * @return 转换后的数据
   * @throws JSONException
   */
  private WeiBoAddResultBean jsonToResultBean(String jsonData) throws JSONException {
 
    WeiBoAddResultBean resultBean = new WeiBoAddResultBean();
   
    JSONObject jsonObj = new JSONObject(jsonData);
   
    // 添加微博失败的场合
    if (jsonObj.getInt("ret") != 0) {
      // 错误标识
      resultBean.setErrorFlg(true);
     
      // 错误编号
      resultBean.setErrorCode(jsonObj.get("errcode").toString());
     
      // 错误信息
      resultBean.setErrorMes(jsonObj.getString("msg"));
     
    } else {
      // 获取微博数据
      JSONObject jsonDataObj = new JSONObject(jsonObj.getJSONObject("data").toString());
     
      // 获取微博ID
      resultBean.setAddWeiBoId(jsonDataObj.get("id").toString());
     
      // 获取微博发布时间
      resultBean.setAddWeiBoDate(oqu.timeStampToDate(jsonDataObj.get("time").toString()));
    }
   
    return resultBean;
  }
View Full Code Here

TOP

Related Classes of com.qq.open.weibo.bean.result.WeiBoAddResultBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.