VisitLogic.php
2.3 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
namespace App\Http\Logic\Bside\Visit;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Visit\Visit;
use App\Models\Visit\VisitItem;
/**
* Class VisitLogic
* @package App\Http\Logic\Bside
* @author zbj
* @date 2023/5/22
*/
class VisitLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new Visit();
}
public function getVisitList($map,$page,$row,$order,$filed = ['*'])
{
// $map['domain'] = $this->user['domain'];
if(isset($map['is_inquiry']) && ($map['is_inquiry'] == 0)){
unset($map['is_inquiry']);
}
$lists = $this->model->lists($map,$page,$row,$order,$filed);
return $this->success($lists);
}
public function getItemList(){
$this->model = new VisitItem();
if(isset($this->param['id']) && !empty($this->param['id'])){
$map = [
'customer_visit_id' => $this->param['id'],
];
}
$data = $this->model->lists($map ?? [], $this->param['page'] ?? 1,$this->param['row'] ?? 20);
return $this->success($data);
}
/**
* @remark :导出数据
* @name :downloadItem
* @author :lyh
* @method :post
* @time :2024/5/6 16:39
*/
public function downloadItem($map,$page,$row,$order,$filed = ['id','depth','created_at','referrer_url','url','device_port','country','ip']){
$lists = $this->model->lists($map,$page,$row,$order,$filed);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $v){
$customer_visit_id[] = $v['id'];
}
$itemModel = new VisitItem();
$itemList = $itemModel->list(['customer_visit_id'=>['in',$customer_visit_id]],['customer_visit_id','url']);
foreach ($lists['list'] as $key => $value){
$sub = [];
foreach ($itemList as $sonValue){
if($value['id'] == $sonValue['customer_visit_id']){
$sub[] = $sonValue;
}
}
$value['sub'] = $sub;
$lists['list'][$key] = $value;
}
}
return $this->success($lists);
}
}