12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace app\utils;
- use think\Env;
- use think\Queue as BaseQueue;
- /**
- * 杂项工具方法
- * Class Common
- * @package App\Utils
- */
- class Queue
- {
- /**
- * 投递队列
- * @param $job
- * @param $data
- * @param int $delay
- * @return mixed
- */
- public static function work($job,$data,int $delay = 0)
- {
- // $prefix = Env::get('redis.REDIS_PREFIX', 'panda:');
- // $prefix = str_replace(':','',$prefix);
- $prefix = '';
- if ($delay > 0){
- $queue = BaseQueue::later($delay,$job,$data,$prefix);
- }else{
- $queue = BaseQueue::push($job,$data,$prefix);
- }
- return $queue;
- }
- }
|