src/Biz/Notification/Job/LiveLessonStartNotifyJob.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\Notification\Job;
use Biz\Activity\Service\ActivityService;
use Biz\Classroom\Service\ClassroomService;
use Biz\CloudPlatform\QueueJob\PushJob;
use Biz\IM\Service\ConversationService;
use Biz\Task\Service\TaskService;
use Codeages\Biz\Framework\Queue\Service\QueueService;
use Codeages\Biz\Framework\Scheduler\AbstractJob;
class LiveLessonStartNotifyJob extends AbstractJob
{
public function execute()
{
$targetType = $this->args['targetType'];
$targetId = $this->args['targetId'];
if ($targetType == 'liveLesson') {
$lesson = $this->getTaskService()->getTask($targetId);
$activity = $this->getActivityService()->getActivity($lesson['activityId']);
$message = '您报名的《'.$lesson['title'].'》课程将于'.date('H:i', $activity['startTime']).'开始直播,点击学习吧';
$classrooms = $this->getClassroomService()->findClassroomsByCourseId($lesson['courseId']);
if (empty($classrooms)) {
$this->pushForClassroomOrCourse($message, $lesson['title'], $lesson['id'], $lesson['courseId']);
} else {
foreach ($classrooms as $classroom) {
$this->pushForClassroomOrCourse($message, $lesson['title'], $lesson['id'], $lesson['courseId'], $classroom['id']);
}
}
return true;
}
}
protected function pushForClassroomOrCourse($message, $lessonTitle, $lessonId, $courseId, $classroomId = null)
{
$conv = array();
if (empty($classroomId)) {
$conv = $this->getConversationService()->getConversationByTarget($courseId, 'course-push');
} else {
$conv = $this->getConversationService()->getConversationByTarget($classroomId, 'classroom-push');
}
$from = array(
'type' => 'lesson',
'id' => $lessonId,
);
$to = array(
'type' => 'lesson',
'id' => 'all',
'convNo' => $conv['no'],
);
$body = array(
'type' => 'live.start',
'courseId' => $courseId,
'lessonId' => $lessonId,
'lessonTitle' => $lessonTitle,
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。