/** * 我的所有微博 * * @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); } } }
public SocialUserAccountInfo newAccountInfo(SocialUserAccount socialUserAccount) { SocialUserAccountInfo info = new SocialUserAccountInfo(); info.setType(DictDef.dict("tencent")); info.setValueType(DictDef.dictInt("string")); info.setAccountId(socialUserAccount.getId()); return info; }
public void updateSocialUserInfo(JSONObject userInfo, SocialUserAccount socialUserAccount) { SocialUserAccountInfo info = new SocialUserAccountInfo(); info.setType(DictDef.dict("tencent")); info.setValue(userInfo.getString("fansnum")); info.setKey(DictDef.dict("followersCount")); info.setValueType(DictDef.dictInt("int")); info.setAccountId(socialUserAccount.getId()); socialUserAccountInfoService.createSocialUserAccountInfo(info); }
/** * 设置用户帐号信息 * * @param socialUserAccount * @param key * @param value */ public void setEntityInfo(String entityId, String entityType, String key, String value) { SocialUserAccountInfo info = new SocialUserAccountInfo(); info.setKey(key); // info.setEntityId(entityId); info.setType(entityType); // 帐号类型 info.setValue(value); info.setValueString(value); info.setValueType(DictDef.dictInt("string")); createSocialUserAccountInfo(info); }
/** * 设置用户信息 * * @param socialUserAccount * @param key * @param value */ public void setSocialUserInfo(String userId, String key, String value) { SocialUserAccountInfo info = new SocialUserAccountInfo(); info.setKey(key); // info.setUserId(userId); info.setType(DictDef.dict("user_info_type")); // 用户类型 info.setValue(value); info.setValueString(value); info.setValueType(DictDef.dictInt("string")); createSocialUserAccountInfo(info); }
/** * 设置用户帐号信息 * * @param socialUserAccount * @param key * @param value */ public void setSocialUserAccountInfo( SocialUserAccount socialUserAccount, String key, String value) { SocialUserAccountInfo info = new SocialUserAccountInfo(); info.setKey(key); // info.setAccountId(socialUserAccount.getId()); info.setType(DictDef.dict("user_account_info_type")); // 帐号类型 info.setValue(value); info.setValueString(value); info.setValueType(DictDef.dictInt("string")); createSocialUserAccountInfo(info); }