log_name = $name; } public function alert($msg) { echo ''; } public function order($request) { //验证表单数据 $this->checkPost($request); //通道检查 $this->checkGateway($request); if (count(self::$errorArr) > 0) { return $this->msg($this->errorFormat()); } //订单金额 $regist=MerchantRegist::find($request->input('model_id')); if(empty($regist)) { return $this->alert('缺少参数'); } $this->user = []; //设置订单数据 $order_sn = $request->input('order_sn'); $system_money=config_cache_default('merchant_config.merchant_regist_min_money',500); if($system_money>($regist->money+0)) { return $this->alert('商户注册链接失效'); } //订单数据 $order_data = [ 'order_sn' => $order_sn, 'name' => $order_sn . '定制', 'money'=>$regist->money, 'model_type'=>$request->input('model_type'), 'model_id'=>$request->input('model_id'), 'from_merchant_id'=>$regist->from_merchant_id, 'gateway_id'=>$this->gateway['id'], 'gateway_type'=>$this->pay_type, 'gateway_method'=>$this->pay_method, 'gateway_data'=>json_encode($this->gateway), 'merchant_money'=>$regist->money-$system_money, 'system_money'=>$system_money ]; //创建订单 $order_r=MerchantOrder::create($order_data); $this->order=$order_r; if ($order_r) { $this->debugLog('选择通道是---' . $this->gateway['id'] . '方式是--' . $this->pay_method); //支付通道配置,签名之类的 $config=[ 'return_url' => route('web.merchant.order.notify', ['type' => $this->pay_type,'method'=>'return']), 'notify_url' => route('web.merchant.order.notify', ['type' => $this->pay_type,'method'=>'notify']), ]; $this->pay_service->payConfig($this->pay_type,$config); $data =[ 'out_trade_no' => $order_data['order_sn'], 'total_amount' => $order_data['money'], 'subject' => $order_data['order_sn'] . '定制' //$request->input('title','测试数据') ]; $this->debugLog('订单数据:',$data); //发送支付请求 return $this->paySend($data); } else { return $this->msg(['error' => 1, 'msg' => '提交失败']); } } //扫码支付 public function scan($r) { $data = [ 'url' => $r->qr_code, 'order' => $this->order, 'type_name' => config('adconfig.pay_type')[$this->pay_type] ]; return view('web.order.scan2', $data); } }