<?php

namespace app\admin\controller\life;

use app\admin\validate\life\CinemaIlkValidate;
use app\controller\Curd;
use app\model\CinemaIlk as CinemaIlkModel;
use support\Request;
use support\Response;

class CinemaIlkController extends Curd
{

    public function __construct()
    {
        $this->model = new CinemaIlkModel();
        $this->validate = true;
        $this->validateClass = new CinemaIlkValidate();
    }

    /**
     * @Desc 查询列表
     * @Author Gorden
     * @Date 2024/3/21 9:58
     *
     * @param Request $request
     * @return Response
     * @throws \support\exception\BusinessException
     */
    public function select(Request $request): Response
    {
        [$where, $format, $limit, $field, $order] = $this->selectInput($request);
        $where['ilk_is_del'] = 0;
        $order = $request->get('order', 'desc');
        $field = $field ?? 'ilk_add_time';
        $query = $this->doSelect($where, $field, $order);
        return $this->doFormat($query, $format, $limit);
    }

    /**
     * @Desc 删除类型
     * @Author Gorden
     * @Date 2024/2/26 9:40
     *
     * @param Request $request
     * @return Response
     * @throws \support\exception\BusinessException
     */
    public function delete(Request $request): Response
    {
        $ids = $this->deleteInput($request);
        $this->doSoftDelete($ids, ['ilk_is_del' => 1]);

        return json_success('success');
    }
}