首頁  >  問答  >  主體

Laravel任務調度

最近再用Laravel做計劃任務,寫了一個計劃任務設定按每分鐘可以正常執行,然而改成小時卻不能按照預期執行。弄得我一臉懵逼。

protected function schedule(Schedule $schedule)
    {
        $schedule->call(function () {
            //DB::table('cms_articles')->delete();
            DB::update('update cms_articles set hit=hit + FLOOR(1 + (RAND() * 10)) where hit>1000');
            DB::update('update cms_articles set hit=hit + FLOOR(1 + (RAND() * 20)) where hit<1000');
        })->hourly();
    }
習慣沉默習慣沉默2712 天前575

全部回覆(1)我來回復

  • 伊谢尔伦

    伊谢尔伦2017-05-16 16:53:20

    要貼上具體的程式碼

    回覆
    0
  • 取消回覆