Skip to content

Commit

Permalink
修正 并 添加助手函数
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwuxin committed Dec 1, 2016
1 parent 9a9d5e0 commit 5896e94
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
21 changes: 20 additions & 1 deletion src/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,23 @@
"think\\queue\\command\\Restart",
"think\\queue\\command\\Listen",
"think\\queue\\command\\Subscribe"
]);
]);

if (!function_exists('queue')) {

/**
* 添加到队列
* @param $job
* @param string $data
* @param int $delay
* @param null $queue
*/
function queue($job, $data = '', $delay = 0, $queue = null)
{
if ($delay > 0) {
\think\Queue::later($delay, $job, $data, $queue);
} else {
\think\Queue::push($job, $data, $queue);
}
}
}
2 changes: 1 addition & 1 deletion src/queue/Queueable.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait Queueable
* @param $queue
* @return $this
*/
public function onQueue($queue)
public function queue($queue)
{
$this->queue = $queue;

Expand Down
1 change: 1 addition & 0 deletions src/queue/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Exception;
use think\Hook;
use think\Queue;

class Worker
{
Expand Down

0 comments on commit 5896e94

Please sign in to comment.