HandleAlbumStatus.php
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class HandleAlbumStatus implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $callData = [];
/**
* Create a new job instance.
* @param array $callData
* @return void
*/
public function __construct(array $callData)
{
$this->callData = $callData;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//php artisan queue:work --queue=handle-album-status --tries=3 --sleep=3
$response_file = database_path('icms/album-status.notify');
file_put_contents($response_file,
'======接收回调数据在'.date('Y-m-n H:i:s').'======'. PHP_EOL
.var_export($this->callData,true). PHP_EOL,FILE_APPEND);
}
/**
* @param null $exception
*/
public function fail($exception = null)
{
//todo: Artisan创建任务失败记录表
}
}