diff --git a/app/Common/function.php b/app/Common/function.php index d30b44e..d77dcf6 100644 --- a/app/Common/function.php +++ b/app/Common/function.php @@ -33,11 +33,11 @@ if (! function_exists('curl_request')) curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_HEADER, 0); - + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - + $response = curl_exec($curl); - + if ($response === FALSE) { $error = curl_error($curl); @@ -50,9 +50,9 @@ if (! function_exists('curl_request')) $response = trim($response,chr(239).chr(187).chr(191)); $response = json_decode($response, true); } - + curl_close($curl); - + return $response; } } diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index 4b86e32..1396f26 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -218,6 +218,7 @@ class UserController extends CommonController return ReturnData::create(ReturnData::PARAMS_ERROR,null,'用户名已存在'); } + $data['add_time'] = time(); //添加用户 $res = User::wxRegister($data); diff --git a/app/Http/Controllers/Api/UserRechargeController.php b/app/Http/Controllers/Api/UserRechargeController.php index 6c3e71e..8719de1 100644 --- a/app/Http/Controllers/Api/UserRechargeController.php +++ b/app/Http/Controllers/Api/UserRechargeController.php @@ -61,6 +61,7 @@ class UserRechargeController extends CommonController $data['status'] = UserRecharge::UN_PAY; //0未处理,1已完成 $data['pay_type'] = $request->input('pay_type',''); //充值类型:1微信,2支付宝 $data['user_id'] = Token::$uid; + $data['created_at'] = time(); if($data['money']=='' || $data['pay_type']=='') { @@ -84,7 +85,7 @@ class UserRechargeController extends CommonController $data['trade_no'] = $request->input('trade_no',''); $data['pay_time'] = $request->input('pay_time',''); $data['status'] = UserRecharge::COMPLETE_PAY; - $data['updated_at'] = date('Y-m-d H:i:s',time()); + $data['updated_at'] = time(); if($id=='' || $data['trade_no']=='' || $data['pay_time']=='') { diff --git a/app/Http/Controllers/Home/IndexController.php b/app/Http/Controllers/Home/IndexController.php index 03e5a51..46c81b6 100644 --- a/app/Http/Controllers/Home/IndexController.php +++ b/app/Http/Controllers/Home/IndexController.php @@ -457,6 +457,27 @@ class IndexController extends CommonController return view('home.404'); } + //验证消息的确来自微信服务器 + public function checksignature() + { + $signature = $_GET["signature"]; + $timestamp = $_GET["timestamp"]; + $nonce = $_GET["nonce"]; + $echoStr = $_GET["echostr"]; + + $token = 'fanli'; + $tmpArr = array($token, $timestamp, $nonce); + sort($tmpArr, SORT_STRING); + $tmpStr = implode( $tmpArr ); + $tmpStr = sha1( $tmpStr ); + + if( $tmpStr == $signature ){ + exit($echoStr); + }else{ + return false; + } + } + //测试页面 public function test() {return view('home.index.test'); diff --git a/app/Http/Controllers/Weixin/OrderController.php b/app/Http/Controllers/Weixin/OrderController.php index 6c2afb1..6c802a1 100644 --- a/app/Http/Controllers/Weixin/OrderController.php +++ b/app/Http/Controllers/Weixin/OrderController.php @@ -237,7 +237,7 @@ class OrderController extends CommonController $this->success_jump('支付成功',route('weixin_order_list')); } - //订单余额支付 + //订单-微信支付 public function orderWxpay(Request $request) { $order_id = $request->input('order_id',''); @@ -262,7 +262,7 @@ class OrderController extends CommonController $body = '订单支付';//订单详情 $out_trade_no = $data['order_detail']['order_sn'];//订单号 $total_fee = floatval($data['order_detail']['order_amount']*100);//价格0.01 - $attach = 'pay_type=2'; //pay_type=2订单支付 + $attach = 'pay_type=2'; //附加数据,pay_type=2订单支付,示例:xxx=1&yyy=2 $notify_url = route('weixin_wxpay_notify');//通知地址 $wxconfig= \WxPayConfig::wxconfig(); diff --git a/app/Http/Controllers/Weixin/UserController.php b/app/Http/Controllers/Weixin/UserController.php index d49fb9e..ca0184d 100644 --- a/app/Http/Controllers/Weixin/UserController.php +++ b/app/Http/Controllers/Weixin/UserController.php @@ -203,7 +203,7 @@ class UserController extends CommonController $html .= '
充值
'; - $html .= ''.$v['created_at'].'
'.date('Y-m-d H:i:s', $v['created_at']).'
'; $html .= '订单已于 提交成功,请您尽快付款!
+订单已于 提交成功,请您尽快付款!
订单号:充值
-订单已于 提交成功,请您尽快付款!
+充值订单已于 提交成功,请您尽快付款!
订单号: