|
@@ -8,6 +8,7 @@ use App\Models\Inquiry\ReInquiryForm; |
|
@@ -8,6 +8,7 @@ use App\Models\Inquiry\ReInquiryForm; |
|
8
|
use Illuminate\Console\Command;
|
8
|
use Illuminate\Console\Command;
|
|
9
|
use Illuminate\Support\Facades\Http;
|
9
|
use Illuminate\Support\Facades\Http;
|
|
10
|
use Illuminate\Support\Facades\Log;
|
10
|
use Illuminate\Support\Facades\Log;
|
|
|
|
11
|
+use Illuminate\Support\Facades\Redis;
|
|
11
|
|
12
|
|
|
12
|
/**
|
13
|
/**
|
|
13
|
* Class postInquiry
|
14
|
* Class postInquiry
|
|
@@ -50,6 +51,18 @@ class postInquiry extends Command |
|
@@ -50,6 +51,18 @@ class postInquiry extends Command |
|
50
|
}
|
51
|
}
|
|
51
|
// 询盘数据入库
|
52
|
// 询盘数据入库
|
|
52
|
foreach ($list as $key => $val) {
|
53
|
foreach ($list as $key => $val) {
|
|
|
|
54
|
+ //加个锁 避免重复执行
|
|
|
|
55
|
+ $lockKey = 're_inquiry_detail_log_lock_' . $val->id;
|
|
|
|
56
|
+ if(!Redis::setnx($lockKey, 1)){
|
|
|
|
57
|
+ continue;
|
|
|
|
58
|
+ }
|
|
|
|
59
|
+ Redis::expire($lockKey, 60);
|
|
|
|
60
|
+
|
|
|
|
61
|
+ $log = ReInquiryDetailLog::find($val->id);
|
|
|
|
62
|
+ if($log->status != ReInquiryDetailLog::STATUS_INIT){
|
|
|
|
63
|
+ continue;
|
|
|
|
64
|
+ }
|
|
|
|
65
|
+
|
|
53
|
$this->output('开始执行' . $val->id);
|
66
|
$this->output('开始执行' . $val->id);
|
|
54
|
try {
|
67
|
try {
|
|
55
|
$detail = ReInquiryDetail::find($val['detail_id']);
|
68
|
$detail = ReInquiryDetail::find($val['detail_id']);
|