|
...
|
...
|
@@ -52,41 +52,21 @@ class InquiryInfoLogic extends BaseLogic |
|
|
|
* @time :2023/7/12 9:22
|
|
|
|
*/
|
|
|
|
public function inquirySave(){
|
|
|
|
try {
|
|
|
|
$this->inquiryInfoSave();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->param['user_id'] = $this->manager['id'];
|
|
|
|
$this->param['user_name'] = $this->manager['name'];
|
|
|
|
$this->param['send_time'] = date('Y-m-d H:i:s',time() + $this->param['delay'] * 60 * 60) ;
|
|
|
|
$xp_id = $this->model->insertGetId($this->param);
|
|
|
|
if(!$xp_id){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
//延时时间为0时,询盘转发
|
|
|
|
if($this->param['delay'] == 0){
|
|
|
|
$this->forwardTime($xp_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存询盘记录表
|
|
|
|
* @name :inquiryInfoSave
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/12 11:12
|
|
|
|
*/
|
|
|
|
public function inquiryInfoSave(){
|
|
|
|
//组装数据
|
|
|
|
$param = [
|
|
|
|
'name'=>$this->param['name'],
|
|
|
|
'email'=>$this->param['email'],
|
|
|
|
'phone'=>$this->param['phone'],
|
|
|
|
'ip'=>$this->param['ip'],
|
|
|
|
'ip_area'=>$this->param['ip_area'],
|
|
|
|
'message'=>$this->param['message'],
|
|
|
|
'type'=>$this->param['type'],
|
|
|
|
'user_id'=>$this->manager['id'],
|
|
|
|
'user_name'=>$this->manager['name'],
|
|
|
|
'forward_url'=>$this->param['forward_url'],
|
|
|
|
'delay'=>$this->param['delay'],
|
|
|
|
];
|
|
|
|
return $this->model->add($param);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :逻辑删除
|
|
|
|
* @name :inquiryInfoDel
|
|
...
|
...
|
@@ -167,32 +147,24 @@ class InquiryInfoLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/13 17:39
|
|
|
|
*/
|
|
|
|
public function forwardTime($param){
|
|
|
|
public function forwardTime($xp_id){
|
|
|
|
$data = [];
|
|
|
|
//获取数据详情
|
|
|
|
$param = $this->model->read(['id'=>$xp_id]);
|
|
|
|
if($param['delay'] == 0){
|
|
|
|
$data = $param;
|
|
|
|
$arr_url = explode(',',$param['forward_url']);
|
|
|
|
foreach ($arr_url as $v){
|
|
|
|
$param['url'] = $v;
|
|
|
|
$this->inquiryForward($param);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
// 获取执行时间
|
|
|
|
$scheduledTime = date('Y-m-d H:i:s',time() + $this->param['delay'] * 60 * 60);
|
|
|
|
$schedule = new Schedule;
|
|
|
|
// 定义定时任务
|
|
|
|
$schedule->call(function () use ($param) {
|
|
|
|
// 任务执行的代码
|
|
|
|
$arr_url = explode(',',$param['forward_url']);
|
|
|
|
foreach ($arr_url as $v){
|
|
|
|
$param['url'] = $v;
|
|
|
|
$this->inquiryForward($param);
|
|
|
|
$data['url'] = $v;
|
|
|
|
$this->inquiryForward($data);
|
|
|
|
}
|
|
|
|
//更新数据库,修改状态为已转发
|
|
|
|
$rs = $this->model->edit(['status'=>3],['id'=>$xp_id]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
})->cron($scheduledTime);
|
|
|
|
// 获取任务调度的命令行参数
|
|
|
|
$parameters = $schedule->dueEvents($schedule->events());
|
|
|
|
// 执行命令行任务
|
|
|
|
Artisan::call($parameters);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|