UpgradeStatus.php
2.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
<?php
namespace domain\upgrade;
/**
* 版本发布状态
* Class UpgradeStatus
* @package domain\upgrade
*/
class UpgradeStatus
{
/**
* 发布状态
*/
const STATUS_ON = 1; // 已发布
const STATUS_WAIT = 0; // 未发布
/**
* 是否强制升级
*/
const FOCUSE_NO = 1; // 不强制升级
const FOCUSE_YES = 2; // 强制升级
/**
* 版本类型
*/
const TYPE_APP = 1; // app类升级
const TYPE_OTA = 2; // OTA整包升级
/**
* 升级类型
*/
const PACKAGE_TYPE_ALL = 1; // 全量升级
const PACKAGE_TYPE_PART = 2; // 增量升级
/**
* 同步OSS状态
*/
const OSS_UPLOAD_WAIT = 1; // 等待同步OSS
const OSS_UPLOAD_SUCCESS = 2; // 同步OSS成功
/**
* @return array
*/
public static function statusLabels()
{
return [
self::STATUS_WAIT => '未发布',
self::STATUS_ON => '已发布',
];
}
/**
* @param string $status
* @return mixed|string
*/
public static function statusLabel($status = null)
{
$statusLabels = self::statusLabels();
return isset($statusLabels[$status]) ? $statusLabels[$status] : '';
}
/**
* @return array
*/
public static function focuseLabels()
{
return [
self::FOCUSE_NO => '正常升级',
self::FOCUSE_YES => '强制升级'
];
}
/**
* @param string $status
* @return mixed|string
*/
public static function focuseLabel($status = null)
{
$focuseLabels = self::focuseLabels();
return isset($focuseLabels[$status]) ? $focuseLabels[$status] : '';
}
/**
* 获取所有的升级类型
* @return array
*/
public static function packageTypeLabels()
{
return [
self::PACKAGE_TYPE_ALL => '全量升级',
self::PACKAGE_TYPE_PART => '增量升级'
];
}
/**
* 获取指定的升级类型
* @param string $type
* @return mixed|string
*/
public static function packageTypeLabel($type = null)
{
$packageTypeLabels = self::packageTypeLabels();
return isset($packageTypeLabels[$type]) ? $packageTypeLabels[$type] : '';
}
}