Browse Source

$channel_ids处理

develop
李可松 4 years ago
parent
commit
dfa7f0f8da
  1. 10
      app/Http/Controllers/Api/IndexController.php

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

@ -37,12 +37,10 @@ class IndexController extends Controller
# 我的频道
if ($this->user_id) {
$channel_ids = UserChannel::where('user_id', $this->user_id)->value('channels');
if ($channel_ids) {
$my_channels = Channel::where('agent_id', $this->agent_id)
->whereIn('id', $channel_ids)
->get(['id', 'name', 'icon']);
}
$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)

Loading…
Cancel
Save