예제 #1
0
 /**
  * 添加告警 basic 
  * 
  * @access public
  * @return void
  */
 public function add_basic($alert_id = null)
 {
     $property_basic = $this->get_alert_operator()->get_alert_basic_property();
     $alert_name = $property_basic->get_alert_name();
     $this->_validate($alert_name);
     if (!isset($alert_id)) {
         $alert_id = \lib\sequence\sw_sequence::get_next_global(SWAN_TBN_alert_BASIC);
     }
     $property_basic->set_alert_id($alert_id);
     $property_basic->set_alert_name($alert_name);
     $attributes = $property_basic->attributes();
     $require_fields = array('alert_id', 'alert_name');
     $this->_check_require($attributes, $require_fields);
     $this->__db->insert(SWAN_TBN_alert_BASIC, $attributes);
     return $alert_id;
 }
예제 #2
0
 /**
  * 添加设备 key 
  * 
  * @access public
  * @return void
  */
 public function add_key($device_id = null)
 {
     $property = $this->get_device_operator()->get_device_key_property();
     $device_name = $property->get_device_name();
     $this->_validate($device_name);
     if (!isset($device_id)) {
         $device_id = \lib\sequence\sw_sequence::get_next_global(SWAN_TBN_DEVICE_KEY);
     }
     $property->set_device_id($device_id);
     $property->set_device_name($device_name);
     $attributes = $property->attributes();
     $require_fields = array('device_name', 'device_id');
     $this->_check_require($attributes, $require_fields);
     $this->__db->insert(SWAN_TBN_DEVICE_KEY, $attributes);
     return $device_id;
 }