index.php
14 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<?php
use yii\helpers\Url;
use app\ht\widgets\LinkPager;
use domain\upgrade\UpgradeStatus;
$this->title = '版本管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
.table > tbody > tr > td
{
border: white 0px solid;
border-top: solid 1px #fff;
border-bottom: 1px solid #fff;
}
.table{
margin-bottom: 0px!important;
}
</style>
<div class="panel panel-default">
<div class="panel-body">
<form action="" method="get" id="search-form" class="filter-form">
<table width="100%" class="table">
<tbody>
<tr >
<td width="10%" class="text-right">APP版本号</td>
<td width="20%" class="text-left">
<input type="text" class="form-control" name="version" placeholder="输入APP版本号" value="<?php if (!empty($gets['version'])){ echo $gets['version']; } ?>">
</td>
<td width="10%" class="text-right">发布状态:</td>
<td width="20%" class="text-left">
<select class="form-control" id="status" name="status">
<option>全部</option>
<option value="-1" <?php if (isset($gets['status']) && $gets['status'] == -1){ echo "selected"; } ?>>未发布</option>
<option value="1" <?php if (isset($gets['status']) && $gets['status'] == 1){ echo "selected"; } ?>>已发布</option>
</select>
</td>
<td width="10%" class="text-right">发布时间:</td>
<td width="20%" class="text-left">
<div class="form-inline">
<input type="date" class="form-control" style="width: 150px;" name="creatTime" placeholder="起" value="<?php if (!empty($gets['creatTime'])){ echo $gets['creatTime']; } ?>"> -
<input type="date" class="form-control" style="width: 150px;" name="endTime" placeholder="止" value="<?php if (!empty($gets['endTime'])){ echo $gets['endTime']; } ?>">
</div>
</td>
</tr>
<tr class="search">
<td colspan="6" class="text-center">
<input type="hidden" id="versionType" name="type" value="<?= (isset($gets["type"]) ? $gets["type"] : UpgradeStatus::TYPE_APP) ?>">
<button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button>
<a class="btn btn-default btncls" href="<?=Url::toRoute(["/upgrade/upgrade/index", "type" => (isset($gets["type"]) ? $gets["type"] : UpgradeStatus::TYPE_APP)])?>">重 置</a>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<div style="margin-bottom: 15px;text-align: right;">
<ul id="countryTab" class="nav nav-tabs" style="margin-bottom: 20px">
<li <?php if (!isset($gets['type']) || $gets['type'] == UpgradeStatus::TYPE_APP){ echo "class=\"active\""; } ?> ><a style="padding: 10px 20px;" href="<?=Url::current(['type' => UpgradeStatus::TYPE_APP])?>" >APP版本管理</a></li>
<li <?php if (isset($gets['type']) && $gets['type'] == 2){ echo "class=\"active\""; } ?> ><a style="padding: 10px 12px;" href="<?=Url::current(['type' => UpgradeStatus::TYPE_OTA])?>" >OTA版本管理</a></li>
</ul>
<div style="float: right; margin-top: -57px;">
<a href="<?=Url::toRoute(["/upgrade/upgrade/create", "type" => UpgradeStatus::TYPE_APP])?>" class="btn btn-success"> 上传APP版本</a>
<a href="<?=Url::toRoute(["/upgrade/upgrade/create", "type" => UpgradeStatus::TYPE_OTA])?>" class="btn btn-success"> 上传OTA版本</a>
</div>
</div>
<table class="table table-striped table-bordered" id="brand-table">
<thead>
<tr>
<th width="10%">版本号</th>
<th width="10%">包名称</th>
<th width="12%">升级批次信息</th>
<th width="10%">上传时间</th>
<th width="10%">发布状态</th>
<th width="10%">发布信息</th>
<th width="12%">包信息</th>
<th width="15%">操作</th>
</tr>
</thead>
<tbody>
<?php if ($listdata) { ?>
<?php foreach ($listdata as $item) : ?>
<tr>
<td style="padding:12px;"><?= (isset($item["version"]) ? $item["version"] : "") ?></td>
<td style="padding:12px;"><?= (isset($item["package_name"]) ? $item["package_name"] : "") ?></td>
<td style="padding:12px;">
批次编码:<?= (isset($item["barcode"]) ? $item["barcode"].'----' : "-") ?><br>
厂商:<?= (isset($item["manufacture_name"]) ? $item["manufacture_name"] : "-") ?><br>
项目:<?= (isset($item["project_name"]) ? $item["project_name"] : "-") ?><br>
型号:<?= (isset($item["model_name"]) ? $item["model_name"] : "-") ?>
</td>
<td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td>
<td style="padding:12px;"><?= UpgradeStatus::statusLabel($item['status'])?></td>
<td style="padding:12px;">
<?= isset($item["pushed_at"]) && $item["pushed_at"] ? "发布时间:" . date("Y-m-d H:i:s", $item['pushed_at']) : "-"?><br>
<?php if (isset($item["type"]) && UpgradeStatus::TYPE_OTA == $item["type"]) { ?>
<?= isset($item["package_type"]) ? UpgradeStatus::packageTypeLabel($item["package_type"]) : ""?>
<?= isset($item["start_version"]) ? $item["start_version"] : ""?>
<?= isset($item["end_version"]) ? '-' . $item["end_version"] : ""?>
<?php } else { ?>
<?= isset($item["focuse"]) ? UpgradeStatus::focuseLabel($item["focuse"]) : ""?>
<?php } ?>
</td>
<td>
大小:<?=$item['size']?> <br/>
校验码:<?=$item['file_md5']?>
</td>
<td style="padding:12px;">
<button class="btn btn-danger btn-sm btn_del" aid="<?=$item['id'] ?>">删除</button>
<?php if (isset($item["status"]) && UpgradeStatus::STATUS_WAIT == $item["status"]) { ?>
|
<a class="btn btn-info btn-sm btn_auth_success" href="<?=Url::toRoute(["/upgrade/upgrade/edit", "uid" => $item['id']])?>" aid="<?=$item['id'] ?>">编辑</a>
<?php if (isset($item["type"]) && UpgradeStatus::TYPE_OTA == $item["type"]) { ?>
<?php if (isset(Yii::$app->params['UPGRADE_FILE_FROM']) &&
'FROM_OSS' == Yii::$app->params['UPGRADE_FILE_FROM']) {
if ( UpgradeStatus::OSS_UPLOAD_SUCCESS == $item["oss_upload_status"]) { ?>
| <a class="btn btn-info btn-sm btn_auth_success" href="<?=Url::toRoute(["/upgrade/upgrade/push-ota", "uid" => $item['id']])?>" aid="<?=$item['id'] ?>">发布</a>
<?php } } else { ?>
| <a class="btn btn-info btn-sm btn_auth_success" href="<?=Url::toRoute(["/upgrade/upgrade/push-ota", "uid" => $item['id']])?>" aid="<?=$item['id'] ?>">发布</a>
<?php } ?>
<?php } else { ?>
<?php if (isset(Yii::$app->params['UPGRADE_FILE_FROM']) &&
'FROM_OSS' == Yii::$app->params['UPGRADE_FILE_FROM']) {
if ( UpgradeStatus::OSS_UPLOAD_SUCCESS == $item["oss_upload_status"]) { ?>
| <a class="btn btn-info btn-sm btn_auth_success" href="<?=Url::toRoute(["/upgrade/upgrade/push-app", "uid" => $item['id']])?>" aid="<?=$item['id'] ?>">发布</a>
<?php } } else { ?>
| <a class="btn btn-info btn-sm btn_auth_success" href="<?=Url::toRoute(["/upgrade/upgrade/push-app", "uid" => $item['id']])?>" aid="<?=$item['id'] ?>">发布</a>
<?php } ?>
<?php } ?>
<?php } ?>
<?php if (UpgradeStatus::STATUS_ON == $item["status"]) { ?>
| <a class="btn btn-info btn-sm btn_auth_cancel" aid="<?=$item['id'] ?>">取消发布</a>
<?php }?>
<?php if (isset($item["oss_upload_status"]) && UpgradeStatus::OSS_UPLOAD_WAIT == $item["oss_upload_status"]) { ?>
| <a class="btn btn-info btn-sm btn_upload_oss" aid="<?=$item['id'] ?>">同步OSS</a>
<?php }?>
</td>
</tr>
<?php endforeach; ?>
<?php } else { ?>
<tr>
<td colspan="7">
<center>暂无记录</center>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="panel-footer">
<div class="hqy-panel-pager">
<?= LinkPager::widget([
'pagination' => $pages,
]); ?>
<div class="clearfix"></div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$(".btn_del").bind("click",function () {
if (confirm("确定要删除该版本吗?")){
var data_id = $.trim($(this).attr("aid"));
if (data_id == null || data_id == ""){
alert("丢失参数,暂时无法删除,请刷新后再试");
return false;
}
var thiz = $(this);
$.ajax({
type: "post",
url: "do-del",
dataType:"json",
data: $.csrf({"data_id":data_id}),
success:function(msg){
alert(msg['msg']);
if (msg['status'] == 1){
thiz.parents("tr").remove();
}else{
//提示确认失败
}
},
error:function(msg){
//提示确认失败
}
});
}
});
$(".btn_auth_cancel").bind("click",function () {
if (confirm("确定要取消发布该版本吗?")) {
var data_id = $.trim($(this).attr("aid"));
if (data_id == null || data_id == ""){
alert("丢失参数,暂时无法取消,请刷新后再试");
return false;
}
var thiz = $(this);
$.ajax({
type: "post",
url: "<?=Url::toRoute('upgrade/do-cancel')?>",
dataType:"json",
data: $.csrf({id:data_id}),
success:function(res){
if(!res.success) {
alert(res.message);
} else {
var versionType = $('#versionType').val();
window.location.href = 'index?type='+versionType;
}
},
error:function(msg){
//提示确认失败
}
});
}
});
$(".btn_upload_oss").bind("click",function () {
if (confirm("确定要同步该版本文件到OSS吗?600M大概需要7分钟左右。")){
var data_id = $.trim($(this).attr("aid"));
if (data_id == null || data_id == ""){
alert("丢失参数,暂时无法取消,请刷新后再试");
return false;
}
var thiz = $(this);
thiz.text("同步中…");
$('#upload-mark').remove();
$('body').append('<div id="upload-mark" style="width:100%;height:100%;position:fixed;top:0;left:0;background: rgba(0,0,0,0.4)"></div>');
var loding = $.loading();
loding.show();
$.ajax({
type: "post",
url: "<?=Url::toRoute('upgrade/push-oss')?>",
dataType:"json",
data: $.csrf({upgrade_id:data_id}),
success:function(res){
$('#upload-mark').remove();
loding.hide();
loding = null;
if(!res.success) {
alert(res.message);
} else {
var versionType = $('#versionType').val();
window.location.href = 'index?type='+versionType;
}
},
error:function(msg){
loding.hide();
loding = null;
//提示确认失败
}
});
}
});
});
</script>