本文整理汇总了PHP中Queue::createTask方法的典型用法代码示例。如果您正苦于以下问题:PHP Queue::createTask方法的具体用法?PHP Queue::createTask怎么用?PHP Queue::createTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue::createTask方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView()
{
$services = Service::model()->findAllByAttributes(['status' => 0]);
$task = [];
$url = $this->app->createUrl('api/view');
foreach ($services as $service) {
$task[] = Queue::createTask($url, $service->uid);
}
if (Queue::enqueue($task, true)) {
echo "Success";
} else {
echo "Failed";
}
}
示例2: run
public function run()
{
$uid = $this->request->getQuery('id', 0);
$service = Service::model()->findByPk($uid);
if (!empty($service)) {
if (in_array($service->status, [1, 2])) {
// 不可用状态
$task = Queue::createTask($this->app->createUrl('api/open'), $uid);
} else {
$task = Queue::createTask($this->app->createUrl('api/close'), $uid);
}
if (Queue::enqueue($task)) {
$this->response(200, ':) success');
} else {
$this->response(200, ':( failure');
}
} else {
$this->response(404, 'Not Found');
}
}
示例3: actionDashboard
public function actionDashboard()
{
$service = Service::model()->with('user')->findByPk($this->user->getId());
if (($post = $this->request->getPost('Service', false)) != false) {
$service->rules = $post['rules'];
if ($service->save()) {
$task = Queue::createTask($this->createUrl('api/pac'), $service->uid);
Queue::enqueue($task);
}
}
$this->render('dashboard', ['service' => $service]);
}
示例4: apiReset
public static function apiReset($uid)
{
$url = Yii::app()->createurl('api/reset');
$task = Queue::createTask($url, $uid, 'api/close');
Queue::enqueue($task);
}
示例5: postAction
private function postAction($uid, $currentAction, $postAction = false)
{
$action = $this->request->getPost('postAction', false);
if ($action == $currentAction) {
$url = Yii::app()->createUrl($action);
$task = Queue::createTask($url, $uid, $postAction);
Queue::enqueue($task);
}
}