예제 #1
0
 /**
  * 我的所有微博
  *
  * @param ac
  * @param oAuth
  * @param pBroadcastTime
  */
 public void homeWeiboToDb(
     SocialUserAccount ac, OAuthV2 oAuth, TimelineParameter pBroadcastTime, boolean sign) {
   String response = "";
   try {
     response = new StatusesAPI(oAuth.getOauthVersion()).homeTimeline(pBroadcastTime);
   } catch (Exception e) {
     e.printStackTrace();
   }
   if (StringTool.judgeBlank(response)) {
     WeiboHandleResult r = weiboSaveDb(response, ac, DictDef.dictInt("weibo_public_timeline"));
     if (r.isSuccess() && r.getInfoSize() > 0) {
       pBroadcastTime.lastid = r.getLastid();
       pBroadcastTime.pagetime = r.getPagetime();
       if (!sign) { // 保存微博的最后时间
         sign = true;
         SocialUserAccountInfo info = new SocialUserAccountInfo();
         info.setKey("weibo_last_time"); // 微博最后更新时间
         Date d = new Date(Long.parseLong(r.getPagetime()) * 1000);
         info.setAccountId(ac.getId());
         info.setType(DictDef.dict("user_account_info_type")); // 帐号类型
         info.setValue(StringDateUtil.parseString(d, 4));
         info.setValueType(DictDef.dictInt("date"));
         info.setValueDate(d);
         socialUserAccountInfoService.createSocialUserAccountInfo(info);
       }
       homeWeiboToDb(ac, oAuth, pBroadcastTime, sign);
     }
   }
 }