/** * -------------------------------------------------------------- * 服务器端get响应 * -------------------------------------------------------------- * 返回成功提示,5秒后跳转到指定页面 */ public function respondGet($code = '') { if (empty($code)) { return false; } \Omnipay::setGateway($code); $resquest = \Omnipay::completePurchase(['request_params' => \Input::all()]); $response = $resquest->send(); if ($response->isSuccessful()) { //TODO //验证成功 //更新账户余额 //更新订单状态 } else { } if ($code) { $payment = $this->get_by_code($_GET['code']); if (!$payment) { showmessage(L('payment_failed')); } $cfg = unserialize_config($payment['config']); $pay_name = ucwords($payment['pay_code']); pc_base::load_app_class('pay_factory', '', 0); $payment_handler = new pay_factory($pay_name, $cfg); $return_data = $payment_handler->receive(); if ($return_data) { if ($return_data['order_status'] == 0) { $this->update_member_amount_by_sn($return_data['order_id']); } $this->update_recode_status_by_sn($return_data['order_id'], $return_data['order_status']); //支付成功 //showmessage(L('pay_success'),APP_PATH.'index.php?m=pay&c=deposit'); } else { //支付失败 //showmessage(L('pay_failed'),APP_PATH.'index.php?m=pay&c=deposit'); } } else { //支付成功 } }
/* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', 'WelcomeController@index'); Route::get('home', 'HomeController@index'); Route::get('test', function () { //进行第三方支付网站跳转 \Omnipay::setGateway('Alipay_Bank'); $options = array('out_trade_no' => '2014010122390002', 'subject' => 'test', 'total_fee' => 0.03, 'price' => '0.01', 'quantity' => '2', 'defaultBank' => 'CCB'); $response = \Omnipay::purchase($options)->send(); //request->response $response->redirect(); //$redirectData = $response->getRedirectData(); //dd($redirectData); /** *正则匹配工具类测试 $regexTool = new \App\Repositories\RegexTool(); dump($regexTool->isEmail('*****@*****.**')); */ }); Route::get('/test2', function () { DB::listen(function ($sql, $bindings, $time) { dump($sql);