<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace app\crm\command;
use think\console\Command;
use think\console\Input;
use think\console\Output;

class Repairintostore extends Command{

    protected function configure()
    {
        $this->setName('repairintostore')->setDescription('Suxuan system service: Repairintostore ');
    }
    
    protected function execute(Input $input, Output $output)
    {
        /**
         *要操作的类，此类必须在LIB下面
         * 
         */
        $controller = 'Repair';
        /**
         * 类里的方法
         */
        $method = config('repair_method');
        
        if(!class_exists('app\\crm\\lib\\'.ucwords($controller))){
            echo '没有发现这个类：'.$controller."\r\n";
            exit();
        }
        $instance = new \ReflectionClass('app\\crm\\lib\\'.ucwords($controller));
        if (!$instance->hasMethod($method)) {
            echo '没有发现这个方法：'.$method."\r\n";
            exit();
        }
        $objMethod = $instance->getMethod($method);
        $handle = $instance->newInstance();
        try{
                $objMethod->invokeArgs($handle,[]);
            } 
        catch (\Exception $e){

        }
    }

}