whereIn('special_id', $special_id); } else { $where['special_id'] = $special_id; $data->where($where); } } if ($source_id) { if (!is_array($source_id)) { $where['source_id'] = $source_id; $data->where($where); } else { $data->whereIn('source_id', $source_id); } } if ($page) { $data->page((int)$page, !$limit ? 10 : (int)$limit); } if ($order) { $data->order('sort asc,id asc'); } else { $data->order('sort desc,id desc'); } return $data->select(); } /**专栏里专题获取 * @param int $special_id * @param bool $limit * @param bool $page * @param int $is_member * @param $type * @return false|\PDOStatement|string|\think\Collection * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public static function get_special_source_list($special_id = 0, $is_member = 0, $type, $limit = false, $page = false, $order = 0) { $where = array(); $data = self::alias('o'); if ($special_id) { if (is_array($special_id)) { $data = $data->whereIn('o.special_id', $special_id); } else { $where['o.special_id'] = $special_id; $data = $data->where($where); } } if ($type == 5) { $data = $data->join('special s', 's.id=o.source_id')->where(['s.is_del' => 0, 's.status' => 1, 's.is_show' => 1]); if (!$is_member) { $data = $data->where('s.is_mer_visible', 0); } } if ($page) { $data->page((int)$page, !$limit ? 10 : (int)$limit); } if ($order) { $data->order('o.sort asc,o.id asc'); } else { $data->order('o.sort desc,o.id desc'); } return $data->select(); } }