Commit b9c383085dd18650628958b75ee9a77fd89e1a74
1 parent
54761512
Exists in
master
1. A OTA版本和APP版本录入必须选择厂商+项目+型号(升级版本的时候也必须校验这三个字段)
2. F 代码初始化参数调整 3. F 调整删除序列号的列表 4. F 数据统计导出出错 5. F OTA版本和APP版本录入要可录入描述
Showing
22 changed files
with
440 additions
and
202 deletions
Show diff stats
app-api/controllers/UpgradeController.php
... | ... | @@ -82,14 +82,29 @@ class UpgradeController extends BaseController |
82 | 82 | */ |
83 | 83 | |
84 | 84 | $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]); |
85 | - $manufactureId = 0; | |
85 | + $project = ProjectRepository::findOne(['project_no' => $deviceBatchInfo[1]]); | |
86 | + $model = ModelRepository::findOne(['model_no' => $deviceBatchInfo[2]]); | |
87 | + $manufactureId = $projectId = $modelId = 0; | |
86 | 88 | if ($ma) { |
87 | 89 | $manufactureId = $ma->id; |
88 | 90 | } |
91 | + if ($project) { | |
92 | + $projectId = $project->id; | |
93 | + } | |
94 | + if ($model) { | |
95 | + $modelId = $model->id; | |
96 | + } | |
97 | + if (empty($ma) || empty($project) || empty($model)) { | |
98 | + $e->status = 4; | |
99 | + $e->message = '厂商、项目、型号里面出现不在系统里面'; | |
100 | + return $e; | |
101 | + } | |
89 | 102 | |
90 | 103 | $upgradeModel = UpgradeModel::find(); |
91 | 104 | $upgradeModel->where([ |
92 | 105 | 'manufacture_id' => $manufactureId, |
106 | + 'project_id' => $projectId, | |
107 | + 'model_id' => $modelId, | |
93 | 108 | 'status' => UpgradeStatus::STATUS_ON, |
94 | 109 | 'is_delete' => 0, |
95 | 110 | 'type' => UpgradeStatus::TYPE_OTA |
... | ... | @@ -301,14 +316,28 @@ class UpgradeController extends BaseController |
301 | 316 | */ |
302 | 317 | |
303 | 318 | $ma = ManufacturerRepository::findOne(['manufacture_no' => $deviceBatchInfo[0]]); |
304 | - $manufactureId = 0; | |
319 | + $project = ProjectRepository::findOne(['project_no' => $deviceBatchInfo[1]]); | |
320 | + $model = ModelRepository::findOne(['model_no' => $deviceBatchInfo[2]]); | |
321 | + $manufactureId = $projectId = $modelId = 0; | |
305 | 322 | if ($ma) { |
306 | 323 | $manufactureId = $ma->id; |
307 | 324 | } |
308 | - | |
325 | + if ($project) { | |
326 | + $projectId = $project->id; | |
327 | + } | |
328 | + if ($model) { | |
329 | + $modelId = $model->id; | |
330 | + } | |
331 | + if (empty($ma) || empty($project) || empty($model)) { | |
332 | + $e->status = 4; | |
333 | + $e->message = '厂商、项目、型号里面出现不在系统里面'; | |
334 | + return $e; | |
335 | + } | |
309 | 336 | $upgradeModel = UpgradeModel::find(); |
310 | 337 | $upgradeModel->where([ |
311 | 338 | 'manufacture_id' => $manufactureId, |
339 | + 'project_id' => $projectId, | |
340 | + 'model_id' => $modelId, | |
312 | 341 | 'status' => UpgradeStatus::STATUS_ON, |
313 | 342 | 'package_name' => $packageName, |
314 | 343 | 'is_delete' => 0, | ... | ... |
app-ht/modules/datas/views/device/export.php
... | ... | @@ -8,6 +8,7 @@ header('Cache-Control: max-age=0'); |
8 | 8 | $fp = fopen('php://output', 'a'); |
9 | 9 | $limit = 10000; |
10 | 10 | $cnt = 0; |
11 | + | |
11 | 12 | ?> |
12 | 13 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
13 | 14 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
... | ... | @@ -43,7 +44,7 @@ $cnt = 0; |
43 | 44 | <td style="padding:12px;"><?= (isset($item["project_name"]) ? $item["project_name"] : "") ?></td> |
44 | 45 | <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td> |
45 | 46 | <td style="padding:12px;"><?= (isset($item["production_name"]) ? $item["production_name"] : "") ?></td> |
46 | - <td style="padding:12px;"><a href="<?=Url::toRoute('datas/device/device-list')?>"><?= (isset($item["num"]) ? $item["num"] : "0") ?></a></td> | |
47 | + <td style="padding:12px;"><?= (isset($item["num"]) ? $item["num"] : "0") ?></td> | |
47 | 48 | <td style="padding:12px;"><?= (isset($item["has_auth_num"]) ? $item["has_auth_num"] : "0") ?></td> |
48 | 49 | <td style="padding:12px;"><?= (!empty($item["auth_fail_num"]) ? $item["auth_fail_num"] : "0") ?></td> |
49 | 50 | <td style="padding:12px;"><?= (!empty($item["no_auth_num"]) ? $item["no_auth_num"] : "0") ?></td> | ... | ... |
app-ht/modules/device/controllers/DeviceController.php
... | ... | @@ -37,6 +37,12 @@ class DeviceController extends BaseController |
37 | 37 | $manufacture = $request->get('manufacture'); |
38 | 38 | $deviceId = $request->get('device_id'); |
39 | 39 | $status = $request->get('status'); |
40 | + | |
41 | + $startApplyAt = $request->get('start_apply_at'); | |
42 | + $endApplyAt = $request->get('end_apply_at'); | |
43 | + $startAuthAt = $request->get('start_auth_at'); | |
44 | + $endAuthAt = $request->get('end_auth_at'); | |
45 | + | |
40 | 46 | $page = $request->get('page'); |
41 | 47 | $where = [ |
42 | 48 | 'and', |
... | ... | @@ -63,6 +69,18 @@ class DeviceController extends BaseController |
63 | 69 | if (!empty($deviceId)) { |
64 | 70 | $where[] = ['like', 'a.device_id', $deviceId]; |
65 | 71 | } |
72 | + if ($startApplyAt) { | |
73 | + $where[] = ['>=', 'a.apply_at', strtotime($startApplyAt)]; | |
74 | + } | |
75 | + if ($endApplyAt) { | |
76 | + $where[] = ['<=', 'a.apply_at', strtotime($endApplyAt) + 86400]; | |
77 | + } | |
78 | + if ($startAuthAt) { | |
79 | + $where[] = ['>=', 'a.auth_at', strtotime($startAuthAt)]; | |
80 | + } | |
81 | + if ($endAuthAt) { | |
82 | + $where[] = ['>=', 'a.auth_at', strtotime($endAuthAt) + 86400]; | |
83 | + } | |
66 | 84 | if (isset($_GET['status']) && -1 != $status) { |
67 | 85 | $where[] = ['=', 'a.status', $status]; |
68 | 86 | } else { |
... | ... | @@ -90,6 +108,10 @@ class DeviceController extends BaseController |
90 | 108 | 'device_id' => $deviceId, |
91 | 109 | 'production' => $production, |
92 | 110 | 'manufacture' => $manufacture, |
111 | + 'start_apply_at' => $startApplyAt, | |
112 | + 'end_apply_at' => $endApplyAt, | |
113 | + 'start_auth_at' => $startAuthAt, | |
114 | + 'end_auth_at' => $endAuthAt, | |
93 | 115 | 'status' => $status |
94 | 116 | ]; |
95 | 117 | |
... | ... | @@ -110,6 +132,11 @@ class DeviceController extends BaseController |
110 | 132 | $manufacture = $request->get('manufacture'); |
111 | 133 | $deviceId = $request->get('device_id'); |
112 | 134 | $status = $request->get('status'); |
135 | + | |
136 | + $startApplyAt = $request->get('start_apply_at'); | |
137 | + $endApplyAt = $request->get('end_apply_at'); | |
138 | + $startAuthAt = $request->get('start_auth_at'); | |
139 | + $endAuthAt = $request->get('end_auth_at'); | |
113 | 140 | $page = $request->get('page'); |
114 | 141 | $where = [ |
115 | 142 | 'and', |
... | ... | @@ -136,6 +163,19 @@ class DeviceController extends BaseController |
136 | 163 | if (!empty($deviceId)) { |
137 | 164 | $where[] = ['like', 'a.device_id', $deviceId]; |
138 | 165 | } |
166 | + | |
167 | + if ($startApplyAt) { | |
168 | + $where[] = ['>=', 'a.apply_at', strtotime($startApplyAt)]; | |
169 | + } | |
170 | + if ($endApplyAt) { | |
171 | + $where[] = ['<=', 'a.apply_at', strtotime($endApplyAt) + 86400]; | |
172 | + } | |
173 | + if ($startAuthAt) { | |
174 | + $where[] = ['>=', 'a.auth_at', strtotime($startAuthAt)]; | |
175 | + } | |
176 | + if ($endAuthAt) { | |
177 | + $where[] = ['>=', 'a.auth_at', strtotime($endAuthAt) + 86400]; | |
178 | + } | |
139 | 179 | if (isset($_GET['status']) && -1 != $status) { |
140 | 180 | $where[] = ['=', 'a.status', $status]; |
141 | 181 | } else { |
... | ... | @@ -163,6 +203,10 @@ class DeviceController extends BaseController |
163 | 203 | 'device_id' => $deviceId, |
164 | 204 | 'production' => $production, |
165 | 205 | 'manufacture' => $manufacture, |
206 | + 'start_apply_at' => $startApplyAt, | |
207 | + 'end_apply_at' => $endApplyAt, | |
208 | + 'start_auth_at' => $startAuthAt, | |
209 | + 'end_auth_at' => $endAuthAt, | |
166 | 210 | 'status' => $status |
167 | 211 | ]; |
168 | 212 | |
... | ... | @@ -207,7 +251,7 @@ class DeviceController extends BaseController |
207 | 251 | return $this->renderJson($e); |
208 | 252 | } |
209 | 253 | |
210 | - $batchNo = strtoupper(Device::getBatchNo($manufactureNo,$projectNo,$modelNo,$productionNo)); | |
254 | + $batchNo = strtoupper(Device::getBatchNo($manufactureNo, $projectNo, $modelNo, $productionNo)); | |
211 | 255 | $batchModel = CreateBatchRepository::findOne(['batch_no' => $batchNo]); |
212 | 256 | if ($batchModel) { |
213 | 257 | $e->message = '已经创建过这个批次序列号'; |
... | ... | @@ -258,7 +302,7 @@ class DeviceController extends BaseController |
258 | 302 | /** |
259 | 303 | * @return string |
260 | 304 | */ |
261 | - public function actionSearchItem() | |
305 | + public function actionBatchItem() | |
262 | 306 | { |
263 | 307 | $req = Yii::$app->request; |
264 | 308 | $type = $req->post('type'); | ... | ... |
app-ht/modules/device/views/device/auth-fail-index.php
... | ... | @@ -39,19 +39,14 @@ $this->params['breadcrumbs'][] = $this->title; |
39 | 39 | <div class="col-sm-2 form-inline"> |
40 | 40 | <input type="text" class="form-control" id="device_id" name="device_id" value="<?php if (!empty($gets['device_id'])){ echo $gets['device_id'];} ?>" autocomplete="off"> |
41 | 41 | </div> |
42 | - <label for="handel" class="col-sm-1 control-label text-right">处理状态:</label> | |
43 | - <div class="col-sm-2 form-inline"> | |
44 | - <input type="text" class="form-control" id="handel" name="handel" value="<?php if (!empty($gets['handel'])){ echo $gets['handel'];} ?>" autocomplete="off"> | |
45 | - </div> | |
42 | + | |
46 | 43 | <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label> |
47 | - <div class="col-sm-2 form-inline"> | |
48 | - <input type="text" class="form-control" id="apply_at" name="apply_at" value="<?php if (!empty($gets['apply_at'])){ echo $gets['apply_at'];} ?>" autocomplete="off"> | |
44 | + <div class="col-sm-5 form-inline"> | |
45 | + <input type="text" class="form-control" id="start_apply_at" name="start_apply_at" value="<?php if (!empty($gets['start_apply_at'])){ echo $gets['start_apply_at'];} ?>" autocomplete="off"> - <input type="text" class="form-control" id="end_apply_at" name="end_apply_at" value="<?php if (!empty($gets['end_apply_at'])){ echo $gets['end_apply_at'];} ?>" autocomplete="off"> | |
49 | 46 | </div> |
50 | 47 | |
51 | 48 | </div> |
52 | 49 | |
53 | - | |
54 | - | |
55 | 50 | <div class="form-group col-sm-12" style="text-align: center;"> |
56 | 51 | <button type="submit" class="btn btn-primary font-1" id="submitFilterBtn">查询</button> |
57 | 52 | </div> | ... | ... |
app-ht/modules/device/views/device/createDevice.php
... | ... | @@ -14,6 +14,7 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css'); |
14 | 14 | <style> |
15 | 15 | .create-div .form-group{padding:1rem 0} |
16 | 16 | .create-div .full-width{width:100%;} |
17 | + .combo-select{max-width:100% !important;} | |
17 | 18 | </style> |
18 | 19 | <div class="panel panel-default"> |
19 | 20 | <div class="panel-body form-inline create-div"> |
... | ... | @@ -21,14 +22,19 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css'); |
21 | 22 | <div class="form-group col-sm-12"> |
22 | 23 | <label for="manufacture" class="col-sm-4 control-label text-right">厂商:</label> |
23 | 24 | <div class="col-sm-4 form-inline"> |
24 | - <input type="text" class="form-control full-width searchInput" id="manufacture" name="manufacture" value="" autocomplete="off"> | |
25 | + <select class="form-control full-width searchInput" id="manufacture" name="manufacture"> | |
26 | + | |
27 | + </select> | |
28 | + | |
25 | 29 | </div> |
26 | 30 | <div class="col-sm-4"><a href="<?=Url::toRoute('/manufacturer/manufacturer/create')?>">+创建厂商</a></div> |
27 | 31 | </div> |
28 | 32 | <div class="form-group col-sm-12"> |
29 | 33 | <label for="project" class="col-sm-4 control-label text-right">项目名:</label> |
30 | 34 | <div class="col-sm-4 form-inline"> |
31 | - <input type="text" class="form-control full-width searchInput" id="project" name="project" value="" autocomplete="off"> | |
35 | + <select class="form-control full-width searchInput" id="project" name="project"> | |
36 | + | |
37 | + </select> | |
32 | 38 | </div> |
33 | 39 | <div class="col-sm-4"><a href="<?=Url::toRoute('/project/project/create')?>">+创建项目</a></div> |
34 | 40 | |
... | ... | @@ -36,14 +42,18 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css'); |
36 | 42 | <div class="form-group col-sm-12"> |
37 | 43 | <label for="model" class="col-sm-4 control-label text-right">设备型号:</label> |
38 | 44 | <div class="col-sm-4 form-inline"> |
39 | - <input type="text" class="form-control full-width searchInput" id="model" name="model" value="" autocomplete="off"> | |
45 | + <select class="form-control full-width searchInput" id="model" name="model"> | |
46 | + | |
47 | + </select> | |
40 | 48 | </div> |
41 | 49 | <div class="col-sm-4"><a href="<?=Url::toRoute('/model/model/create')?>">+创建型号</a></div> |
42 | 50 | </div> |
43 | 51 | <div class="form-group col-sm-12"> |
44 | 52 | <label for="production" class="col-sm-4 control-label text-right">生产日期:</label> |
45 | 53 | <div class="col-sm-4 form-inline"> |
46 | - <input type="text" class="form-control full-width searchInput" id="production" name="production" value="" autocomplete="off"> | |
54 | + <select class="form-control full-width searchInput" id="production" name="production"> | |
55 | + | |
56 | + </select> | |
47 | 57 | </div> |
48 | 58 | <div class="col-sm-4"><a href="<?=Url::toRoute('/production/production/create')?>">+生产日期</a></div> |
49 | 59 | </div> |
... | ... | @@ -63,66 +73,79 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css'); |
63 | 73 | |
64 | 74 | </div> |
65 | 75 | |
66 | -<script type="text/javascript" src="<?=Url::toRoute('/exts/base/1.0.0/ui/typeahead/bootstrap3-typeahead.min.js')?>" ></script> | |
76 | +<script src="<?= Yii::$app->request->baseUrl . "/exts/combo-select/js/jquery.combo.select.js"?>"></script> | |
77 | +<link rel="stylesheet" type="text/css" href="<?= Yii::$app->request->baseUrl . "/exts/combo-select/css/combo.select.css"?>" /> | |
67 | 78 | <script type="text/javascript"> |
68 | - var searchItemUrl = "<?=Url::toRoute('/device/device/search-item')?>"; | |
79 | + var searchItemUrl = "<?=Url::toRoute('/device/device/batch-item')?>"; | |
69 | 80 | var saveUrl = "<?=Url::toRoute('/device/device/do-create-device')?>"; |
70 | 81 | $(function() { |
71 | 82 | |
72 | - function typeaheadAll(id) { | |
73 | - var type = id; | |
74 | - $('#'+id).typeahead({ | |
75 | - minLength: 2, | |
76 | - items:15, | |
77 | - source: function(query, process) { | |
78 | - | |
79 | - var parameter = {query: query, type: type}; | |
80 | - $.post(searchItemUrl, parameter, function (res) { | |
81 | - var data = []; | |
82 | - var iList = res.list; | |
83 | - for(i in iList){ | |
84 | - var tItem = iList[i]; | |
85 | - data.push(JSON.stringify(tItem)); | |
86 | - } | |
87 | - process(data); | |
88 | - },'json'); | |
89 | - }, | |
90 | - highlighter: function(item) { | |
91 | - var itemObject = JSON.parse(item); | |
92 | - var title = itemObject.name; | |
93 | - $('#'+id).attr('data-id', itemObject.id); | |
94 | - $('#'+id).attr('data-no', itemObject[id+'_no']); | |
95 | - return title ; | |
96 | - }, | |
97 | - | |
98 | - updater: function(item) { | |
99 | - var itemObject = JSON.parse(item); | |
100 | - var title = itemObject.name; | |
101 | - $('#'+id).attr('data-id', itemObject.id); | |
102 | - $('#'+id).attr('data-no', itemObject[id+'_no']); | |
103 | - return title; | |
83 | + function selectAll(id) { | |
84 | + $.post(searchItemUrl, {type:id}, function(res) { | |
85 | + if(res.list.length > 0) { | |
86 | + var wrapper = '<option value="">请选择</option>'; | |
87 | + $.each(res.list, function(i,n){ | |
88 | + wrapper = wrapper + '<option value="'+ n.uid+'">'+ n.name+'</option>'; | |
89 | + }) | |
90 | + $('#'+id).html(wrapper); | |
91 | + $('#'+id).comboSelect(); | |
104 | 92 | } |
105 | - }); | |
93 | + | |
94 | + }, 'json') | |
95 | + | |
106 | 96 | } |
107 | - typeaheadAll('manufacture'); | |
108 | - typeaheadAll('project'); | |
109 | - typeaheadAll('model'); | |
110 | - typeaheadAll('production'); | |
97 | + selectAll('manufacture'); | |
98 | + selectAll('project'); | |
99 | + selectAll('model'); | |
100 | + selectAll('production'); | |
111 | 101 | |
112 | 102 | $('#createDeviceBtn').click(function(e) { |
113 | 103 | e.preventDefault(); |
104 | + var manufacture = $('#manufacture').val(); | |
105 | + if ('' == manufacture) { | |
106 | + alert('请选择厂商'); | |
107 | + return false; | |
108 | + } | |
109 | + manufacture = manufacture.split('_'); | |
110 | + | |
111 | + var project = $('#project').val(); | |
112 | + if ('' == project) { | |
113 | + alert('请选择项目'); | |
114 | + return false; | |
115 | + } | |
116 | + project = project.split('_'); | |
117 | + | |
118 | + var model = $('#model').val(); | |
119 | + if ('' == model) { | |
120 | + alert('请选择型号'); | |
121 | + return false; | |
122 | + } | |
123 | + model = model.split('_'); | |
124 | + | |
125 | + var production = $('#production').val(); | |
126 | + if ('' == production) { | |
127 | + alert('请选生产日期'); | |
128 | + return false; | |
129 | + } | |
130 | + production = production.split('_'); | |
131 | + var num = $('#num').val(); | |
132 | + if ('' == num || 0 == num) { | |
133 | + alert('请录入生成数量'); | |
134 | + return false; | |
135 | + } | |
114 | 136 | var params = { |
115 | - manufactureId: $('#manufacture').attr('data-id'), | |
116 | - manufactureNo: $('#manufacture').attr('data-no'), | |
117 | - projectId: $('#project').attr('data-id'), | |
118 | - projectNo: $('#project').attr('data-no'), | |
137 | + manufactureId: manufacture[0], | |
138 | + manufactureNo: manufacture[1], | |
139 | + | |
140 | + projectId: project[0], | |
141 | + projectNo: project[1], | |
119 | 142 | |
120 | - modelId: $('#model').attr('data-id'), | |
121 | - modelNo: $('#model').attr('data-no'), | |
143 | + modelId: model[0], | |
144 | + modelNo: model[1], | |
122 | 145 | |
123 | - productionId: $('#production').attr('data-id'), | |
124 | - productionNo: $('#production').attr('data-no'), | |
125 | - num: $('#num').val() | |
146 | + productionId: production[0], | |
147 | + productionNo: production[1], | |
148 | + num: num | |
126 | 149 | } |
127 | 150 | $.post(saveUrl, params, function(res) { |
128 | 151 | if (!res.success) { | ... | ... |
app-ht/modules/device/views/device/delete-index.php
... | ... | @@ -49,12 +49,8 @@ $this->params['breadcrumbs'][] = $this->title; |
49 | 49 | <input type="text" class="form-control" id="manufacture" name="manufacture" value="<?php if (!empty($gets['manufacture'])){ echo $gets['manufacture'];} ?>" autocomplete="off"> |
50 | 50 | </div> |
51 | 51 | <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label> |
52 | - <div class="col-sm-2 form-inline"> | |
53 | - <input type="text" class="form-control" id="apply_at" name="apply_at" value="<?php if (!empty($gets['apply_at'])){ echo $gets['apply_at'];} ?>" autocomplete="off"> | |
54 | - </div> | |
55 | - <label for="auth_at" class="col-sm-1 control-label text-right">授权时间:</label> | |
56 | - <div class="col-sm-2 form-inline"> | |
57 | - <input type="text" class="form-control" id="auth_at" name="auth_at" value="<?php if (!empty($gets['auth_at'])){ echo $gets['auth_at'];} ?>" autocomplete="off"> | |
52 | + <div class="col-sm-5 form-inline"> | |
53 | + <input type="date" class="form-control" id="start_apply_at" name="start_apply_at" value="<?php if (!empty($gets['start_apply_at'])){ echo $gets['start_apply_at'];} ?>" autocomplete="off"> - <input type="date" class="form-control" id="end_apply_at" name="end_apply_at" value="<?php if (!empty($gets['end_apply_at'])){ echo $gets['end_apply_at'];} ?>" autocomplete="off"> | |
58 | 54 | </div> |
59 | 55 | </div> |
60 | 56 | |
... | ... | @@ -67,13 +63,9 @@ $this->params['breadcrumbs'][] = $this->title; |
67 | 63 | <div class="col-sm-2 form-inline"> |
68 | 64 | <input type="text" class="form-control" id="device_id" name="device_id" value="<?php if (!empty($gets['device_id'])){ echo $gets['device_id'];} ?>" autocomplete="off"> |
69 | 65 | </div> |
70 | - <label for="handel" class="col-sm-1 control-label text-right">处理状态:</label> | |
71 | - <div class="col-sm-2 form-inline"> | |
72 | - <input type="text" class="form-control" id="handel" name="handel" value="<?php if (!empty($gets['handel'])){ echo $gets['handel'];} ?>" autocomplete="off"> | |
73 | - </div> | |
74 | - <label for="empty_serial" class="col-sm-1 control-label text-right">空序列号:</label> | |
75 | - <div class="col-sm-2 form-inline"> | |
76 | - <input type="text" class="form-control" id="empty_serial" name="empty_serial" value="<?php if (!empty($gets['empty_serial'])){ echo $gets['empty_serial'];} ?>" autocomplete="off"> | |
66 | + <label for="auth_at" class="col-sm-1 control-label text-right">授权时间:</label> | |
67 | + <div class="col-sm-5 form-inline"> | |
68 | + <input type="date" class="form-control" id="start_auth_at" name="start_auth_at" value="<?php if (!empty($gets['start_auth_at'])){ echo $gets['start_auth_at'];} ?>" autocomplete="off"> - <input type="date" class="form-control" id="end_auth_at" name="end_auth_at" value="<?php if (!empty($gets['end_auth_at'])){ echo $gets['end_auth_at'];} ?>" autocomplete="off"> | |
77 | 69 | </div> |
78 | 70 | </div> |
79 | 71 | ... | ... |
app-ht/modules/device/views/device/index.php
... | ... | @@ -49,12 +49,8 @@ $this->params['breadcrumbs'][] = $this->title; |
49 | 49 | <input type="text" class="form-control" id="manufacture" name="manufacture" value="<?php if (!empty($gets['manufacture'])){ echo $gets['manufacture'];} ?>" autocomplete="off"> |
50 | 50 | </div> |
51 | 51 | <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label> |
52 | - <div class="col-sm-2 form-inline"> | |
53 | - <input type="text" class="form-control" id="apply_at" name="apply_at" value="<?php if (!empty($gets['apply_at'])){ echo $gets['apply_at'];} ?>" autocomplete="off"> | |
54 | - </div> | |
55 | - <label for="auth_at" class="col-sm-1 control-label text-right">授权时间:</label> | |
56 | - <div class="col-sm-2 form-inline"> | |
57 | - <input type="text" class="form-control" id="auth_at" name="auth_at" value="<?php if (!empty($gets['auth_at'])){ echo $gets['auth_at'];} ?>" autocomplete="off"> | |
52 | + <div class="col-sm-5 form-inline"> | |
53 | + <input type="date" class="form-control" id="start_apply_at" name="start_apply_at" value="<?php if (!empty($gets['start_apply_at'])){ echo $gets['start_apply_at'];} ?>" autocomplete="off"> - <input type="date" class="form-control" id="end_apply_at" name="end_apply_at" value="<?php if (!empty($gets['end_apply_at'])){ echo $gets['end_apply_at'];} ?>" autocomplete="off"> | |
58 | 54 | </div> |
59 | 55 | </div> |
60 | 56 | |
... | ... | @@ -67,13 +63,9 @@ $this->params['breadcrumbs'][] = $this->title; |
67 | 63 | <div class="col-sm-2 form-inline"> |
68 | 64 | <input type="text" class="form-control" id="device_id" name="device_id" value="<?php if (!empty($gets['device_id'])){ echo $gets['device_id'];} ?>" autocomplete="off"> |
69 | 65 | </div> |
70 | - <label for="handel" class="col-sm-1 control-label text-right">处理状态:</label> | |
71 | - <div class="col-sm-2 form-inline"> | |
72 | - <input type="text" class="form-control" id="handel" name="handel" value="<?php if (!empty($gets['handel'])){ echo $gets['handel'];} ?>" autocomplete="off"> | |
73 | - </div> | |
74 | - <label for="empty_serial" class="col-sm-1 control-label text-right">空序列号:</label> | |
75 | - <div class="col-sm-2 form-inline"> | |
76 | - <input type="text" class="form-control" id="empty_serial" name="empty_serial" value="<?php if (!empty($gets['empty_serial'])){ echo $gets['empty_serial'];} ?>" autocomplete="off"> | |
66 | + <label for="auth_at" class="col-sm-1 control-label text-right">授权时间:</label> | |
67 | + <div class="col-sm-5 form-inline"> | |
68 | + <input type="date" class="form-control" id="start_auth_at" name="start_auth_at" value="<?php if (!empty($gets['start_auth_at'])){ echo $gets['start_auth_at'];} ?>" autocomplete="off"> - <input type="date" class="form-control" id="end_auth_at" name="end_auth_at" value="<?php if (!empty($gets['end_auth_at'])){ echo $gets['end_auth_at'];} ?>" autocomplete="off"> | |
77 | 69 | </div> |
78 | 70 | </div> |
79 | 71 | ... | ... |
app-ht/modules/upgrade/controllers/UpgradeController.php
... | ... | @@ -10,6 +10,8 @@ use domain\manufacturer\ManufacturerRepository; |
10 | 10 | use domain\upgrade\Upgrade; |
11 | 11 | use domain\upgrade\UpgradeRepository; |
12 | 12 | use domain\upgrade\UpgradeStatus; |
13 | +use domain\model\ModelRepository; | |
14 | +use domain\project\ProjectRepository; | |
13 | 15 | |
14 | 16 | use stdClass; |
15 | 17 | |
... | ... | @@ -567,6 +569,14 @@ class UpgradeController extends BaseController |
567 | 569 | if (isset($manufacture["name"])) { |
568 | 570 | $info["manufacture_name"] = $manufacture["name"]; |
569 | 571 | } |
572 | + $project = ProjectRepository::selectOne($info["project_id"]); | |
573 | + if (isset($project["name"])) { | |
574 | + $info["project_name"] = $project["name"]; | |
575 | + } | |
576 | + $model = ModelRepository::selectOne($info["model_id"]); | |
577 | + if (isset($model["name"])) { | |
578 | + $info["model_name"] = $model["name"]; | |
579 | + } | |
570 | 580 | } |
571 | 581 | return $this->render('push-app', ["info" => $info]); |
572 | 582 | } |
... | ... | @@ -585,6 +595,14 @@ class UpgradeController extends BaseController |
585 | 595 | if (isset($manufacture["name"])) { |
586 | 596 | $info["manufacture_name"] = $manufacture["name"]; |
587 | 597 | } |
598 | + $project = ProjectRepository::selectOne($info["project_id"]); | |
599 | + if (isset($project["name"])) { | |
600 | + $info["project_name"] = $project["name"]; | |
601 | + } | |
602 | + $model = ModelRepository::selectOne($info["model_id"]); | |
603 | + if (isset($model["name"])) { | |
604 | + $info["model_name"] = $model["name"]; | |
605 | + } | |
588 | 606 | } |
589 | 607 | return $this->render('push-ota', ["info" => $info]); |
590 | 608 | } | ... | ... |
app-ht/modules/upgrade/views/upgrade/create.php
... | ... | @@ -12,7 +12,7 @@ $this->params['breadcrumbs'][] = $this->title; |
12 | 12 | #upload-container, #upload-list{width: 500px; margin: 0 auto; } |
13 | 13 | #upload-container{cursor: pointer; border-radius: 15px; background: #EEEFFF; height: 200px;} |
14 | 14 | #upload-list{height: 100px; border: 1px solid #EEE; border-radius: 5px; margin-top: 10px; padding: 10px 20px;} |
15 | - #upload-container>span{widows: 100%; text-align: center; color: gray; display: block; padding-top: 15%;} | |
15 | + #upload-container>span{width: 100%; text-align: center; color: gray; display: block; padding-top: 15%;} | |
16 | 16 | .upload-item{margin-top: 5px; padding-bottom: 5px; border-bottom: 1px dashed gray;} |
17 | 17 | .percentage{height: 5px; background: green;} |
18 | 18 | .btn-delete, .btn-retry{cursor: pointer; color: gray;} |
... | ... | @@ -22,8 +22,10 @@ $this->params['breadcrumbs'][] = $this->title; |
22 | 22 | padding: 6px 15px!important; |
23 | 23 | margin-right: 20px; |
24 | 24 | } |
25 | + .combo-select{max-width: 100% !important;} | |
25 | 26 | </style> |
26 | 27 | |
28 | +<link rel="stylesheet" type="text/css" href="<?= Yii::$app->request->baseUrl . "/exts/combo-select/css/combo.select.css"?>" /> | |
27 | 29 | <form action="<?php echo Url::toRoute(['/upgrade/upgrade/do-add']); ?>" name="myFrom" id="myFrom" method="post" enctype="multipart/form-data"> |
28 | 30 | <div class="panel panel-default"> |
29 | 31 | <div class="panel-body"> |
... | ... | @@ -47,14 +49,27 @@ $this->params['breadcrumbs'][] = $this->title; |
47 | 49 | </div> |
48 | 50 | </div> |
49 | 51 | <div class="form-group col-sm-12"> |
50 | - <label for="skillName" class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>请选择厂商名称:</label> | |
52 | + <label class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>选择厂商:</label> | |
51 | 53 | <div class="col-sm-4 text-left"> |
52 | - <input type="hidden" id="manufacture_id" name="manufacture_id" value="<?= (isset($gets["manufacture_id"]) ? $gets["manufacture_id"] : "") ?>"/> | |
53 | - <?php if (isset($gets["is_manufacture"]) && $gets["is_manufacture"] == 1) { ?> | |
54 | - <div class="form-control text-center"><span id="manufactureName"><?= (isset($gets["manufacture_name"]) && !empty($gets["manufacture_name"]) ? $gets["manufacture_name"] : "请选择厂商名称") ?></span> <span style="float: right;padding-right: 13px"> > </span></div> | |
55 | - <?php } else { ?> | |
56 | - <div class="form-control text-center" id="select_manufacture"><span id="manufactureName"><?= (isset($gets["manufacture_name"]) && !empty($gets["manufacture_name"]) ? $gets["manufacture_name"] : "请选择厂商名称") ?></span> <span style="float: right;padding-right: 13px"> > </span></div> | |
57 | - <?php } ?> | |
54 | + <select name="manufacture_id" class="form-control" id ="manufacture"></select> | |
55 | + </div> | |
56 | + </div> | |
57 | + <div class="form-group col-sm-12"> | |
58 | + <label class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>选择项目:</label> | |
59 | + <div class="col-sm-4 text-left"> | |
60 | + <select name="project_id" class="form-control" id ="project"></select> | |
61 | + </div> | |
62 | + </div> | |
63 | + <div class="form-group col-sm-12"> | |
64 | + <label class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>选择型号:</label> | |
65 | + <div class="col-sm-4 text-left"> | |
66 | + <select name="model_id" class="form-control" id ="model"></select> | |
67 | + </div> | |
68 | + </div> | |
69 | + <div class="form-group col-sm-12"> | |
70 | + <label class="col-sm-4 control-label text-right">描述:</label> | |
71 | + <div class="col-sm-4 text-left"> | |
72 | + <textarea name="desc" class="form-control" id ="desc"></textarea> | |
58 | 73 | </div> |
59 | 74 | </div> |
60 | 75 | <div class="form-group col-sm-12"> |
... | ... | @@ -88,18 +103,19 @@ $this->params['breadcrumbs'][] = $this->title; |
88 | 103 | </div> |
89 | 104 | |
90 | 105 | <div class="panel-footer text-center"> |
91 | - <button type="button" class="btn btn-primary ladda-button" data-style="slide-up" id="save">确认上传</button> | |
106 | + <button type="button" class="btn btn-primary ladda-button" data-style="slide-up" id="save">确认提交</button> | |
92 | 107 | </div> |
93 | 108 | </div> |
94 | 109 | |
95 | 110 | </form> |
96 | - | |
111 | +<script src="<?= Yii::$app->request->baseUrl . "/exts/combo-select/js/jquery.combo.select.js"?>"></script> | |
97 | 112 | <!--引入CSS--> |
98 | 113 | <link rel="stylesheet" type="text/css" href="<?=Yii::$app->request->baseUrl ?>/exts/webuploader-0.1.5/webuploader.css"> |
99 | 114 | <!--引入JS--> |
100 | 115 | <script type="text/javascript" src="<?=Yii::$app->request->baseUrl ?>/exts/webuploader-0.1.5/webuploader.js"></script> |
101 | 116 | |
102 | 117 | <script> |
118 | + var searchItemUrl = "<?=Url::toRoute('/device/device/batch-item')?>"; | |
103 | 119 | // 表单提交验证 |
104 | 120 | seajs.use("base/1.0.0/unit/validate/custom-1.0.0",function () { |
105 | 121 | var validator = $("#myFrom").validate({ |
... | ... | @@ -114,7 +130,9 @@ $this->params['breadcrumbs'][] = $this->title; |
114 | 130 | $('#myFrom').attr('action', getUrl); |
115 | 131 | var a = $("input[name='version']").val(); |
116 | 132 | var package_name = $("input[name='package_name']").val(); |
117 | - var manufacture_id = $("input[name='manufacture_id']").val(); | |
133 | + var manufacture_id = $("#manufacture").val(); | |
134 | + var project_id = $("#project").val(); | |
135 | + var model_id = $("#model").val(); | |
118 | 136 | var path = $("input[name='path']").val(); |
119 | 137 | if (a == ""){ |
120 | 138 | alert("APP版本号不能为空"); |
... | ... | @@ -124,10 +142,19 @@ $this->params['breadcrumbs'][] = $this->title; |
124 | 142 | alert("安装包名不能为空"); |
125 | 143 | return false; |
126 | 144 | } |
145 | + | |
127 | 146 | if (manufacture_id == ""){ |
128 | 147 | alert("请选择厂商"); |
129 | 148 | return false; |
130 | 149 | } |
150 | + if (project_id == ""){ | |
151 | + alert("请选择项目"); | |
152 | + return false; | |
153 | + } | |
154 | + if (model_id == ""){ | |
155 | + alert("请选择型号"); | |
156 | + return false; | |
157 | + } | |
131 | 158 | if (path == ""){ |
132 | 159 | alert("请上传安装包"); |
133 | 160 | return false; |
... | ... | @@ -141,27 +168,7 @@ $this->params['breadcrumbs'][] = $this->title; |
141 | 168 | l.start(); |
142 | 169 | return false; |
143 | 170 | }); |
144 | - <?php if (!isset($gets["is_manufacture"]) || $gets["is_manufacture"] != 1) { ?> | |
145 | - $("#select_manufacture").bind("click", function () { | |
146 | - var getUrl = '<?=Url::toRoute("/upgrade/upgrade/select-manufacture")?>'; | |
147 | - var version = $("input[name='version']").val(); | |
148 | - var package_name = $("input[name='package_name']").val(); | |
149 | - var manufacture_id = $("input[name='manufacture_id']").val(); | |
150 | - var path = $("input[name='path']").val(); | |
151 | - var size = $("input[name='size']").val(); | |
152 | - var file_md5 = $("input[name='file_md5']").val(); | |
153 | - var oldName = $("input[name='oldName']").val(); | |
154 | - var type = $("input[name='type']").val(); | |
155 | - getUrl = getUrl + "?version=" + version + "&package_name=" + package_name + "&manufacture_id=" + manufacture_id; | |
156 | - getUrl = getUrl + "&path=" + path; | |
157 | - getUrl = getUrl + "&size=" + size; | |
158 | - getUrl = getUrl + "&file_md5=" + file_md5; | |
159 | - getUrl = getUrl + "&oldName=" + oldName; | |
160 | - getUrl = getUrl + "&type=" + type; | |
161 | - getUrl = getUrl + "&isCreate=" + 1; | |
162 | - window.location.href = getUrl; | |
163 | - }); | |
164 | - <?php } ?> | |
171 | + | |
165 | 172 | //上传文件函数 |
166 | 173 | //ids唯一ID |
167 | 174 | //folder文件保存目录 |
... | ... | @@ -259,5 +266,24 @@ $this->params['breadcrumbs'][] = $this->title; |
259 | 266 | }); |
260 | 267 | } |
261 | 268 | |
262 | - uploadfiles(2655,"files"); | |
269 | + uploadfiles(2655, "files"); | |
270 | + $(function(){ | |
271 | + function selectAll(id) { | |
272 | + $.post(searchItemUrl, {type:id}, function(res) { | |
273 | + if(res.list.length > 0) { | |
274 | + var wrapper = '<option value="">请选择</option>'; | |
275 | + $.each(res.list, function(i,n){ | |
276 | + wrapper = wrapper + '<option value="'+ n.id+'">'+ n.name+'</option>'; | |
277 | + }) | |
278 | + $('#'+id).html(wrapper); | |
279 | + $('#'+id).comboSelect(); | |
280 | + } | |
281 | + | |
282 | + }, 'json') | |
283 | + | |
284 | + } | |
285 | + selectAll('manufacture'); | |
286 | + selectAll('project'); | |
287 | + selectAll('model'); | |
288 | + }) | |
263 | 289 | </script> |
264 | 290 | \ No newline at end of file | ... | ... |
app-ht/modules/upgrade/views/upgrade/edit.php
... | ... | @@ -22,8 +22,9 @@ $this->params['breadcrumbs'][] = $this->title; |
22 | 22 | padding: 6px 15px!important; |
23 | 23 | margin-right: 20px; |
24 | 24 | } |
25 | + .combo-select{max-width: 100% !important;} | |
25 | 26 | </style> |
26 | - | |
27 | +<link rel="stylesheet" type="text/css" href="<?= Yii::$app->request->baseUrl . "/exts/combo-select/css/combo.select.css"?>" /> | |
27 | 28 | <form action="<?php echo Url::toRoute(['/upgrade/upgrade/do-edit']); ?>" name="myFrom" id="myFrom" method="post" enctype="multipart/form-data"> |
28 | 29 | <div class="panel panel-default"> |
29 | 30 | <div class="panel-body"> |
... | ... | @@ -47,10 +48,27 @@ $this->params['breadcrumbs'][] = $this->title; |
47 | 48 | </div> |
48 | 49 | </div> |
49 | 50 | <div class="form-group col-sm-12"> |
50 | - <label for="skillName" class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>请选择厂商名称:</label> | |
51 | + <label for="skillName" class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>选择厂商:</label> | |
52 | + <div class="col-sm-4 text-left"> | |
53 | + <select name="manufacture_id" class="form-control" id ="manufacture"></select> | |
54 | + </div> | |
55 | + </div> | |
56 | + <div class="form-group col-sm-12"> | |
57 | + <label class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>选择项目:</label> | |
51 | 58 | <div class="col-sm-4 text-left"> |
52 | - <input type="hidden" id="manufacture_id" name="manufacture_id" value="<?= (isset($info["manufacture_id"]) ? $info["manufacture_id"] : "") ?>"/> | |
53 | - <div class="form-control text-center" id="select_manufacture"><span id="manufactureName"><?= (isset($info["manufacture_name"]) && !empty($info["manufacture_name"]) ? $info["manufacture_name"] : "请选择厂商名称") ?></span> <span style="float: right;padding-right: 13px"> > </span></div> | |
59 | + <select name="project_id" class="form-control" id ="project"></select> | |
60 | + </div> | |
61 | + </div> | |
62 | + <div class="form-group col-sm-12"> | |
63 | + <label class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>选择型号:</label> | |
64 | + <div class="col-sm-4 text-left"> | |
65 | + <select name="model_id" class="form-control" id ="model"></select> | |
66 | + </div> | |
67 | + </div> | |
68 | + <div class="form-group col-sm-12"> | |
69 | + <label class="col-sm-4 control-label text-right">描述:</label> | |
70 | + <div class="col-sm-4 text-left"> | |
71 | + <textarea name="desc" class="form-control" id ="desc"><?=$info['desc']?></textarea> | |
54 | 72 | </div> |
55 | 73 | </div> |
56 | 74 | <div class="form-group col-sm-12"> |
... | ... | @@ -90,13 +108,14 @@ $this->params['breadcrumbs'][] = $this->title; |
90 | 108 | </div> |
91 | 109 | |
92 | 110 | </form> |
93 | - | |
111 | +<script src="<?= Yii::$app->request->baseUrl . "/exts/combo-select/js/jquery.combo.select.js"?>"></script> | |
94 | 112 | <!--引入CSS--> |
95 | 113 | <link rel="stylesheet" type="text/css" href="<?=Yii::$app->request->baseUrl ?>/exts/webuploader-0.1.5/webuploader.css"> |
96 | 114 | <!--引入JS--> |
97 | 115 | <script type="text/javascript" src="<?=Yii::$app->request->baseUrl ?>/exts/webuploader-0.1.5/webuploader.js"></script> |
98 | 116 | |
99 | 117 | <script> |
118 | + var searchItemUrl = "<?=Url::toRoute('/device/device/batch-item')?>"; | |
100 | 119 | // 表单提交验证 |
101 | 120 | seajs.use("base/1.0.0/unit/validate/custom-1.0.0",function () { |
102 | 121 | var validator = $("#myFrom").validate({ |
... | ... | @@ -105,7 +124,9 @@ $this->params['breadcrumbs'][] = $this->title; |
105 | 124 | } |
106 | 125 | }); |
107 | 126 | }); |
108 | - | |
127 | + var manufacture_id = '<?=$info["manufacture_id"]?>'; | |
128 | + var project_id = '<?=$info["project_id"]?>'; | |
129 | + var model_id = '<?=$info["model_id"]?>'; | |
109 | 130 | $("#save").bind("click", function () { |
110 | 131 | var getUrl = '<?=Url::toRoute("/upgrade/upgrade/do-edit")?>'; |
111 | 132 | $('#myFrom').attr('action', getUrl); |
... | ... | @@ -114,6 +135,23 @@ $this->params['breadcrumbs'][] = $this->title; |
114 | 135 | alert("APP版本号不能为空"); |
115 | 136 | return false; |
116 | 137 | } |
138 | + var manufacture_id = $("#manufacture").val(); | |
139 | + var project_id = $("#project").val(); | |
140 | + var model_id = $("#model").val(); | |
141 | + | |
142 | + if (manufacture_id == ""){ | |
143 | + alert("请选择厂商"); | |
144 | + return false; | |
145 | + } | |
146 | + if (project_id == ""){ | |
147 | + alert("请选择项目"); | |
148 | + return false; | |
149 | + } | |
150 | + if (model_id == ""){ | |
151 | + alert("请选择型号"); | |
152 | + return false; | |
153 | + } | |
154 | + | |
117 | 155 | var cb = $("#myFrom").validate().form(); |
118 | 156 | if (!cb){ |
119 | 157 | return; |
... | ... | @@ -124,27 +162,6 @@ $this->params['breadcrumbs'][] = $this->title; |
124 | 162 | return false; |
125 | 163 | }); |
126 | 164 | |
127 | - $("#select_manufacture").bind("click", function () { | |
128 | - var getUrl = '<?=Url::toRoute("/upgrade/upgrade/select-manufacture")?>'; | |
129 | - var version = $("input[name='version']").val(); | |
130 | - var package_name = $("input[name='package_name']").val(); | |
131 | - var manufacture_id = $("input[name='manufacture_id']").val(); | |
132 | - var path = $("input[name='path']").val(); | |
133 | - var uid = $("input[name='uid']").val(); | |
134 | - var size = $("input[name='size']").val(); | |
135 | - var file_md5 = $("input[name='file_md5']").val(); | |
136 | - var oldName = $("input[name='oldName']").val(); | |
137 | - var type = $("input[name='type']").val(); | |
138 | - getUrl = getUrl + "?version=" + version + "&package_name=" + package_name + "&manufacture_id=" + manufacture_id; | |
139 | - getUrl = getUrl + "&path=" + path; | |
140 | - getUrl = getUrl + "&size=" + size; | |
141 | - getUrl = getUrl + "&file_md5=" + file_md5; | |
142 | - getUrl = getUrl + "&oldName=" + oldName; | |
143 | - getUrl = getUrl + "&type=" + type; | |
144 | - getUrl = getUrl + "&uid=" + uid; | |
145 | - getUrl = getUrl + "&isCreate=" + 2; | |
146 | - window.location.href = getUrl; | |
147 | - }); | |
148 | 165 | |
149 | 166 | //上传文件函数 |
150 | 167 | //ids唯一ID |
... | ... | @@ -242,4 +259,28 @@ $this->params['breadcrumbs'][] = $this->title; |
242 | 259 | } |
243 | 260 | |
244 | 261 | uploadfiles(2655,"files"); |
262 | + | |
263 | + $(function(){ | |
264 | + function selectAll(id, selectId) { | |
265 | + $.post(searchItemUrl, {type:id}, function(res) { | |
266 | + if(res.list.length > 0) { | |
267 | + var wrapper = '<option value="">请选择</option>'; | |
268 | + $.each(res.list, function(i,n){ | |
269 | + var selected = ''; | |
270 | + if (selectId == n.id) { | |
271 | + selected = 'selected'; | |
272 | + } | |
273 | + wrapper = wrapper + '<option value="'+ n.id+'" '+selected+'>'+ n.name+'</option>'; | |
274 | + }) | |
275 | + $('#'+id).html(wrapper); | |
276 | + $('#'+id).comboSelect(); | |
277 | + } | |
278 | + | |
279 | + }, 'json') | |
280 | + | |
281 | + } | |
282 | + selectAll('manufacture', manufacture_id); | |
283 | + selectAll('project', project_id); | |
284 | + selectAll('model', model_id); | |
285 | + }) | |
245 | 286 | </script> |
246 | 287 | \ No newline at end of file | ... | ... |
app-ht/modules/upgrade/views/upgrade/index.php
... | ... | @@ -46,7 +46,7 @@ $this->params['breadcrumbs'][] = $this->title; |
46 | 46 | </tr> |
47 | 47 | <tr class="search"> |
48 | 48 | <td colspan="6" class="text-center"> |
49 | - <input type="hidden" name="type" value="<?= (isset($gets["type"]) ? $gets["type"] : UpgradeStatus::TYPE_APP) ?>"> | |
49 | + <input type="hidden" id="versionType" name="type" value="<?= (isset($gets["type"]) ? $gets["type"] : UpgradeStatus::TYPE_APP) ?>"> | |
50 | 50 | <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button> |
51 | 51 | <a class="btn btn-default btncls" href="<?=Url::toRoute(["/upgrade/upgrade/index", "type" => (isset($gets["type"]) ? $gets["type"] : UpgradeStatus::TYPE_APP)])?>">重 置</a> |
52 | 52 | </td> |
... | ... | @@ -93,7 +93,7 @@ $this->params['breadcrumbs'][] = $this->title; |
93 | 93 | <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td> |
94 | 94 | <td style="padding:12px;"><?= UpgradeStatus::statusLabel($item['status'])?></td> |
95 | 95 | <td style="padding:12px;"> |
96 | - <?= isset($item["pushed_at"]) && $item["pushed_at"] ? "发布时间:" . date("Y-m-d H:i:s", $item['pushed_at']) : ""?><br> | |
96 | + <?= isset($item["pushed_at"]) && $item["pushed_at"] ? "发布时间:" . date("Y-m-d H:i:s", $item['pushed_at']) : "-"?><br> | |
97 | 97 | <?php if (isset($item["type"]) && UpgradeStatus::TYPE_OTA == $item["type"]) { ?> |
98 | 98 | <?= isset($item["package_type"]) ? UpgradeStatus::packageTypeLabel($item["package_type"]) : ""?> |
99 | 99 | <?= isset($item["start_version"]) ? $item["start_version"] : ""?> |
... | ... | @@ -120,7 +120,7 @@ $this->params['breadcrumbs'][] = $this->title; |
120 | 120 | <?php |
121 | 121 | if (UpgradeStatus::STATUS_ON == $item["status"]) { |
122 | 122 | ?> |
123 | - <a class="btn btn-info btn-sm btn_auth_cancel" href="<?=Url::toRoute(["/upgrade/upgrade/cancel-push", "uid" => $item['id']])?>" aid="<?=$item['id'] ?>">取消发布</a> | |
123 | + <a class="btn btn-info btn-sm btn_auth_cancel" aid="<?=$item['id'] ?>">取消发布</a> | |
124 | 124 | <?php }?> |
125 | 125 | </td> |
126 | 126 | </tr> |
... | ... | @@ -174,5 +174,33 @@ $this->params['breadcrumbs'][] = $this->title; |
174 | 174 | }); |
175 | 175 | } |
176 | 176 | }); |
177 | + | |
178 | + $(".btn_auth_cancel").bind("click",function () { | |
179 | + if (confirm("确定要取消发布该版本吗?")){ | |
180 | + var data_id = $.trim($(this).attr("aid")); | |
181 | + if (data_id == null || data_id == ""){ | |
182 | + alert("丢失参数,暂时无法取消,请刷新后再试"); | |
183 | + return false; | |
184 | + } | |
185 | + var thiz = $(this); | |
186 | + $.ajax({ | |
187 | + type: "post", | |
188 | + url: "<?=Url::toRoute('upgrade/do-cancel')?>", | |
189 | + dataType:"json", | |
190 | + data: $.csrf({id:data_id}), | |
191 | + success:function(res){ | |
192 | + if(!res.success) { | |
193 | + alert(res.message); | |
194 | + } else { | |
195 | + var versionType = $('#versionType').val(); | |
196 | + window.location.href = 'index?type='+versionType; | |
197 | + } | |
198 | + }, | |
199 | + error:function(msg){ | |
200 | + //提示确认失败 | |
201 | + } | |
202 | + }); | |
203 | + } | |
204 | + }); | |
177 | 205 | }); |
178 | 206 | </script> |
179 | 207 | \ No newline at end of file | ... | ... |
app-ht/modules/upgrade/views/upgrade/push-app.php
... | ... | @@ -30,7 +30,19 @@ $this->params['breadcrumbs'][] = $this->title; |
30 | 30 | <div class="form-group col-sm-12"> |
31 | 31 | <label for="skillName" class="col-sm-4 control-label text-right">选择厂商:</label> |
32 | 32 | <div class="col-sm-4 text-left"> |
33 | - <?= (isset($info["manufacture_name"]) ? $info["manufacture_name"] : "") ?> | |
33 | + <?= (isset($info["manufacture_name"]) ? $info["manufacture_name"] : "-") ?> | |
34 | + </div> | |
35 | + </div> | |
36 | + <div class="form-group col-sm-12"> | |
37 | + <label class="col-sm-4 control-label text-right">项目:</label> | |
38 | + <div class="col-sm-4 text-left"> | |
39 | + <?= (isset($info["project_name"]) ? $info["project_name"] : "-") ?> | |
40 | + </div> | |
41 | + </div> | |
42 | + <div class="form-group col-sm-12"> | |
43 | + <label class="col-sm-4 control-label text-right">型号:</label> | |
44 | + <div class="col-sm-4 text-left"> | |
45 | + <?= (isset($info["model_name"]) ? $info["model_name"] : "-") ?> | |
34 | 46 | </div> |
35 | 47 | </div> |
36 | 48 | <div class="form-group col-sm-12"> | ... | ... |
app-ht/modules/upgrade/views/upgrade/push-ota.php
... | ... | @@ -8,7 +8,9 @@ $this->params['breadcrumbs'][] = ['label' => '版本管理', 'url' => ['/upgrade |
8 | 8 | $this->params['breadcrumbs'][] = $this->title; |
9 | 9 | |
10 | 10 | ?> |
11 | - | |
11 | +<style> | |
12 | + .version_range{display:none} | |
13 | + </style> | |
12 | 14 | <form action="<?php echo Url::toRoute(['/upgrade/upgrade/do-push-app']); ?>" name="myFrom" id="myFrom" method="post"> |
13 | 15 | <div class="panel panel-default"> |
14 | 16 | <div class="panel-body"> |
... | ... | @@ -33,6 +35,18 @@ $this->params['breadcrumbs'][] = $this->title; |
33 | 35 | <?= (isset($info["manufacture_name"]) ? $info["manufacture_name"] : "") ?> |
34 | 36 | </div> |
35 | 37 | </div> |
38 | + <div class="form-group col-sm-12"> | |
39 | + <label class="col-sm-4 control-label text-right">项目:</label> | |
40 | + <div class="col-sm-4 text-left"> | |
41 | + <?= (isset($info["project_name"]) ? $info["project_name"] : "-") ?> | |
42 | + </div> | |
43 | + </div> | |
44 | + <div class="form-group col-sm-12"> | |
45 | + <label class="col-sm-4 control-label text-right">型号:</label> | |
46 | + <div class="col-sm-4 text-left"> | |
47 | + <?= (isset($info["model_name"]) ? $info["model_name"] : "-") ?> | |
48 | + </div> | |
49 | + </div> | |
36 | 50 | <hr class="form-group col-sm-12"/> |
37 | 51 | <div class="form-group col-sm-12"> |
38 | 52 | <label for="skillName" class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>是否强制升级:</label> |
... | ... | @@ -48,22 +62,22 @@ $this->params['breadcrumbs'][] = $this->title; |
48 | 62 | <div class="form-group col-sm-12"> |
49 | 63 | <label for="skillName" class="col-sm-4 control-label text-right">设备ID:</label> |
50 | 64 | <div class="col-sm-4 text-left form-inline"> |
51 | - <input type="text" class="form form-control" id="device_ids" style="width: 80%" name="device_ids" placeholder="请填写设备ID,多个ID用逗号隔开"/><span>(选填)</span> | |
65 | + <textarea class="form form-control" id="device_ids" style="width: 100%" name="device_ids" placeholder="请填写设备ID,多个ID用逗号隔开(选填)"></textarea> | |
52 | 66 | </div> |
53 | 67 | </div> |
54 | 68 | <div class="form-group col-sm-12"> |
55 | - <label for="skillName" class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>升级方式:</label> | |
69 | + <label class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>升级方式:</label> | |
56 | 70 | <div class="col-sm-4 text-left"> |
57 | - <input type="radio" name="package_type" style="vertical-align: bottom;" value="2">增量升级 | |
58 | - <input type="radio" name="package_type" style="vertical-align: bottom;margin-left: 20px" value="1">全量升级 | |
71 | + <input type="radio" name="package_type" id="package_part" class="package_type" style="vertical-align: bottom;" value="2">增量升级 | |
72 | + <input type="radio" name="package_type" id="package_full" class="package_type" checked style="vertical-align: bottom;margin-left: 20px" value="1">全量升级 | |
59 | 73 | </div> |
60 | 74 | </div> |
61 | - <div class="form-group col-sm-12"> | |
62 | - <label for="skillName" class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>升级方式:</label> | |
75 | + <div class="form-group col-sm-12 version_range"> | |
76 | + <label class="col-sm-4 control-label text-right"><span style="color: #ff0000;">*</span>版本范围:</label> | |
63 | 77 | <div class="col-sm-4 text-left form form-inline"> |
64 | - <input name="start_version" value="" style="width: 150px;" class="form form-control" placeholder="v1.0"> | |
78 | + <input name="start_version" value="" style="width: 150px;" class="form form-control" placeholder="V1.0"> | |
65 | 79 | <span style="padding: 0 10px">至</span> |
66 | - <input style="width: 150px;" class="form form-control" name="end_version" value="" placeholder="v2.0"> | |
80 | + <input style="width: 150px;" class="form form-control" name="end_version" value="" placeholder="V2.0"> | |
67 | 81 | </div> |
68 | 82 | </div> |
69 | 83 | </div> |
... | ... | @@ -88,6 +102,14 @@ $this->params['breadcrumbs'][] = $this->title; |
88 | 102 | } |
89 | 103 | }); |
90 | 104 | }); |
105 | + $('.package_type').click(function(e){ | |
106 | + var thisVal = $(this).val(); | |
107 | + if(2 == thisVal) { | |
108 | + $('.version_range').show(); | |
109 | + } else { | |
110 | + $('.version_range').hide(); | |
111 | + } | |
112 | + }) | |
91 | 113 | |
92 | 114 | $("#save").bind("click", function () { |
93 | 115 | var getUrl = '<?=Url::toRoute("/upgrade/upgrade/do-push-app")?>'; |
... | ... | @@ -109,14 +131,13 @@ $this->params['breadcrumbs'][] = $this->title; |
109 | 131 | alert("请选择升级方式"); |
110 | 132 | return false; |
111 | 133 | } |
112 | - if (start_version == ""){ | |
113 | - alert("请填写开始版本号"); | |
114 | - return false; | |
115 | - } | |
116 | - if (end_version == ""){ | |
117 | - alert("请填写结束版本号"); | |
118 | - return false; | |
134 | + if (2 == package_type) { | |
135 | + if (start_version == ""){ | |
136 | + alert("请填写开始版本号"); | |
137 | + return false; | |
138 | + } | |
119 | 139 | } |
140 | + | |
120 | 141 | var cb = $("#myFrom").validate().form(); |
121 | 142 | if (!cb){ |
122 | 143 | return; | ... | ... |
console/controllers/TestController.php
... | ... | @@ -119,8 +119,8 @@ class TestController extends Controller |
119 | 119 | public function actionCheckOtaUpdate() |
120 | 120 | { |
121 | 121 | //actionCheckAppVersion |
122 | - $url = 'http://47.107.95.101/app-api/web/checkOtaVersion'; | |
123 | - //$url = 'http://kingb:8012/app-api/web/checkOtaVersion'; | |
122 | + //$url = 'http://47.107.95.101/app-api/web/checkOtaVersion'; | |
123 | + $url = 'http://kingb:8012/app-api/web/checkOtaVersion'; | |
124 | 124 | $params = [ |
125 | 125 | 'barcode' => '0001000100010001', |
126 | 126 | 'device_id' => 'DGDEVBICEID00001', |
... | ... | @@ -128,7 +128,7 @@ class TestController extends Controller |
128 | 128 | 'hardware_version' => 'V1.0.1', |
129 | 129 | ]; |
130 | 130 | $params = json_encode($params); |
131 | - $params = '{"barcode":"0001000100010001","device_id":"DEVICEID00001","software_version":"V1.00.1A.20191002","hardware_version":""}'; | |
131 | + //$params = '{"barcode":"0001000100010001","device_id":"DEVICEID00001","software_version":"V1.00.1A.20191002","hardware_version":""}'; | |
132 | 132 | $postResult = Http::POST($url, $params); |
133 | 133 | echo $postResult; |
134 | 134 | } | ... | ... |
domain/device/CreateBatchRepository.php
... | ... | @@ -33,37 +33,35 @@ class CreateBatchRepository |
33 | 33 | { |
34 | 34 | if ('manufacture' == $type) { |
35 | 35 | $q = new Query(); |
36 | - $q->select('id,manufacture_no, name'); | |
36 | + $q->select(['concat(id, "_", manufacture_no) as uid', 'id','manufacture_no', 'name']); | |
37 | 37 | $q->from('manufacture'); |
38 | - $q->where('name like "%'.$keyword.'%" or manufacture_no like "%'.$keyword.'%"'); | |
39 | - $q->limit(20); | |
38 | + $q->where('id >1'); | |
39 | + | |
40 | 40 | $list = $q->all(); |
41 | 41 | |
42 | 42 | return $list; |
43 | 43 | } elseif('project' == $type) { |
44 | 44 | $q = new Query(); |
45 | - $q->select('id,project_no, name'); | |
45 | + $q->select(['concat(id,"_", project_no) as uid', 'id','project_no', 'name']); | |
46 | 46 | $q->from('project'); |
47 | - $q->where('name like "%'.$keyword.'%" or project_no like "%'.$keyword.'%"'); | |
48 | - $q->limit(20); | |
47 | + $q->where('id >1'); | |
48 | + | |
49 | 49 | $list = $q->all(); |
50 | 50 | |
51 | 51 | return $list; |
52 | 52 | } elseif ('model' == $type) { |
53 | 53 | $q = new Query(); |
54 | - $q->select('id,model_no, name'); | |
54 | + $q->select(['concat(id,"_", model_no) as uid','id','model_no', 'name']); | |
55 | 55 | $q->from('model'); |
56 | - $q->where('name like "%'.$keyword.'%" or model_no like "%'.$keyword.'%"'); | |
57 | - $q->limit(20); | |
56 | + $q->where('id >1'); | |
58 | 57 | $list = $q->all(); |
59 | 58 | |
60 | 59 | return $list; |
61 | 60 | } elseif ('production' == $type) { |
62 | 61 | $q = new Query(); |
63 | - $q->select('id,production_no, name'); | |
62 | + $q->select(['concat(id,"_", production_no) as uid','id','production_no', 'name']); | |
64 | 63 | $q->from('production'); |
65 | - $q->where('name like "%'.$keyword.'%" or production_no like "%'.$keyword.'%"'); | |
66 | - $q->limit(20); | |
64 | + $q->where('id >1'); | |
67 | 65 | $list = $q->all(); |
68 | 66 | |
69 | 67 | return $list; | ... | ... |
domain/upgrade/Upgrade.php
... | ... | @@ -20,20 +20,30 @@ class Upgrade |
20 | 20 | static function create($item) |
21 | 21 | { |
22 | 22 | try { |
23 | - $findUpgradeModel = UpgradeModel::findOne(['version' => $item["version"], 'manufacture_id' => $item["manufacture_id"], 'type' => $item["type"]]); | |
23 | + $where = [ | |
24 | + 'version' => $item["version"], | |
25 | + 'manufacture_id' => $item["manufacture_id"], | |
26 | + 'project_id' => $item["project_id"], | |
27 | + 'model_id' => $item["model_id"], | |
28 | + 'type' => $item["type"] | |
29 | + ]; | |
30 | + $findUpgradeModel = UpgradeModel::findOne($where); | |
24 | 31 | if (!empty($findUpgradeModel)) { |
25 | 32 | return -1; |
26 | 33 | } |
27 | 34 | $upgradeModel = Yii::createObject(UpgradeModel::className()); |
28 | - $upgradeModel->type = $item["type"]; // 版本类型 1. app类升级,2. OTA整包升级 | |
29 | - $upgradeModel->version = $item["version"]; // 版本 | |
30 | - $upgradeModel->manufacture_id = $item["manufacture_id"]; // 厂商编号 | |
31 | - $upgradeModel->path = $item["path"]; // 文件路径 | |
32 | - $upgradeModel->package_name = $item["package_name"]; // 安装包名称 | |
35 | + $upgradeModel->type = $item["type"]; // 版本类型 1. app类升级,2. OTA整包升级 | |
36 | + $upgradeModel->version = $item["version"]; // 版本 | |
37 | + $upgradeModel->manufacture_id = $item["manufacture_id"]; // 厂商编号 | |
38 | + $upgradeModel->project_id = $item["project_id"]; // 项目 | |
39 | + $upgradeModel->model_id = $item["model_id"]; // 型号 | |
40 | + $upgradeModel->desc = $item["desc"]; // 描述 | |
41 | + $upgradeModel->path = $item["path"]; // 文件路径 | |
42 | + $upgradeModel->package_name = $item["package_name"]; // 安装包名称 | |
33 | 43 | if (isset($item["device_ids"])) { |
34 | 44 | $upgradeModel->device_ids = $item["指定deviceID,可以多个,多个用逗号隔开"]; // 版本 |
35 | 45 | } |
36 | - $upgradeModel->size = $item["size"]; // 文件大小 | |
46 | + $upgradeModel->size = $item["size"]; // 文件大小 | |
37 | 47 | $upgradeModel->file_md5 = $item["file_md5"]; // 软件包校验用的md5 |
38 | 48 | $saveResult = $upgradeModel->save(); |
39 | 49 | return $saveResult; |
... | ... | @@ -66,6 +76,15 @@ class Upgrade |
66 | 76 | if (isset($item['manufacture_id']) && !empty($item['manufacture_id'])) { |
67 | 77 | $upgradeModel->manufacture_id = $item['manufacture_id']; |
68 | 78 | } |
79 | + if (isset($item['project_id']) && !empty($item['project_id'])) { | |
80 | + $upgradeModel->project_id = $item['project_id']; | |
81 | + } | |
82 | + if (isset($item['model_id']) && !empty($item['model_id'])) { | |
83 | + $upgradeModel->model_id = $item['model_id']; | |
84 | + } | |
85 | + if (isset($item['desc']) && !empty($item['desc'])) { | |
86 | + $upgradeModel->desc = $item['desc']; | |
87 | + } | |
69 | 88 | if (isset($item['path']) && !empty($item['path'])) { |
70 | 89 | $upgradeModel->path = $item['path']; |
71 | 90 | } | ... | ... |
environments/dev/app-ht/config/params-local.php
environments/dev/common/config/main-local.php
1 | 1 | <?php |
2 | 2 | $config['components']['db'] = [ |
3 | 3 | 'class' => 'yii\db\Connection', |
4 | - 'dsn' => 'mysql:host=localhost;dbname=ota', | |
4 | + 'dsn' => 'mysql:host=127.0.0.1;dbname=authorization', | |
5 | 5 | 'username' => 'root', |
6 | - 'password' => '123456', | |
6 | + 'password' => 'kb@2019', | |
7 | 7 | 'charset' => 'utf8', |
8 | 8 | ]; |
9 | 9 | ... | ... |
environments/prod/app-api/config/main-local.php
... | ... | @@ -3,7 +3,7 @@ $config = [ |
3 | 3 | 'components' => [ |
4 | 4 | 'request' => [ |
5 | 5 | // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation |
6 | - 'cookieValidationKey' => '', | |
6 | + 'cookieValidationKey' => 'YdCyYvm8eOZZsaNRa_idrGimyTbsEQ8R', | |
7 | 7 | ], |
8 | 8 | ], |
9 | 9 | ]; | ... | ... |
environments/prod/app-ht/config/params-local.php
environments/prod/common/config/main-local.php
environments/test/common/config/main-local.php