[+] добавлен пользователь СИСТЕМА для новых плат
This commit is contained in:
1 parent
c7dc3d0434
commit
9c029c5b11
3 files changed
+9
-4
No files matched your search
@@ -57,6 +57,11 @@ define('DB_PASSWORD', '2670135');
|
||||
*/
|
||||
define('DB_NAME', 'rsgrinko_iotcore');
|
||||
|
||||
/**
|
||||
* ID системного пользователя
|
||||
*/
|
||||
define('SYSTEM_USER_ID', 10);
|
||||
|
||||
/**
|
||||
* Количество элементов, выводимых на страницу (для пагинации)
|
||||
*/
|
||||
|
||||
@@ -73,7 +73,7 @@ class CIoT {
|
||||
* @param $fw
|
||||
*/
|
||||
public static function addDevice($mac, $chipid, $hw, $fw):void {
|
||||
self::$DB->addItem('devices', array('mac' => $mac, 'chipid' => $chipid, 'hw' => $hw, 'fw' => $fw, 'user' => 'SYSTEM', 'time' => time(), 'last_active' => time()));
|
||||
self::$DB->addItem('devices', array('mac' => $mac, 'chipid' => $chipid, 'hw' => $hw, 'fw' => $fw, 'user' => SYSTEM_USER_ID, 'time' => time(), 'last_active' => time()));
|
||||
$deviceId = self::getDeviceId($mac);
|
||||
self::$DB->addItem('relays', array('device' => $deviceId, 'relay1' => '0', 'relay2' => '0', 'relay3' => '0', 'relay4' => '0'));
|
||||
self::$DB->addItem('configs', array('device' => $deviceId, 'ds_resulution' => '9', 'sending_interval' => '2000'));
|
||||
|
||||
@@ -61,15 +61,15 @@ class CUser {
|
||||
* @param int $id
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function getFields($id = ''){
|
||||
if(empty($id) or $id == ''){
|
||||
public static function getFields($id = false){
|
||||
if(empty($id) or $id === false){
|
||||
$id = self::$id;
|
||||
}
|
||||
|
||||
if(is_array($id)){
|
||||
$where = $id;
|
||||
} else {
|
||||
$where = array('id'=>$id);
|
||||
$where = array('id' => $id);
|
||||
}
|
||||
$result = self::$DB->getItem(self::$table, $where);
|
||||
if($result) {
|
||||
|
||||
Reference in new issue
Block a user