0) { $this->page = intval(trim($_GET['page'])); } else { $this->page = 10; } if (is_numeric($_GET['curpage']) && intval(trim($_GET['curpage'])) > 0) { $this->cur_page = intval(trim($_GET['curpage'])); } else { $this->cur_page = 1; } $this->initpage($this->page, $this->cur_page); } public static function outerr($code, $msg = '', $page = '', $type = 'ajax') { static $json_clients = ['android', 'ios', 'mini']; if (!empty($type)) { $show_type = $type; } else { $show_type = $_SESSION['client_type']; } if (in_array($show_type, $json_clients)) { joutput_error($code, $msg); } elseif ($show_type == 'wap') { Tpl::clear(); Tpl::output("error", $msg); if (!empty($page)) { Tpl::showpage($page); } } elseif ($show_type == 'ajax') { $callback = $_GET['callback']; if (!isset($callback) || empty($callback)) { joutput_error($code, $msg); } else { echo "{$callback}("; joutput_error($code, $msg); echo ");"; } } else { if (empty($msg)) { $msg = errcode::msg($code); } $start = microtime(true); echo joutput_error($code, $msg, 'web') . "
"; perfor_period("joutput", $start, "web"); echo sprintf("eclipse_time = %.6f

", self::eclipse_time()); echo "性能关键统计:

"; echo perfor_log(); $sqls = Log::sql_log(); echo "sql count = " . count($sqls) . "

"; foreach ($sqls as $sql) { echo "{$sql}
"; } } return true; } public static function outsuccess($data, $page = '', $type = NULL) { static $json_clients = ['android', 'ios', 'mini']; if (!empty($type)) { $show_type = $type; } else { $show_type = $_SESSION['client_type']; } if (in_array($show_type, $json_clients)) { joutput_data($data); } elseif ($show_type == 'wap') { Tpl::clear(); if (is_array($data)) { foreach ($data as $key => $val) { Tpl::output($key, $val); } } if (!empty($page)) { Tpl::showpage($page); } } elseif ($show_type == 'ajax') { $callback = $_GET['callback']; if (!isset($callback) || empty($callback)) { joutput_data($data); } else { echo "{$callback}("; joutput_data($data); echo ");"; } } else { echo 'success: return data=
'; $start = microtime(true); joutput_data($data, 'web'); perfor_period("joutput", $start, "web"); echo "

"; echo sprintf("eclipse_time = %.6f

", self::eclipse_time()); echo "性能关键统计:

"; echo perfor_log(); $sqls = Log::sql_log(); echo "sql count = " . count($sqls) . "

"; foreach ($sqls as $sql) { echo "{$sql}
"; } } return true; } private static function eclipse_time() { return (microtime(true) - self::$startime); } protected function initpage($page_size, $cur_page) { pagecmd('seteachnum', $page_size); pagecmd('setnowpage', $cur_page); } } class mbMerchantControl extends merchantwebControl { public $err_code = errcode::Success; public function __construct() { parent::__construct(); if (empty($_SESSION['mchid'])) { throw new UnloginException(); } } public function mchid() { return intval($_SESSION['mchid']); } }