|
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api\V1;
|
|
use App\Helper\JpushHelper;
|
|
use App\Helper\JpushHelper;
|
|
use App\Models\AccountLog;
|
|
use App\Models\AccountLog;
|
|
use App\Models\BaseSettingsModel;
|
|
use App\Models\BaseSettingsModel;
|
|
|
|
+use App\Models\CommentInfoModel;
|
|
use App\Models\DreamImages;
|
|
use App\Models\DreamImages;
|
|
use App\Models\DreamInfoModel;
|
|
use App\Models\DreamInfoModel;
|
|
use App\Models\InteractionInfo;
|
|
use App\Models\InteractionInfo;
|
|
@@ -232,9 +233,19 @@ class DreamController extends Controller
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($type == 'paihang') return $this->api($topuser);
|
|
if ($type == 'paihang') return $this->api($topuser);
|
|
- $interactions = InteractionInfo::where('dream_id',$id)->with(['comments' => function ($query) {
|
|
|
|
- $query->orderBy('created_at');
|
|
|
|
- }])->orderBy('id','desc')->get();
|
|
|
|
|
|
+ $interactions = InteractionInfo::where('dream_id',$id)->orderBy('id','desc')->get();
|
|
|
|
+ foreach ($interactions as $interaction) {
|
|
|
|
+// 被屏蔽的人
|
|
|
|
+ $arr = array_filter(explode(',',$interaction->black_list));
|
|
|
|
+ if(!empty($arr)){
|
|
|
|
+ $interaction->comments = CommentInfoModel::where('interaction_id',$interaction->id)->where(function ($query) use ($arr) {
|
|
|
|
+ $query->whereNotIn('user_id',$arr);
|
|
|
|
+ })->orderBy('created_at')->get()->toArray();
|
|
|
|
+ }else{
|
|
|
|
+ $interaction->comments = CommentInfoModel::where('interaction_id',$interaction->id)->orderBy('created_at')->get()->toArray();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/*dd($interactions);
|
|
/*dd($interactions);
|
|
foreach ($interactions as $item) {
|
|
foreach ($interactions as $item) {
|
|
$item->comments;
|
|
$item->comments;
|
|
@@ -289,9 +300,18 @@ class DreamController extends Controller
|
|
// 梦想互动
|
|
// 梦想互动
|
|
$interaction_id = $request->input('interaction_id');
|
|
$interaction_id = $request->input('interaction_id');
|
|
|
|
|
|
- $interactions = InteractionInfo::where('dream_id',$id)->with(['comments' => function ($query) {
|
|
|
|
- $query->orderBy('created_at');
|
|
|
|
- }])->orderBy('created_at','desc')->get();
|
|
|
|
|
|
+ $interactions = InteractionInfo::where('dream_id',$id)->orderBy('created_at','desc')->get();
|
|
|
|
+ foreach ($interactions as $interaction) {
|
|
|
|
+// 被屏蔽的人
|
|
|
|
+ $arr = array_filter(explode(',',$interaction->black_list));
|
|
|
|
+ if(!empty($arr)){
|
|
|
|
+ $interaction->comments = CommentInfoModel::where('interaction_id',$interaction->id)->where(function ($query) use ($arr) {
|
|
|
|
+ $query->whereNotIn('user_id',$arr);
|
|
|
|
+ })->orderBy('created_at')->get()->toArray();
|
|
|
|
+ }else{
|
|
|
|
+ $interaction->comments = CommentInfoModel::where('interaction_id',$interaction->id)->orderBy('created_at')->get()->toArray();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (!empty($interaction_id)) {
|
|
if (!empty($interaction_id)) {
|
|
$data = InteractionInfo::with(['comments' => function ($query) {
|
|
$data = InteractionInfo::with(['comments' => function ($query) {
|
|
$query->orderBy('created_at');
|
|
$query->orderBy('created_at');
|