src/Biz/Testpaper/Copy/TestpapersCopy.php

(开头部分) 1KB

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

<?php

namespace Biz\Testpaper\Copy;

use Biz\AbstractCopy;
use AppBundle\Common\ArrayToolkit;

class TestpapersCopy extends AbstractCopy
{
    public function doCopy($source, $options)
    {
        return $this->cloneCourseSetTestpapers($source, $options);
    }

    protected function getFields()
    {
        return array(
            'name',
            'description',
            'limitedTime',
            'pattern',
            'status',
            'score',
            'passedCondition',
            'itemCount',
            'courseId', //先复制courseId、LessonId,最后更新成新的
            'lessonId',
            'metas',
            'type',
        );
    }

    public function preCopy($source, $options)
    {
    }

    private function cloneCourseSetTestpapers($source, $options)
    {
        $newCourseSet = $options['newCourseSet'];
        $conditions = array(
            'courseSetId' => $source['id'],
            'type' => 'testpaper',
        );
        $testpapers = $this->getTestpaperDao()->search($conditions, array(), 0, PHP_INT_MAX);

        if (empty($testpapers)) {
            return;
        }

        $user = $this->biz['user'];
        $newTestpapers = array();
        $testpaperIds = array();
        foreach ($testpapers as $testpaper) {
            $newTestpaper = $this->partsFields($testpaper);
            $newTestpaper['courseSetId'] = $newCourseSet['id'];
            $newTestpaper['target'] = 'course-'.$newCourseSet['id'];
            $newTestpaper['createdUserId'] = $user['id'];
            $newTestpaper['updatedUserId'] = $user['id'];
            $newTestpaper['copyId'] = $testpaper['id'];

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

AI 解读 AI

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

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