src/ApiBundle/Api/Resource/Notification/Notification.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace ApiBundle\Api\Resource\Notification;
use ApiBundle\Api\ApiRequest;
use ApiBundle\Api\Resource\AbstractResource;
class Notification extends AbstractResource
{
public function search(ApiRequest $request)
{
$user = $this->getCurrentUser();
$startTime = $request->query->get('startTime', 0);
$type = $request->query->get('type', 'course');
$conditions = array(
'createdTime_GT' => $startTime,
'userId' => $user['id'],
);
$conditions = $this->filterType($type, $conditions);
list($offset, $limit) = $this->getOffsetAndLimit($request);
$notifications = $this->getNotificationService()->searchNotifications(
$conditions,
array('createdTime' => 'DESC'),
$offset,
$limit
);
$total = $this->getNotificationService()->countNotifications($conditions);
$notifications = $this->filterUserFollow($notifications);
return $this->makePagingObject($notifications, $total, $offset, $limit);
}
protected function filterType($type, $conditions)
{
$typeMap = array(
'friend' => array('user-follow'),
'course' => array(
'cash_account',
'classroom-deadline',
'classroom-student',
'coupon',
'course-deadline',
'course-student',
'course-thread',
'discount',
'invite-reward',
'learn-notice',
'live-course',
'order_refund',
'questionRemind',
'role',
'materialLib',
'student-create',
'student-remove',
'test-paper',
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。