ServeConfig.php
1.4 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
<?php
/**
* Created by PhpStorm.
* User: zhl
* Date: 2023/4/17
* Time: 10:04
*/
namespace App\Models;
/**
* 服务账户信息
* Class ServeConfig
* @package App\Models
*/
class ServeConfig extends Base
{
/**
* @var string
*/
protected $table = 'gl_server_config';
/**
* @var array
*/
protected $guarded = ['updated_at'];
/**
* 1:服务器, 2:MySQL, 3:Redis
*/
const TYPE_SERVER = 1;
const TYPE_MYSQL = 2;
const TYPE_REDIS = 3;
/**
* 用户名加密
* @param $value
*/
public function setUserAttribute($value)
{
$this->attributes['user'] = encrypt($value);
}
/**
* 密码加密
* @param $value
*/
public function setPasswordAttribute($value)
{
$this->attributes['password'] = encrypt($value);
}
/**
* 端口加密
* @param $value
*/
public function setPortAttribute($value)
{
$this->attributes['Port'] = encrypt($value);
}
/**
* @return mixed
*/
public function getUserAttribute()
{
return decrypt($this->user);
}
/**
* @return mixed
*/
public function getPasswordAttribute()
{
return decrypt($this->password);
}
/**
* @return mixed
*/
public function getPortAttribute()
{
return decrypt($this->port);
}
}