<?php

namespace App\Console\Commands;

use App\dao\Pay\PayError;
use App\Facade\RedisConnect;
use App\Facade\TableName;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;


class TestCon extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'test_con';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {

        $r = (new PayError())->create(2,'pay2');
        dd($r);

        $list = DB::table(TableName::agent() . 'admin_configs')
            ->where('type', 'pay')
            ->where('status', 1)

            ->orderBy('pay_error')
            ->orderByDesc('sort')
            ->pluck('name', 'id')->toArray();

        dd($list);
//        $redis = new RedisConnect();
//        // 判断开关
//        $open = 1;
//        $pay_id = 2;    // 支付ID
//
//        // 判断支付渠道
//        if (!$redis->redis()->exists('pay_channel')) {
//
//            // 插表 -- 错误支付id存表
//
//            DB::table(TableName::agent() . 'pay_poll')
//                ->updateOrInsert(['id' => 1], ['error_pay_id' => $pay_id . ',']);
//
//            DB::table(TableName::agent() . 'admin_configs')->where('id', $id)->update(['pay_error' => 1]);
//
//
//            $list = DB::table(TableName::agent() . 'admin_configs')
//                ->where('type', 'pay')
//                ->where('status', 1)
//                ->orderBy('pay_error')
//                ->orderByDesc('sort')
//                ->pluck('name', 'id')->toArray();
//
//
//
//
//
//        }


    }


}
