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

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


   
    // 请求发布微博接口 并 接受返回值
    String jsonData = oqu.doPost(OpenQqConstants.WEIBO_ADD_PIC_T_URL, this.getInterfaceData(paramBean));
   
    // 返回javaBean的接口数据
    WeiBoAddPicTResultBean resultBean = this.jsonToResultBean(jsonData);
   
    // 日志
    log.info("上传一张图片,并发布一条消息到腾讯微博平台 结束....");
   
    return resultBean;
View Full Code Here


   * @return 转换后的数据
   * @throws JSONException
   */
  private WeiBoAddPicTResultBean jsonToResultBean(String jsonData) throws JSONException {
 
    WeiBoAddPicTResultBean resultBean = new WeiBoAddPicTResultBean();
   
    JSONObject jsonObj;
    try {
      jsonObj = new JSONObject(jsonData);
     
      // 添加微博失败的场合
      if (jsonObj.getInt("ret") != 0) {
        // 错误标识
        resultBean.setErrorFlg(true);
       
        // 错误编号
        resultBean.setErrorCode(jsonObj.get("ret").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("addPicT 异常,json数据是:" + jsonData);
View Full Code Here

   
    paramBean.setLatitude("121.640625");
   
    WeiBoAddPicT addPicT = new WeiBoAddPicT();
   
    WeiBoAddPicTResultBean resultBean = addPicT.addPicT(paramBean);
   
    System.out.println(resultBean.getAddWeiBoId());
   
    System.exit(0);
   
  }
View Full Code Here

   * @return 转换后的数据
   * @throws JSONException
   */
  private WeiBoAddPicTResultBean jsonToResultBean(String jsonData) throws JSONException {
 
    WeiBoAddPicTResultBean resultBean = new WeiBoAddPicTResultBean();
   
    JSONObject jsonObj = new JSONObject(jsonData);
   
    // 添加微博失败的场合
    if (jsonObj.getInt("ret") != 0) {
      // 错误标识
      resultBean.setErrorFlg(true);
     
      // 错误编号
      resultBean.setErrorCode(jsonObj.get("ret").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.WeiBoAddPicTResultBean

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.