ProjectsLogic.php
2.4 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
namespace App\Http\Logic\Aside\Projects;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Projects\Projects;
/**
* @remark :谷歌流量系统统计表
* @class :ProjectsLogic.php
* @author :lyh
* @time :2023/7/11 9:54
*/
class ProjectsLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new Projects();
}
/**
* @remark :获取列表
* @name :projectsLists
* @author :lyh
* @method :post
* @time :2023/7/11 9:56
*/
public function projectsLists($map,$page,$row,$order = 'id',$filed = ['*']){
$lists = $this->model->lists($map,$page,$row,$order,$filed);
return $this->success($lists);
}
/**
* @remark :更新
* @name :projectsSave
* @author :lyh
* @method :post
* @time :2023/7/11 10:05
*/
public function projectsSave(){
//参数处理
$this->param = $this->verifyParam($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['created_at'] = date('Y-m-d H:i:s');
$rs = $this->model->insert($this->param);
}
if($rs === false){
$this->fail('error');
}
return $this->success();
}
/**
* @remark :参数处理
* @name :verifyParam
* @author :lyh
* @method :post
* @time :2023/7/18 10:46
*/
public function verifyParam($param){
$param['set_country'] = json_encode(explode(',', $param['set_country']));
$param['set_ban_country'] = json_encode(explode(',', $param['set_ban_country']));
$param['set_page_percent'] = json_encode($param['set_page_percent']);
$param['set_device'] = json_encode($param['set_device']);
$param['set_referer'] = json_encode($param['set_referer']);
$param['set_depth'] = json_encode($param['set_depth']);
$param['time_sleep'] = [3,5];//TODO::已弃用
return $param;
}
/**
* @remark :删除
* @name :projectsDel
* @author :lyh
* @method :post
* @time :2023/7/11 10:07
*/
public function projectsDel(){
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
}