<?php

namespace App\Http\Controllers\Admin;

use App\Http\Resources\Admin\RiskListCollection;
use App\Models\BlackListModel;
use App\Models\RiskListModel;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class BlackListController extends Controller
{
    //


    /**
     * 风险列表
     * @param  Request  $request
     */
    public function riskList(Request $request)
    {
        $risks = RiskListModel::paginate($request->input("per_page", 20));
        foreach ($risks as $risk) {
            $risk->uid_verify = BlackListModel::where('account_type', 'uid')->where(
                'account',
                $risk->phone
            )->first() ? true : false;
            $risk->phone_verify = BlackListModel::where('account_type', 'phone')->where(
                'account',
                $risk->phone
            )->first() ? true : false;
            $risk->weixin_verify = BlackListModel::where('account_type', 'weixin')->where(
                'account',
                $risk->weixin
            )->first() ? true : false;
            $risk->qq_verify = BlackListModel::where('account_type', 'qq')->where(
                'account',
                $risk->qq
            )->first() ? true : false;
        }
        return new RiskListCollection($risks);
    }
}
