src/AppBundle/Controller/NotificationController.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace AppBundle\Controller;
use Biz\Course\Service\CourseService;
use Biz\User\Service\BatchNotificationService;
use Biz\User\Service\NotificationService;
use AppBundle\Common\Paginator;
use Biz\User\UserException;
use Symfony\Component\HttpFoundation\Request;
class NotificationController extends BaseController
{
public function indexAction(Request $request)
{
$user = $this->getCurrentUser();
if (!$user->isLogin()) {
$this->createNewException(UserException::UN_LOGIN());
}
$paginator = new Paginator(
$request,
$this->getNotificationService()->countNotificationsByUserId($user->id),
20
);
$notifications = $this->getNotificationService()->searchNotificationsByUserId(
$user->id,
$paginator->getOffsetCount(),
$paginator->getPerPageCount()
);
$id = $request->query->get('id');
if (!empty($id)) {
$notifications = $this->getNotificationService()->isSelectNotification($notifications, $id);
}
$this->getNotificationService()->clearUserNewNotificationCounter($user->id);
$user->clearNotifacationNum();
return $this->render('notification/index.html.twig', array(
'notifications' => $notifications,
'paginator' => $paginator,
));
}
public function showAction(Request $request, $id)
{
$batchNotification = $this->getBatchNotificationService()->getBatchNotification($id);
return $this->render('notification/batch-notification-show.html.twig', array(
'batchnotification' => $batchNotification,
));
}
/**
* @return CourseService
*/
protected function getCourseService()
{
return $this->getBiz()->service('Course:CourseService');
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。