delete(); foreach ($channels as $channel) { self::create(['bid' => $bid, 'channel_user_id' => $channel]); } return true; } /** * 获取书本设置的渠道标识 * @param $bid * @return mixed */ public static function getChannelsByBid($bid) { return self::select('channel_user_id')->where('bid', $bid)->get(); } /** * 清除书本设置的渠道标识 * @param $bid * @return mixed */ public static function clearSpecialChannle($bid) { return self::where('bid', $bid)->delete(); } /** * 获取渠道下配置的所有的书本id列表 * @param $channel_user_id * @return array */ public static function getBids($channel_user_id) { $data= self::where('channel_user_id', $channel_user_id)->select('bid')->get(); $bids=[]; foreach ($data as $item){ $bids[]=$item->bid; } return $bids; } }