|
@@ -9,6 +9,7 @@
|
|
|
namespace App\Http\Controllers\V1;
|
|
|
|
|
|
use App\Repositories\PostRepositories;
|
|
|
+use App\Traits\CmsTrait;
|
|
|
use App\Traits\UserTrait;
|
|
|
use App\Transformers\Post\CommentTransformer;
|
|
|
use App\Transformers\Post\DetailTransformer;
|
|
@@ -33,6 +34,7 @@ use League\Fractal\Resource\Item;
|
|
|
class PostController extends Controller
|
|
|
{
|
|
|
use UserTrait;
|
|
|
+ use CmsTrait;
|
|
|
public function __construct(PostRepositories $postRepositories)
|
|
|
{
|
|
|
$this->postRepositories = $postRepositories;
|
|
@@ -150,6 +152,7 @@ class PostController extends Controller
|
|
|
Log::info('获取用户信息失败');
|
|
|
return jsonError('获取用户信息失败');
|
|
|
}
|
|
|
+ $floor = $this->getFloorInfo();
|
|
|
$param = $request->all();
|
|
|
$list = $this->postRepositories->suggestPost($param);
|
|
|
$fractal = new Manager();
|
|
@@ -157,11 +160,12 @@ class PostController extends Controller
|
|
|
$resource->setPaginator(new IlluminatePaginatorAdapter($list));
|
|
|
$data = $fractal->createData($resource)->toArray();
|
|
|
|
|
|
- if(!(isset($param['current_page']) && $param['current_page'] > 1)){
|
|
|
+ if(!(isset($param['current_page']) && $param['current_page'] > 1) && $floor && $floor['data']){
|
|
|
+ $floor = array_column($floor['data'], null, 'floor_location');
|
|
|
$newData = [];
|
|
|
foreach($data['data'] as $key => $val){
|
|
|
- if($key == 1){
|
|
|
- $newData[] = ['show_type' => 1];
|
|
|
+ if(isset($floor[$key+1])){
|
|
|
+ $newData[] = $floor[$key+1];
|
|
|
}
|
|
|
$newData[] = $val;
|
|
|
}
|