|
@@ -1,153 +1,165 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-require_once (BASE_HELPER_PATH . "/session_helper.php");
|
|
|
-
|
|
|
-class merchant_baseControl
|
|
|
-{
|
|
|
- //列表默认分页数
|
|
|
- protected $page;
|
|
|
- protected $cur_page;
|
|
|
-
|
|
|
- public function __construct()
|
|
|
- {
|
|
|
- $_SESSION['client_type'] = $_GET['client_type'];
|
|
|
- if($_GET['act'] != 'merchant_login'){
|
|
|
- if (empty($_SESSION['mch_id'])) {
|
|
|
- throw new UnloginException();
|
|
|
- }
|
|
|
- }
|
|
|
- if (is_numeric($_GET['page']) && intval(trim($_GET['page'])) > 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') . "<br/>";
|
|
|
- perfor_period("joutput",$start,"web");
|
|
|
-
|
|
|
- echo sprintf("eclipse_time = %.6f <br/><br/>", self::eclipse_time());
|
|
|
- echo "性能关键统计:<br/><br/>";
|
|
|
- performance_helper::format_log();
|
|
|
-
|
|
|
- $sqls = Log::sql_log();
|
|
|
- echo "sql count = " . count($sqls) . "<br/><br/>";
|
|
|
- foreach ($sqls as $sql) {
|
|
|
- echo "{$sql}<br/>";
|
|
|
- }
|
|
|
- }
|
|
|
- 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=<br/>';
|
|
|
- $start = microtime(true);
|
|
|
- joutput_data($data, 'web');
|
|
|
- perfor_period("joutput",$start,"web");
|
|
|
-
|
|
|
- echo "<br/><br/>";
|
|
|
- echo sprintf("eclipse_time = %.6f <br/><br/>", self::eclipse_time());
|
|
|
- echo "性能关键统计:<br/><br/>";
|
|
|
- performance_helper::format_log();
|
|
|
- $sqls = Log::sql_log();
|
|
|
- echo "sql count = " . count($sqls) . "<br/><br/>";
|
|
|
-
|
|
|
- foreach ($sqls as $sql) {
|
|
|
- echo "{$sql}<br/>";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- protected function initpage($page_size,$cur_page)
|
|
|
- {
|
|
|
- pagecmd('seteachnum', $page_size);
|
|
|
- pagecmd('setnowpage', $cur_page);
|
|
|
- }
|
|
|
+<?php
|
|
|
+
|
|
|
+require_once (BASE_HELPER_PATH . "/session_helper.php");
|
|
|
+
|
|
|
+class merchantwebControl
|
|
|
+{
|
|
|
+ //列表默认分页数
|
|
|
+ protected $page;
|
|
|
+ protected $cur_page;
|
|
|
+
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ $_SESSION['client_type'] = $_GET['client_type'];
|
|
|
+ if (is_numeric($_GET['page']) && intval(trim($_GET['page'])) > 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') . "<br/>";
|
|
|
+ perfor_period("joutput",$start,"web");
|
|
|
+
|
|
|
+ echo sprintf("eclipse_time = %.6f <br/><br/>", self::eclipse_time());
|
|
|
+ echo "性能关键统计:<br/><br/>";
|
|
|
+ performance_helper::format_log();
|
|
|
+
|
|
|
+ $sqls = Log::sql_log();
|
|
|
+ echo "sql count = " . count($sqls) . "<br/><br/>";
|
|
|
+ foreach ($sqls as $sql) {
|
|
|
+ echo "{$sql}<br/>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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=<br/>';
|
|
|
+ $start = microtime(true);
|
|
|
+ joutput_data($data, 'web');
|
|
|
+ perfor_period("joutput",$start,"web");
|
|
|
+
|
|
|
+ echo "<br/><br/>";
|
|
|
+ echo sprintf("eclipse_time = %.6f <br/><br/>", self::eclipse_time());
|
|
|
+ echo "性能关键统计:<br/><br/>";
|
|
|
+ performance_helper::format_log();
|
|
|
+ $sqls = Log::sql_log();
|
|
|
+ echo "sql count = " . count($sqls) . "<br/><br/>";
|
|
|
+
|
|
|
+ foreach ($sqls as $sql) {
|
|
|
+ echo "{$sql}<br/>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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['mch_id'])) {
|
|
|
+ throw new UnloginException();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public function mchid() {
|
|
|
+ return intval($_SESSION['mch_id']);
|
|
|
+ }
|
|
|
}
|