89 lines
2.3 KiB
PHP
89 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace app\models;
|
|
|
|
use Yii;
|
|
|
|
/**
|
|
* This is the model class for table "face_logs".
|
|
*
|
|
* @property int $id
|
|
* @property string $camera_id
|
|
* @property string $confidence
|
|
* @property string $enable_door
|
|
* @property string $encoded_person_image
|
|
* @property string $frametime
|
|
* @property string $face_id
|
|
* @property string $person_id
|
|
* @property string $image
|
|
* @property string $status
|
|
* @property string $stt
|
|
* @property string $timezone
|
|
* @property string $name
|
|
*/
|
|
class FaceLogs extends \yii\db\ActiveRecord {
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function tableName() {
|
|
return 'face_logs';
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function rules() {
|
|
return [
|
|
[['camera_id', 'confidence', 'enable_door', 'encoded_person_image', 'frametime', 'face_id', 'person_id', 'image', 'status', 'stt', 'timezone', 'name'], 'string'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function attributeLabels() {
|
|
return [
|
|
'id' => 'ID',
|
|
'camera_id' => 'Camera ID',
|
|
'confidence' => 'Confidence',
|
|
'enable_door' => 'Enable Door',
|
|
'encoded_person_image' => 'Encoded Person Image',
|
|
'frametime' => 'Frametime',
|
|
'face_id' => 'Face ID',
|
|
'person_id' => 'Person ID',
|
|
'image' => 'Image',
|
|
'status' => 'Status',
|
|
'stt' => 'Stt',
|
|
'timezone' => 'Timezone',
|
|
'name' => 'Name'
|
|
];
|
|
}
|
|
|
|
public function create($data) {
|
|
$r = $this->load([
|
|
'camera_id' => $data['camera_id'],
|
|
'confidence' => $data['confidence'],
|
|
'enable_door' => $data['enable_door'],
|
|
'encoded_person_image' => $data['encoded_person_image'],
|
|
'frametime' => $data['frametime'],
|
|
'face_id' => $data['face_id'],
|
|
'person_id' => $data['person_id'],
|
|
'image' => $data['image'],
|
|
'status' => $data['status'],
|
|
'stt' => $data['stt'],
|
|
'timezone' => $data['timezone'],
|
|
'name' => $data['name']
|
|
], '');
|
|
if ($r) {
|
|
try {
|
|
$this->save();
|
|
return $this->id;
|
|
} catch (\Exception $ex) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|