海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
728 B

<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Channel;
use App\Models\UserChannel;
/**
* 频道列表
* Class Channel
* @package App\Http\Controllers\Api
*/
class ChannelController extends Controller
{
// 所有频道列表
public function index()
{
$list = Channel::orderBy('sort')->orderBy('id', 'DESC')->get(['pid', 'name', 'icon']);
return $this->success($list);
}
// 我的频道
public function my()
{
$channel_ids = UserChannel::where('uid', $this->user_id)->value('channels');
$list = Channel::whereIn('id', $channel_ids)->get(['id', 'pid', 'name', 'icon']);
return $this->success($list);
}
}