You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
722 B
42 lines
722 B
<?php
|
|
declare(strict_types=1);
|
|
namespace App\TaskWorker;
|
|
|
|
use Hyperf\Utils\ApplicationContext;
|
|
use App\Libs\SimpleSSDB;
|
|
use Hyperf\Task\Annotation\Task;
|
|
|
|
class SSDBTask
|
|
{
|
|
/**
|
|
* @var SimpleSSDB
|
|
*/
|
|
public $ss = null;
|
|
|
|
/**
|
|
* @Task
|
|
*/
|
|
public function exec($method,...$args)
|
|
{
|
|
$result = $this->client()->__call($method,$args);
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function execWithoutTask($method,...$args)
|
|
{
|
|
$result = $this->client()->__call($method,$args);
|
|
|
|
return $result;
|
|
}
|
|
|
|
protected function client(){
|
|
|
|
$ss = new SimpleSSDB(env('SSDB_HOST'), env('SSDB_PORT'));
|
|
$ss->auth(env('SSDB_AUTH'));
|
|
|
|
return $ss;
|
|
|
|
}
|
|
}
|
|
|