71 lines
1.3 KiB
PHP
71 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace app\models;
|
|
|
|
use Yii;
|
|
|
|
/**
|
|
* This is the model class for table "capture_logs".
|
|
*
|
|
* @property int $id
|
|
* @property int $time
|
|
* @property string $image
|
|
* @property int $status
|
|
* @property string $remark
|
|
*/
|
|
class CaptureLogs extends \yii\db\ActiveRecord {
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public static function tableName() {
|
|
return 'capture_logs';
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function rules() {
|
|
return [
|
|
[['time', 'status'], 'integer'],
|
|
[['image', 'remark'], 'string'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function attributeLabels() {
|
|
return [
|
|
'id' => 'ID',
|
|
'time' => 'Time',
|
|
'image' => 'Image',
|
|
'status' => 'Status',
|
|
'remark' => 'Remark',
|
|
];
|
|
}
|
|
|
|
public function create($data) {
|
|
$r = $this->load([
|
|
'time' => $data['Time'],
|
|
'image' => $data["Image"],
|
|
'status' => 0,
|
|
'remark' => ''
|
|
], '');
|
|
if ($r) {
|
|
try {
|
|
$this->save();
|
|
return $this->id;
|
|
} catch (\Exception $ex) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static $statusArray = [
|
|
0 => "Unknown",
|
|
1 => "List management"
|
|
];
|
|
|
|
}
|