public static function end($source = null) { if (!self::isExtension()) { die("没有xhprof扩展!"); } // 可以return掉 则不影响正常程序 $xhprof_data = xhprof_disable(); $oXHProf = app::get("serveradm")->model("xhprof"); //$run_id = $oXHProf->write_data($xhprof_data); include_once dirname(__FILE__) . "/../vendor/xhprof_lib/utils/xhprof_lib.php"; include_once dirname(__FILE__) . "/../vendor/xhprof_lib/utils/xhprof_runs.php"; $xhprof_runs = new XHProfRuns_Default(); $run_id = $xhprof_runs->save_run($xhprof_data, "xhprof"); $aData = array('source' => 'xhprof', 'run_id' => $run_id, 'request_uri' => vmc::request()->get_request_uri(), 'app' => $_GET['app'], 'ctl' => $_GET['ctl'], 'act' => $_GET['act'], 'wt' => $xhprof_data["main()"]["wt"], 'mu' => $xhprof_data["main()"]["mu"], 'pmu' => $xhprof_data["main()"]["pmu"], 'addtime' => time()); $oXHProf->save($aData); }
function dispatch($query) { $query_args = explode('/', $query); $controller = array_shift($query_args); $action = array_shift($query_args); if ($controller == 'index.php') { $controller = ''; } foreach ($query_args as $i => $v) { if ($i % 2) { $params[$k] = $v; } else { $k = $v; } } $controller = $controller ? $controller : 'default'; vmc::request()->set_params($params); $action = $action ? $action : 'index'; $controller = $this->app->controller($controller); $controller->{$action}(); }
public function getway_callback($pay) { $mdl_bills = $this->app->model('bills'); $obj_bill = vmc::singleton('ectools_bill'); $params = vmc::singleton('base_component_request')->get_params(true); $pay_app_class = key($pay); if (!stripos($pay_app_class, '_')) { //兼容处理 $pay_app_class = 'ectools_payment_applications_' . $pay_app_class; } $pay_app_method = current($pay); $pay_app_instance = new $pay_app_class(); if ($pay_app_class == 'wechat_payment_applications_wxpay') { /** * 微信支付特殊处理 */ $params['_http_raw_post_data_'] = $GLOBALS["HTTP_RAW_POST_DATA"]; } $pay_result = $pay_app_instance->{$pay_app_method}($params); logger::debug('支付网关回调params:' . var_export($params, 1) . "\n" . $pay_app_class . "\n" . $pay_app_method . "\n" . var_export($pay_result, 1)); if (!$pay_result || empty($pay_result['status'])) { $pay_result['status'] = 'error'; } if ($pay_result['bill_id'] && ($bill = $mdl_bills->dump($pay_result['bill_id']))) { $pay_result = array_merge($bill, $pay_result); //update bill if (!$obj_bill->generate($pay_result, $msg)) { logger::error('支付网关回调后,更新或保存支付单据失败!' . $msg . '.bill_export:' . var_export($pay_result, 1)); } } // Redirect page. if ($pay_app_method != 'notify' && $pay_result['return_url']) { //for ecmobilecenter if (preg_match('/^http([^:]*):\\/\\//', $pay_result['return_url'])) { header('Location: ' . $pay_result['return_url']); } else { header('Location: ' . strtolower(vmc::request()->get_schema() . '://' . vmc::request()->get_host()) . $pay_result['return_url']); } } }
public function __construct(&$app) { $this->app = $app; $this->params = vmc::request()->request_params; //$this->pagedata = $this->$_vars; }
private function gen_id() { return md5(vmc::request()->get_request_uri()); }