public function orderEdit(Request $request) { $order = Order::find($request->input('id', '')); $order->status = $request->input('status', 1); $order->save(); $m3_result = new M3Result(); $m3_result->status = 0; $m3_result->message = '添加成功'; return $m3_result->toJson(); }
public function toOrderList(Request $request) { $member = $request->session()->get('member', ''); $orders = Order::where('member_id', $member->id)->get(); foreach ($orders as $order) { $order_items = OrderItem::where('order_id', $order->id)->get(); $order->order_items = $order_items; foreach ($order_items as $order_item) { $order_item->product = json_decode($order_item->pdt_snapshot); } } return view('order_list')->with('orders', $orders); }
public function wxNotify() { Log::info('微信支付回调开始'); $return_data = file_get_contents("php://input"); Log::info('return_data: ' . $return_data); libxml_disable_entity_loader(true); $data = simplexml_load_string($return_data, 'SimpleXMLElement', LIBXML_NOCDATA); Log::info('return_code: ' . $data->return_code); if ($data->return_code == 'SUCCESS') { $order = Order::where('order_no', $data->out_trade_no)->first(); $order->status = 2; $order->save(); return "<xml>\n <return_code><![CDATA[SUCCESS]]></return_code>\n <return_msg><![CDATA[OK]]></return_msg>\n </xml>"; } return "<xml>\n <return_code><![CDATA[FAIL]]></return_code>\n <return_msg><![CDATA[FAIL]]></return_msg>\n </xml>"; }