From dbf4fbf4a038d9126bd99534c963a22cc5162d64 Mon Sep 17 00:00:00 2001 From: caoming <604844710@qq.com> Date: Wed, 30 Oct 2019 11:12:44 +0800 Subject: [PATCH] app-ht(v1.8.6 build 12) 1.数据统计OTA升级统计功能实现 1.数据统计APP升级统计功能实现 --- app-ht/config/main.php | 7 +++++-- app-ht/config/params.php | 2 +- app-ht/modules/datas/Module.php | 14 ++++++++++++++ app-ht/modules/datas/config/perm.php | 14 ++++++++++++++ app-ht/modules/datas/controllers/UpgradeLogController.php | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/datas/views/upgrade-log/export.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/datas/views/upgrade-log/index.php | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/manufacturer/views/manufacturer/index.php | 2 +- app-ht/modules/model/views/model/index.php | 2 +- app-ht/modules/production/views/production/index.php | 2 +- app-ht/modules/project/views/project/index.php | 2 +- app-ht/modules/upgrade/views/upgrade/index.php | 12 +----------- app-ht/views/layouts/routes.php | 6 +++--- domain/upgrade/UpgradeLog.php | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ domain/upgrade/UpgradeLogRepository.php | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ domain/upgrade/UpgradeLogStatus.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ domain/upgrade/models/UpgradeLog.php | 36 ++++++++++++++++++++++++++++++++++++ 17 files changed, 720 insertions(+), 21 deletions(-) create mode 100644 app-ht/modules/datas/Module.php create mode 100644 app-ht/modules/datas/config/perm.php create mode 100644 app-ht/modules/datas/controllers/UpgradeLogController.php create mode 100644 app-ht/modules/datas/views/upgrade-log/export.php create mode 100644 app-ht/modules/datas/views/upgrade-log/index.php create mode 100644 domain/upgrade/UpgradeLog.php create mode 100644 domain/upgrade/UpgradeLogRepository.php create mode 100644 domain/upgrade/UpgradeLogStatus.php create mode 100644 domain/upgrade/models/UpgradeLog.php diff --git a/app-ht/config/main.php b/app-ht/config/main.php index 1484c0f..dc07cae 100644 --- a/app-ht/config/main.php +++ b/app-ht/config/main.php @@ -42,11 +42,14 @@ $config = [ ], 'home' => [ 'class' => 'app\ht\modules\home\Module', - ] - , + ], 'production' => [ 'class' => 'app\ht\modules\production\Module', ] + , + 'datas' => [ + 'class' => 'app\ht\modules\datas\Module', + ] ], 'components' => [ 'user' => [ diff --git a/app-ht/config/params.php b/app-ht/config/params.php index 2773e12..2d23b29 100644 --- a/app-ht/config/params.php +++ b/app-ht/config/params.php @@ -1,4 +1,4 @@ 'v1.8.6 build 11', + 'VERSION' => 'v1.8.6 build 12', ]; \ No newline at end of file diff --git a/app-ht/modules/datas/Module.php b/app-ht/modules/datas/Module.php new file mode 100644 index 0000000..cd83321 --- /dev/null +++ b/app-ht/modules/datas/Module.php @@ -0,0 +1,14 @@ +params['perm'] = require(__DIR__ . '/config/perm.php'); + } +} \ No newline at end of file diff --git a/app-ht/modules/datas/config/perm.php b/app-ht/modules/datas/config/perm.php new file mode 100644 index 0000000..d10bcc3 --- /dev/null +++ b/app-ht/modules/datas/config/perm.php @@ -0,0 +1,14 @@ + '数据统计', + 'items' => [ + 'shop_city' => [ + 'label' => '数据统计', + 'items' => [ + 2 => '数据统计', + ], + 'path' => 'datas/upgrade-log/*' + ], + ] +]; diff --git a/app-ht/modules/datas/controllers/UpgradeLogController.php b/app-ht/modules/datas/controllers/UpgradeLogController.php new file mode 100644 index 0000000..ede76de --- /dev/null +++ b/app-ht/modules/datas/controllers/UpgradeLogController.php @@ -0,0 +1,126 @@ +dataList(1); + /** + * 渲染模板 + */ + return $this->render('index', $params); + } + + /** + * 查询数据列表 + */ + protected function dataList($type = '') + { + $request = Yii::$app->request; + $creatTime = $request->get('creatTime'); + $endTime = $request->get('endTime'); + $status = $request->get('status'); + $current_version = $request->get('current_version'); + $target_version = $request->get('target_version'); + $manufacture_name = $request->get('manufacture_name'); + $device_no = $request->get('device_no'); + $barcode = $request->get('barcode'); + $error_code = $request->get('error_code'); + $device_device_id = $request->get('device_device_id'); + $dataType = !empty($request->get('type')) ? $request->get('type') : UpgradeStatus::TYPE_APP; + + $gets = [ + 'creatTime' => $creatTime, + 'endTime' => $endTime, + 'status' => $status, + 'current_version' => $current_version, + 'target_version' => $target_version, + 'manufacture_name' => $manufacture_name, + 'device_no' => $device_no, + 'barcode' => $barcode, + 'error_code' => $error_code, + 'device_device_id' => $device_device_id, + 'type' => $dataType, + ]; + + $where = ['and']; + if ($creatTime) { + $creatTime = strtotime($creatTime); + $where[] = ['>=', 'ul.created_at', $creatTime]; + } + if ($endTime) { + $endTime = strtotime($endTime) + 86400; + $where[] = ['<=', 'ul.created_at', $endTime]; + } + if ($status) { + $where[] = ['=', 'ul.status', $status]; + } + if ($current_version) { + $where[] = ['like', 'ul.current_version', $current_version]; + } + if ($target_version) { + $where[] = ['like', 'ul.target_version', $target_version]; + } + if ($manufacture_name) { + $where[] = ['like', 'mf.name', $manufacture_name]; + } + if ($device_no) { + $where[] = ['like', 'md.name', $device_no]; + } + if ($barcode) { + $where[] = ['like', 'ul.barcode', $barcode]; + } + if ($error_code) { + $where[] = ['like', 'ul.error_code', $error_code]; + } + if ($device_device_id) { + $where[] = ['like', 'de.device_id', $device_device_id]; + } + if ($dataType) { + $where[] = ['=', 'ul.type', $dataType]; + } + if ($type == 0) { + $pageList = UpgradeLogRepository::getPageList($where, 0 , 0); + $pages = null; + } else { + $pageSize = 20; + $pages = new Pagination(['totalCount' => UpgradeLogRepository::getPageCount($where), 'pageSize' => $pageSize]); + $pageList = UpgradeLogRepository::getPageList($where, $pages->offset, $pages->limit); + } + + /** + * 数据整理 + */ + return [ + 'listdata' => $pageList, + 'pages' => $pages, + 'gets' => $gets + ]; + } + + /** + * 导出版本日志数据 + * @return string + */ + public function actionExport() + { + $params = $this->dataList(0); + return $this->renderPartial('export', $params); + } +} \ No newline at end of file diff --git a/app-ht/modules/datas/views/upgrade-log/export.php b/app-ht/modules/datas/views/upgrade-log/export.php new file mode 100644 index 0000000..8639fdb --- /dev/null +++ b/app-ht/modules/datas/views/upgrade-log/export.php @@ -0,0 +1,66 @@ + + + + + + + + + +
+ + + + + + + + + + + + + + + + $item) : ?> + + + + + + + + + + + + + + +
设备ID当前版本目标版本厂商机器型号Barcode升级状态升级错误码时间
+
+ + \ No newline at end of file diff --git a/app-ht/modules/datas/views/upgrade-log/index.php b/app-ht/modules/datas/views/upgrade-log/index.php new file mode 100644 index 0000000..b87524c --- /dev/null +++ b/app-ht/modules/datas/views/upgrade-log/index.php @@ -0,0 +1,180 @@ +title = 'OTA升级统计'; +} else { + $this->title = 'APP升级统计'; +} +$this->params['breadcrumbs'][] = $this->title; +?> + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
当前版本 + + 目标版本 + + 厂商 + + 机器型号 + +
Barcode + + 升级状态 + + 升级错误码 + + 时间 +
+ - + +
+
设备ID + +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
设备ID当前版本目标版本厂商机器型号Barcode升级状态升级错误码时间
+
暂无记录
+
+
+ + +
+ \ No newline at end of file diff --git a/app-ht/modules/manufacturer/views/manufacturer/index.php b/app-ht/modules/manufacturer/views/manufacturer/index.php index bb7dc02..c5e9d01 100644 --- a/app-ht/modules/manufacturer/views/manufacturer/index.php +++ b/app-ht/modules/manufacturer/views/manufacturer/index.php @@ -87,7 +87,7 @@ $this->params['breadcrumbs'][] = $this->title; - +
暂无记录
diff --git a/app-ht/modules/model/views/model/index.php b/app-ht/modules/model/views/model/index.php index 0f961a7..7efb824 100644 --- a/app-ht/modules/model/views/model/index.php +++ b/app-ht/modules/model/views/model/index.php @@ -81,7 +81,7 @@ $this->params['breadcrumbs'][] = $this->title; - +
暂无记录
diff --git a/app-ht/modules/production/views/production/index.php b/app-ht/modules/production/views/production/index.php index d65ede9..59c5378 100644 --- a/app-ht/modules/production/views/production/index.php +++ b/app-ht/modules/production/views/production/index.php @@ -82,7 +82,7 @@ $this->params['breadcrumbs'][] = $this->title; - +
暂无记录
diff --git a/app-ht/modules/project/views/project/index.php b/app-ht/modules/project/views/project/index.php index 6c917a2..c19d137 100644 --- a/app-ht/modules/project/views/project/index.php +++ b/app-ht/modules/project/views/project/index.php @@ -81,7 +81,7 @@ $this->params['breadcrumbs'][] = $this->title; - +
暂无记录
diff --git a/app-ht/modules/upgrade/views/upgrade/index.php b/app-ht/modules/upgrade/views/upgrade/index.php index 6dc1bbc..bb05a34 100644 --- a/app-ht/modules/upgrade/views/upgrade/index.php +++ b/app-ht/modules/upgrade/views/upgrade/index.php @@ -117,7 +117,7 @@ $this->params['breadcrumbs'][] = $this->title; - +
暂无记录
@@ -136,16 +136,6 @@ $this->params['breadcrumbs'][] = $this->title;