ProjectsController.php
3.8 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
namespace App\Http\Controllers\Aside\Optimize;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Optimize\ProjectsLogic;
/**
* @remark :谷歌流量系统
* @class :ProjectsController.php
* @author :lyh
* @time :2023/7/11 9:46
*/
class ProjectsController extends BaseController
{
/**
* @remark :流量系统列表
* @name :lists
* @author :lyh
* @method :post
* @time :2023/7/11 9:52
*/
public function lists(ProjectsLogic $projectsLogic){
//域名搜索
if(isset($this->map['domain']) && !empty($this->map['domain'])){
$this->map['domain'] = ['like','%'.$this->map['domain'].'%'];
}
$lists = $projectsLogic->projectsLists($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :编辑谷歌流量系统
* @name :save
* @author :lyh
* @method :post
* @time :2023/7/11 9:53
*/
public function save(ProjectsLogic $projectsLogic){
//参数验证
$this->verifyParam();
$projectsLogic->projectsSave();
$this->response('success');
}
/**
* @remark :参数验证
* @name :verifyParam
* @author :lyh
* @method :post
* @time :2023/7/18 10:19
*/
public function verifyParam(){
$this->request->validate([
'domain'=>'required',//域名
'switch'=>'required',//开关 默认:1
'custom'=>'required',//自建站 默认:1
'start_date'=>'required',//推广日期
'set_country'=>'required',//主推国家
'set_ban_country'=>'required',//屏蔽国家
'set_page_percent'=>'required',//页面占比 默认:首页 0.1 产品 0.25 关键词 0.4 分类 0.25
'set_device'=>'required',//设备占比 默认0.7 0.3
'set_referer'=>'required',//来源占比 默认0.7 0.3
'set_depth'=>'required',//深度占比 默认 0.7 0.15 0.1 0.05
'ips_b'=>'required',//IP初始值 默认50
'seo_type'=>'required',//引流方式 1:api 2:浏览器
],[
'domain.required' => '域名不能为空',
'switch.required' => '开关不能为空',
'custom.required' => '自建站不能为空',
'start_date.required' => '推广日期不能为空',
'set_country.required' => '主推国家不能为空',
'set_ban_country.required' => '屏蔽国家不能为空',
'set_page_percent.required' => '页面占比不能为空',
'set_device.required' => '设备占比不能为空',
'set_referer.required' => '来源占比不能为空',
'set_depth.required' => '深度占比不能为空',
'ips_b.required' => 'IP初始值不能为空',
'seo_type.required' => '引流方式不能为空',
]);
}
/**
* @remark :删除记录
* @name :del
* @author :lyh
* @method :post
* @time :2023/7/11 9:53
*/
public function del(ProjectsLogic $projectsLogic){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$projectsLogic->projectsDel();
$this->response('success');
}
/**
* @remark :获取国家
* @name :getCountry
* @author :lyh
* @method :post
* @time :2023/7/18 11:08
*/
public function getCountry(ProjectsLogic $projectsLogic){
if(isset($this->map['cname']) && !empty( $this->map['cname'])){
$this->map['cname'] = ['like','%'.$this->map['cname'].'%'];
}
$lists = $projectsLogic->getCountryList($this->map);
$this->response('success',Code::SUCCESS,$lists);
}
}