ServersLogic.php
1.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
<?php
/**
* @remark :
* @name :ServersLogic.php
* @author :lyh
* @method :post
* @time :2024/6/24 16:19
*/
namespace App\Http\Logic\Aside\Devops;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Devops\Servers;
use App\Utils\EncryptUtils;
class ServersLogic extends BaseLogic
{
/**
* 数据初始化
*/
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new Servers();
}
/**
* @remark :获取信息
* @name :getServiceConfig
* @author :lyh
* @method :post
* @time :2024/6/24 17:05
*/
public function infoServers(){
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$this->fail('当前数据不存在或者被删除');
}
return $this->success($info);
}
/**
* @remark :保存数据
* @name :saveServers
* @author :lyh
* @method :post
* @time :2024/6/24 16:33
*/
public function saveServers(){
$encrypt = new EncryptUtils();
$this->param['account'] = $encrypt->lock_url($this->param['account']);
$this->param['password'] = $encrypt->lock_url($this->param['password']);
$this->param['port'] = $encrypt->lock_url($this->param['port']);
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
$id = $this->model->addReturnId($this->param);
}
return $this->success(['id'=>$id]);
}
}