where('agent_id', $this->agent_id) ->orderBy('sort') ->orderBy('id') ->get(['id', 'pid', 'name', 'icon']); return $this->success($list); } // 我的频道 public function my() { $channel_ids = UserChannel::where('user_id', $this->user_id)->value('channels'); $list = Channel::whereIn('id', $channel_ids)->get(['id', 'pid', 'name', 'icon']); return $this->success($list); } //根据频道ID获取产品 public function product() { $channel_id = (int)request()->input('channel_id'); $list = AgentProduct::where('agent_id', $this->agent_id) ->whereRaw("FIND_IN_SET($channel_id, `channel_id`)") ->with('product:id,title,pictures') ->select('id', 'sale', 'product_id', 'price', 'original_price') ->orderBy('id', 'DESC') ->simplePaginate(); return $this->success($list); } }