Ejemplo n.º 1
0
 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('尾款支付成功,等待卖家发货!');
     */
 }
Ejemplo n.º 2
0
 public function delBid($id)
 {
     try {
         $bid = Bid::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         return Redirect::to('/')->withInput()->withErrors('竞价信息不存在或已被删除!');
     }
     $bid->delete();
     return Redirect::back()->withInput()->withErrors('删除成功!');
 }
Ejemplo n.º 3
0
 public function win(Request $request)
 {
     try {
         $action = $request->get("action");
         if ($action == "") {
             $bid = Bid::findOrFail($request->get('id'));
             if ($bid->demand->stauts < 0) {
                 return Redirect::to('/demand/show/' . $bid->demand->id)->withErrors('当前状态下不能选择中标!');
             }
             if (Auth::user()->id != $bid->demand->user_id) {
                 return '没有权限';
                 return Redirect::to('/demand/show/' . $bid->demand->id)->withInput()->withErrors('没有权限!');
             }
             $bid->is_win = 1;
             $bid->demand->status = 1;
             $bid->save();
             $bid->demand->save();
             return '操作成功';
             return Redirect::to('/demand/show/' . $bid->demand->id)->withInput()->withErrors('操作成功!');
         }
         if ($action == "drop") {
             $deid = $request->get("deid");
             $demand = Demand::findOrFail($deid);
             $demand->status = "-3";
             //取消,放弃
             $demand->deposit = 0;
             //扣除保证金
             $demand->save();
             return '操作成功';
         }
     } catch (ModelNotFoundException $e) {
         return '删除';
         return Redirect::to('/')->withInput()->withErrors('竞购信息不存在或已被删除!');
     }
 }