Пример #1
0
 /**
  * 我的订单
  */
 public function orderAction()
 {
     $pageSize = 20;
     $curPage = intval($this->param('p', 1));
     $curPage = $curPage < 1 ? 1 : $curPage;
     $curUser = $this->getCurrentUser();
     $where = "user_id='{$curUser['id']}' and status='1'";
     $totalItems = OrderData::count($where);
     $list = array();
     if ($totalItems) {
         $totalPages = ceil($totalItems / $pageSize);
         $curPage = $curPage > $totalPages ? $totalPages : $curPage;
         $start = $pageSize * ($curPage - 1);
         $sql = "select * from `order` where {$where} order by create_time desc limit {$start},{$pageSize}";
         $list = OrderData::sql($sql);
         if ($list) {
             $pageHtml = ComTool::pageHtml($curPage, $pageSize, $totalItems, $this->urlroot . 'my/order/p');
         }
     }
     $this->assign('list', $list);
     $this->assign('pageHtml', $pageHtml);
     $this->display();
 }