wechat->callback(Request()->post()); if($result && $result->event_type=='TRANSACTION.SUCCESS'){ $ciphertext=$result->resource['ciphertext']; if ($ciphertext['trade_state'] === 'SUCCESS') { $extra['transaction_id'] = $ciphertext['transaction_id']; $attach = $ciphertext['attach']; switch ($attach) { case 'cashierclass': PayNotifyLogic::handle('cashierclass', $ciphertext['out_trade_no'], $ciphertext); $app->wechat->success(); break; } } } } /** * @notes 查询订单支付状态 */ public function wechatQuery(){ $order_no=$this->request->get('order_no'); $order = [ 'out_trade_no' => $order_no, ]; $app=new PayService(0); $res = $app->wechat->query($order); if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') { PayNotifyLogic::handle('cashierclass', $res['out_trade_no'], $res); return $this->success('支付成功'); }else{ return $this->fail('订单支付中'); } } /** * 支付宝同步回调地址 */ public function alipay_return(){ $app=new PayService(); $result = $app->alipay->callback(Request()->post()); Log::error('支付宝同步回调',$result->toArray()); // if($result && $result->event_type=='TRANSACTION.SUCCESS'){ // $ciphertext=$result->resource['ciphertext']; // if ($ciphertext['trade_state'] === 'SUCCESS') { // $extra['transaction_id'] = $ciphertext['transaction_id']; // $attach = $ciphertext['attach']; // switch ($attach) { // case 'cashierclass': // PayNotifyLogic::handle('cashierclass', $ciphertext['out_trade_no'], $ciphertext); // $app->wechat->success(); // break; // } // } // } } /** * 支付宝异步回调地址 */ public function alipay_notify(){ $app=new PayService(); $result = $app->alipay->callback(Request()->post()); Log::error('支付宝异步回调',$result->toArray()); } }