From 547615129fba03bb2b884574d14f33ed6a3759cd Mon Sep 17 00:00:00 2001 From: xu Date: Mon, 4 Nov 2019 10:55:46 +0800 Subject: [PATCH] 1. A 添加删除序列号列表 2. F 调整出错页面 --- app-ht/modules/datas/views/device/index.php | 2 ++ app-ht/modules/device/controllers/DeviceController.php | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/device/views/device/createDevice.php | 8 ++++---- app-ht/modules/device/views/device/delete-index.php | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app-ht/modules/device/views/device/index.php | 5 +++++ app-ht/modules/upgrade/controllers/UpgradeController.php | 19 +++++++++++++++++-- app-ht/views/site/error/400.php | 2 +- app-ht/views/site/error/403.php | 2 +- app-ht/views/site/error/404.php | 2 +- domain/device/CreateBatchRepository.php | 6 ++++-- domain/upgrade/Upgrade.php | 2 +- domain/upgrade/UpgradeStatus.php | 2 +- 12 files changed, 339 insertions(+), 13 deletions(-) create mode 100644 app-ht/modules/device/views/device/delete-index.php diff --git a/app-ht/modules/datas/views/device/index.php b/app-ht/modules/datas/views/device/index.php index 5ad5be6..a5ea6fd 100644 --- a/app-ht/modules/datas/views/device/index.php +++ b/app-ht/modules/datas/views/device/index.php @@ -69,6 +69,7 @@ $this->params['breadcrumbs'][] = $this->title; 型号 生产日期 生成总数 + 删除数 授权总数 授权失败数 未授权数 @@ -85,6 +86,7 @@ $this->params['breadcrumbs'][] = $this->title; + diff --git a/app-ht/modules/device/controllers/DeviceController.php b/app-ht/modules/device/controllers/DeviceController.php index c31dcac..0675e51 100644 --- a/app-ht/modules/device/controllers/DeviceController.php +++ b/app-ht/modules/device/controllers/DeviceController.php @@ -99,6 +99,79 @@ class DeviceController extends BaseController /** * @return string */ + public function actionDeleteIndex() + { + $request = Yii::$app->request; + $serialNo = $request->get('serial_no'); + $mac = $request->get('mac'); + $project = $request->get('project'); + $model = $request->get('model'); + $production = $request->get('production'); + $manufacture = $request->get('manufacture'); + $deviceId = $request->get('device_id'); + $status = $request->get('status'); + $page = $request->get('page'); + $where = [ + 'and', + ['=','a.is_delete', 1] + ]; + if (!empty($serialNo)) { + $where[] = ['like', 'a.serial_no', $serialNo]; + } + if (!empty($project)) { + $where[] = ['like', 'p.name', $project]; + } + if (!empty($model)) { + $where[] = ['like', 'mo.name', $model]; + } + if (!empty($production)) { + $where[] = ['like', 'pd.name', $production]; + } + if (!empty($mac)) { + $where[] = ['like', 'a.mac', $mac]; + } + if (!empty($manufacture)) { + $where[] = ['like', 'm.name', $manufacture]; + } + if (!empty($deviceId)) { + $where[] = ['like', 'a.device_id', $deviceId]; + } + if (isset($_GET['status']) && -1 != $status) { + $where[] = ['=', 'a.status', $status]; + } else { + $status = -1; + } + + if (0 >= $page) { + $page = 1; + } + $pageSize = 20; + $page = ($page -1) * $pageSize; + // DeviceRepository::getList($where, $pageSize, $page); + $deviceData = DeviceRepository::getList($where, $pageSize, $page); + $pages = new Pagination(['totalCount' => DeviceRepository::getListCount($where), 'pageSize' => $pageSize]); + $statusList = DeviceStatus::statusLabels(); // + + $params['statusList'] = $statusList; + $params['deviceList'] = $deviceData; + $params['pages'] = $pages; + $params["gets"] = [ + 'serial_no' => $serialNo, + 'mac' => $mac, + 'project' => $project, + 'model' => $model, + 'device_id' => $deviceId, + 'production' => $production, + 'manufacture' => $manufacture, + 'status' => $status + ]; + + return $this->render('delete-index', $params); + } + + /** + * @return string + */ public function actionCreateDevice() { return $this->render('createDevice'); diff --git a/app-ht/modules/device/views/device/createDevice.php b/app-ht/modules/device/views/device/createDevice.php index cc32054..39903ac 100644 --- a/app-ht/modules/device/views/device/createDevice.php +++ b/app-ht/modules/device/views/device/createDevice.php @@ -23,14 +23,14 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css');
-
+创建厂商
+
+创建厂商
- +
@@ -38,14 +38,14 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css');
- +
- +
diff --git a/app-ht/modules/device/views/device/delete-index.php b/app-ht/modules/device/views/device/delete-index.php new file mode 100644 index 0000000..a1fe0f0 --- /dev/null +++ b/app-ht/modules/device/views/device/delete-index.php @@ -0,0 +1,229 @@ +title = '删除序列号管理'; +$this->params['breadcrumbs'][] = '序列号管理'; +$this->params['breadcrumbs'][] = $this->title; +?> + +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID序列号厂商项目设备型号生产日期MAC地址设备ID申请时间授权时间状态操作
+ + +
+
+ + + + + + + + +
+
+
+
+ + + + + + + +
+
暂无记录
+
+
+ + +
+ + \ No newline at end of file diff --git a/app-ht/modules/device/views/device/index.php b/app-ht/modules/device/views/device/index.php index 37ccb63..80ca5f4 100644 --- a/app-ht/modules/device/views/device/index.php +++ b/app-ht/modules/device/views/device/index.php @@ -86,6 +86,11 @@ $this->params['breadcrumbs'][] = $this->title;
diff --git a/app-ht/modules/upgrade/controllers/UpgradeController.php b/app-ht/modules/upgrade/controllers/UpgradeController.php index 10a7a4c..f3ad1b4 100644 --- a/app-ht/modules/upgrade/controllers/UpgradeController.php +++ b/app-ht/modules/upgrade/controllers/UpgradeController.php @@ -4,12 +4,12 @@ namespace app\ht\modules\upgrade\controllers; use Yii; use yii\data\Pagination; +use app\ht\controllers\BaseController; use common\components\adminlog\AdminLogs; use domain\manufacturer\ManufacturerRepository; use domain\upgrade\Upgrade; use domain\upgrade\UpgradeRepository; use domain\upgrade\UpgradeStatus; -use app\ht\controllers\BaseController; use stdClass; @@ -156,11 +156,25 @@ class UpgradeController extends BaseController $request = Yii::$app->request; $id = $request->post("id"); // $e = new stdClass(); + $e->success = false; + $e->message = 'fail'; if (empty($id)) { - + $e->message = 'ID为空'; + return $this->renderJson($e); + } + $upgradeModel = UpgradeRepository::findOne(['id' => $id]); + if (empty($upgradeModel)) { + $e->message = '未找到版本记录'; return $this->renderJson($e); } + $upgradeModel->status = UpgradeStatus::STATUS_WAIT; + if ($upgradeModel->save()) { + $e->success = true; + } else { + $e->message = '取消失败'; + } + return $this->renderJson($e); } /** @@ -606,6 +620,7 @@ class UpgradeController extends BaseController } else { Yii::$app->session->setFlash('error', '发布失败'); } + return $this->redirect('index?type=' . (!empty($request->post("type")) ? $request->post("type") : UpgradeStatus::TYPE_APP)); } } \ No newline at end of file diff --git a/app-ht/views/site/error/400.php b/app-ht/views/site/error/400.php index 88747bf..85a6382 100644 --- a/app-ht/views/site/error/400.php +++ b/app-ht/views/site/error/400.php @@ -19,7 +19,7 @@ use yii\helpers\Url;

请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。

-

邮箱:tech@jiwork.com

+

邮箱:tech@szboardtek.com

---- 400 OTA技术部(求约) diff --git a/app-ht/views/site/error/403.php b/app-ht/views/site/error/403.php index 98f2914..6c84939 100644 --- a/app-ht/views/site/error/403.php +++ b/app-ht/views/site/error/403.php @@ -19,7 +19,7 @@ use yii\helpers\Url;

请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。

-

邮箱:tech@jiwork.com

+

邮箱:tech@szboardtek.com

----OTA技术部(求约) diff --git a/app-ht/views/site/error/404.php b/app-ht/views/site/error/404.php index 72603b2..86b2436 100644 --- a/app-ht/views/site/error/404.php +++ b/app-ht/views/site/error/404.php @@ -19,7 +19,7 @@ use yii\helpers\Url;

请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。

-

邮箱:tech@jiwork.com

+

邮箱:tech@szboardtek.com

---- 404(求约) diff --git a/domain/device/CreateBatchRepository.php b/domain/device/CreateBatchRepository.php index a641298..f6a52ec 100644 --- a/domain/device/CreateBatchRepository.php +++ b/domain/device/CreateBatchRepository.php @@ -81,11 +81,13 @@ class CreateBatchRepository static function getPageList($where, $offset = 0, $limit = 0) { $hasAuthNumExpress = new Expression("(select count(*) from ".DeviceModel::tableName(). "as dd where dd.status =".DeviceStatus::HAS_AUTH.' and dd.batch_id = a.id and dd.is_delete = 0) as has_auth_num'); - $noAuthNumExpress = new Expression("(select count(*) from ".DeviceModel::tableName(). "as dd where dd.status =".DeviceStatus::NO_AUTH.' and dd.batch_id = a.id and dd.is_delete = 0) as no_auth_num'); + $noAuthNumExpress = new Expression("(select count(*) from ".DeviceModel::tableName(). "as dd where dd.status =".DeviceStatus::NO_AUTH.' and dd.batch_id = a.id and dd.is_delete = 0) as del_num'); + + $delNumExpress = new Expression("(select count(*) from ".DeviceModel::tableName(). "as dd where dd.is_delete = 1 and dd.batch_id = a.id) as del_num"); $batchModelFind = CreateBatchModel::find(); $batchModelFind->alias('a'); - $batchModelFind->select(['a.*','m.name as manufacture_name','pro.name as project_name','mo.name as model_name','prod.name as production_name', $hasAuthNumExpress, $noAuthNumExpress]); + $batchModelFind->select(['a.*','m.name as manufacture_name','pro.name as project_name','mo.name as model_name','prod.name as production_name', $hasAuthNumExpress, $noAuthNumExpress, $delNumExpress]); $batchModelFind->leftJoin(ManufacturerModel::tableName(). ' m', 'm.id = a.manufacture_id'); $batchModelFind->leftJoin(ProjectModel::tableName(). ' pro', 'pro.id = a.project_id'); $batchModelFind->leftJoin(ModelModel::tableName(). ' mo', 'mo.id = a.model_id'); diff --git a/domain/upgrade/Upgrade.php b/domain/upgrade/Upgrade.php index 5bf4568..1b733ec 100644 --- a/domain/upgrade/Upgrade.php +++ b/domain/upgrade/Upgrade.php @@ -84,7 +84,7 @@ class Upgrade $upgradeModel->start_version = $item['start_version']; } // 增量允许的结束版本号 - if (isset($item['end_version']) && !empty($item['end_version'])) { + if (isset($item['end_version'])) { $upgradeModel->end_version = $item['end_version']; } if (isset($item['size']) && !empty($item['size'])) { diff --git a/domain/upgrade/UpgradeStatus.php b/domain/upgrade/UpgradeStatus.php index 2b04470..e1caf51 100644 --- a/domain/upgrade/UpgradeStatus.php +++ b/domain/upgrade/UpgradeStatus.php @@ -60,7 +60,7 @@ class UpgradeStatus public static function focuseLabels() { return [ - self::FOCUSE_NO => '不强制升级', + self::FOCUSE_NO => '正常升级', self::FOCUSE_YES => '强制升级' ]; } -- libgit2 0.21.0