Exemplo n.º 1
0
 public function payDeposit(Request $request, $id)
 {
     header("Content-Type:text/html;charset=utf-8");
     $demand = Demand::findOrFail($id);
     $dset = Setting::where('set_key', '=', "deposite")->get()->first();
     $depositfee = intval($dset->set_value);
     $demand->deposit = $demand->price * $depositfee / 100;
     //这个地方需要个判断
     $demand->save();
     //这个是支付定金的地方
     //    $oneorder=Orders::where("desn1","=",$id);
     $order = DB::table('orders')->where('desn', '=', $id)->first();
     if ($order == null) {
         $order = new orders();
         $order->desn = $demand->id;
         $order->userid = Auth::user()->id;
         //加入用户的编号,用于以后检索
         $order->fee = $demand->deposit;
         $order->fee = 0.01;
         //must comment
         $order->step = 1;
         //第一阶段支付保证金
         $order->status = 0;
         $order->title = $demand->title . "-支付保证金";
         $order->details = $demand->title . "-支付保证金";
         $order->showurl = "http://www.51jinggou.com/demand/show/" . $id;
         $order->save();
     } else {
         if ($order->status == 1) {
             return redirect()->back()->withErrors('您已经支付过保证金了,不需要再支付一次。');
         }
     }
     $paytype = $request->input("pay_type");
     if ($paytype == "alipay") {
         if ($this->ismobile()) {
             $this->alipayapi($order->id);
         } else {
             $this->payorder($order->id);
         }
     } elseif ($paytype == "weixin") {
         //微信支付
         //   $data=array( "deid"=>$id,'orderid'=>$order->id );
         //   return view('pay.chooseb',$data );
         //   return ;
     } else {
         //网银支付
         $this->bankorder($paytype, $order->id);
     }
 }
Exemplo n.º 2
0
 public function save($id)
 {
     $setting = Setting::find($id);
     $setting->update(Input::all());
     $resolved_content = Markdown::parse(Input::get('content'));
     $setting->resolved_content = $resolved_content;
     $setting->save($id);
 }