Commit 27252b60583893f65d5079a53d052b7008846fcb

Authored by xu
1 parent 4df7fbdd
Exists in master

1. F 序列号管理更正

app-api/controllers/AuthDeviceController.php
@@ -73,7 +73,8 @@ class AuthDeviceController extends BaseController @@ -73,7 +73,8 @@ class AuthDeviceController extends BaseController
73 return $e; 73 return $e;
74 } 74 }
75 // 检测是否授权过了的设备 75 // 检测是否授权过了的设备
76 - $deviceModel = DeviceRepository::findOne(['device_id' => $deviceId]); 76 + // 这里还得判读删除之后恢复的,状态是未授权
  77 + $deviceModel = DeviceRepository::findOne(['device_id' => $deviceId, 'is_delete' => 0]);
77 if ($deviceModel && DeviceStatus::HAS_AUTH == $deviceModel->status) { 78 if ($deviceModel && DeviceStatus::HAS_AUTH == $deviceModel->status) {
78 $e->mac = $deviceModel->mac; 79 $e->mac = $deviceModel->mac;
79 $e->serial_no = $deviceModel->serial_no; 80 $e->serial_no = $deviceModel->serial_no;
app-ht/modules/datas/views/device/device-list.php
@@ -43,7 +43,6 @@ $this->params['breadcrumbs'][] = $this->title; @@ -43,7 +43,6 @@ $this->params['breadcrumbs'][] = $this->title;
43 </div> 43 </div>
44 44
45 <div class="form-group col-sm-12"> 45 <div class="form-group col-sm-12">
46 -  
47 <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label> 46 <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label>
48 <div class="col-sm-4 form-inline"> 47 <div class="col-sm-4 form-inline">
49 <input type="date" class="form-control" style="width:140px" id="start_apply_at" name="start_apply_at" value="<?php if (!empty($gets['start_apply_at'])){ echo $gets['start_apply_at'];} ?>" autocomplete="off"> - 48 <input type="date" class="form-control" style="width:140px" id="start_apply_at" name="start_apply_at" value="<?php if (!empty($gets['start_apply_at'])){ echo $gets['start_apply_at'];} ?>" autocomplete="off"> -
@@ -62,7 +61,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -62,7 +61,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
62 </div> 61 </div>
63 </div> 62 </div>
64 <div class="panel" style="margin-bottom: 0"> 63 <div class="panel" style="margin-bottom: 0">
65 - <div style="padding:10px ;20px;box-sizing: border-box">><b>厂商:</b><?=$gets['manufacture']?> <b>项目:</b><?=$gets['manufacture']?> <b>型号:</b><?=$gets['model']?> <b>生产日期:</b><?=$gets['production']?> 64 + <div style="padding:10px ;20px;box-sizing: border-box">><b>厂商:</b><?=$gets['manufacture']?> <b>项目:</b><?=$gets['project']?> <b>型号:</b><?=$gets['model']?> <b>生产日期:</b><?=$gets['production']?>
66 <b> 批次编号:</b><?=$gets['batch_no']?> 65 <b> 批次编号:</b><?=$gets['batch_no']?>
67 </div> 66 </div>
68 </div> 67 </div>
app-ht/modules/datas/views/device/index.php
@@ -70,8 +70,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -70,8 +70,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
70 <th width="10%">生产日期</th> 70 <th width="10%">生产日期</th>
71 <th width="10%">生成总数</th> 71 <th width="10%">生成总数</th>
72 <th width="8%">删除数</th> 72 <th width="8%">删除数</th>
73 - <th width="10%">授权总数</th>  
74 - <th width="15%">授权失败数</th> 73 + <th width="8%">授权总数</th>
  74 + <th width="8%">超出总数</th>
  75 + <th width="8%">授权失败数</th>
75 <th width="15%">未授权数</th> 76 <th width="15%">未授权数</th>
76 </tr> 77 </tr>
77 </thead> 78 </thead>
@@ -88,6 +89,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -88,6 +89,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
88 <td style="padding:12px;"><a href="<?=Url::toRoute(['device/device-list','batch_id' => $item['id']])?>"><?= (isset($item["num"]) ? $item["num"] : "0") ?></a></td> 89 <td style="padding:12px;"><a href="<?=Url::toRoute(['device/device-list','batch_id' => $item['id']])?>"><?= (isset($item["num"]) ? $item["num"] : "0") ?></a></td>
89 <td style="padding:12px;"><?= (isset($item["del_num"]) ? $item["del_num"] : "0") ?></td> 90 <td style="padding:12px;"><?= (isset($item["del_num"]) ? $item["del_num"] : "0") ?></td>
90 <td style="padding:12px;"><?= (isset($item["has_auth_num"]) ? $item["has_auth_num"] : "0") ?></td> 91 <td style="padding:12px;"><?= (isset($item["has_auth_num"]) ? $item["has_auth_num"] : "0") ?></td>
  92 + <td>4</td>
91 <td style="padding:12px;"><?= (!empty($item["auth_fail_num"]) ? $item["auth_fail_num"] : "0") ?></td> 93 <td style="padding:12px;"><?= (!empty($item["auth_fail_num"]) ? $item["auth_fail_num"] : "0") ?></td>
92 <td style="padding:12px;"><?= (!empty($item["no_auth_num"]) ? $item["no_auth_num"] : "0") ?></td> 94 <td style="padding:12px;"><?= (!empty($item["no_auth_num"]) ? $item["no_auth_num"] : "0") ?></td>
93 </tr> 95 </tr>
app-ht/modules/device/controllers/DeviceController.php
@@ -43,6 +43,8 @@ class DeviceController extends BaseController @@ -43,6 +43,8 @@ class DeviceController extends BaseController
43 $startAuthAt = $request->get('start_auth_at'); 43 $startAuthAt = $request->get('start_auth_at');
44 $endAuthAt = $request->get('end_auth_at'); 44 $endAuthAt = $request->get('end_auth_at');
45 45
  46 + $has_re_auth = $request->get('has_re_auth');
  47 +
46 $page = $request->get('page'); 48 $page = $request->get('page');
47 $where = [ 49 $where = [
48 'and', 50 'and',
@@ -81,6 +83,9 @@ class DeviceController extends BaseController @@ -81,6 +83,9 @@ class DeviceController extends BaseController
81 if ($endAuthAt) { 83 if ($endAuthAt) {
82 $where[] = ['>=', 'a.auth_at', strtotime($endAuthAt) + 86400]; 84 $where[] = ['>=', 'a.auth_at', strtotime($endAuthAt) + 86400];
83 } 85 }
  86 + if ($has_re_auth) {
  87 + $where[] = ['=', 'a.has_re_auth', $has_re_auth];
  88 + }
84 if (isset($_GET['status']) && -1 != $status) { 89 if (isset($_GET['status']) && -1 != $status) {
85 $where[] = ['=', 'a.status', $status]; 90 $where[] = ['=', 'a.status', $status];
86 } else { 91 } else {
@@ -112,6 +117,7 @@ class DeviceController extends BaseController @@ -112,6 +117,7 @@ class DeviceController extends BaseController
112 'end_apply_at' => $endApplyAt, 117 'end_apply_at' => $endApplyAt,
113 'start_auth_at' => $startAuthAt, 118 'start_auth_at' => $startAuthAt,
114 'end_auth_at' => $endAuthAt, 119 'end_auth_at' => $endAuthAt,
  120 + 'has_re_auth' => $has_re_auth,
115 'status' => $status 121 'status' => $status
116 ]; 122 ];
117 123
@@ -174,7 +180,7 @@ class DeviceController extends BaseController @@ -174,7 +180,7 @@ class DeviceController extends BaseController
174 $where[] = ['>=', 'a.auth_at', strtotime($startAuthAt)]; 180 $where[] = ['>=', 'a.auth_at', strtotime($startAuthAt)];
175 } 181 }
176 if ($endAuthAt) { 182 if ($endAuthAt) {
177 - $where[] = ['>=', 'a.auth_at', strtotime($endAuthAt) + 86400]; 183 + $where[] = ['<=', 'a.auth_at', strtotime($endAuthAt) + 86400];
178 } 184 }
179 if (isset($_GET['status']) && -1 != $status) { 185 if (isset($_GET['status']) && -1 != $status) {
180 $where[] = ['=', 'a.status', $status]; 186 $where[] = ['=', 'a.status', $status];
@@ -637,6 +643,23 @@ class DeviceController extends BaseController @@ -637,6 +643,23 @@ class DeviceController extends BaseController
637 } 643 }
638 } 644 }
639 645
  646 + /**
  647 + * 恢复删除的设备
  648 + * @return string
  649 + */
  650 + public function actionRestoreDevice()
  651 + {
  652 + $req = Yii::$app->request;
  653 + $id = $req->post('id');
  654 + $e = new stdClass();
  655 + $e->success = false;
  656 + $e->message = 'fail';
  657 + $delDevice = DeviceRepository::findOne(['id' => $id, 'is_delete' => 1]);
  658 +
  659 +
  660 + return $this->renderJson($e);
  661 + }
  662 +
640 public function actionBatchIndex() 663 public function actionBatchIndex()
641 { 664 {
642 665
app-ht/modules/device/views/device/auth-fail-index.php
@@ -42,7 +42,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -42,7 +42,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
42 42
43 <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label> 43 <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label>
44 <div class="col-sm-5 form-inline"> 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"> 45 + <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">
46 </div> 46 </div>
47 47
48 </div> 48 </div>
@@ -59,8 +59,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -59,8 +59,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
59 <table class="table table-striped table-bordered" id="brand-table"> 59 <table class="table table-striped table-bordered" id="brand-table">
60 <thead> 60 <thead>
61 <tr> 61 <tr>
62 - <th width="5%"><input type="checkbox" value="all" class="all_check"/></th>  
63 - <th width="6%">ID</th> 62 + <th width="4%"></th>
  63 + <th width="5%">ID</th>
64 <th width="15%">厂商</th> 64 <th width="15%">厂商</th>
65 <th width="6%">项目</th> 65 <th width="6%">项目</th>
66 <th width="8%">设备型号</th> 66 <th width="8%">设备型号</th>
@@ -102,7 +102,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -102,7 +102,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
102 102
103 <td class="td-cls"> 103 <td class="td-cls">
104 <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>" data-action="edit">编辑</button> &nbsp;|&nbsp; 104 <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>" data-action="edit">编辑</button> &nbsp;|&nbsp;
105 - <button class="btn btn-primary btn-sm btn_re_auth" aid="<?=$item['id'] ?>">授权</button> 105 + <button class="btn btn-primary btn-sm btn_re_auth" aid="<?=$item['id'] ?>">处理</button>
106 </td> 106 </td>
107 </tr> 107 </tr>
108 <?php endforeach; ?> 108 <?php endforeach; ?>
@@ -115,6 +115,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -115,6 +115,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
115 <?php } ?> 115 <?php } ?>
116 </tbody> 116 </tbody>
117 </table> 117 </table>
  118 + <div class="action-box">
  119 + <label><input type="checkbox" class="check-all" value="all" /> 本页全选 </label> <button class="btn btn-primary btn-sm btn_batch_auth" >批量处理</button>
  120 + </div>
118 </div> 121 </div>
119 122
120 <div class="panel-footer"> 123 <div class="panel-footer">
app-ht/modules/device/views/device/delete-index.php
@@ -82,15 +82,16 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -82,15 +82,16 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
82 <li ><a style="padding: 10px 20px;" href="<?=Url::toRoute('/device/device/index')?>" >全部序列号</a></li> 82 <li ><a style="padding: 10px 20px;" href="<?=Url::toRoute('/device/device/index')?>" >全部序列号</a></li>
83 <li class="active" ><a style="padding: 10px 12px;" href="<?=Url::toRoute('/device/device/delete-index')?>" >删除序列号</a></li> 83 <li class="active" ><a style="padding: 10px 12px;" href="<?=Url::toRoute('/device/device/delete-index')?>" >删除序列号</a></li>
84 </ul> 84 </ul>
85 - </div> 85 +
86 <table class="table table-striped table-bordered" id="brand-table"> 86 <table class="table table-striped table-bordered" id="brand-table">
87 <thead> 87 <thead>
88 <tr> 88 <tr>
  89 + <th >ID</th>
89 <th width="6%">ID</th> 90 <th width="6%">ID</th>
90 <th width="6%">序列号</th> 91 <th width="6%">序列号</th>
91 <th width="8%">厂商</th> 92 <th width="8%">厂商</th>
92 <th width="6%">项目</th> 93 <th width="6%">项目</th>
93 - <th width="8%">设备型号</th> 94 + <th width="7%">设备型号</th>
94 <th width="6%">生产日期</th> 95 <th width="6%">生产日期</th>
95 <th>MAC地址</th> 96 <th>MAC地址</th>
96 <th width="7%">设备ID</th> 97 <th width="7%">设备ID</th>
@@ -105,6 +106,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -105,6 +106,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
105 <?php if ($deviceList) { ?> 106 <?php if ($deviceList) { ?>
106 <?php foreach ($deviceList as $item) : ?> 107 <?php foreach ($deviceList as $item) : ?>
107 <tr> 108 <tr>
  109 + <td><input type="checkbox" class="check-cls check-item" value="<?= $item['id'] ?>"/></td>
108 <td class="td-cls"> 110 <td class="td-cls">
109 <?= $item['id'] ?> 111 <?= $item['id'] ?>
110 </td> 112 </td>
@@ -139,7 +141,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -139,7 +141,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
139 <?= $statusList[$item['status']] ?> 141 <?= $statusList[$item['status']] ?>
140 </td> 142 </td>
141 <td class="td-cls"> 143 <td class="td-cls">
142 - <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>" data-action="edit">编辑</button> 144 + <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>" data-action="edit">编辑</button> &nbsp;|&nbsp;
  145 + <button class="btn btn-warning btn-sm btn_restore" aid="<?=$item['id'] ?>">恢复</button>
143 </td> 146 </td>
144 </tr> 147 </tr>
145 <?php endforeach; ?> 148 <?php endforeach; ?>
@@ -152,6 +155,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -152,6 +155,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
152 <?php } ?> 155 <?php } ?>
153 </tbody> 156 </tbody>
154 </table> 157 </table>
  158 + <div class="action-box">
  159 + <label><input type="checkbox" class="check-all" value="all" /> 本页全选 </label> <button class="btn btn-primary btn-sm btn_batch_auth" >批量恢复</button>
  160 + </div>
155 </div> 161 </div>
156 162
157 <div class="panel-footer"> 163 <div class="panel-footer">
@@ -167,6 +173,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -167,6 +173,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
167 <script> 173 <script>
168 var authURL = "<?=Url::toRoute('/device/device/auth-device')?>"; 174 var authURL = "<?=Url::toRoute('/device/device/auth-device')?>";
169 var delURL = "<?=Url::toRoute('/device/device/del-device')?>"; 175 var delURL = "<?=Url::toRoute('/device/device/del-device')?>";
  176 + var restoreURL = "<?=Url::toRoute('/device/device/restore-device')?>";
170 var doEditURL = "<?=Url::toRoute('/device/device/do-edit')?>"; 177 var doEditURL = "<?=Url::toRoute('/device/device/do-edit')?>";
171 $(function () { 178 $(function () {
172 179
@@ -216,6 +223,10 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -216,6 +223,10 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
216 223
217 }) 224 })
218 225
  226 + $('.btn_restore').click(function(){
  227 +
  228 + })
  229 +
219 230
220 }); 231 });
221 </script> 232 </script>
222 \ No newline at end of file 233 \ No newline at end of file
app-ht/modules/device/views/device/index.php
@@ -48,13 +48,6 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -48,13 +48,6 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
48 <div class="col-sm-2 form-inline"> 48 <div class="col-sm-2 form-inline">
49 <input type="text" class="form-control" id="manufacture" name="manufacture" value="<?php if (!empty($gets['manufacture'])){ echo $gets['manufacture'];} ?>" autocomplete="off"> 49 <input type="text" class="form-control" id="manufacture" name="manufacture" value="<?php if (!empty($gets['manufacture'])){ echo $gets['manufacture'];} ?>" autocomplete="off">
50 </div> 50 </div>
51 - <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label>  
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">  
54 - </div>  
55 - </div>  
56 -  
57 - <div class="form-group col-sm-12">  
58 <label for="mac" class="col-sm-1 control-label text-right">MAC地址:</label> 51 <label for="mac" class="col-sm-1 control-label text-right">MAC地址:</label>
59 <div class="col-sm-2 form-inline"> 52 <div class="col-sm-2 form-inline">
60 <input type="text" class="form-control" id="mac" name="mac" value="<?php if (!empty($gets['mac'])){ echo $gets['mac'];} ?>" autocomplete="off"> 53 <input type="text" class="form-control" id="mac" name="mac" value="<?php if (!empty($gets['mac'])){ echo $gets['mac'];} ?>" autocomplete="off">
@@ -63,10 +56,26 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -63,10 +56,26 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
63 <div class="col-sm-2 form-inline"> 56 <div class="col-sm-2 form-inline">
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"> 57 <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">
65 </div> 58 </div>
  59 + </div>
  60 + <div class="form-group col-sm-12">
  61 + <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label>
  62 + <div class="col-sm-4 form-inline">
  63 + <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">
  64 + </div>
66 <label for="auth_at" class="col-sm-1 control-label text-right">授权时间:</label> 65 <label for="auth_at" class="col-sm-1 control-label text-right">授权时间:</label>
67 - <div class="col-sm-5 form-inline"> 66 + <div class="col-sm-4 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"> 67 <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">
69 </div> 68 </div>
  69 +
  70 +
  71 + <label for="auth_at" class="col-sm-1 control-label text-right">处理:</label>
  72 + <div class="col-sm-1 form-inline">
  73 + <select name="has_re_auth" class="form-control">
  74 + <option value="">全部</option>
  75 + <option value="1" <?php if(1 ==$gets['has_re_auth']) {echo "selected";}?>>已处理</option>
  76 + <option value="2" <?php if(2 ==$gets['has_re_auth']) {echo "selected";}?>>未处理</option>
  77 + </select>
  78 + </div>
70 </div> 79 </div>
71 80
72 <div class="form-group col-sm-12" style="text-align: center;"> 81 <div class="form-group col-sm-12" style="text-align: center;">
@@ -82,12 +91,13 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -82,12 +91,13 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
82 <li class="active" ><a style="padding: 10px 20px;" href="<?=Url::toRoute('/device/device/index')?>" >全部序列号</a></li> 91 <li class="active" ><a style="padding: 10px 20px;" href="<?=Url::toRoute('/device/device/index')?>" >全部序列号</a></li>
83 <li ><a style="padding: 10px 12px;" href="<?=Url::toRoute('/device/device/delete-index')?>" >删除序列号</a></li> 92 <li ><a style="padding: 10px 12px;" href="<?=Url::toRoute('/device/device/delete-index')?>" >删除序列号</a></li>
84 </ul> 93 </ul>
85 - </div> 94 +
86 <table class="table table-striped table-bordered" id="brand-table"> 95 <table class="table table-striped table-bordered" id="brand-table">
87 <thead> 96 <thead>
88 <tr> 97 <tr>
  98 + <th></th>
89 <th width="6%">ID</th> 99 <th width="6%">ID</th>
90 - <th width="6%">序列号</th> 100 + <th width="5%">序列号</th>
91 <th width="8%">厂商</th> 101 <th width="8%">厂商</th>
92 <th width="6%">项目</th> 102 <th width="6%">项目</th>
93 <th width="8%">设备型号</th> 103 <th width="8%">设备型号</th>
@@ -105,6 +115,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -105,6 +115,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
105 <?php if ($deviceList) { ?> 115 <?php if ($deviceList) { ?>
106 <?php foreach ($deviceList as $item) : ?> 116 <?php foreach ($deviceList as $item) : ?>
107 <tr> 117 <tr>
  118 + <td><input type="checkbox" class="check-cls check-item" value="<?= $item['id'] ?>"/></td>
108 <td class="td-cls"> 119 <td class="td-cls">
109 <?= $item['id'] ?> 120 <?= $item['id'] ?>
110 </td> 121 </td>
@@ -139,9 +150,12 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -139,9 +150,12 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
139 <?= $statusList[$item['status']] ?> 150 <?= $statusList[$item['status']] ?>
140 </td> 151 </td>
141 <td class="td-cls"> 152 <td class="td-cls">
142 - <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>" data-action="edit">编辑</button> &nbsp;|&nbsp;  
143 - <?php if(DeviceStatus::HAS_AUTH != $item['status']){?> <button class="btn btn-primary btn-sm btn_auth" aid="<?=$item['id'] ?>">授权</button> &nbsp;|&nbsp; <?php }?>  
144 - <button class="btn btn-danger btn-sm btn_del" aid="<?=$item['id'] ?>">删除</button> 153 + <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>" data-action="edit">编辑</button>
  154 + <?php if(DeviceStatus::HAS_AUTH != $item['status']){?>&nbsp;|&nbsp;<button class="btn btn-primary btn-sm btn_auth" aid="<?=$item['id'] ?>">授权</button> <?php }?>
  155 + <?php if(DeviceStatus::HAS_AUTH == $item['status']) :?>
  156 + &nbsp;|&nbsp;
  157 + <button class="btn btn-danger btn-sm btn_del" aid="<?=$item['id'] ?>">删除</button>
  158 + <?php endif;?>
145 </td> 159 </td>
146 </tr> 160 </tr>
147 <?php endforeach; ?> 161 <?php endforeach; ?>
@@ -154,8 +168,12 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -154,8 +168,12 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
154 <?php } ?> 168 <?php } ?>
155 </tbody> 169 </tbody>
156 </table> 170 </table>
  171 + <div class="action-box">
  172 + <label><input type="checkbox" class="check-all" value="all" /> 本页全选 </label> <button class="btn btn-primary btn-sm btn_batch_auth" >批量授权</button> <button class="btn btn-danger btn-sm btn_batch_del" >批量删除</button>
  173 + </div>
157 </div> 174 </div>
158 175
  176 +
159 <div class="panel-footer"> 177 <div class="panel-footer">
160 <div class="hqy-panel-pager"> 178 <div class="hqy-panel-pager">
161 <?= LinkPager::widget([ 179 <?= LinkPager::widget([
@@ -236,11 +254,15 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -236,11 +254,15 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
236 } 254 }
237 255
238 }, 'json') 256 }, 'json')
239 -  
240 } 257 }
241 258
242 }) 259 })
243 260
  261 + $('.check-all').click(function(e){
  262 + var checkVal = $(this).prop('checked');
  263 + $('.check-item').prop('checked', checkVal)
  264 +
  265 + })
244 266
245 }); 267 });
246 </script> 268 </script>
247 \ No newline at end of file 269 \ No newline at end of file
domain/device/Device.php
@@ -62,7 +62,7 @@ class Device @@ -62,7 +62,7 @@ class Device
62 if (($count *1) >= ($batchModel->num * 1)) { 62 if (($count *1) >= ($batchModel->num * 1)) {
63 // 超过了限制数,记录到另外一个表里面 63 // 超过了限制数,记录到另外一个表里面
64 // to do 记录到表里面 64 // to do 记录到表里面
65 - $failRecord = DeviceAuthFailRepository::findOne(['device_id' => $deviceId]); 65 + $failRecord = DeviceAuthFailRepository::findOne(['device_id' => $deviceId, 'is_delete' => 0]);
66 if (!$failRecord) { 66 if (!$failRecord) {
67 $item = [ 67 $item = [
68 'manufacture_no' => $manufactureNo, 68 'manufacture_no' => $manufactureNo,
@@ -100,6 +100,15 @@ class Device @@ -100,6 +100,15 @@ class Device
100 $e->mac = $deviceModel->mac; 100 $e->mac = $deviceModel->mac;
101 } elseif (DeviceStatus::FAIL_AUTH == $deviceModel->status) { 101 } elseif (DeviceStatus::FAIL_AUTH == $deviceModel->status) {
102 $e->message = '授权失败'; 102 $e->message = '授权失败';
  103 + } elseif (DeviceStatus::NO_AUTH == $deviceModel->status) {
  104 + // 删除之后恢复的数据
  105 + $deviceModel->status = DeviceStatus::HAS_AUTH;
  106 + $deviceModel->auth_at = $tt;
  107 + $deviceModel->save();
  108 + $e->message = '授权成功';
  109 + $e->success = true;
  110 + $e->serial_no = $deviceModel->serial_no;
  111 + $e->mac = $deviceModel->mac;
103 } else { 112 } else {
104 $e->message = '授权失败!'; 113 $e->message = '授权失败!';
105 } 114 }