|
@@ -99,7 +99,7 @@ class IndexController extends Controller
|
|
|
|
|
|
/*热门专家*/
|
|
/*热门专家*/
|
|
$hotExperts = Cache::remember('index_hot_experts',Setting()->get('website_cache_time',1),function(){
|
|
$hotExperts = Cache::remember('index_hot_experts',Setting()->get('website_cache_time',1),function(){
|
|
- return Authentication::hottest(8);
|
|
|
|
|
|
+ return Authentication::hottest(4);
|
|
});
|
|
});
|
|
|
|
|
|
$hotUsers = Cache::remember('index_hot_users',30,function() {
|
|
$hotUsers = Cache::remember('index_hot_users',30,function() {
|
|
@@ -117,14 +117,23 @@ class IndexController extends Controller
|
|
});
|
|
});
|
|
|
|
|
|
/*热门文章*/
|
|
/*热门文章*/
|
|
- $hotArticles = Cache::remember('index_hot_articles',Setting()->get('website_cache_time',1),function() {
|
|
|
|
- return Article::hottest(0,12);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
|
|
+// $hotArticles = Cache::remember('index_hot_articles',Setting()->get('website_cache_time',1),function() {
|
|
|
|
+// return Article::hottest(0,5);
|
|
|
|
+// });
|
|
|
|
+ $hotArticles = DB::table('articles')
|
|
|
|
+ ->where('status','>',0)
|
|
|
|
+ ->orderBy('views','desc')
|
|
|
|
+ ->paginate(5)
|
|
|
|
+ ->all();
|
|
/*最新文章*/
|
|
/*最新文章*/
|
|
- $newestArticles = Cache::remember('index_newest_articles',Setting()->get('website_cache_time',1),function() {
|
|
|
|
- return Article::newest(0,12);
|
|
|
|
- });
|
|
|
|
|
|
+// $newestArticles = Cache::remember('index_newest_articles',Setting()->get('website_cache_time',1),function() {
|
|
|
|
+// return Article::newest(0,5);
|
|
|
|
+// });
|
|
|
|
+ $newestArticles = DB::table('articles')
|
|
|
|
+ ->where('status','>',0)
|
|
|
|
+ ->orderBy('updated_at','desc')
|
|
|
|
+ ->paginate(5)
|
|
|
|
+ ->all();
|
|
|
|
|
|
/*最新公告*/
|
|
/*最新公告*/
|
|
$newestNotices = Cache::remember('newest_notices',Setting()->get('website_cache_time',1),function() {
|
|
$newestNotices = Cache::remember('newest_notices',Setting()->get('website_cache_time',1),function() {
|
|
@@ -165,6 +174,7 @@ class IndexController extends Controller
|
|
$userData['mobile_status'] = 1;
|
|
$userData['mobile_status'] = 1;
|
|
}
|
|
}
|
|
$this->userData->create($userData);
|
|
$this->userData->create($userData);
|
|
|
|
+
|
|
}
|
|
}
|
|
$user->attachRole(2); //默认注册为普通用户角色
|
|
$user->attachRole(2); //默认注册为普通用户角色
|
|
$this->auth->login($user);
|
|
$this->auth->login($user);
|
|
@@ -286,7 +296,6 @@ class IndexController extends Controller
|
|
|
|
|
|
public function topic( $categorySlug='all')
|
|
public function topic( $categorySlug='all')
|
|
{
|
|
{
|
|
-
|
|
|
|
$parentId=$currentCategoryId = 0;
|
|
$parentId=$currentCategoryId = 0;
|
|
$query = Tag::query();
|
|
$query = Tag::query();
|
|
if( $categorySlug != 'all' ){
|
|
if( $categorySlug != 'all' ){
|