<?php
namespace App\Domains\Export\Http\Controllers;

use App\Core\Controller;
use Illuminate\Http\Request;
use App\Domains\Export\Services\ExportService;

class ExportController extends Controller
{
    protected $request;
    protected $exportService;

    /**
     * 构造函数，自动注入.
     */
    public function __construct(Request $request, ExportService $exportService)
    {
        $this->request = $request;
        $this->exportService = $exportService;
    }

    /**
     * 列表.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $conditions = $this->request->all();

        $res = $this->exportService->index($conditions);

        return res($res, '导出记录', 201);
    }

    /**
     * 删除.
     *
     * @return \Illuminate\Http\Response
     */
    public function destroy()
    {
        $ids = $this->request->ids();

        $this->exportService->destroy($ids);

        return res(true, '删除成功');
    }
}
