Google Home Bether Working
This commit is contained in:
		@@ -46,9 +46,6 @@ class LogManager
 | 
			
		||||
 | 
			
		||||
	function write($value, $type = LogRecordType::ERROR){
 | 
			
		||||
		$record = "[".date("H:m:s")."][".$type."]" . $value . "\n";
 | 
			
		||||
		if (strlen($record) > 65 ) {
 | 
			
		||||
			$record = Utilities::stringInsert($record,"\n",65);
 | 
			
		||||
		}
 | 
			
		||||
		fwrite($this->logFile, $record);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,19 @@
 | 
			
		||||
class RecordManager{
 | 
			
		||||
	public static $records;
 | 
			
		||||
 | 
			
		||||
	public static function createWithSubId ($subDeviceId,  $value) {
 | 
			
		||||
		$record = array (
 | 
			
		||||
			'subdevice_id' => $subDeviceId,
 | 
			
		||||
			'value' => $value,
 | 
			
		||||
		);
 | 
			
		||||
		try {
 | 
			
		||||
			return Db::add ('records', $record);
 | 
			
		||||
		} catch(PDOException $error) {
 | 
			
		||||
			echo $error->getMessage();
 | 
			
		||||
			die();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static function create ($deviceId, $type, $value) {
 | 
			
		||||
		$subDeviceId = Db::loadOne('SELECT * FROM subdevices WHERE device_id = ? AND type = ?;', array($deviceId, $type))['subdevice_id'];
 | 
			
		||||
		if ($subDeviceId == '') {
 | 
			
		||||
@@ -19,6 +32,7 @@ class RecordManager{
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	public static function setExecuted($recordId) {
 | 
			
		||||
		try {
 | 
			
		||||
			Db::edit ('records', ['execuded' => 1], 'WHERE record_id = ?', array($recordId));
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user