|
@@ -166,19 +166,19 @@ class AesController extends HomeBaseController{ |
|
@@ -166,19 +166,19 @@ class AesController extends HomeBaseController{ |
166
|
* @url /portal/Aes/decryption
|
166
|
* @url /portal/Aes/decryption
|
167
|
* @method GET
|
167
|
* @method GET
|
168
|
*
|
168
|
*
|
169
|
- * @param name:MACAddress type:String require:1 default:无 other: desc:设备MAC地址
|
169
|
+ * @param name:name type:String require:1 default:无 other: desc:设备名称
|
170
|
* @param name:key type:String require:1 default:无 other: desc:设备返回状态(未加密)
|
170
|
* @param name:key type:String require:1 default:无 other: desc:设备返回状态(未加密)
|
171
|
* @param name:type type:String require:1 default:无 other:1开锁返回指令,2状态返回指令 desc:命令类型
|
171
|
* @param name:type type:String require:1 default:无 other:1开锁返回指令,2状态返回指令 desc:命令类型
|
172
|
*
|
172
|
*
|
173
|
* @return code:1锁已开,0位锁已关,2为数据异常
|
173
|
* @return code:1锁已开,0位锁已关,2为数据异常
|
174
|
*/
|
174
|
*/
|
175
|
- public function state($MACAddress,$key,$type){
|
175
|
+ public function state($name,$key,$type){
|
176
|
if ($type==1){
|
176
|
if ($type==1){
|
177
|
if($key[0]=='0xff' && $key[4]=='0xef'){
|
177
|
if($key[0]=='0xff' && $key[4]=='0xef'){
|
178
|
if ($key[3]=='0x01'){
|
178
|
if ($key[3]=='0x01'){
|
179
|
//修改数据库设备状态
|
179
|
//修改数据库设备状态
|
180
|
try{
|
180
|
try{
|
181
|
- Db::name('equipment')->where('mac_address',$MACAddress)->update(['use'=>1]);
|
181
|
+ Db::name('equipment')->where('name',$name)->update(['use'=>1]);
|
182
|
}catch (\Exception $exception){
|
182
|
}catch (\Exception $exception){
|
183
|
$this->apiResponse(301,'数据库状态更改失败,错误信息:'.$exception->getMessage());
|
183
|
$this->apiResponse(301,'数据库状态更改失败,错误信息:'.$exception->getMessage());
|
184
|
}
|
184
|
}
|
|
@@ -192,7 +192,7 @@ class AesController extends HomeBaseController{ |
|
@@ -192,7 +192,7 @@ class AesController extends HomeBaseController{ |
192
|
}else if($type==2){
|
192
|
}else if($type==2){
|
193
|
if($key[0]=='0xff' && $key[7]=='0xef'){
|
193
|
if($key[0]=='0xff' && $key[7]=='0xef'){
|
194
|
if ($key[5]=='0x01'){
|
194
|
if ($key[5]=='0x01'){
|
195
|
- Db::name('equipment')->where('mac_address',$MACAddress)->update(['electricity'=>0]);
|
195
|
+ Db::name('equipment')->where('name',$name)->update(['electricity'=>0]);
|
196
|
}
|
196
|
}
|
197
|
if ($key[6]=='0x01'){
|
197
|
if ($key[6]=='0x01'){
|
198
|
//修改数据库设备状态
|
198
|
//修改数据库设备状态
|
|
@@ -200,7 +200,7 @@ class AesController extends HomeBaseController{ |
|
@@ -200,7 +200,7 @@ class AesController extends HomeBaseController{ |
200
|
}else if($key[6]=='0x00'){
|
200
|
}else if($key[6]=='0x00'){
|
201
|
//修改数据库设备状态
|
201
|
//修改数据库设备状态
|
202
|
try{
|
202
|
try{
|
203
|
- Db::name('equipment')->where('mac_address',$MACAddress)->update(['use'=>0]);
|
203
|
+ Db::name('equipment')->where('name',$name)->update(['use'=>0]);
|
204
|
}catch (\Exception $exception){
|
204
|
}catch (\Exception $exception){
|
205
|
$this->apiResponse(301,'数据库状态更改失败,错误信息:'.$exception->getMessage());
|
205
|
$this->apiResponse(301,'数据库状态更改失败,错误信息:'.$exception->getMessage());
|
206
|
}
|
206
|
}
|