src/Biz/Notification/Job/PushNotificationOneHourJob.php

(开头部分) 1KB

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

<?php

namespace Biz\Notification\Job;

use Biz\CloudPlatform\QueueJob\PushJob;
use Biz\Course\Service\CourseService;
use Biz\Course\Service\CourseSetService;
use Biz\System\Service\SettingService;
use Biz\Task\Service\TaskService;
use Codeages\Biz\Framework\Queue\Service\QueueService;
use Codeages\Biz\Framework\Scheduler\AbstractJob;

class PushNotificationOneHourJob extends AbstractJob
{
    public function execute()
    {
        $targetType = $this->args['targetType'];
        $targetId = $this->args['targetId'];
        if ($targetType == 'lesson') {
            $lesson = $this->getTaskService()->getTask($targetId);
            $course = $this->getCourseService()->getCourse($lesson['courseId']);
            $courseSet = $this->getCourseSetService()->getCourseSet($lesson['fromCourseSetId']);

            $lesson['course'] = $course;
            $lesson['courseSet'] = $courseSet;

            $from = array(
                'type' => 'course',
                'id' => $course['id'],
            );

            $to = array(
                'type' => 'course',
                'id' => $course['id'],
                'convNo' => $this->getConvNo(),
            );

            $body = array(
                'type' => 'live.notify',
                'id' => $lesson['id'],
                'lessonType' => $lesson['type'],
                'title' => "《{$lesson['title']}》",
                'message' => "直播课《{$lesson['title']}》即将开课",
            );

            $this->createPushJob($from, $to, $body);
        }
    }

    private function getConvNo()
    {
        $imSetting = $this->getSettingService()->get('app_im', array());
        $convNo = isset($imSetting['convNo']) && !empty($imSetting['convNo']) ? $imSetting['convNo'] : '';

        return $convNo;
    }

    private function createPushJob($from, $to, $body)
    {
        $pushJob = new PushJob(array(

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

AI 解读 AI

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

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