src/Biz/Task/Job/CourseTaskUpdateSyncJob.php

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Biz\Task\Job;

use Biz\Activity\Config\Activity;
use Biz\Activity\Dao\ActivityDao;
use Biz\AppLoggerConstant;
use Biz\Course\Copy\Chain\ActivityTestpaperCopy;
use Biz\Course\Dao\CourseDao;
use Biz\System\Service\LogService;
use Biz\Task\Dao\TaskDao;
use Biz\Task\Service\TaskService;
use Codeages\Biz\Framework\Dao\BatchUpdateHelper;
use Codeages\Biz\Framework\Scheduler\AbstractJob;

class CourseTaskUpdateSyncJob extends AbstractJob
{
    public function execute()
    {
        try {
            $task = $this->getTaskService()->getTask($this->args['taskId']);
            $copiedCourses = $this->getCourseDao()->findCoursesByParentIdAndLocked($task['courseId'], 1);

            $copiedCourseIds = array_column($copiedCourses, 'id');
            $copiedTasks = $this->getTaskDao()->findByCopyIdAndLockedCourseIds($task['id'], $copiedCourseIds);

            $helper = new BatchUpdateHelper($this->getTaskDao());
            foreach ($copiedTasks as $ct) {
                $this->updateActivity($ct['activityId'], $ct['fromCourseSetId'], $ct['courseId']);

                $ct = $this->copyFields($task, $ct, array(
                    'seq',
                    'title',
                    'isFree',
                    'isOptional',
                    'startTime',
                    'endTime',
                    'number',
                    'mediaSource',
                    'maxOnlineNum',
                    'status',
                    'length',
                ));

                $helper->add('id', $ct['id'], $ct);
            }

            $helper->flush();

            $this->getLogService()->info(AppLoggerConstant::COURSE, 'sync_when_task_update', 'course.log.task.update.sync.success_tips', array('taskId' => $task['id']));
        } catch (\Exception $e) {
            $this->getLogService()->error(AppLoggerConstant::COURSE, 'sync_when_task_update', 'course.log.task.update.sync.fail_tips', array('error' => $e->getMessage()));
        }
    }

    private function updateActivity($activityId, $courseSetId, $courseId)
    {
        $activity = $this->getActivityDao()->get($activityId);
        $sourceActivity = $this->getActivityDao()->get($activity['copyId']);

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。