update export excel
This commit is contained in:
88
models/FaceLogs.php
Normal file
88
models/FaceLogs.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
78
models/FaceLogsSearch.php
Normal file
78
models/FaceLogsSearch.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use app\models\FaceLogs;
|
||||
|
||||
/**
|
||||
* FaceLogsSearch represents the model behind the search form of `app\models\FaceLogs`.
|
||||
*/
|
||||
class FaceLogsSearch extends FaceLogs {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
[['id'], 'integer'],
|
||||
[['camera_id', 'confidence', 'enable_door', 'encoded_person_image', 'frametime', 'face_id', 'person_id', 'image', 'status', 'stt', 'timezone', 'name'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function scenarios() {
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params) {
|
||||
$query = FaceLogs::find();
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
|
||||
$this->load($params);
|
||||
|
||||
if (!$this->validate()) {
|
||||
// uncomment the following line if you do not want to return any records when validation fails
|
||||
// $query->where('0=1');
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
// grid filtering conditions
|
||||
$query->andFilterWhere([
|
||||
'id' => $this->id,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'camera_id', $this->camera_id])
|
||||
->andFilterWhere(['like', 'confidence', $this->confidence])
|
||||
->andFilterWhere(['like', 'enable_door', $this->enable_door])
|
||||
->andFilterWhere(['like', 'encoded_person_image', $this->encoded_person_image])
|
||||
->andFilterWhere(['like', 'frametime', $this->frametime])
|
||||
->andFilterWhere(['like', 'face_id', $this->face_id])
|
||||
->andFilterWhere(['like', 'person_id', $this->person_id])
|
||||
->andFilterWhere(['like', 'image', $this->image])
|
||||
->andFilterWhere(['like', 'status', $this->status])
|
||||
->andFilterWhere(['like', 'stt', $this->stt])
|
||||
->andFilterWhere(['like', 'timezone', $this->timezone])
|
||||
->andFilterWhere(['like', 'name', $this->name]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user