DomainInfo.php
4.1 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
namespace App\Models\Aside\Domain;
use App\Models\Base;
/**
* Class DomainInfo
*
* @package App\Models\Aside\Domain
* @Author YiYuan-LIn
* @Date : 2019/5/16
* 域名信息模型
* @property int $id
* @property string|null $domain 域名
* @property string $belong_to 域名归属 1 - 公司 2 - 客户
* @property string $status 域名状态 0 - 正常 1 - 关闭
* @property string|null $domain_start_time 域名开始时间
* @property string|null $domain_end_time 域名结束时间
* @property string|null $certificate_start_time 证书开始时间
* @property string|null $certificate_end_time 证书结束时间
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property int|null $deleted 软删除 0 - 正常 1 - 软删除
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo query()
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereBelongTo($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereCertificateEndTime($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereCertificateStartTime($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereDeleted($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereDomain($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereDomainEndTime($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereDomainStartTime($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|DomainInfo whereUpdatedAt($value)
* @mixin \Eloquent
*/
class DomainInfo extends Base
{
protected $table = 'gl_domain_info';
// 软删除 0:正常 1:删除
/** @var int 软删除 - 正常 */
const DELETED_NORMAL = 0;
/** @var int 软删除 - 删除 */
const DELETED_DELETE = 1;
protected $hidden = [
'created_at',
'updated_at'
];
/**
* 字段信息
* @return array
*/
public function FieldsArray()
{
return [
'domain' => '域名',
'belong_to' => '域名归属',
'status' => '域名状态',
'domain_start_time' => '域名开始时间',
'domain_end_time' => '域名结束时间',
'certificate_start_time' => '证书开始时间',
'certificate_end_time' => '证书结束时间',
];
}
/**
* 域名归属信息
* @return array
*/
public function BelongToArray()
{
return [
1 => '公司',
2 => '客户',
];
}
public function BelongToStr($num)
{
return array_flip($this->BelongToArray())[$num];
}
public function BelongTo($num)
{
return $this->BelongToArray()[$num];
}
/**
* 域名状态信息
* @return array
*/
public function StatusToArray()
{
return [
0 => '未使用',
1 => '使用中',
];
}
public function StatusToStr($num)
{
return array_flip($this->StatusToArray())[$num];
}
/**
* 返回域名状态
* @param $num
*
* @return string
*/
public function StatusTo($num)
{
return $this->StatusToArray()[$num];
}
/**
* 返回服务器归属
* @param $value
*
* @return string
*/
public function getBelongToAttribute($value)
{
return $this->BelongTo($value);
}
/**
* 返回服务器状态
* @param $value
*
* @return string
*/
public function getStatusAttribute($value)
{
return $this->StatusTo($value);
}
}