checkChapterCache($id); $user = $this->getCurrentUser(); $post = $this->request->getPost(); if ($user->id == 0) return; $validator = new LearningValidator(); $data = [ 'chapter_id' => $chapter->id, 'user_id' => $user->id, ]; $data['request_id'] = $validator->checkRequestId($post['request_id']); /** * @var array $attrs */ $attrs = $chapter->attrs; if ($attrs['model'] == CourseModel::MODEL_VOD) { $data['position'] = $validator->checkPosition($post['position']); } $interval = $validator->checkInterval($post['interval']); $learning = new LearningModel($data); $syncer = new LearningSyncerService(); $syncer->addItem($learning, $interval); } }