Closed simaguo closed 7 years ago
'scheme' => [
'AgentName' => [
'10 backup',
'agentClass' => '.....',
],
],
@simaguo 上面
@toplan ,[注:我用的是laravel-sms]按上面配置不行,它调用另外一个代理类ParasiticAgent 了,没有执行我自定义的类
$className = "Toplan\\PhpSms\\{$name}Agent";
if (isset($options['agentClass'])) {
$className = $options['agentClass'];
unset($options['agentClass']);
}dump(['classname'=>$className,'options'=>$options]);
if (!empty($options)) {
self::$agents[$name] = new ParasiticAgent($config, $options);
self::getTask()->driver("$name $scheme")->work(function (Driver $driver) use ($settings) {
$agent = self::getAgent($driver->name, $settings);dd($agent,$driver->name,$settings);
extract($driver->getTaskData());
如下,打印结果
array:2 [
"classname" => "App\Library\LanzSMSAgent"
"options" => array:1 [
0 => "10 backup"
]
]
ParasiticAgent {#327
#handlers: array:1 [
0 => "10 backup"
]
#config: []
#params: []
#result: array:3 [
"success" => false
"info" => null
"code" => 0
]
}
"App\Library\LanzSMSAgent"
array:3 [
0 => "10 backup"
"agentClass" => "App\Library\LanzSMSAgent"
"scheme" => "10 backup App\Library\LanzSMSAgent "
]
好的,我看看,确实有问题的话,我发布新版本解决问题。如果你急着使用,可以改改源码,后续再更新。
好的,麻烦了,去掉'10 backup',可以了,已解决。但好像获取不到配置项用_get方法
@toplan 我晕 没发现这是个问题吗- -!自定义代理器要是加了weight 就全都跑ParasiticAgent去了
上面我自定义代理类的,phpsms.php配置文件是:
然而程序是用这个$className = "Toplan\PhpSms\{$name}Agent";,如何在phpsms.php定义agentClass