public function viewShipping($orderId = 0) { $data = []; $data['user_id'] = Session::get('uid'); $data['id'] = $orderId; $data['delivery'] = 1; $order = PhoneOrder::where($data)->first(); if ($order) { $reqData = []; $reqData['type'] = $order->expresses->type; $reqData['postid'] = $order->shipping_code; $expData = PHPCurl::get('http://www.kuaidi100.com/query', $reqData); if ($expData) { $res = json_decode($expData, true); if ($res['status'] == 200) { $renData = []; $renData['expresses'] = $res['data']; return view('home.my.order.viewShipping')->with($renData); } else { flash($res['message']); return redirect()->back(); } } } flash('亲~服务器繁忙请稍后再试'); return redirect()->back(); }
/** * 订单发货 * * @param int $orderId * @return \Illuminate\Http\RedirectResponse */ public function sendOrderShipping($orderId = 0) { $order = PhoneOrder::find($orderId); if ($order) { $express = Input::get('express', 0); $code = Input::get('code', null); if ($express and $code) { $order->delivery = 1; $order->shipping_id = Input::get('express', 0); $order->shipping_code = Input::get('code', null); if ($order->save()) { return redirect('admin/orders/show'); } } } return redirect()->back(); }
/** * 商家首页 * * @return $this */ public function promote() { $data = []; $data['price'] = 0; $user = AdminUser::find(Session::get('admin_id')); if ($user->coupon) { $data['code'] = $user->coupon->coupon_code; $data['orders'] = PhoneOrder::where(['coupon_id' => $user->coupon->id, 'coupon_pay' => 0])->get(); } else { $data['code'] = null; $data['orders'] = null; } if ($data['orders']) { foreach ($data['orders'] as $order) { if ($order->pay_type == 1) { $data['price'] += 100; } } } return view('admin.promote.show')->with($data); }
/** * 更新订单支付状态为成功 * * @param int $orderId 订单ID */ private function updateOrderPayStatus($orderId = 0, $tradeNo = null, $payStatus = 1) { if ($orderId) { $order = PhoneOrder::find($orderId); $order->pay_type = $payStatus; $order->trade_no = $tradeNo; $order->save(); } }
public function success($orderId) { if ($orderId) { $order = PhoneOrder::find($orderId); if ($order) { return view('home.order.success')->withOrder($order); } } return redirect('/'); }