GeoLinkController.php
3.9 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
/**
* @remark :
* @name :GeoLinkController.php
* @author :lyh
* @method :post
* @time :2025/7/14 16:17
*/
namespace App\Http\Controllers\Aside\Geo;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Geo\GeoLinkLogic;
use App\Models\Geo\GeoLink;
use App\Models\Geo\GeoQuestionResult;
use Illuminate\Http\Request;
/**
* @remark :geo权威新闻(链接数据)
* @name :GeoLinkController
* @author :lyh
* @method :post
* @time :2025/7/14 16:18
*/
class GeoLinkController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new GeoLinkLogic();
}
/**
* @remark :获取链接数据列表
* @name :lists
* @author :lyh
* @method :post
* @time :2025/7/15 9:14
*/
public function lists(){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => '项目ID不能为空',
]);
$lists = $this->logic->getLinkList($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :获取数据详情
* @name :info
* @author :lyh
* @method :post
* @time :2025/7/15 9:15
*/
public function info(){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$data = $this->logic->getLinkInfo();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2025/7/15 9:17
*/
public function save(){
$this->request->validate([
'project_id'=>'required',
'data'=>'required|array'
],[
'project_id.required' => '项目ID不能为空',
'data.required' => '数据详情不能为空',
'data.array' => '数据详情为数组',
]);
$data = $this->logic->saveLink();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除数据
* @name :del
* @author :lyh
* @method :post
* @time :2025/7/15 9:17
*/
public function del(){
$this->request->validate([
'ids'=>'required|array',
],[
'ids.required' => 'IDs不能为空',
'ids.array' => '数据详情为数组',
]);
$data = $this->logic->delLink();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :下载geo链接
* @name :downloadGeoLink
* @author :lyh
* @method :post
* @time :2025/9/18 11:50
*/
public function downloadGeoLink()
{
$data = [];
$geoResultModel = new GeoQuestionResult();
$lists = $geoResultModel->list(['project_id'=>$this->param['project_id']]);
foreach ($lists as $item) {
if(!empty($item['url_num'])){
foreach ($item['url_num'] as $key=>$val) {
if(!isset( $data[$key][$item['platform']])){
$data[$key][$item['platform']] = $val;
}else{
$data[$key][$item['platform']] += $val;
}
}
}
}
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :执行da值返回数据
* @name :daResultData
* @author :lyh
* @method :post
* @time :2025/10/9 09:39
*/
public function daResultData(){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$data = $this->logic->daResultData();
$this->response('success',Code::SUCCESS,$data);
}
}