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.

40 lines
694 B

5 years ago
5 years ago
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\TaskWorker;
  4. use Hyperf\Utils\ApplicationContext;
  5. use App\Libs\SimpleSSDB;
  6. use Hyperf\Task\Annotation\Task;
  7. class SSDBTask
  8. {
  9. /**
  10. * @var SimpleSSDB
  11. */
  12. public $ss = null;
  13. public function exec($method,...$args)
  14. {
  15. $result = $this->client()->__call($method,$args);
  16. return $result;
  17. }
  18. public function execWithoutTask($method,...$args)
  19. {
  20. $result = $this->client()->__call($method,$args);
  21. return $result;
  22. }
  23. protected function client(){
  24. $ss = new SimpleSSDB(env('SSDB_HOST'), env('SSDB_PORT'));
  25. $ss->auth(env('SSDB_AUTH'));
  26. return $ss;
  27. }
  28. }