<?php


namespace App\Http\Controllers\Admin;


use App\Http\helper\Helper;
use App\Http\logic\admin\ControlRecordLogic;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class ControlRecordController
{

    // 单控池总监控
    public function monitor(Request $request)
    {

        $start_time = $request->start_time ?: '';
        $end_time = $request->end_time ?: '';
        $date = $request->date ?: '';
        $excel = $request->excel ?: '';

        $list = (new ControlRecordLogic())->monitor($start_time, $end_time, $date, $excel);

        return view('admin.ControlRecord.monitor', $list);
    }

    // 单控控制--用户单控记录
    public function show_control_log(Request $request, $id)
    {

        $user_id = $request->UserID;
        if (!empty($id)) {
            $user_id = $id;
        }

        $time = Helper::return_time($request);
        $list = (new ControlRecordLogic())->query_list($user_id, $time);
        return view('admin.ControlRecord.show_control_log',$list);
    }

    // 单控操作记录
    public function index(Request $request)
    {
        $user_id = $request->UserID ?: '';
        $time = Helper::return_time($request);
        $list = (new ControlRecordLogic())->query_list($user_id, $time);
        return view('admin.ControlRecord.index', $list);
    }
}
