uid; if (!$uid || !$this->data) return app('json')->json_error('下单失败'); list($body, $total_amount, $order_type, $remarks, $trade_type, $pay_way) = $this->_payConf($uid, $this->data, 2); $out_trade_no = rand(1000000000, 9999999999) . (string)date('ymdhis', time()) . (int)microtime(true); // 订单号 /** @var WxPay $pay */ $pay = app()->make(WxPay::class); $rpm = $pay->unifiedOrder(compact('uid', 'body', 'out_trade_no', 'total_amount')); if (!$rpm['flag']) { return app('json')->json_error($rpm['msg']); } $this->setPaymentOrder(compact('body', 'out_trade_no', 'total_amount', 'remarks', 'uid', 'trade_type', 'order_type', 'pay_way'), 2); return app('json')->json_success('微信统一下单成功', $rpm['data']); } /** * 支付回调 * @return $this */ public function getNotifyInfo () { $pay = new WxPay(); if ($pay->checkSign($this->data)) { if ($this->data['trade_status'] == 'TRADE_SUCCESS') { $this->notify_info = $this->data; $this->pay_status = true; $this->pay_way = 2; } } return $this; } /** * 魔术方法 * @param $name * @param $arguments * @return $this */ public function __call ($name, $arguments) { // TODO: Implement __call() method. if ($name == 'data') { $this->{$name} = $arguments[0]; } else { $this->{$name} = $arguments[0]; } return $this; } }