BiFace_Server_Lite/models/CaptureLogs.php
2021-08-23 15:19:49 +07:00

84 lines
2.0 KiB
PHP

<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "capture_logs".
*
* @property int $id
* @property int $staff_id
* @property int $time
* @property string $image
* @property int $status
* @property string $remark
* @property string $confidence
* @property int $sync_status
*/
class CaptureLogs extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'capture_logs';
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['staff_id', 'time', 'status', 'sync_status'], 'integer'],
[['image', 'remark', 'confidence'], 'string'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'id' => Yii::t("app", "ID"),
'time' => Yii::t("app", "THOI_GIAN"),
'image' => Yii::t("app", "HINH_ANH"),
'status' => Yii::t("app", "TRANG_THAI"),
'remark' => Yii::t("app", "REMARK"),
'staff_name' => Yii::t("app", "TEN"),
'staff_image' => Yii::t("app", "HINH_ANH_DANG_KI"),
'confidence' => Yii::t("app", "DO_TIN_CAY"),
'sync_status' => Yii::t("app", "TRANG_THAI_DONG_BO")
];
}
public function create($data) {
$r = $this->load([
'staff_id' => $data['Staff'],
'time' => $data['Time'],
'image' => $data["Image"],
'status' => 0,
'remark' => '',
'confidence' => $data["Confidence"]
], '');
if ($r) {
try {
$this->save();
return $this->id;
} catch (\Exception $ex) {
return false;
}
}
}
public static $statusArray = [
0 => "Unknown",
1 => "List management"
];
public function getListManagement() {
return $this->hasOne(ListManagement::className(), ["id" => "staff_id"]);
}
}