<?php
/**
 *
 * @file:VerifyBankInfoController.php
 * @Date: 2023/5/25
 * @Time: 18:14
 */


namespace Modules\Jiesuan\Http\Controllers;

use Catch\Base\CatchController;
use Illuminate\Http\Request;
use Modules\Jiesuan\Http\Requests\VerifyCheckRequest;
use Modules\Jiesuan\Services\BusinessmanService;
use Modules\Jiesuan\Services\VerifyService;
use Modules\User\Http\Controllers\UserTrait;

class VerifyBankInfoController extends CatchController
{
    use UserTrait;

    public function list(Request $request)
    {
        $isAll = $request->input('is_all', false);
        $param = $request->all();

        return VerifyService::verifyList($param, $isAll);
    }

    /**
     *  商务列表选择项
     * name: businessOption
     * @param Request $request
     * @return \Illuminate\Support\Collection
     * date 2023/05/30 09:54
     */
    public function businessOption(Request $request)
    {
        return BusinessmanService::list($request->all());
    }

    public function check(VerifyCheckRequest $request)
    {
        $userContext = $this->getUserContext(null);
        $param = [
            'status' => $request->input('status'),
            'checked_user' => [
                "id"=> $userContext['loginUser']->id,
                "user_name"=> $userContext['loginUser']->username,
                "email"=> $userContext['loginUser']->email,
            ],
            'checked_at' => get_date(),
            'remark' => $request->input('remark',"")
        ];

        return VerifyService::checkBankInfo($request->input("id"),$param);
    }

}
