src/AppBundle/Controller/Admin/BatchNotificationController.php

(开头部分) 2KB

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

<?php

namespace AppBundle\Controller\Admin;

use AppBundle\Common\Paginator;
use AppBundle\Common\ArrayToolkit;
use Biz\Notification\NotificationException;
use Symfony\Component\HttpFoundation\Request;

class BatchNotificationController extends BaseController
{
    public function indexAction(Request $request)
    {
        $user = $this->getUser();
        $conditions = array();
        $paginator = new Paginator(
            $this->get('request'),
            $this->getBatchNotificationService()->countBatchNotifications($conditions),
            10
        );
        $batchnotifications = $this->getBatchNotificationService()->searchBatchNotifications(
            $conditions,
            array('createdTime' => 'DESC'),
            $paginator->getOffsetCount(),
            $paginator->getPerPageCount()
        );
        $userIds = ArrayToolkit::column($batchnotifications, 'fromId');
        $users = $this->getUserService()->findUsersByIds($userIds);

        return $this->render('admin/notification/index.html.twig', array(
            'paginator' => $paginator,
            'batchnotifications' => $batchnotifications,
            'users' => $users,
        ));
    }

    public function createAction(Request $request)
    {
        $user = $this->getUser();

        if ($request->getMethod() == 'POST') {
            $formData = $request->request->all();

            if (empty($formData['title']) || empty($formData['content'])) {
                $this->createMessageResponse('error', 'message_response.mass_title_and_text_cannot_empty');
            }

            $this->getBatchNotificationService()->createBatchNotification($formData);

            return $this->redirect($this->generateUrl('admin_batch_notification'));
        }

        return $this->render('admin/notification/notification-modal.html.twig');
    }

    public function editAction(Request $request, $id)
    {
        $user = $this->getUser();
        $batchnotification = $this->getBatchNotificationService()->getBatchNotification($id);
        if (empty($batchnotification)) {

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

AI 解读 AI

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

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