field($field)->find(); } /** * 列表 * @param $where * @param int $page * @return array * @throws \think\db\exception\DbException */ public static function getList($where, $page = 10) { return self::where($where) ->field('id,name,sort,status,create_time') ->order('sort desc,create_time desc') ->paginate($page) ->each(function ($item) { $item['create_time'] = date('Y-m-d H:i:s', $item['create_time']); return $item; })->toArray(); } /** * 列表不分页 * @return \think\Collection * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function getListNoPage($where) { return self::where($where) ->field('id,name') ->order('sort desc') ->select(); } }