123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Jobs\Cron;
- use App\Services\Common\SmsService;
- use Illuminate\Bus\Queueable;
- use Illuminate\Queue\SerializesModels;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Support\Facades\Log;
- class DemoJob implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct()
- {
- //
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle(SmsService $smsService)
- {
- //可以在这个方法里使用依赖注入.
- Log::info("定时任务开始:");
- //ToDo
- Log::info("定时任务结束.");
- }
- }
|