file_transcode) || is_object($this->file_transcode)) { $this->file_transcode = kg_json_encode($this->file_transcode); } if (is_array($this->file_remote) || is_object($this->file_remote)) { $this->file_remote = kg_json_encode($this->file_remote); } $this->create_time = time(); } public function beforeUpdate() { if (is_array($this->file_transcode) || is_object($this->file_transcode)) { $this->file_transcode = kg_json_encode($this->file_transcode); } if (is_array($this->file_remote) || is_object($this->file_remote)) { $this->file_remote = kg_json_encode($this->file_remote); } $this->update_time = time(); } public function afterFetch() { if (is_string($this->file_transcode)) { $this->file_transcode = json_decode($this->file_transcode, true); } if (is_string($this->file_remote)) { $this->file_remote = json_decode($this->file_remote, true); } if (!empty($this->file_id) && empty($this->file_transcode)) { $this->file_transcode = $this->getFileTranscode($this->file_id); } } protected function getFileTranscode($fileId) { $vodService = new VodService(); $transcode = $vodService->getFileTranscode($fileId); if ($transcode && empty($this->file_transcode)) { $this->file_transcode = $transcode; $this->update(); } return $transcode; } }