ServerInformation.php
2.0 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
<?php
namespace App\Models\Devops;
use Illuminate\Database\Eloquent\Model;
class ServerInformation extends Model
{
protected $table = 'gl_server_information';
const CREATED_AT = 'create_at';
const UPDATED_AT = 'update_at';
// 软删除 0:正常 1:删除
const DELETED_NORMAL = 0;
const DELETED_DELETE = 1;
/**
* @param $num
*
* @return string
*/
public function Service($num)
{
return $this->ServiceArray()[$num];
}
/**
* @return array
*/
public function ServiceArray()
{
return [
1 => '阿里云',
2 => '腾讯云',
3 => 'linode',
4 => '尊云',
5 => '互联',
6 => '其他',
7 => 'Ramnode',
8 => 'CN2-SSD美国',
9 => '国内测试服务器',
];
}
/**
* 字段信息
* @return array
*/
public function FieldsArray()
{
return [
'type' => '服务器类型',
'ip' => '服务器IP',
'title' => '服务器标题',
'belong_to' => '服务器归属',
'sshpass' => 'SSH 密码',
'ports' => 'SSH 端口',
'other' => '其他信息 json格式',
];
}
/**
* 服务器归属信息
* @return array
*/
public function BelongToArray()
{
return [
1 => '公司',
2 => '客户',
];
}
public function BelongTo($num)
{
return $this->BelongToArray()[$num];
}
/**
* 返回服务器类型
* @param $value
*
* @return string
*/
public function getTypeAttribute($value)
{
return $this->Service($value);
}
/**
* 返回服务器归属
* @param $value
*
* @return string
*/
public function getBelongToAttribute($value)
{
return $this->BelongTo($value);
}
}