wzh 5 years ago
parent
commit
b5ef8d4a68
1 changed files with 4 additions and 2 deletions
  1. 4 2
      api/application/controllers/Lampcontrol.php

+ 4 - 2
api/application/controllers/Lampcontrol.php

@@ -2448,6 +2448,7 @@ class Lampcontrol extends Base_Controller {
             $this->add_operation_log('insert',"在\"{$projectData['projectname']}\"项目里添加编号为\"{$data['number']}\"、无线模块地址为\"{$data['address']}\"的路灯",0);
             $this->add_operation_log('insert',"Add lamp:\"{$data['number']}\".Wireless module address:\"{$data['address']}\".Project name:\"{$projectData['projectname']}\"",0,1);
         } else {
+
             if ($this->Lamp_model->getDataCount(array('number'=>$data['number'], 'projectid'=>$data['projectid']), $where['id']) > 0) {
                 exit(json_result('0401', $this->response['0401'], array()));
             }
@@ -2464,8 +2465,8 @@ class Lampcontrol extends Base_Controller {
                 }
             }
 
-            $old = $this->Lamp_model->get_one($where,'networkid,isfaulted,projectid,address,protocoltype');
-            
+
+            $old = $this->Lamp_model->get_one($where,'isfaulted,projectid,address,protocoltype');
             if ($old['projectid'] != $data['projectid']) {
                 $new['projectid']  = $data['projectid'];
                 $new['faultcount'] = $old['isfaulted'] > 0 ? 1 : 0;
@@ -2478,6 +2479,7 @@ class Lampcontrol extends Base_Controller {
             if ($old['address'] != $data['address'] || $protocoltype != $old['protocoltype']) {
 
             }   
+
             $this->Lamp_model->update($data,$where);
             $projectData = $this->Project_model->getData(array('id'=>$data['projectid']),'projectname');
             $this->add_operation_log('update',"修改\"{$projectData['projectname']}\"项目下的编号为\"{$data['number']}\"、无线模块地址为\"{$data['address']}\"的路灯信息");