作者 赵彬吉

update

... ... @@ -352,7 +352,7 @@ class RelayInquiry extends Command
// 随机访问1-6个页面
$deep = rand(1,6);
if($deep > 2) {
$visit_urls = Arr::random($all_urls, rand(1, count($all_urls) > 3 ? 3 : count($all_urls)));
$visit_urls = Arr::random($all_urls, rand(1, count($all_urls) > 4 ? 4 : count($all_urls)));
$urls = array_merge($urls, $visit_urls);
}
if($deep > 1) {
... ...
... ... @@ -8,6 +8,7 @@ use App\Models\Inquiry\ReInquiryForm;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;
/**
* Class postInquiry
... ... @@ -50,6 +51,18 @@ class postInquiry extends Command
}
// 询盘数据入库
foreach ($list as $key => $val) {
//加个锁 避免重复执行
$lockKey = 're_inquiry_detail_log_lock_' . $val->id;
if(!Redis::setnx($lockKey, 1)){
continue;
}
Redis::expire($lockKey, 60);
$log = ReInquiryDetailLog::find($val->id);
if($log->status != ReInquiryDetailLog::STATUS_INIT){
continue;
}
$this->output('开始执行' . $val->id);
try {
$detail = ReInquiryDetail::find($val['detail_id']);
... ...