|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands\DayCount;
|
|
|
|
|
|
|
|
use App\Models\Inquiry\InquiryInfo;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
|
|
* @class :InquiryDelay.php
|
|
|
|
* @author :lyh
|
|
|
|
* @time :2023/7/14 10:16
|
|
|
|
*/
|
|
|
|
class InquiryDelay extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'inquiry_delay';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = '延时询盘转发(暂时弃用)';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :延时询盘转发
|
|
|
|
* @name :handle
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/14 10:17
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
$inquiryInfoModel = new InquiryInfo();
|
|
|
|
$param = $inquiryInfoModel->formatQuery(['status'=>$inquiryInfoModel::STATUS_FOUR])->orderBy('send_time','asc')->first();
|
|
|
|
if(!empty($param)){
|
|
|
|
$time = date('Y-m-d H:i:s');
|
|
|
|
if($time >= $param['send_time']){
|
|
|
|
$data = [];
|
|
|
|
//TODO::处理转发的url
|
|
|
|
$arr_url = explode(',',$param['forward_url']);
|
|
|
|
foreach ($arr_url as $v){
|
|
|
|
$data['url'] = $v;
|
|
|
|
$this->inquiryForward($data);
|
|
|
|
}
|
|
|
|
$inquiryInfoModel->edit(['status'=>$inquiryInfoModel::STATUS_THREE],['id'=>$param['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :询盘转发
|
|
|
|
* @name :inquiryForward
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/13 14:39
|
|
|
|
*/
|
|
|
|
public function inquiryForward($post_data){
|
|
|
|
$url = 'https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f';
|
|
|
|
$post_data_new = [];
|
|
|
|
$post_data_new['refer'] = $post_data['url'];
|
|
|
|
$post_data_new['name'] = $post_data['name'];
|
|
|
|
$post_data_new['email'] = $post_data['email'];
|
|
|
|
$post_data_new['phone'] = $post_data['phone'];
|
|
|
|
$post_data_new['ip'] = $post_data['ip'];
|
|
|
|
$post_data_new['message'] = $post_data['message'];
|
|
|
|
$post_data_new['submit_time'] = date('Y-m-d H:i:s',time()+20);
|
|
|
|
$token = md5($post_data_new['refer'].$post_data_new['name'].$post_data_new['ip'].date("Y-m-d",time()));
|
|
|
|
$post_data_new['token'] = $token;
|
|
|
|
$header = array(
|
|
|
|
'CLIENT-IP: '.$post_data['ip'],
|
|
|
|
'X-FORWARDED-FOR: '.$post_data['ip']
|
|
|
|
);
|
|
|
|
return http_post($url,$post_data_new,$header);
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|