where($where); $totalCount = $query->count(); $list = $query ->order('id', 'desc') ->page($page, $pageSize) ->select() ->toArray(); return [ 'list' => $list, 'totalCount' => $totalCount, 'pageSize' => $pageSize, 'page' => $page ]; } /** * 获取订单详情 * @param int $id * @return array|null */ public function getOrderDetail($id) { $order = $this->where('id', $id)->find(); if (!$order) { return null; } $data = $order->toArray(); // 获取订单商品 $cartInfo = (new StoreOrderCartInfo())->where('oid', $id)->select()->toArray(); $data['cart_info'] = $cartInfo; return $data; } }