'ID', 'staff_id' => 'Mã nhân viên', 'card_number' => 'Mã thẻ', 'device_id' => 'Thiết bị', 'door_id' => 'Cửa', 'in_out_state' => 'Trạng thái vào/ra', 'time' => 'Thời gian', 'event_type' => 'Mô tả sự kiện', 'staff_name' => 'Tên nhân viên', 'staff_department' => 'Phòng ban', 'staff_code' => 'Mã nhân viên' ]; } public static $stateArray = [ 0 => "Vào", 1 => "Ra" ]; public function multiCreate($datas) { $field = ['staff_id', 'card_number', 'device_id', 'door_id', 'in_out_state', 'time', 'event_type']; static::getDb()->createCommand()->batchInsert($this->tableName(), $field, $datas)->execute(); return true; } public function getStaff() { return $this->hasOne(Staff::className(), ["id" => "staff_id"]); } public static function parseTime($time) { $temp = intval($time); $second = $temp % 60; $temp = $temp / 60; $minute = $temp % 60; $temp = $temp / 60; $hour = $temp % 24; $temp = $temp / 24; $day = $temp % 31 + 1; $temp = $temp / 31; $month = $temp % 12 + 1; $temp = $temp / 12; $year = $temp + 2000; $timeFull = sprintf("%02d", $hour) . ":" . sprintf("%02d", $minute) . ":" . sprintf("%02d", $second) . " " . sprintf("%02d", $day) . "/" . sprintf("%02d", $month) . "/" . intval($year); return date_format(date_create_from_format('H:i:s d/m/Y', $timeFull), 'U'); } }