This commit is contained in:
2025-12-01 16:46:23 +08:00
parent d3e6a37418
commit 36e7144e8a
2 changed files with 8 additions and 4 deletions
+3 -3
View File
@@ -17,9 +17,9 @@ class PostController extends BaseController
{ {
use CrudControllerTrait; use CrudControllerTrait;
protected $noNeedLogin = ['index']; // protected $noNeedLogin = ['index'];
//
protected $noNeedHeaderData = ['index']; // protected $noNeedHeaderData = ['index'];
protected $service; protected $service;
+5 -1
View File
@@ -52,7 +52,11 @@ class PostService
$config['where']['category_id'] = $p['category_id']; $config['where']['category_id'] = $p['category_id'];
} }
if (isset($p['scene']) && $p['scene']=='self') { if (isset($p['scene']) && $p['scene']=='self') {
$config['where']['user_id'] = $request->user->uid; if(!empty($request->user) && !empty($request->user->uid)){
$config['where']['user_id'] = $request->user->uid;
}else{
$config['where']['user_id'] = -1;
}
} }
if(isset($p['year']) && $p['year']){ if(isset($p['year']) && $p['year']){
$from = strtotime($p['year'].'-01-01'); $from = strtotime($p['year'].'-01-01');