Beispiel #1
0
 /**
  * 更新 最新最热 博文列表  每个博主下各抽取5条,最新的、最热的
  * 推荐的文章也是依据这个表,会依据 表中的推荐权重字段
  */
 private function updateTopNewBlog($database)
 {
     $db = Db_Blog::instance(null, $database);
     //最新5篇
     $newList = Helper_Blog::getArticleList(array('pageSize' => 5, 'isPublished' => 1, 'fields' => array('id', 'view', 'cate', 'title', 'descript', 'insertTime'), 'order' => 'order by insertTime desc'));
     //最热5篇
     $hotList = Helper_Blog::getArticleList(array('pageSize' => 5, 'isPublished' => 1, 'fields' => array('id', 'view', 'cate', 'title', 'descript', 'insertTime'), 'order' => 'order by view desc'));
     if (is_array($newList) && is_array($hotList)) {
         $newHotList = array_merge($newList, $hotList);
         $webSite = str_replace('blog_', '', $database);
         foreach ($newHotList as $articleInfo) {
             //查询推荐权重
             $isRecommend = Helper_Blogconfig::getArticleInfo(array('articleId' => $articleInfo['id'], 'webSite' => $webSite, 'fileds' => array('isRecommend')));
             $isRecommend = $isRecommend['isRecommend'] ? $isRecommend['isRecommend'] : 0;
             Helper_Blogconfig::insertHotnew(array('insertData' => array('webSite' => $webSite, 'articleId' => $articleInfo['id'], 'title' => $articleInfo['title'], 'descript' => $articleInfo['descript'], 'cate' => $articleInfo['cate'], 'cateVal' => LJL_Config::get('Blog_' . ucfirst($webSite) . '_Cate', 'CATE')[$articleInfo['cate']][0], 'view' => $articleInfo['view'], 'score' => $articleInfo['view'], 'publishTime' => $articleInfo['insertTime'], 'isRecommend' => $isRecommend)));
         }
     }
     echo $database . ' hot and new blog publish over' . PHP_EOL;
 }