亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Laravel 作業(隊列)不起作用

Laravel 作業(隊列)不起作用

PHP
慕的地8271018 2021-11-05 14:37:38
我的一份工作 Laravel 有問題。(這是我第一次遇到這個問題,我有其他工作沒有問題......)我有一個監聽器在一個模型更新時調度工作,所以:一名模型觀察員(工作)觀察者發起的一項活動(工作)一個偵聽前一個事件的偵聽器(工作中)一個由聽眾派遣的工作(不工作......)作業已執行,但他轉到我數據庫中失敗的作業,并顯示錯誤“ErrorException: Undefined variable: ....” ...很奇怪,因為所有的變量都被定義了,為什么它兩次工作一次?如果有人對此有想法,我會接受:D提前致謝!工作代碼:<?phpnamespace App\Jobs;use Illuminate\Bus\Queueable;use Illuminate\Queue\SerializesModels;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;use App\Models\Transaction;use App\Repositories\TransactionRepository;use App\Repositories\InvoiceModelRepository;use App\Repositories\BalanceRepository;use Scheme;use Log;use Config;use App\Helpers\HelperNumber;use Symfony\Component\Console\Output\ConsoleOutput;/*    sudo apt-get install supervisor    https://laravel.com/docs/5.4/queues#supervisor-configuration    php artisan queue:work --queue compute_fees --retry_after 30 --timeout 30*/class ComputeFees implements ShouldQueue{    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;    protected $id;    /**     * Create a new job instance.     *     * @param int $id     * @return void     */    public function __construct($id)    {        $this->id = $id;    }    /**     * Get the best match of invoice models     *     * @param \App\Models\Transaction $transaction     * @return \App\Models\InvoiceModel     */     private function getFees($transaction) {         $invoiceModelRepository = new InvoiceModelRepository();         //Get the fees for this site and payment type (And country if needed)         $params = [             'sites_id' => $transaction->site->id         ];          return $params;     }
查看完整描述

1 回答

?
縹緲止盈

TA貢獻2041條經驗 獲得超4個贊

我發現了這個問題,當你在你的工作中進行修改時,你總是需要重新啟動隊列......

所以執行:php artisan queue:restart每次你編輯你的工作。


查看完整回答
反對 回復 2021-11-05
  • 1 回答
  • 0 關注
  • 351 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號