DeviceController.php
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace app\ht\modules\device\controllers;
use Yii;
use yii\data\Pagination;
use app\ht\controllers\BaseController;
use domain\DeviceRepository;
use domain\DeviceStatus;
/**
* 设备管理
*/
class DeviceController extends BaseController
{
/**
* @return string
*/
public function actionIndex()
{
$request = Yii::$app->request;
$serialNo = $request->get('serial_no');
$mac = $request->get('mac');
$page = $request->get('page');
$where = [
'and'
];
if (null !== $serialNo) {
$where[] = ['like', 'serial_no', $serialNo];
}
if (isset($mac)) {
$where[] = ['like', 'mac', $mac];
}
if (0 >= $page) {
$page = 1;
}
$pageSize = 20;
$page = ($page -1) * $pageSize;
$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,
];
return $this->render('index', $params);
}
/**
* 导出订单数据
* @return string
*/
public function actionExportDa()
{
$request = Yii::$app->request;
}
/**
* @return string
*/
public function actionInfo()
{
}
}