Beispiel #1
0
 /* 获得充值记录,如果客户端支持XSLT,则直接发送XML格式的文本到客户端;
       否则在服务器端把XML转换成XHTML后发送到客户端。
    */
 case 'get_charge_history':
     $start_date = isset($_POST['start_date']) ? $_POST['start_date'] : '';
     $end_date = isset($_POST['end_date']) ? $_POST['end_date'] : '';
     $page_size = isset($_POST['page_size']) ? $_POST['page_size'] : 20;
     $page = isset($_POST['page']) ? $_POST['page'] : 1;
     $is_xslt_supported = isset($_POST['is_xslt_supported']) ? $_POST['is_xslt_supported'] : 'no';
     if ($is_xslt_supported === 'yes') {
         $xml = $sms->get_charge_history_by_xml($start_date, $end_date, $page_size, $page);
         header('Content-Type: application/xml; charset=utf-8');
         //TODO:判断错误信息,链上XSLT
         echo $xml;
     } else {
         $result = $sms->get_charge_history($start_date, $end_date, $page_size, $page);
         if ($result !== false) {
             $smarty->assign('sms_charge_history', $result);
             /* 分页信息 */
             $turn_page = array('total_records' => $result['count'], 'total_pages' => intval(ceil($result['count'] / $page_size)), 'page' => $page, 'page_size' => $page_size);
             $smarty->assign('turn_page', $turn_page);
             $smarty->assign('start_date', $start_date);
             $smarty->assign('end_date', $end_date);
             assign_query_info();
             $smarty->display('sms_charge_history.htm');
         } else {
             $link[] = array('text' => $_LANG['back_charge_history'], 'href' => 'sms.php?act=display_charge_history_ui');
             @($error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']] . $_LANG['api_errors']['get_history'][$sms->errors['api_errors']['error_no']]);
             sys_msg($_LANG['history_query_error'] . $error_detail, 1, $link);
         }
     }