public function indexAction(Request $request) { $user = $this->getCurrentUser(); if ($request->getMethod() == 'POST') { $conditions = $request->request->all(); $paginator = new Paginator($this->get('request'), $this->getUserService()->searchUserCount($conditions), $request->request->get('rows')); $users = $this->getUserService()->searchUsers($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount()); $users = ArrayToolkit::format($users, array('createdTime')); $usersJson['total'] = $this->getUserService()->searchUserCount($conditions); $usersJson['rows'] = $users; return $this->createJsonResponse($usersJson); } return $this->render('TopxiaAdminBundle:User:user-index.html.twig'); }
public function cartAction(Request $request) { if ($request->getMethod() == 'POST') { $conditions = $request->request->all(); $paginator = new Paginator($request, $this->getCartService()->searchCartsCount($conditions), $request->request->get('rows')); $carts = $this->getCartService()->searchCarts($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount()); $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($carts, 'userId')); $carts = ArrayToolkit::format($carts, array('createdTime'), $users); $cartsJson['total'] = $this->getCartService()->searchCartsCount($conditions); $cartsJson['rows'] = $carts; return $this->createJsonResponse($cartsJson); } return $this->render('TopxiaAdminBundle:Order:cart-index.html.twig'); }
public function indexAction(Request $request) { if ($request->getMethod() == 'POST') { $conditions = array_filter($request->query->all()); $paginator = new Paginator($request, $this->getContentService()->searchContentCount($conditions), $request->request->get('rows')); $contents = $this->getContentService()->searchContents($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount()); $contents = ArrayToolkit::format($contents, array('publishedTime')); $userIds = ArrayToolkit::column($contents, 'userId'); $users = $this->getUserService()->findUsersByIds($userIds); $categoryIds = ArrayToolkit::column($contents, 'categoryId'); $categories = $this->getCategoryService()->findCategoriesByIds($categoryIds); $contentsJson['total'] = $this->getContentService()->searchContentCount($conditions); $contentsJson['rows'] = $contents; return $this->createJsonResponse($contentsJson); } return $this->render('TopxiaAdminBundle:Content:content-index.html.twig'); }
public function listAction(Request $request) { $conditions = $request->request->all(); $conditions['targetType'] = 'gift'; $paginator = new Paginator($request, $this->getGiftOrdersService()->searchOrdersCount($conditions), $request->request->get('rows')); $orders = $this->getGiftOrdersService()->searchOrders($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount()); $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($orders, 'userId')); $orders = ArrayToolkit::format($orders, array('createdTime', 'paidTime'), $users); foreach ($orders as $index => $expiredOrderToBeUpdated) { if ($expiredOrderToBeUpdated["createdTime"] + 48 * 60 * 60 < time() && $expiredOrderToBeUpdated["status"] == 'created') { $this->getGiftOrdersService()->cancelOrder($expiredOrderToBeUpdated['id']); $orders[$index]['status'] = 'cancelled'; } } $orderJson['total'] = $this->getGiftOrdersService()->searchOrdersCount($conditions); $orderJson['rows'] = $orders; return $this->createJsonResponse($orderJson); }
public function listAction(Request $request) { $conditions = $request->request->all(); if (!empty($conditions['courseTitle'])) { $courses = $this->getCourseService()->findCoursesByLikeTitle(trim($conditions['courseTitle'])); $conditions['courseIds'] = ArrayToolkit::column($courses, 'id'); if (count($conditions['courseIds']) == 0) { return $this->render('TopxiaAdminBundle:Review:index.html.twig', array('reviews' => array(), 'users' => array(), 'courses' => array(), 'paginator' => new Paginator($request, 0, 20))); } } $paginator = new Paginator($request, $this->getReviewService()->searchReviewsCount($conditions), $request->request->get('rows')); $reviews = $this->getReviewService()->searchReviews($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount()); $users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($reviews, 'userId')); $reviews = ArrayToolkit::format($reviews, array('createdTime'), $users); $courses = $this->getCourseService()->findCoursesByIds(ArrayToolkit::column($reviews, 'courseId')); $reviewsJson['total'] = $this->getReviewService()->searchReviewsCount($conditions); $reviewsJson['rows'] = $reviews; return $this->createJsonResponse($reviewsJson); }
public function cashbillListAction(Request $request) { $fields = $request->request->all(); if (!empty($fields)) { $conditions = $this->_prepareSearchConditions($fields); } $conditions['cashType'] = 'RMB'; $paginator = new Paginator($request, $this->getCashService()->searchFlowsCount($conditions), 20); $cashes = $this->getCashService()->searchFlows($conditions, array('ID', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount()); $userIds = ArrayToolkit::column($cashes, "userId"); $users = $this->getUserService()->findUsersByIds($userIds); $cashes = ArrayToolkit::format($cashes, array('createdTime'), $users); $jsonData['total'] = $this->getCashService()->searchFlowsCount($conditions); $conditions['type'] = 'inflow'; $amountInflow = $this->getCashService()->analysisAmount($conditions); $conditions['type'] = 'outflow'; $amountOutflow = $this->getCashService()->analysisAmount($conditions); $jsonData['rows'] = $cashes; $jsonData['footer'] = array(array('amount' => 0, 'type' => '充值:<span class="inflow">' . $amountInflow . '</span>消费:<span class="outflow">' . $amountOutflow . '</span>')); return $this->createJsonResponse($jsonData); }