| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 | <?phpnamespace  App\Import;use App\Service\ImportService;use Maatwebsite\Excel\Concerns\ToArray;class ImportAll implements ToArray {    private $msg = '';    public $crt_id = 0;    public $type = "";    public $user = [];    public function array (array $array){        $this->handleData($array);    }    public function setCrt($crt_id){        $this->crt_id = $crt_id;    }    public function setType($type){        $this->type = $type;    }    public function setUser($user){        $this->user = $user;    }    public function getMsg(){        return $this->msg;    }    public function setMsg($msg){        $this->msg = $msg;    }    public function handleData (array $array) {        $func = $this->type . "Import";        if(! $func) {            $this->setMsg("意外错误");            return;        }        list($status,$msg) = (new ImportService())->$func($array,$this->user);        if(empty($status)) $this->setMsg($msg);    }}
 |