Example #1
0
/**
 * 获取记账条目列表
 */
function get_bill_list()
{
    $userId = (int) $_SESSION['userId'];
    $accountId = is_empty($_REQUEST['accountId']) ? null : (int) $_REQUEST['accountId'];
    $billTypeId = is_empty($_REQUEST['billTypeId']) ? null : (int) $_REQUEST['billTypeId'];
    $startDate = is_empty($_REQUEST['startDate']) ? null : $_REQUEST['startDate'];
    $endDate = is_empty($_REQUEST['endDate']) ? null : $_REQUEST['endDate'];
    $billTypeFlag = is_empty($_REQUEST['billTypeFlag']) ? null : (int) $_REQUEST['billTypeFlag'];
    $curPageIndex = is_empty($_REQUEST['curPageIndex']) ? 1 : (int) $_REQUEST['curPageIndex'];
    $pageSize = get_page_size();
    $code = '0';
    $billService = new BillService();
    $page = $billService->getBillListPage($userId, $accountId, $billTypeId, $startDate, $endDate, $billTypeFlag, $curPageIndex, $pageSize);
    if ($page != null) {
        $totalCount = $page['totalCount'];
        $pageCount = $page['pageCount'];
        $rows = $page['page'];
    } else {
        $code = '-1';
    }
    $output = array('retCode' => $code, 'curPageIndex' => $curPageIndex, 'totalCount' => $totalCount, 'pageCount' => $pageCount, 'billList' => $rows);
    echo get_json($output);
}