GeoLinkLogic.php
2.6 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
<?php
/**
* @remark :
* @name :GeoLinkLogic.php
* @author :lyh
* @method :post
* @time :2025/7/14 16:20
*/
namespace App\Http\Logic\Aside\Geo;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoLink;
/**
* @remark :geo权威新闻(链接数据)
* @name :GeoLinkLogic
* @author :lyh
* @method :post
* @time :2025/7/14 16:20
*/
class GeoLinkLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new GeoLink();
}
/**
* @remark :获取权威新闻链接数据
* @name :getLinkList
* @author :lyh
* @method :post
* @time :2025/7/14 16:47
*/
public function getLinkList($map = [],$page = 1,$row = 20,$order = 'id'){
$filed = ['*'];
if(isset($map['url']) && !empty($map['url'])){
$map['url'] = ['like','%'.$map['url'].'%'];
}
$lists = $this->model->lists($map,$page,$row,$order,$filed);
return $this->success($lists);
}
/**
* @remark :获取链接数据详情
* @name :getLinkInfo
* @author :lyh
* @method :post
* @time :2025/7/14 16:51
*/
public function getLinkInfo(){
$info = $this->model->read($this->param);
if($info === false){
$this->fail('当前数据不存在或者已被删除');
}
return $this->success($info);
}
/**
* @remark :保存链接数据
* @name :saveLink
* @author :lyh
* @method :post
* @time :2025/7/14 16:50
*/
public function saveLink(){
try {
if(!empty($this->param['data'])){
$data = [];
foreach ($this->param['data'] as $item){
$data[] = [
'project_id'=>$this->param['project_id'],
'da'=>$item['da'] ?? 0,
'url'=>$item['url'],
'send_time'=>$item['send_time']
];
}
$this->model->insertAll($data);
}
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
return $this->success();
}
/**
* @remark :删除数据
* @name :delLink
* @author :lyh
* @method :post
* @time :2025/7/14 16:51
*/
public function delLink(){
try {
$this->model->del(['id'=>['in',$this->param['ids']]]);
}catch (\Exception $e){
$this->fail('删除失败,请联系管理员.');
}
return $this->success();
}
}