|
@@ -422,42 +422,42 @@ class Lampcontrol extends Base_Controller {
|
|
|
}
|
|
|
$ids = explode(',', $lamp_id);
|
|
|
$status = 1;
|
|
|
- foreach ($ids as $v) {
|
|
|
- $record['cmdtype'] = 0;
|
|
|
- $record['relateid'] = $v;
|
|
|
- $record['statuscmd'] = 0;
|
|
|
- $record['updatetime'] = date("Y-m-d H:i:s");
|
|
|
- $recordid = $this->Batmanage_model->get_record_id($record, 'batch_update_cmd');
|
|
|
- if(!$recordid){
|
|
|
- exit(json_result('0009', $this->response['0009'], array()));
|
|
|
- }
|
|
|
- if ($recordid != -1) {
|
|
|
- $status = 0;
|
|
|
- $cmd = '{"cmd_type":"batch_update_cmd","cmd_id":'.$recordid.'}';
|
|
|
- $lampData = $this->Lamp_model->getOne($v,'N.status,N.protocoltype,L.protocoltype as lampprotocoltype');
|
|
|
- if ($lampData['protocoltype'] == 4 || $lampData['protocoltype'] == 6) {
|
|
|
- $url = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['SERVER_NAME'].'/api/device/lampcontrol/update_asy';
|
|
|
- doAsyncRequest($url,['clientid'=>$clientid,'username'=>$username,'client_key'=>$client_key,'token'=>$token,'version'=>$version,'lamp_id'=>$v]);
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (isset($lampData['protocoltype']) && $lampData['protocoltype'] != 0) {
|
|
|
- $cmdret = send_cmd($cmd,1,0,$lampData['protocoltype']);
|
|
|
- if ($cmdret === false) {
|
|
|
- sleep(1);
|
|
|
- $cmdret = send_cmd($cmd,1,0,$lampData['protocoltype']);
|
|
|
- }
|
|
|
- }else{
|
|
|
- $cmdret = send_cmd($cmd,0,0,$lampData['protocoltype']);
|
|
|
- if ($cmdret === false) {
|
|
|
- sleep(1);
|
|
|
- $cmdret = send_cmd($cmd,0,0,$lampData['protocoltype']);
|
|
|
- }
|
|
|
- }
|
|
|
- if($cmdret === false){
|
|
|
- exit(json_result('0008', $this->response['0008'], array()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // foreach ($ids as $v) {
|
|
|
+ // $record['cmdtype'] = 0;
|
|
|
+ // $record['relateid'] = $v;
|
|
|
+ // $record['statuscmd'] = 0;
|
|
|
+ // $record['updatetime'] = date("Y-m-d H:i:s");
|
|
|
+ // $recordid = $this->Batmanage_model->get_record_id($record, 'batch_update_cmd');
|
|
|
+ // if(!$recordid){
|
|
|
+ // exit(json_result('0009', $this->response['0009'], array()));
|
|
|
+ // }
|
|
|
+ // if ($recordid != -1) {
|
|
|
+ // $status = 0;
|
|
|
+ // $cmd = '{"cmd_type":"batch_update_cmd","cmd_id":'.$recordid.'}';
|
|
|
+ // $lampData = $this->Lamp_model->getOne($v,'N.status,N.protocoltype,L.protocoltype as lampprotocoltype');
|
|
|
+ // if ($lampData['protocoltype'] == 4 || $lampData['protocoltype'] == 6) {
|
|
|
+ // $url = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['SERVER_NAME'].'/api/device/lampcontrol/update_asy';
|
|
|
+ // doAsyncRequest($url,['clientid'=>$clientid,'username'=>$username,'client_key'=>$client_key,'token'=>$token,'version'=>$version,'lamp_id'=>$v]);
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+ // if (isset($lampData['protocoltype']) && $lampData['protocoltype'] != 0) {
|
|
|
+ // $cmdret = send_cmd($cmd,1,0,$lampData['protocoltype']);
|
|
|
+ // if ($cmdret === false) {
|
|
|
+ // sleep(1);
|
|
|
+ // $cmdret = send_cmd($cmd,1,0,$lampData['protocoltype']);
|
|
|
+ // }
|
|
|
+ // }else{
|
|
|
+ // $cmdret = send_cmd($cmd,0,0,$lampData['protocoltype']);
|
|
|
+ // if ($cmdret === false) {
|
|
|
+ // sleep(1);
|
|
|
+ // $cmdret = send_cmd($cmd,0,0,$lampData['protocoltype']);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if($cmdret === false){
|
|
|
+ // exit(json_result('0008', $this->response['0008'], array()));
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
sleep(2);
|
|
|
if ($status) {
|
|
|
exit(json_result('0406', $this->response['0406'], array()));
|