Beispiel #1
0
Datei: Api.php Projekt: apuc/api
 public static function deleteTaskByNetwork($model)
 {
     $network = $model->service->network;
     $id = null;
     if ($network == Service::VK) {
         $id = VK::deleteTask($model->foreign_id);
     }
     if ($network == Service::INSTAGRAM) {
         $id = Instagram::deleteTask($model->foreign_id);
     }
     if ($network == Service::TWITTER) {
         $id = Twitter::deleteTask($model->foreign_id);
     }
     if ($network == Service::ASKFM) {
         $id = AskFM::deleteTask($model->foreign_id);
     }
     return $id;
 }
Beispiel #2
0
 public static function synchronizeStatuses()
 {
     $tasks = Vk::getTasks();
     $tasks = ArrayHelper::merge($tasks, Instagram::getTasks());
     $tasks = ArrayHelper::merge($tasks, Twitter::getTasks());
     $tasks = ArrayHelper::merge($tasks, AskFM::getTasks());
     foreach ($tasks as $task) {
         if ($task->finished) {
             $order = Order::findOne(['foreign_id' => $task->id]);
             if (isset($order->status)) {
                 if ($order->status == Order::PROCESSED) {
                     $order->status = Order::DONE;
                     $order->save();
                 }
             }
         }
     }
 }