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

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. /**
  14. * @Task
  15. */
  16. public function exec($method,...$args)
  17. {
  18. $result = $this->client()->__call($method,$args);
  19. return $result;
  20. }
  21. public function execWithoutTask($method,...$args)
  22. {
  23. $result = $this->client()->__call($method,$args);
  24. return $result;
  25. }
  26. protected function client(){
  27. $ss = new SimpleSSDB(env('SSDB_HOST'), env('SSDB_PORT'));
  28. $ss->auth(env('SSDB_AUTH'));
  29. return $ss;
  30. }
  31. }