最近发表的话题
最近发表的评论
  • 队列处理器一直执行? at 1个月前

    @leo

    [2019-01-09 10:04:56] Processed: App\Listeners\UpdateProductRating

    老师,我在执行队列处理器之后执行成功过一次,成功之后这个监听器一直自动触发。
    执行成功之后不是应该停止了吗,为啥他自己一直自动触发?
    我为了避免写错,全是复制您的代码;

  • 队列处理器一直执行? at 1个月前

    @leo

    Call to a member function items() on null

    错误信息显示是 $items = $event->getOrder()->items()->with(['product'])->get();
    这行代码

    我在 Order 模型文件里已经设置 items() hasMany 了

    附上日志里的报错信息

    [2019-01-09 07:50:22] local.ERROR: Call to a member function items() on null {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Call to a member function items() on null at /home/vagrant/code/laravel-shop/app/Listeners/UpdateProductRating.php:17)
    [stacktrace]

    0 [internal function]: App\Listeners\UpdateProductRating->handle(Object(App\Events\OrderReviewed))

    1 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Events/CallQueuedListener.php(86): call_user_func_array(Array, Array)

    2 [internal function]: Illuminate\Events\CallQueuedListener->handle(Object(Illuminate\Foundation\Application))

    3 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)

    4 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()

    5 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))

    6 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)

    7 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)

    8 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(114): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Illuminate\Events\CallQueuedListener))

    9 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Events\CallQueuedListener))

    10 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))

    11 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(49): Illuminate\Bus\Dispatcher->dispatchNow(Object(Illuminate\Events\CallQueuedListener), false)

    12 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(76): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)

    13 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(320): Illuminate\Queue\Jobs\Job->fire()

    14 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(270): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions))

    15 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(114): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Illuminate\Queue\WorkerOptions))

    16 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('redis', 'default', Object(Illuminate\Queue\WorkerOptions))

    17 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default')

    18 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()

    19 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)

    20 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()

    21 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))

    22 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)

    23 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)

    24 /home/vagrant/code/laravel-shop/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

    25 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

    26 /home/vagrant/code/laravel-shop/vendor/symfony/console/Application.php(946): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    27 /home/vagrant/code/laravel-shop/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    28 /home/vagrant/code/laravel-shop/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    29 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Console/Application.php(88): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    30 /home/vagrant/code/laravel-shop/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    31 /home/vagrant/code/laravel-shop/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    32 {main}

    "}

  • 队列处理器一直执行? at 1个月前

    @leo

    用 git 回滚到上个版本后,
    执行 php artisan queue:work 还是一直 Processing: App\Listeners\UpdateProductRating
    回滚之后已经没有这个文件了啊,也清空缓存了

    另外,老师我不清楚在命令行怎么 看 Laravel 日志,能讲一下吗,谢谢

  • Please provide a valid cache path. at 2个月前

    @leo 谢谢老师 git status 发现误删了 ./storage/framework 目录