DomainInfoController.php
3.3 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
<?php
namespace App\Http\Controllers\Aside\Domain;
use App\Enums\Common\Code;
use App\Exceptions\AsideGlobalException;
use App\Exceptions\BsideGlobalException;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Domain\DomainInfoLogic;
use App\Http\Requests\Aside\Domain\DomainInfoRequest;
use App\Models\Aside\Domain\DomainInfo;
use App\Models\Aside\Domain\DomainInfoLog;
use Illuminate\Http\JsonResponse;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* Class DomainInfoController
* @package App\Http\Controllers\Aside 域名管理
*/
class DomainInfoController extends BaseController
{
/**
* 域名列表
* @param int $deleted
* @return JsonResponse
*/
public function lists()
{
$domainModel = new DomainInfo();
if(isset($this->map['domain']) && !empty($this->map['domain'])){
$this->map['domain'] = ['like','%'.$this->map['domain'],'%'];
}
$lists = $domainModel->lists($this->map,$this->page,$this->row,$this->order);
return $this->response('success', Code::SUCCESS, $lists);
}
/**
* @remark :保存域名
* @name :save
* @author :lyh
* @method :post
* @time :2023/8/1 15:36
*/
public function save(DomainInfoLogic $domainInfoLogic)
{
$this->verifyParam();
$domainInfoLogic->saveDomain();
$this->response('success');
}
/**
* @remark :验证字段
* @name :verifyParam
* @author :lyh
* @method :post
* @time :2023/8/1 15:32
*/
public function verifyParam(){
$this->request->validate([
'domain'=>'required',
'remark'=>'required',
'company'=>'required',
'belong_to'=>'required',
],[
'domain.required' => 'domain不能为空',
'remark.required' => '备注不能为空',
'company.required' => '所属项目不能为空',
'belong_to.required' => '域名不能为空'
]);
return true;
}
public function info(DomainInfoLogic $domainInfoLogic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'id不能为空',
]);
$info = $domainInfoLogic->infoDomain();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :修改状态
* @name :status
* @author :lyh
* @method :post
* @time :2023/8/1 15:47
*/
public function status(DomainInfoLogic $domainInfoLogic){
$this->request->validate([
'id'=>'required',
'status'=>'required'
],[
'id.required' => 'id不能为空',
'status.required' => 'id不能为空'
]);
$domainInfoLogic->editDomainStatus();
$this->response('success');
}
/**
* @remark :删除域名
* @name :del
* @author :lyh
* @method :post
* @time :2023/8/1 15:38
*/
public function del(DomainInfoLogic $domainInfoLogic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'id不能为空',
]);
$domainInfoLogic->delDomain();
$this->response('success');
}
}