Example #1
0
 function action()
 {
     $category = new Category();
     $kdgs = new Kdgs();
     $album = new Album();
     $story_url = new StoryUrl();
     $category_list = $category->get_list("`res_name`='kdgs' and `s_id`='0'");
     foreach ($category_list as $k => $v) {
         $page = 1;
         while (true) {
             $album_list = $kdgs->get_children_category_album_list($v['s_p_id'], $page);
             if (!$album_list) {
                 break;
             }
             foreach ($album_list as $k2 => $v2) {
                 $exists = $album->check_exists("`link_url` = '{$v2['url']}'");
                 if ($exists) {
                     continue;
                 }
                 $album_id = $album->insert(array('title' => $v2['title'], 'min_age' => $v2['min_age'], 'max_age' => $v2['max_age'], 'intro' => '', 's_cover' => $v2['cover'], 'link_url' => $v2['url'], 'add_time' => date('Y-m-d H:i:s')));
                 $story_url->insert(array('res_name' => 'album', 'res_id' => $album_id, 'field_name' => 'cover', 'source_url' => $v2['cover'], 'source_file_name' => ltrim(strrchr($v2['cover'], '/'), '/'), 'add_time' => date('Y-m-d H:i:s')));
             }
             $page++;
         }
     }
 }
Example #2
0
 function action()
 {
     $album = new Album();
     $story = new Story();
     $kdgs = new Kdgs();
     $story_url = new StoryUrl();
     $album_list = $album->get_list("id>0", 10);
     foreach ($album_list as $k => $v) {
         $story_list = $kdgs->get_album_story_list($v['link_url']);
         foreach ($story_list as $k2 => $v2) {
             $exists = $story->check_exists("`source_audio_url`='{$v2['source_audio_url']}'");
             if ($exists) {
                 continue;
             }
             $story_id = $story->insert(array('album_id' => $v['id'], 'title' => $v2['title'], 'intro' => $v2['intro'], 's_cover' => $v2['cover'], 'source_audio_url' => $v2['source_audio_url'], 'add_time' => date('Y-m-d H:i:s')));
             $story_url->insert(array('res_name' => 'story', 'res_id' => $story_id, 'field_name' => 'cover', 'source_url' => $v2['cover'], 'source_file_name' => ltrim(strrchr($v2['cover'], '/'), '/'), 'add_time' => date('Y-m-d H:i:s')));
             echo $story_id;
             echo "<br />";
             exit;
         }
     }
 }
Example #3
0
 function action()
 {
     // 子类
     $category = new Category();
     $kdgs = new Kdgs();
     $story_url = new StoryUrl();
     $current_time = date('Y-m-d H:i:s');
     $parent_category_list = $kdgs->get_parent_category($this->home_url);
     foreach ($parent_category_list as $k => $v) {
         $exists = $category->check_exists("`res_name`='kdgs' and `s_id`='{$v['s_id']}'");
         if ($exists) {
             continue;
         } else {
             $category_id = $category->insert(array('res_name' => 'kdgs', 'parent_id' => 0, 'title' => $v['title'], 's_id' => $v['s_id'], 's_p_id' => 0, 'from_url' => $this->home_url, 'link_url' => $v['link_url'], 's_cover' => $v['cover'], 'add_time' => date('Y-m-d H:i:s')));
             $story_url->insert(array('res_name' => 'category', 'res_id' => $category_id, 'field_name' => 'cover', 'source_url' => $v['cover'], 'source_file_name' => ltrim(strrchr($v['cover'], '/'), '/'), 'add_time' => date('Y-m-d H:i:s')));
             echo $category_id;
             echo "<br />";
         }
     }
     // 子类
     $category_list = $category->get_list("`res_name`='kdgs' and `s_p_id`=0");
     foreach ($category_list as $k => $v) {
         $children_category_list = $kdgs->get_children_category_list($v['link_url']);
         foreach ($children_category_list as $k2 => $v2) {
             $exists = $category->check_exists("`res_name`='kdgs' and `s_id`='0' and `s_p_id`='{$v2['s_p_id']}'");
             if ($exists) {
                 continue;
             } else {
                 $category_id = $category->insert(array('res_name' => 'kdgs', 'parent_id' => $v['id'], 'title' => $v2['title'], 's_id' => 0, 's_p_id' => $v2['s_p_id'], 'from_url' => $v['link_url'], 'link_url' => $v2['link_url'], 's_cover' => $v2['cover'], 'add_time' => date('Y-m-d H:i:s')));
                 $story_url->insert(array('res_name' => 'category', 'res_id' => $category_id, 'field_name' => 'cover', 'source_url' => $v2['cover'], 'source_file_name' => ltrim(strrchr($v2['cover'], '/'), '/'), 'add_time' => date('Y-m-d H:i:s')));
                 echo "children:" . $category_id;
                 echo "<br />";
             }
         }
     }
 }