| xqd
@@ -3,7 +3,6 @@
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
use App\Model\DeviceInfo;
|
|
|
-use App\Model\LockInfo;
|
|
|
use App\Model\PhoneInfo;
|
|
|
use App\Model\SystemConfig;
|
|
|
use App\Server\DeviceServer;
|
| xqd
@@ -54,14 +53,12 @@ class IndexController extends Controller
|
|
|
if(empty($device)){
|
|
|
return json_encode(['code'=>602,'msg'=>'设备不存在']);
|
|
|
}
|
|
|
-// echo '缓存类型--'.$re_type.' 当前类型:--'.$type;
|
|
|
|
|
|
if(empty($re_type)){
|
|
|
if($type == 4) Cache::put($cache_key,$re_type,$time1);
|
|
|
} else {
|
|
|
if($type != $re_type) return json_encode(['code'=>603,'msg'=>'设备下发协议冲突']);
|
|
|
}
|
|
|
-// return json_encode(['code'=>200,'msg'=>'不重复']);
|
|
|
switch ($type){
|
|
|
case 1:
|
|
|
$rule = ['cmd'=>'start_test'];
|
| xqd
@@ -100,8 +97,6 @@ class IndexController extends Controller
|
|
|
default:
|
|
|
$rule = [];
|
|
|
}
|
|
|
-// $rule = ["cmd"=>"stop_test"];
|
|
|
-// dd(json_encode($rule));
|
|
|
if($type != 3){
|
|
|
$res = (new DeviceServer())->sendMsg($device->device_name,json_encode($rule));
|
|
|
}
|
| xqd
@@ -183,7 +178,7 @@ class IndexController extends Controller
|
|
|
$rule = ["cmd"=>"start_update"];
|
|
|
$res = $deviceService->sendMsg($device_name ,json_encode($rule));
|
|
|
if($res['Success'] == 'success') {
|
|
|
- return genApiData(200,'设备更新新中');
|
|
|
+ return genApiData(200,'设置成功');
|
|
|
}
|
|
|
} else {
|
|
|
$res = DeviceInfo::where('device_name',$device_name)->update($data);
|
| xqd
@@ -193,7 +188,6 @@ class IndexController extends Controller
|
|
|
return genApiData(601,'异常设备,请联系后台管理员',$res);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//设备版本号升级信息
|
|
|
public function getDevice()
|
|
|
{
|
| xqd
@@ -229,7 +223,6 @@ class IndexController extends Controller
|
|
|
return genApiData(200,'ok',$data);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//更新设备版本
|
|
|
public function upVersion()
|
|
|
{
|
| xqd
@@ -276,8 +269,8 @@ class IndexController extends Controller
|
|
|
public function getPhonelist()
|
|
|
{
|
|
|
$list = PhoneInfo::where('device_name',null)->pluck('phone')->toArray();
|
|
|
+ $list[] = '1516516161616';
|
|
|
return genApiData(200,'ok',$list);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|