GscLogic.php
2.7 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
<?php
namespace App\Http\Logic\Aside\Optimize;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\DomainInfo;
use App\Models\Project\Gsc;
class GscLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new Gsc();
$this->param = $this->requestAll;
}
/**
* @remark :gsc账号列表
* @name :GscLists
* @author :lyh
* @method :post
* @time :2023/6/19 11:32
*/
public function GscLists($map,$page,$row,$order = 'created_at',$files = ['*']){
$lists = $this->model->lists($map,$page,$row,$order,$files);
if(!empty($lists['list'])){
$domainInfoModel = new DomainInfo();
foreach ($lists['list'] as $k => $v){
$lists['list'][$k]['tal'] = $domainInfoModel->formatQuery(['gsc_id'=>$v['id']])->count();
$lists['list'][$k]['pub'] = $domainInfoModel->formatQuery(['gsc_id'=>$v['id'],'status'=>$domainInfoModel::STATUS_TRUE])->count();
$lists['list'][$k]['num'] = $lists['list'][$k]['tal'] - $lists['list'][$k]['pub'];
}
}
return $this->success($lists);
}
/**
* @remark :gsc账号审核域名列表
* @name :DomainLists
* @author :lyh
* @method :post
* @time :2023/6/19 15:56
*/
public function DomainLists($map,$page,$row,$order = 'created_at',$files = ['*']){
$domainInfoModel = new DomainInfo();
$lists = $domainInfoModel->lists($map,$page,$row,$order,$files);
return $this->success($lists);
}
/**
* @remark :gsc账户详情
* @name :GscRead
* @author :lyh
* @method :post
* @time :2023/6/19 17:07
*/
public function GscRead(){
$info = $this->model->read($this->param);
return $this->success($info);
}
/**
* @remark :更新账号列表
* @name :save
* @author :lyh
* @method :post
* @time :2023/6/19 16:21
*/
public function GscSave(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$rs = $this->model->add($this->param);
}
if($rs === false){
$this->fail('error');
}
return $this->success();
}
/**
* @remark :删除账号列表
* @name :del
* @author :lyh
* @method :post
* @time :2023/6/19 16:31
*/
public function GscDel(){
$this->param['id'] = ['in',$this->param['id']];
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
}