Commit 78ba6991792bb5a79437432ca65eb352dc337feb
1 parent
b80f928e
Exists in
master
app-ht
1. F筛选条件添加过滤空格 2. A OTA 和APP升级统计日志添加删除功能 3. F 上传文件包添加说明告知上传的时间较长
Showing
12 changed files
with
241 additions
and
64 deletions
Show diff stats
app-ht/controllers/BaseController.php
@@ -103,4 +103,17 @@ class BaseController extends Controller | @@ -103,4 +103,17 @@ class BaseController extends Controller | ||
103 | mkdir($downloadFilePath, 0777, true); | 103 | mkdir($downloadFilePath, 0777, true); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | + | ||
107 | + /** | ||
108 | + * 过滤空格 | ||
109 | + * @param $var | ||
110 | + * @return mixed | ||
111 | + */ | ||
112 | + public function filterVar($var) | ||
113 | + { | ||
114 | + $var = str_replace(" ", "", $var); | ||
115 | + $var = str_replace("\t", "", $var); | ||
116 | + | ||
117 | + return $var; | ||
118 | + } | ||
106 | } | 119 | } |
app-ht/modules/datas/controllers/DeviceController.php
@@ -10,6 +10,7 @@ use app\ht\controllers\BaseController; | @@ -10,6 +10,7 @@ use app\ht\controllers\BaseController; | ||
10 | use domain\device\CreateBatchRepository; | 10 | use domain\device\CreateBatchRepository; |
11 | use domain\device\DeviceRepository; | 11 | use domain\device\DeviceRepository; |
12 | use domain\device\DeviceStatus; | 12 | use domain\device\DeviceStatus; |
13 | +use function strtotime; | ||
13 | 14 | ||
14 | /** | 15 | /** |
15 | * 机器状态码管理 | 16 | * 机器状态码管理 |
@@ -41,6 +42,13 @@ class DeviceController extends BaseController | @@ -41,6 +42,13 @@ class DeviceController extends BaseController | ||
41 | $modelName = $request->get('model_name'); | 42 | $modelName = $request->get('model_name'); |
42 | $productionName = $request->get('production_name'); | 43 | $productionName = $request->get('production_name'); |
43 | $batchName = $request->get('batch_no'); | 44 | $batchName = $request->get('batch_no'); |
45 | + | ||
46 | + $manufactureName = $this->filterVar($manufactureName); | ||
47 | + $projectName = $this->filterVar($projectName); | ||
48 | + $modelName = $this->filterVar($modelName); | ||
49 | + $productionName = $this->filterVar($productionName); | ||
50 | + $batchName = $this->filterVar($batchName); | ||
51 | + | ||
44 | $gets = [ | 52 | $gets = [ |
45 | 'manufacture_name' => $manufactureName, | 53 | 'manufacture_name' => $manufactureName, |
46 | 'project_name' => $projectName, | 54 | 'project_name' => $projectName, |
app-ht/modules/datas/controllers/DeviceStatsController.php
@@ -2,13 +2,12 @@ | @@ -2,13 +2,12 @@ | ||
2 | 2 | ||
3 | namespace app\ht\modules\datas\controllers; | 3 | namespace app\ht\modules\datas\controllers; |
4 | 4 | ||
5 | -use domain\device\DeviceStatsRepository; | ||
6 | use Yii; | 5 | use Yii; |
7 | use yii\data\Pagination; | 6 | use yii\data\Pagination; |
8 | -use domain\upgrade\UpgradeLogRepository; | ||
9 | -use domain\upgrade\UpgradeStatus; | ||
10 | use app\ht\controllers\BaseController; | 7 | use app\ht\controllers\BaseController; |
8 | +use domain\device\DeviceStatsRepository; | ||
11 | 9 | ||
10 | +use function strtotime; | ||
12 | /** | 11 | /** |
13 | * 机器状态码管理 | 12 | * 机器状态码管理 |
14 | * Class DeviceStatsController | 13 | * Class DeviceStatsController |
@@ -36,13 +35,13 @@ class DeviceStatsController extends BaseController | @@ -36,13 +35,13 @@ class DeviceStatsController extends BaseController | ||
36 | $request = Yii::$app->request; | 35 | $request = Yii::$app->request; |
37 | $createTime = $request->get('createTime'); | 36 | $createTime = $request->get('createTime'); |
38 | $endTime = $request->get('endTime'); | 37 | $endTime = $request->get('endTime'); |
39 | - $software_version = $request->get('software_version'); | ||
40 | - $hardware_version = $request->get('hardware_version'); | ||
41 | - $manufacture_name = $request->get('manufacture_name'); | ||
42 | - $model_name = $request->get('model_name'); | ||
43 | - $device_id = $request->get('device_id'); | ||
44 | - $barcode = $request->get('barcode'); | ||
45 | - $city = $request->get('city'); | 38 | + $software_version = $this->filterVar($request->get('software_version')); |
39 | + $hardware_version = $this->filterVar($request->get('hardware_version')); | ||
40 | + $manufacture_name = $this->filterVar($request->get('manufacture_name')); | ||
41 | + $model_name = $this->filterVar($request->get('model_name')); | ||
42 | + $device_id = $this->filterVar($request->get('device_id')); | ||
43 | + $barcode = $this->filterVar($request->get('barcode')); | ||
44 | + $city = $this->filterVar($request->get('city')); | ||
46 | 45 | ||
47 | $gets = [ | 46 | $gets = [ |
48 | 'createTime' => $createTime, | 47 | 'createTime' => $createTime, |
@@ -59,11 +58,11 @@ class DeviceStatsController extends BaseController | @@ -59,11 +58,11 @@ class DeviceStatsController extends BaseController | ||
59 | $where = ['and']; | 58 | $where = ['and']; |
60 | if ($createTime) { | 59 | if ($createTime) { |
61 | $createTime = strtotime($createTime); | 60 | $createTime = strtotime($createTime); |
62 | - $where[] = ['>=', 'ds.created_at', $createTime]; | 61 | + $where[] = ['>=', 'ds.timestamp', $createTime]; |
63 | } | 62 | } |
64 | if ($endTime) { | 63 | if ($endTime) { |
65 | $endTime = strtotime($endTime) + 86400; | 64 | $endTime = strtotime($endTime) + 86400; |
66 | - $where[] = ['<=', 'ds.created_at', $endTime]; | 65 | + $where[] = ['<=', 'ds.timestamp', $endTime]; |
67 | } | 66 | } |
68 | 67 | ||
69 | if ($software_version) { | 68 | if ($software_version) { |
app-ht/modules/datas/controllers/UpgradeLogController.php
@@ -4,9 +4,13 @@ namespace app\ht\modules\datas\controllers; | @@ -4,9 +4,13 @@ namespace app\ht\modules\datas\controllers; | ||
4 | 4 | ||
5 | use Yii; | 5 | use Yii; |
6 | use yii\data\Pagination; | 6 | use yii\data\Pagination; |
7 | +use app\ht\controllers\BaseController; | ||
7 | use domain\upgrade\UpgradeLogRepository; | 8 | use domain\upgrade\UpgradeLogRepository; |
8 | use domain\upgrade\UpgradeStatus; | 9 | use domain\upgrade\UpgradeStatus; |
9 | -use app\ht\controllers\BaseController; | 10 | +use domain\upgrade\UpgradeLog; |
11 | +use stdClass; | ||
12 | +use function count; | ||
13 | +use function strtotime; | ||
10 | 14 | ||
11 | /** | 15 | /** |
12 | * 版本日志管理 | 16 | * 版本日志管理 |
@@ -32,19 +36,47 @@ class UpgradeLogController extends BaseController | @@ -32,19 +36,47 @@ class UpgradeLogController extends BaseController | ||
32 | */ | 36 | */ |
33 | protected function dataList($type = '') | 37 | protected function dataList($type = '') |
34 | { | 38 | { |
39 | + $searchCondition = $this->searchWhere(); | ||
40 | + $where = $searchCondition[0]; | ||
41 | + $gets = $searchCondition[1]; | ||
42 | + if ($type == 0) { | ||
43 | + $pageList = UpgradeLogRepository::getPageList($where, 0 , 0); | ||
44 | + $pages = null; | ||
45 | + } else { | ||
46 | + $pageSize = 20; | ||
47 | + $pages = new Pagination(['totalCount' => UpgradeLogRepository::getPageCount($where), 'pageSize' => $pageSize]); | ||
48 | + $pageList = UpgradeLogRepository::getPageList($where, $pages->offset, $pages->limit); | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * 数据整理 | ||
53 | + */ | ||
54 | + return [ | ||
55 | + 'listdata' => $pageList, | ||
56 | + 'pages' => $pages, | ||
57 | + 'gets' => $gets | ||
58 | + ]; | ||
59 | + } | ||
60 | + | ||
61 | + private function searchWhere($requestType = 1) | ||
62 | + { | ||
35 | $request = Yii::$app->request; | 63 | $request = Yii::$app->request; |
36 | - $creatTime = $request->get('creatTime'); | ||
37 | - $endTime = $request->get('endTime'); | ||
38 | - $status = $request->get('status'); | ||
39 | - $current_version = $request->get('current_version'); | ||
40 | - $target_version = $request->get('target_version'); | ||
41 | - $manufacture_name = $request->get('manufacture_name'); | ||
42 | - $device_no = $request->get('device_no'); | ||
43 | - $barcode = $request->get('barcode'); | ||
44 | - $error_code = $request->get('error_code'); | ||
45 | - $device_device_id = $request->get('device_device_id'); | ||
46 | - $package_name = $request->get('package_name'); | ||
47 | - $dataType = !empty($request->get('type')) ? $request->get('type') : UpgradeStatus::TYPE_APP; | 64 | + $reqName = 'get'; |
65 | + if (2 == $requestType) { | ||
66 | + $reqName = 'post'; | ||
67 | + } | ||
68 | + $creatTime = $request->$reqName('creatTime'); | ||
69 | + $endTime = $request->$reqName('endTime'); | ||
70 | + $status = $request->$reqName('status'); | ||
71 | + $current_version = $this->filterVar($request->$reqName('current_version')); | ||
72 | + $target_version = $this->filterVar($request->$reqName('target_version')); | ||
73 | + $manufacture_name = $this->filterVar($request->$reqName('manufacture_name')); | ||
74 | + $device_no = $this->filterVar($request->$reqName('device_no')); | ||
75 | + $barcode = $this->filterVar($request->$reqName('barcode')); | ||
76 | + $error_code = $request->$reqName('error_code'); | ||
77 | + $device_device_id = $request->$reqName('device_device_id'); | ||
78 | + $package_name = $this->filterVar($request->$reqName('package_name')); | ||
79 | + $dataType = !empty($request->$reqName('type')) ? $request->$reqName('type') : UpgradeStatus::TYPE_APP; | ||
48 | 80 | ||
49 | $gets = [ | 81 | $gets = [ |
50 | 'creatTime' => $creatTime, | 82 | 'creatTime' => $creatTime, |
@@ -100,23 +132,8 @@ class UpgradeLogController extends BaseController | @@ -100,23 +132,8 @@ class UpgradeLogController extends BaseController | ||
100 | if ($dataType) { | 132 | if ($dataType) { |
101 | $where[] = ['=', 'ul.type', $dataType]; | 133 | $where[] = ['=', 'ul.type', $dataType]; |
102 | } | 134 | } |
103 | - if ($type == 0) { | ||
104 | - $pageList = UpgradeLogRepository::getPageList($where, 0 , 0); | ||
105 | - $pages = null; | ||
106 | - } else { | ||
107 | - $pageSize = 20; | ||
108 | - $pages = new Pagination(['totalCount' => UpgradeLogRepository::getPageCount($where), 'pageSize' => $pageSize]); | ||
109 | - $pageList = UpgradeLogRepository::getPageList($where, $pages->offset, $pages->limit); | ||
110 | - } | ||
111 | 135 | ||
112 | - /** | ||
113 | - * 数据整理 | ||
114 | - */ | ||
115 | - return [ | ||
116 | - 'listdata' => $pageList, | ||
117 | - 'pages' => $pages, | ||
118 | - 'gets' => $gets | ||
119 | - ]; | 136 | + return [$where, $gets]; |
120 | } | 137 | } |
121 | 138 | ||
122 | /** | 139 | /** |
@@ -128,4 +145,69 @@ class UpgradeLogController extends BaseController | @@ -128,4 +145,69 @@ class UpgradeLogController extends BaseController | ||
128 | $params = $this->dataList(0); | 145 | $params = $this->dataList(0); |
129 | return $this->renderPartial('export', $params); | 146 | return $this->renderPartial('export', $params); |
130 | } | 147 | } |
148 | + | ||
149 | + /** | ||
150 | + * @return string | ||
151 | + */ | ||
152 | + public function actionDelSearch() | ||
153 | + { | ||
154 | + $request = Yii::$app->request; | ||
155 | + $e = new stdClass(); | ||
156 | + $e->success = false; | ||
157 | + $e->message = '失败'; | ||
158 | + | ||
159 | + $searchCondition = $this->searchWhere(2); | ||
160 | + $where = $searchCondition[0]; | ||
161 | + | ||
162 | + $post = $request->post(); | ||
163 | + if ((1 == count($post) && isset($post['type'])) || empty($post)) { | ||
164 | + $e->message = '请录入搜索条件'; | ||
165 | + return $this->renderJson($e); | ||
166 | + } | ||
167 | + | ||
168 | + $upgrades = UpgradeLogRepository::getPageList($where, 0 , 0); | ||
169 | + $ids = []; | ||
170 | + foreach($upgrades as $k => $v) { | ||
171 | + if ($v) { | ||
172 | + $ids[] = $v['id']; | ||
173 | + } | ||
174 | + } | ||
175 | + if (!$ids) { | ||
176 | + $e->message = '没有满足条件的记录'; | ||
177 | + return $this->renderJson($e); | ||
178 | + } | ||
179 | + $result = UpgradeLog::deleteAll(['id' => $ids]); | ||
180 | + if ($result) { | ||
181 | + $e->message = '成功删除'.count($ids).'记录'; | ||
182 | + $e->success = true; | ||
183 | + return $this->renderJson($e); | ||
184 | + } else { | ||
185 | + $e->message = '删除失败'; | ||
186 | + return $this->renderJson($e); | ||
187 | + } | ||
188 | + } | ||
189 | + | ||
190 | + /** | ||
191 | + * @return string | ||
192 | + */ | ||
193 | + public function actionDelItem() | ||
194 | + { | ||
195 | + $request = Yii::$app->request; | ||
196 | + $e = new stdClass(); | ||
197 | + $e->success = false; | ||
198 | + $e->message = '失败'; | ||
199 | + $id = $request->post('id'); | ||
200 | + if (empty($id)) { | ||
201 | + $e->message = 'ID为空,删除失败'; | ||
202 | + return $this->renderJson($e); | ||
203 | + } | ||
204 | + if (UpgradeLog::delete($id)) { | ||
205 | + $e->message = '删除成功'; | ||
206 | + $e->success = true; | ||
207 | + return $this->renderJson($e); | ||
208 | + } else { | ||
209 | + $e->message = 'ID为空,删除失败'; | ||
210 | + return $this->renderJson($e); | ||
211 | + } | ||
212 | + } | ||
131 | } | 213 | } |
132 | \ No newline at end of file | 214 | \ No newline at end of file |
app-ht/modules/datas/views/device-stats/export.php
@@ -28,8 +28,8 @@ $cnt = 0; | @@ -28,8 +28,8 @@ $cnt = 0; | ||
28 | <tr> | 28 | <tr> |
29 | <th width="10%">设备ID</th> | 29 | <th width="10%">设备ID</th> |
30 | <th width="10%">Barcode</th> | 30 | <th width="10%">Barcode</th> |
31 | - <th width="10%">硬件版本</th> | ||
32 | <th width="10%">软件版本</th> | 31 | <th width="10%">软件版本</th> |
32 | + <th width="10%">硬件版本</th> | ||
33 | <th width="10%">厂商</th> | 33 | <th width="10%">厂商</th> |
34 | <th width="10%">设备型号</th> | 34 | <th width="10%">设备型号</th> |
35 | <th width="10%">所在城市</th> | 35 | <th width="10%">所在城市</th> |
@@ -48,7 +48,7 @@ $cnt = 0; | @@ -48,7 +48,7 @@ $cnt = 0; | ||
48 | <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td> | 48 | <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td> |
49 | <td style="padding:12px;"><?= empty($item["city"])? '-':$item["city"]?></td> | 49 | <td style="padding:12px;"><?= empty($item["city"])? '-':$item["city"]?></td> |
50 | <td style="padding:12px;"><?= $item["ip"]?></td> | 50 | <td style="padding:12px;"><?= $item["ip"]?></td> |
51 | - <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td> | 51 | + <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['timestamp'])?></td> |
52 | </tr> | 52 | </tr> |
53 | <?php | 53 | <?php |
54 | $cnt++; | 54 | $cnt++; |
app-ht/modules/datas/views/device-stats/index.php
@@ -85,8 +85,8 @@ $this->params['breadcrumbs'][] = '机器状态统计'; | @@ -85,8 +85,8 @@ $this->params['breadcrumbs'][] = '机器状态统计'; | ||
85 | <tr> | 85 | <tr> |
86 | <th width="10%">设备ID</th> | 86 | <th width="10%">设备ID</th> |
87 | <th width="10%">Barcode</th> | 87 | <th width="10%">Barcode</th> |
88 | - <th width="10%">硬件版本</th> | ||
89 | <th width="10%">软件版本</th> | 88 | <th width="10%">软件版本</th> |
89 | + <th width="10%">硬件版本</th> | ||
90 | <th width="10%">厂商</th> | 90 | <th width="10%">厂商</th> |
91 | <th width="10%">设备型号</th> | 91 | <th width="10%">设备型号</th> |
92 | <th width="10%">所在城市</th> | 92 | <th width="10%">所在城市</th> |
@@ -107,7 +107,7 @@ $this->params['breadcrumbs'][] = '机器状态统计'; | @@ -107,7 +107,7 @@ $this->params['breadcrumbs'][] = '机器状态统计'; | ||
107 | <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td> | 107 | <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td> |
108 | <td style="padding:12px;"><?= empty($item["city"])? '-':$item["city"]?></td> | 108 | <td style="padding:12px;"><?= empty($item["city"])? '-':$item["city"]?></td> |
109 | <td style="padding:12px;"><?= $item["ip"]?></td> | 109 | <td style="padding:12px;"><?= $item["ip"]?></td> |
110 | - <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td> | 110 | + <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['timestamp'])?></td> |
111 | </tr> | 111 | </tr> |
112 | <?php endforeach; ?> | 112 | <?php endforeach; ?> |
113 | <?php } else { ?> | 113 | <?php } else { ?> |
app-ht/modules/datas/views/upgrade-log/index.php
@@ -103,16 +103,17 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -103,16 +103,17 @@ $this->params['breadcrumbs'][] = $this->title; | ||
103 | <table class="table table-striped table-bordered" id="brand-table"> | 103 | <table class="table table-striped table-bordered" id="brand-table"> |
104 | <thead> | 104 | <thead> |
105 | <tr> | 105 | <tr> |
106 | - <th width="10%">设备ID</th> | 106 | + <th width="9%">设备ID</th> |
107 | <th width="8%">包名</th> | 107 | <th width="8%">包名</th> |
108 | <th width="8%">当前版本</th> | 108 | <th width="8%">当前版本</th> |
109 | - <th width="10%">目标版本</th> | ||
110 | - <th width="10%">厂商</th> | ||
111 | - <th width="10%">机器型号</th> | ||
112 | - <th width="10%">Barcode</th> | 109 | + <th width="9%">目标版本</th> |
110 | + <th width="9%">厂商</th> | ||
111 | + <th width="9%">机器型号</th> | ||
112 | + <th width="9%">Barcode</th> | ||
113 | <th width="7%">升级状态</th> | 113 | <th width="7%">升级状态</th> |
114 | - <th width="10%">升级错误码</th> | ||
115 | - <th width="10%">时间</th> | 114 | + <th width="9%">升级错误码</th> |
115 | + <th width="9%">时间</th> | ||
116 | + <th width="8%">操作</th> | ||
116 | </tr> | 117 | </tr> |
117 | </thead> | 118 | </thead> |
118 | 119 | ||
@@ -130,6 +131,7 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -130,6 +131,7 @@ $this->params['breadcrumbs'][] = $this->title; | ||
130 | <td style="padding:12px;"><?= UpgradeLogStatus::statusLabel($item['status'])?></td> | 131 | <td style="padding:12px;"><?= UpgradeLogStatus::statusLabel($item['status'])?></td> |
131 | <td style="padding:12px;"><?= (!empty($item["error_code"]) ? $item["error_code"] : "-") ?></td> | 132 | <td style="padding:12px;"><?= (!empty($item["error_code"]) ? $item["error_code"] : "-") ?></td> |
132 | <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td> | 133 | <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td> |
134 | + <td style="padding:12px;"><a class="del-item-btn" href="javascript:void(0)" data-id="<?=$item['id']?>">删除</a></td> | ||
133 | </tr> | 135 | </tr> |
134 | <?php endforeach; ?> | 136 | <?php endforeach; ?> |
135 | <?php } else { ?> | 137 | <?php } else { ?> |
@@ -141,6 +143,9 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -141,6 +143,9 @@ $this->params['breadcrumbs'][] = $this->title; | ||
141 | <?php } ?> | 143 | <?php } ?> |
142 | </tbody> | 144 | </tbody> |
143 | </table> | 145 | </table> |
146 | + <div class="action-box"> | ||
147 | + <button class="btn btn-danger btn-sm btn_search_del" >删除搜索结果</button> | ||
148 | + </div> | ||
144 | </div> | 149 | </div> |
145 | 150 | ||
146 | <div class="panel-footer"> | 151 | <div class="panel-footer"> |
@@ -153,6 +158,8 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -153,6 +158,8 @@ $this->params['breadcrumbs'][] = $this->title; | ||
153 | </div> | 158 | </div> |
154 | </div> | 159 | </div> |
155 | <script> | 160 | <script> |
161 | + var delSearchURL = '<?=Url::to("del-search")?>'; | ||
162 | + var delItemURL = '<?=Url::to("del-item")?>'; | ||
156 | window.queryParams = function(params) { | 163 | window.queryParams = function(params) { |
157 | $("#search-form").find('input[name]').each(function () { | 164 | $("#search-form").find('input[name]').each(function () { |
158 | var val = $(this).val(); | 165 | var val = $(this).val(); |
@@ -163,7 +170,7 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -163,7 +170,7 @@ $this->params['breadcrumbs'][] = $this->title; | ||
163 | }); | 170 | }); |
164 | return params; | 171 | return params; |
165 | } | 172 | } |
166 | - $(document).ready(function () { | 173 | + $(function () { |
167 | $('#btn-export').click(function(e){ | 174 | $('#btn-export').click(function(e){ |
168 | var params = {}; | 175 | var params = {}; |
169 | window.queryParams(params); | 176 | window.queryParams(params); |
@@ -178,5 +185,57 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -178,5 +185,57 @@ $this->params['breadcrumbs'][] = $this->title; | ||
178 | window.location.href = "export" + $strQuery; | 185 | window.location.href = "export" + $strQuery; |
179 | return false; | 186 | return false; |
180 | }) | 187 | }) |
188 | + | ||
189 | + | ||
190 | + $('.btn_search_del').click(function(e){ | ||
191 | + var params = {}; | ||
192 | + window.queryParams(params); | ||
193 | + | ||
194 | + if (null == params || '' == params) { | ||
195 | + alert('请录入搜索条件'); | ||
196 | + return false; | ||
197 | + } | ||
198 | + | ||
199 | + var paramsLen = 0; | ||
200 | + var keyName = ''; | ||
201 | + for(var key in params ) { | ||
202 | + paramsLen++; | ||
203 | + keyName = key; | ||
204 | + } | ||
205 | + | ||
206 | + if (('type' == keyName && 1 == paramsLen) || '' == keyName) { | ||
207 | + alert('请录入搜索条件'); | ||
208 | + return false; | ||
209 | + } | ||
210 | + | ||
211 | + if (!confirm('确定删除么?')) { | ||
212 | + return false; | ||
213 | + } | ||
214 | + $.post(delSearchURL, params, function(ajaxRes){ | ||
215 | + alert(ajaxRes.message); | ||
216 | + if(ajaxRes.success) { | ||
217 | + var _body = window.parent; | ||
218 | + var _iframe1=_body.document.getElementById('x-iframe'); | ||
219 | + _iframe1.contentWindow.location.reload(true); | ||
220 | + } | ||
221 | + }, 'json') | ||
222 | + | ||
223 | + }) | ||
224 | + | ||
225 | + $('.del-item-btn').click(function(e){ | ||
226 | + var id = $(this).attr('data-id'); | ||
227 | + if (!confirm('确定删除该条记录么?')) { | ||
228 | + return false; | ||
229 | + } | ||
230 | + $.post(delItemURL, {id:id}, function(ajaxRes){ | ||
231 | + alert(ajaxRes.message); | ||
232 | + if(ajaxRes.success) { | ||
233 | + var _body = window.parent; | ||
234 | + var _iframe1=_body.document.getElementById('x-iframe'); | ||
235 | + _iframe1.contentWindow.location.reload(true); | ||
236 | + } | ||
237 | + }, 'json') | ||
238 | + }) | ||
239 | + | ||
181 | }); | 240 | }); |
182 | </script> | 241 | </script> |
183 | \ No newline at end of file | 242 | \ No newline at end of file |
app-ht/modules/device/controllers/DeviceController.php
@@ -58,13 +58,13 @@ class DeviceController extends BaseController | @@ -58,13 +58,13 @@ class DeviceController extends BaseController | ||
58 | private function dataList($type, $delete = 0) | 58 | private function dataList($type, $delete = 0) |
59 | { | 59 | { |
60 | $request = Yii::$app->request; | 60 | $request = Yii::$app->request; |
61 | - $serialNo = $request->get('serial_no'); | ||
62 | - $mac = $request->get('mac'); | ||
63 | - $project = $request->get('project'); | ||
64 | - $model = $request->get('model'); | ||
65 | - $production = $request->get('production'); | ||
66 | - $manufacture = $request->get('manufacture'); | ||
67 | - $deviceId = $request->get('device_id'); | 61 | + $serialNo = $this->filterVar($request->get('serial_no')); |
62 | + $mac = $this->filterVar($request->get('mac')); | ||
63 | + $project = $this->filterVar($request->get('project')); | ||
64 | + $model = $this->filterVar($request->get('model')); | ||
65 | + $production = $this->filterVar($request->get('production')); | ||
66 | + $manufacture = $this->filterVar($request->get('manufacture')); | ||
67 | + $deviceId = $this->filterVar($request->get('device_id')); | ||
68 | $status = $request->get('status'); | 68 | $status = $request->get('status'); |
69 | 69 | ||
70 | $startApplyAt = $request->get('start_apply_at'); | 70 | $startApplyAt = $request->get('start_apply_at'); |
@@ -81,6 +81,7 @@ class DeviceController extends BaseController | @@ -81,6 +81,7 @@ class DeviceController extends BaseController | ||
81 | 'and', | 81 | 'and', |
82 | ['=','a.is_delete', $delete] | 82 | ['=','a.is_delete', $delete] |
83 | ]; | 83 | ]; |
84 | + | ||
84 | if (!empty($serialNo)) { | 85 | if (!empty($serialNo)) { |
85 | $where[] = ['like', 'a.serial_no', $serialNo]; | 86 | $where[] = ['like', 'a.serial_no', $serialNo]; |
86 | } | 87 | } |
app-ht/modules/upgrade/controllers/UpgradeController.php
@@ -553,8 +553,10 @@ class UpgradeController extends BaseController | @@ -553,8 +553,10 @@ class UpgradeController extends BaseController | ||
553 | ]; | 553 | ]; |
554 | 554 | ||
555 | // 上传OSS | 555 | // 上传OSS |
556 | + | ||
556 | $fileService = new FileService(); | 557 | $fileService = new FileService(); |
557 | $fileService->add($uploadPath, $savePath); | 558 | $fileService->add($uploadPath, $savePath); |
559 | + | ||
558 | // 删除服务器传成功的文件 | 560 | // 删除服务器传成功的文件 |
559 | //@unlink($uploadPath); | 561 | //@unlink($uploadPath); |
560 | 562 |
app-ht/modules/upgrade/views/upgrade/create.php
@@ -219,7 +219,7 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -219,7 +219,7 @@ $this->params['breadcrumbs'][] = $this->title; | ||
219 | '</div>' ); | 219 | '</div>' ); |
220 | }); | 220 | }); |
221 | // 文件上传过程中创建进度条实时显示。 | 221 | // 文件上传过程中创建进度条实时显示。 |
222 | - uploader.on( 'uploadProgress', function( file, percentage ) { | 222 | + uploader.on('uploadProgress', function( file, percentage ) { |
223 | var $li = $( '#'+file.id ), | 223 | var $li = $( '#'+file.id ), |
224 | $percent = $li.find('.progress .progress-bar'); | 224 | $percent = $li.find('.progress .progress-bar'); |
225 | 225 | ||
@@ -231,7 +231,7 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -231,7 +231,7 @@ $this->params['breadcrumbs'][] = $this->title; | ||
231 | '</div>').appendTo( $li ).find('.progress-bar'); | 231 | '</div>').appendTo( $li ).find('.progress-bar'); |
232 | } | 232 | } |
233 | 233 | ||
234 | - $li.find('p.state').text('上传中'); | 234 | + $li.find('p.state').text('上传中, 文件会先上传到缓存再传到远程服务器,600M大概是12分钟左右,请耐心等待'); |
235 | 235 | ||
236 | $percent.css( 'width', percentage * 100 + '%' ); | 236 | $percent.css( 'width', percentage * 100 + '%' ); |
237 | }); | 237 | }); |
app-ht/modules/upgrade/views/upgrade/edit.php
@@ -222,7 +222,7 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -222,7 +222,7 @@ $this->params['breadcrumbs'][] = $this->title; | ||
222 | '</div>').appendTo( $li ).find('.progress-bar'); | 222 | '</div>').appendTo( $li ).find('.progress-bar'); |
223 | } | 223 | } |
224 | 224 | ||
225 | - $li.find('p.state').text('上传中'); | 225 | + $li.find('p.state').text('上传中, 文件会先上传到缓存再传到远程服务器,600M大概是12分钟左右,请耐心等待'); |
226 | 226 | ||
227 | $percent.css( 'width', percentage * 100 + '%' ); | 227 | $percent.css( 'width', percentage * 100 + '%' ); |
228 | }); | 228 | }); |
domain/upgrade/UpgradeLog.php
@@ -126,6 +126,19 @@ class UpgradeLog | @@ -126,6 +126,19 @@ class UpgradeLog | ||
126 | return false; | 126 | return false; |
127 | } | 127 | } |
128 | 128 | ||
129 | - return UpgradeLogModel::deleteAll(["id" => $id]); | 129 | + return $upgradeModel->delete(); |
130 | + } | ||
131 | + | ||
132 | + /** | ||
133 | + * @param $condition | ||
134 | + * @return bool|int | ||
135 | + */ | ||
136 | + public static function deleteAll($condition) | ||
137 | + { | ||
138 | + if (empty($condition)) { | ||
139 | + return false; | ||
140 | + } | ||
141 | + | ||
142 | + return UpgradeLogModel::deleteAll($condition); | ||
130 | } | 143 | } |
131 | } | 144 | } |
132 | \ No newline at end of file | 145 | \ No newline at end of file |