where($where); if ($order) { $model->order($order[0] ?? 'id', $order[1] ?? 'asc'); } if (!empty($params['withCount'])) { $model->withCount($params['withCount']); } return $model->find(); } /** * 获取列表数据 * @param $where * @param int $page_size * @param string|array $order --'id desc,status'|['order','id'=>'desc'] * @param string $group * @param string|array $with * @param array $params * @return mixed */ public static function getList($where, $page_size = 0, $order = [], $group = '', $with = [], $params = []) { $model = self::$Model::where($where); if ($order) { $model->order($order); } if ($group) { $model->group($group); } if ($with) { $model->with($with); } if (!empty($params['withCount'])) { $model->withCount($params['withCount']); } $res = $page_size ? $model->paginate($page_size, false, $params['config'] ?? []) : $model->select(); return $res; } /** * 调用模型静态方法 * @param $funName * @param $args * @return mixed */ public static function __callStatic($funName, $args) { $res = self::$Model::$funName(...$args); return $res; } }