public function getOrderdetail (Request $request) {

    $order_code = $request->input('order_code');

    $order = OrderAllInfo::where('order_code', '=', $order_code)->first();

    $deliver = DeliverInfo::where('order_code', '=', $order_code)->first();

    $data = [
    
      'order' => $order,

      'deliver' => $deliver,

      'wTitle' => '个人中心 - 订单详情'
    
    ];

    if (!empty($order->order_code)) {

      return view('profile/order_detail', $data);

    } else {

      return view('profile/order_not_found');

    }

  }
Beispiel #2
0
  public function getRebuy (Request $request) 
  {

    if (Session::get('rebuy_code') == $request->input('order_code')) {

      $mb = $request->input('mb');

      if (empty($mb)) {
    
        return redirect('/order/pay?order=' . Session::get('order_code'));

      } else {
      
        return redirect('/order/pay?order=' . Session::get('order_code') . '&mb=true');
      
      }
    
    } else {

      Session::put('rebuy_code', $request->input('order_code'));
    
    }

    $order_code = $request->input('order_code'); 

    if (empty($order_code)) {
    
      //todo
    
    }

    $user = Auth::user();

    $orderInfo = OrderAllInfo::where('order_code', '=', $order_code)

      ->where('uid', '=', $user->id)
      
      ->first();

    if (empty($orderInfo->oid)) {
    
      //todo

    }

    $newOrder = [
    
      'code' => $this->generateOrderCode($user->id),

      'uid' => $user->id,

      'rid' => $orderInfo->rid,

      'cid' => $orderInfo->cid,

      'gid' => $orderInfo->gid,

      'num' => $orderInfo->num,

      'sum' => $orderInfo->orig_price,

      'comment' => $orderInfo->comment,

      'status' => 0,

      'active' => 1
    
    ];

    $order = Order::create($newOrder);

    Session::put('order_code', $order->code);

    $orderPrices = [
    
      'oid' => $order->id,

      'orig_price' => $order->sum,

      'cut_fee' => 0,

      'extra_fee' => 0,

      'final_price' => $orderInfo->orig_price,

      'active' => 1
    
    ];

    $op = OrderPrice::create($orderPrices);

    $good = Good::where('id', '=', $order->gid)->first();

    $receiver = ReceiverInfo::where('id', '=', $order->rid)->first();

    $pay_token = md5($order->id . time());

    $banks = Bank::all();

    $bouns = Boun::where('uid', '=', $user->id)
      
      ->where('active', '=', 1)

      ->where('type', '=', 1)
      
      ->get();

    $data = [

      'rebuy' => true,

      'bouns' => $bouns,
    
      'order' => $order,

      'orderPrice' => $op,

      'good' => $good,

      'receiver' => $receiver,

      'pay_token' => $pay_token,

      'banks' => $banks,

      'is_pay' => true,

      'wTitle' => '订单支付'
    
    ];

    $mb = $request->input('mb');

    if (!empty($mb)) {
    
      return view('mobile/minipay', $data);

    } else {
    
      return view('orders/pay', $data);
    
    }
  
  }
  public function getOrderinfo (Request $request) 
  {
     $order_code = $request->input('order');  

     if (empty($order_code) || strlen($order_code) == 0) {
     
      
     
     }
      
     $order = OrderAllInfo::where('order_code', '=', $order_code)->first();

     if (empty($order->oid)) {
     
     }

     $data = [ 'order' => $order, 'header' => '订单详情' ];
  
     return view('/mobile/order_detail', $data); 

  }
  public function getOrderpdf (Request $request) 
  {

    $oid = $request->input('oid');

    $order = OrderAllInfo::where('order_code', '=', $oid)->first();

    if (empty($order) || count($order) == 0) {

      return 'fail';

    }

    $boun = Boun::where('uid', '=', $order->uid)

      ->where('type', '=', 0)

      ->first();

    $data = [
    
      'order_code' => $order->order_code,

      'mobile' => $order->mobile,

      'user' => $order->order_owner,

      'created_at' => $order->created_at,

      'receiver' => $order->receiver,

      'address' => $order->city . $order->district . $order->address,
    
      'boun_code' => $boun->code,

      'good_name' => $order->good_name,

      'price' => $order->g_single_price,

      'num' => $order->num,

      'cut_fee' => $order->cut_fee,

      'final_fee' => $order->final_price,

      'car_num' => $order->plate_number
    
    ];

    return view('order_pdf', $data);

  }
Beispiel #5
0
  public function getNotifyorderpayment(Request $request) 
  {

    $timestamp = time();

    $orderNum = Order::where('status', '=', 0)->count();

    $length = 1000;

    $pages = ceil($orderNum/1000);

    $interval = 2;

    for ($i = 0; $i < $pages; $i++) {

      $orders = OrderAllInfo::where('status', '=', 0)->take($i * 1000, $length)->get();

      foreach ($orders as $order) {

        $createdAt = strtotime($order->created_at.'');

        $time = ceil(($timestamp - $createdAt)/60);

        if ($time >= $interval) {

          $sms = event(new TriggerSms($order->order_owner_mobile, 'unpay', [
            
              'created_at' => $order->created_at . '',
            
              'order_code' => $order->order_code
            
            ])); 

          $mail = event(new TriggerEmail($order->order_owner_email, 'unpay', [
            
              'user' => $order->order_owner,

              'order_date' => $order->created_at . '',
            
              'order_code' => $order->order_code
            
            ]));

        }

      }

    }

    return 'done';
  
  }
 public function getOrderpdf(Request $request)
 {
     $order_code = $request->order_code;
     if (empty($order_code)) {
         return 'empty_ordercode';
     }
     $order = OrderAllInfo::where('order_code', '=', $order_code)->first();
     $path = storage_path() . '/app/pdf/';
     $pdf = $order->order_code . '.pdf';
     if (!is_dir($path)) {
         mkdir($path, 0777, true);
     }
     if (!file_exists($pdf)) {
         $debug = Config::get('app.debug');
         if ($debug) {
             $url = "http://www.51linpai.com:8000/download/orderpdf?oid=" . $order->order_code;
         } else {
             $url = "http://www.51linpai.com/download/orderpdf?oid=" . $order->order_code;
         }
         $command = "/tools/wkhtmltopdf {$url}  {$path}{$pdf}";
         $out = array();
         $status = 0;
         shell_exec("export LANG=zh_CN.utf8 && export LANGUAGE=zh_CN:zh:en_US:en && export LC_ALL=zh_CN.utf8 && export LC_CTYPE=zh_CN.utf8 && locale && " . $command);
         DownloadRecord::create(['code' => $url, 'type' => 'pdf', 'output' => 1, 'status' => 1, 'key' => $order->order_code]);
     }
     return response()->download($path . $pdf);
 }