<?php
/* +----------------------------------------------------------------------+
   | Copyright (c) 2018-2019 YmPay                                        |
   |              <530759076@qq.com>                                      |
   +----------------------------------------------------------------------+*/
namespace App\Http\Controllers\Daili;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Redis;


class DailiCommonController extends Controller{

	public $dailiInfo = [];
	public $my_uids = [];
	public function __construct(){

		 

		$this->middleware(function ($request,$next) {

		    if(! \Session::get('daili')){
		    	return redirect('/login');
		    }


				$this->dailiInfo = \Session::get('daili');
				$this->dailiInfo = DB::table('daili')->where('Id' , $this->dailiInfo['Id'])->first();
				$this->dailiInfo = json_decode(json_encode($this->dailiInfo), true);
				//print_r($this->dailiInfo);exit;
				//获得我得商户
				$ulist= DB::table('user')->where(['daili_id' => $this->dailiInfo['Id']])->get();
				$my_uids = [];
				foreach ($ulist as $u) {
					$my_uids[] = $u->Id;
				}
				$this->my_uids = $my_uids;

		    return $next($request);
		});
	}
}
