// +---------------------------------------------------------------------- namespace app\wap\model\special; use traits\ModelTrait; use basic\ModelBasic; /** * Class Special 专题素材关联表 * @package app\admin\model\special */ class SpecialSource extends ModelBasic { use ModelTrait; /**获取专题素材 * @param bool $special_id * @return false|\PDOStatement|string|\think\Collection * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public static function getSpecialSource($special_id = false, $source_id = false, $limit = false, $page = false) { $where = array(); $data = self::where($where); if ($special_id) { if (is_array($special_id)) { $data->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($page, !$limit ? 10 : $limit); } return $data->order('sort DESC')->select(); } }