src/Biz/Sms/Event/OpenCourseSmsEventSubscriber.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\Sms\Event;
use Biz\Sms\Service\SmsService;
use Codeages\Biz\Framework\Event\Event;
use Codeages\Biz\Framework\Scheduler\Service\SchedulerService;
use Codeages\PluginBundle\Event\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class OpenCourseSmsEventSubscriber extends EventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return array(
'open.course.lesson.publish' => 'onLiveOpenCourseLessonCreate',
'open.course.lesson.update' => 'onLiveOpenCourseLessonUpdate',
'open.course.lesson.delete' => 'onLiveOpenCourseLessonDelete',
);
}
public function onLiveOpenCourseLessonDelete(Event $event)
{
$context = $event->getSubject();
$lesson = $context['lesson'];
$this->deleteJob($lesson);
}
public function onLiveOpenCourseLessonCreate(Event $event)
{
$lesson = $event->getSubject();
if ('liveOpen' == $lesson['type'] && isset($lesson['startTime'])
&& ($this->getSmsService()->isOpen('sms_live_play_one_day') || $this->getSmsService()->isOpen('sms_live_play_one_hour'))
) {
$this->registerJob($lesson);
}
}
public function onLiveOpenCourseLessonUpdate(Event $event)
{
$context = $event->getSubject();
$lesson = $context['lesson'];
if ('liveOpen' == $lesson['type'] && isset($lesson['startTime'])
&& $lesson['fields']['startTime'] != $lesson['startTime']
&& ($this->getSmsService()->isOpen('sms_live_play_one_day') || $this->getSmsService()->isOpen('sms_live_play_one_hour'))
) {
$this->deleteJob($lesson);
if ('published' == $lesson['status']) {
$this->registerJob($lesson);
}
}
}
protected function registerJob($lesson)
{
$dayIsOpen = $this->getSmsService()->isOpen('sms_live_play_one_day');
$hourIsOpen = $this->getSmsService()->isOpen('sms_live_play_one_hour');
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。