コード例 #1
0
 public function Exec()
 {
     foreach ($this->Accounts as $Account) {
         $mes = date("Y-m-d H:i:s") . " Account: " . $Account->account_name . " 処理開始\n";
         error_log($mes, 3, _TWITTER_LOG_PATH . 'log_' . date("Y_m_d") . ".log");
         //ロジックにアカウントセット
         $this->LogicObj->setAccountId($Account->id);
         try {
             //フォロー状況反映
             $this->LogicObj->getMyFollwerList();
             //リムーブ処理
             $this->LogicObj->FollowingRemove();
             //フォロー処理
             $this->LogicObj->GoFollowing();
         } catch (Exception $e) {
             //ログ出力
             error_log($e->getMessage(), 3, _TWITTER_LOG_PATH . $this->logFile);
             //メッセージテーブルに書き出し
             $MTobj = new DT_Message();
             $MTobj->addMessage($e->getMessage(), $Account->id, 'error', $e->getFile() . ':' . $e->getLine());
         }
         $mes = date("Y-m-d H:i:s") . " Account: " . $Account->account_name . " 処理終了\n";
         error_log($mes, 3, _TWITTER_LOG_PATH . 'log_' . date("Y_m_d") . ".log");
     }
 }
コード例 #2
0
 public function Exec()
 {
     foreach ($this->Accounts as $Account) {
         $mes = date("Y-m-d H:i:s") . " Account: " . $Account->account_name . " 特殊リムーブ処理開始\n";
         error_log($mes, 3, _TWITTER_LOG_PATH . 'log_' . date("Y_m_d") . ".log");
         //ロジックにアカウントセット
         $this->LogicObj->setAccountId($Account->id);
         try {
             //対象を取得しDBへセット
             $this->LogicObj->getTargetUserAndSetDB();
             //リムーブ処理
             $this->LogicObj->execRemove();
         } catch (Exception $e) {
             //ログ出力
             error_log($e->getMessage(), 3, _TWITTER_LOG_PATH . $this->logFile);
             //メッセージテーブルに書き出し
             $MTobj = new DT_Message();
             $MTobj->addMessage($e->getMessage(), $Account->id, 'error', $e->getFile() . ':' . $e->getLine());
         }
         $mes = date("Y-m-d H:i:s") . " Account: " . $Account->account_name . " 特殊リムーブ処理終了\n";
         error_log($mes, 3, _TWITTER_LOG_PATH . 'log_' . date("Y_m_d") . ".log");
     }
     //クリックカウント用固体識別情報テーブル 古いデータ削除処理
     $this->LogicObj->deleteClickcountHosts();
 }
コード例 #3
0
 public function Exec()
 {
     //リツイート予約取得
     if (!$this->getReserve()) {
         $mes = 'リツイート予約なし' . "\n";
         error_log($mes, 3, _TWITTER_LOG_PATH . $this->logFile);
         return;
     }
     foreach ($this->Reserve_Info as $reserve) {
         $mes = 'リツイート予約 ReserveID: ' . $reserve->id . ' RtwAccountID: ' . $reserve->rtw_account_id . "\n";
         error_log($mes, 3, _TWITTER_LOG_PATH . $this->logFile);
         try {
             //リツイート実行
             $this->RetweetReserve($reserve);
         } catch (Exception $e) {
             //ログ出力
             error_log($e->getMessage(), 3, _TWITTER_LOG_PATH . $this->logFile);
             //メッセージテーブルに書き出し
             $MTobj = new DT_Message();
             $MTobj->addMessage($e->getMessage(), $reserve->id, 'error', $e->getFile() . ':' . $e->getLine());
         }
     }
 }
コード例 #4
0
 public function Exec()
 {
     foreach ($this->Accounts as $Account) {
         //インターバル時間過ぎていない場合、処理スキップ
         if ($Account->retweet_interval_time - 15 > $this->LogicObj->getLastExecTime($Account->id)) {
             $mes = date("Y-m-d H:i:s") . " CRON: " . $Account->account_name . " クーロンインターバル中(処理スキップ)\n";
             error_log($mes, 3, _TWITTER_LOG_PATH . 'log_' . date("Y_m_d") . ".log");
             continue;
         }
         $mes = date("Y-m-d H:i:s") . " CRON: " . $Account->account_name . " ツイート処理開始\n";
         error_log($mes, 3, _TWITTER_LOG_PATH . 'log_' . date("Y_m_d") . ".log");
         //ロジックにアカウントセット
         $this->LogicObj->setAccountId($Account->id);
         try {
             //検索 人気順並び替え
             $this->LogicObj->SearchTweets();
             //重複していないもの取得
             $tweet = $this->LogicObj->getAnDuplicateTweetID();
             if (is_null($tweet)) {
                 $mes = "TwieetID: 全て重複" . "\n";
                 error_log($mes, 3, _TWITTER_LOG_PATH . $this->logFile);
                 //throw new Exception($mes);
             } else {
                 //リツイート
                 $this->LogicObj->Retweets($tweet);
             }
         } catch (Exception $e) {
             //ログ出力
             error_log($e->getMessage(), 3, _TWITTER_LOG_PATH . $this->logFile);
             //メッセージテーブルに書き出し
             $MTobj = new DT_Message();
             $MTobj->addMessage($e->getMessage(), $Account->id, 'error', $e->getFile() . ':' . $e->getLine());
         }
         $mes = date("Y-m-d H:i:s") . " CRON: " . $Account->account_name . " ツイート処理終了\n";
         error_log($mes, 3, _TWITTER_LOG_PATH . 'log_' . date("Y_m_d") . ".log");
     }
 }
コード例 #5
0
 public function Retweets($tweet)
 {
     //--getAnDuplicateTweetIDで実行
     //if(!$this->checkRetweetNum($tweet)){
     //    $mes = $tweet->id.": retweet_count: ".$tweet->retweet_count." 最低リツイート数設定に達しなかったため、リツイート未実行"."\n";
     //    error_log($mes, 3, _TWITTER_LOG_PATH.$this->logFile);
     //    return $this;
     //}
     $retweetObj = new statuses_retweet($this->twObj);
     $apires = $retweetObj->setRetweetId($tweet->id)->Request();
     //エラーチェック
     $error_msg = '';
     $success_flg = 1;
     $apiErrorObj = new Api_Error($apires);
     if ($apiErrorObj->error) {
         //エラー情報
         $error_msg = $apiErrorObj->errorMes_Str;
         $success_flg = 0;
         //ログ出力
         error_log($apiErrorObj->errorMes_Str, 3, _TWITTER_LOG_PATH . $this->logFile);
         //メッセージテーブルに書き出し
         $MTobj = new DT_Message();
         $MTobj->addMessage($apiErrorObj->errorMes_Str, (int) $this->Account_ID, 'error', 'RetweetsProcese');
     } else {
         //成功時ログ出力
         $mes = "リツイート成功 RetweetID: " . $tweet->id_str . "\n";
         error_log($mes, 3, _TWITTER_LOG_PATH . $this->logFile);
     }
     unset($apiErrorObj);
     //リツイートリストに追加 (エラー時でも追加される)
     $sql = "INSERT INTO dt_retweet_list ( account_id, tweet_id, search_str, tweet_text, retweet_success_flg, error_mes, retweet_count, create_date ) VALUES ( ?, ?, ?, ?, ?, ?, ?, now() )";
     $res = $this->DBobj->execute($sql, array((int) $this->Account_ID, $tweet->id_str, $this->SerchAction->search_str_1, $tweet->text, $success_flg, $error_msg, $tweet->retweet_count));
     return $this;
 }