private function setFollowerNum($user_ids) { //仕様上一度に100が最大 if (count($user_ids) > 100) { $user_ids = array_slice($user_ids, 0, 100); } $option = array('user_id' => implode(",", $user_ids), 'include_entities' => false); $UsersLookup = new users_lookup($this->twObj); $api_res = $UsersLookup->setOption($option)->Request(); //エラーチェック $apiErrorObj = new Api_Error($api_res); if ($apiErrorObj->error) { //エラーのときは処理終了 throw new Exception($apiErrorObj->errorMes_Str); } unset($apiErrorObj); foreach ($api_res as $user) { //フォロワー数セット $sql = "UPDATE dt_follower_cont SET follower_count = ? WHERE account_id = ? AND user_id = ?"; $upcount = $this->DBobj->execute($sql, array($user->followers_count, $this->Account_ID, (string) $user->id)); } }
private function checkActiveUser($TagetUsers) { $ActveUser = array(); $NonacUser = array(); $option = array('user_id' => implode(",", $TagetUsers), 'include_entities' => false); $UsersLookup = new users_lookup($this->twObj); $api_res = $UsersLookup->setOption($option)->Request(); //エラーチェック $apiErrorObj = new Api_Error($api_res); if ($apiErrorObj->error) { //エラーのとき、チェックをあきらめる $resUsers = array(); foreach ($TagetUsers as $user) { $resUser = new stdClass(); $resUser->id = $user; $resUsers[] = $resUser; } $mes = $apiErrorObj->errorMes_Str . "\n"; error_log($mes, 3, _TWITTER_LOG_PATH . $this->logFile); return array($resUsers, array()); } unset($apiErrorObj); foreach ($api_res as $user) { if (floor((time() - strtotime($user->created_at)) / 86400) < $this->Last_Active_Daypast or isset($user->status->created_at) and floor((time() - strtotime($user->status->created_at)) / 86400) < $this->Last_Active_Daypast) { $ActveUser[] = $user; } else { $NonacUser[] = $user; } } return array($ActveUser, $NonacUser); }