|
@@ -12,6 +12,7 @@ use app\model\SysSerial;
|
|
|
use support\Db;
|
|
|
use support\exception\BusinessException;
|
|
|
use support\Request;
|
|
|
+use support\Response;
|
|
|
use Tinywan\Jwt\JwtToken;
|
|
|
|
|
|
class IndexController extends Curd
|
|
@@ -23,6 +24,16 @@ class IndexController extends Curd
|
|
|
$this->validateClass = new IndexValidate();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function select(Request $request): Response
|
|
|
+ {
|
|
|
+ [$where, $format, $limit, $field, $order] = $this->selectInput($request);
|
|
|
+ $order = $request->get('order', 'desc');
|
|
|
+ $field = $field ?? 'created_at';
|
|
|
+ $query = $this->doSelect($where, $field, $order);
|
|
|
+ return $this->doFormat($query, $format, $limit);
|
|
|
+ }
|
|
|
+
|
|
|
protected function doSelect(array $where, string $field = null, string $order = 'desc')
|
|
|
{
|
|
|
$model = $this->model->with('user');
|