コード例 #1
0
ファイル: Sync_blogController.php プロジェクト: apanly/dream
 public function actionInit()
 {
     $date_now = date("Y-m-d H:i:s");
     $posts_list = Posts::find()->where(['status' => 1])->orderBy("id asc")->all();
     foreach ($posts_list as $_item) {
         foreach (SyncBlogService::$type_mapping as $_type => $_f) {
             $model_blog_sync_queue = new BlogSyncQueue();
             $model_blog_sync_queue->blog_id = $_item['id'];
             $model_blog_sync_queue->type = $_type;
             $model_blog_sync_queue->updated_time = $date_now;
             $model_blog_sync_queue->created_time = $date_now;
             $model_blog_sync_queue->status = -1;
             $model_blog_sync_queue->save(0);
         }
     }
 }
コード例 #2
0
ファイル: SyncBlogService.php プロジェクト: apanly/dream
 public static function addQueue($blog_id)
 {
     $date_now = date("Y-m-d H:i:s");
     foreach (self::$type_mapping as $_type => $_f) {
         $has_not_handle_task = BlogSyncQueue::findOne(['blog_id' => $blog_id, 'status' => -1, 'type' => $_type]);
         if ($has_not_handle_task) {
             continue;
         }
         $tmp_model_blog_sync_queue = new BlogSyncQueue();
         $tmp_model_blog_sync_queue->blog_id = $blog_id;
         $tmp_model_blog_sync_queue->type = $_type;
         $tmp_model_blog_sync_queue->status = -1;
         $tmp_model_blog_sync_queue->updated_time = $date_now;
         $tmp_model_blog_sync_queue->created_time = $date_now;
         $tmp_model_blog_sync_queue->save(0);
     }
 }