public function payDemand(Request $request, $id) { $demand = Demand::findOrFail($id); $demand->is_pay = 1; $demand->save(); $winbid = Bid::whereRaw("demand_id={$id} and is_win=1")->first(); $order = new Orders(); $order->desn = $demand->id; $order->userid = Auth::user()->id; //这个是用户的编号用于以后检索 $order->fee = $winbid->price - $demand->deposit; $order->fee = 0.01; //must comment $order->step = 2; //这是第二阶段来支付尾款 $order->status = 0; $order->title = $demand->title . "-支付尾款"; $order->details = $demand->title . "-支付尾款"; $order->showurl = "http://www.51jinggou.com/demand/show/" . $id; $order->save(); $paytype = $request->input("pay_type"); if ($paytype == "alipay") { // echo "this is alipay and id=".$order->id; //支付宝支付 //根据不同的用户界面pc与mobile进行跳转 if ($this->ismobile()) { $this->alipayapi($order->id); } else { $this->payorder($order->id); } exit; return; } elseif ($paytype == "weixin") { exit; //微信支付 return; } else { // echo "this is bankpay"; //网银支付 $this->bankorder($paytype, $order->id); } /* return Redirect::to('/demand/show/' . $demand->id) ->withInput() ->withErrors('尾款支付成功,等待卖家发货!'); */ }
public function Demandbid($id) { $bids = Bid::whereRaw("demand_id={$id}")->orderBy('id', 'desc')->get(); return view("admin.debids")->with("bids", $bids); }
public function shoukuan($id) { try { $userid = Auth::user()->id; $demand = Demand::findOrFail($id); $bid = Bid::whereRaw(" demand_id=" . $demand->id . " and user_id=" . $userid . " and is_win=1")->get()->first(); if (!$bid) { return redirect()->back()->withInput()->withErrors('没有找到相关的订单,收款失败。'); } $demand->status = 5; $demand->save(); //收款 return redirect()->back()->withInput()->withErrors('收款成功。'); } catch (ModelNotFoundException $e) { return Redirect::to('/')->withInput()->withErrors('竞购信息不存在或已被删除!'); } }