Browse Source

取消我的频道默认数据

master
李可松 4 years ago
parent
commit
276e44b4dc
  1. 10
      app/Http/Controllers/Api/IndexController.php

10
app/Http/Controllers/Api/IndexController.php

@ -36,19 +36,15 @@ class IndexController extends Controller
->orderBy('sort')->orderBy('id', 'desc')->get(['id', 'title']);
# 我的频道
$my_channels = [];
if ($this->user_id) {
$channel_ids = UserChannel::where('user_id', $this->user_id)->value('channels') ?? [];
$my_channels = Channel::where('agent_id', $this->agent_id)
->whereIn('id', $channel_ids)
->get(['id', 'name', 'icon']);
} else {
$my_channels = Channel::where('agent_id', $this->agent_id)
->where('pid', '<>', 0)
->orderBy('id')
->limit(8)
->get(['id', 'name', 'icon']);
}
if (!$my_channels->isEmpty()) {
if ($my_channels && !$my_channels->isEmpty()) {
foreach ($my_channels as &$v) {
$v->icon = $img_prefix . $v->icon;
}

Loading…
Cancel
Save