all(); echo getDateFull()."===支付返回\n"; $data = !empty($param['msg']) ? json_decode($param['msg'],true) : []; print_r($data); $orderSn = $data['out_order_no']; if ($data['status'] <> "SUCCESS") return json(['err_no' => 0,'err_tips' => "success"]); if (empty($data)) return json(['err_no' => 0,'err_tips' => "success"]); $order = (new SaasOrder)->where("out_order_no",$orderSn)->findOrEmpty(); if ($order->isEmpty()) return json(['err_no' => 0,'err_tips' => "success"]); if ($order['status'] <> 0) return json(['err_no' => 0,'err_tips' => "success"]); $order->status = 1; $order->pay_at = getDateFull(); $order->pay_type = $data['pay_channel']; $order->pay_sn = $data['channel_pay_id']; $order->pay_money = $data['total_amount']; $order->save(); return json(['err_no' => 0,'err_tips' => "success"]); } catch (\Throwable $th) { return error($th->getMessage()); } } #[PostMapping("price")] public function getOrderNotifyPrice(Request $request): Response { try { $param = $request->all(); echo getDateFull()."===支付返回\n"; $data = !empty($param['msg']) ? json_decode($param['msg'],true) : []; print_r($data); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[PostMapping("mini")] public function getOrderNotifyMini(Request $request): Response { try { $param = $request->all(); echo getDateFull()."===支付返回\n"; $data = !empty($param['msg']) ? json_decode($param['msg'],true) : []; print_r($data); $orderSn = $data['cp_extra']; if ($data['status'] <> "SUCCESS") return json(['err_no' => 0,'err_tips' => "success"]); if (empty($data)) return json(['err_no' => 0,'err_tips' => "success"]); $order = (new SaasOrder)->where("order_sn",$orderSn)->findOrEmpty(); if ($order->isEmpty()) return json(['err_no' => 0,'err_tips' => "success"]); if ($order['status'] <> 0) return json(['err_no' => 0,'err_tips' => "success"]); $order->status = 1; $order->pay_at = getDateFull(); $order->pay_type = $data['way']; $order->pay_sn = $data['cp_orderno']; $order->pay_money = $data['total_amount']; $order->save(); return json(['err_no' => 0,'err_tips' => "success"]); } catch (\Throwable $th) { return error($th->getMessage()); } } #[PostMapping("refund")] public function getOrderRefund(Request $request): Response { try { $param = $request->all(); echo getDateFull()."===退款返回\n"; $data = !empty($param['msg']) ? json_decode($param['msg'],true) : []; print_r($data); $orderSn = $data['order_id']; if ($data['status'] <> "SUCCESS") return json(['err_no' => 0,'err_tips' => "success"]); if (empty($data)) return json(['err_no' => 0,'err_tips' => "success"]); $order = (new SaasOrder)->where("order_sn",$orderSn)->findOrEmpty(); if ($order['status'] <> 4) return json(['err_no' => 0,'err_tips' => "success"]); $order->status = 3; $order->refund_at = getDateFull(); $order->save(); return json(['err_no' => 0,'err_tips' => "success"]); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[PostMapping("refund/mini")] public function getOrderRefundMini(Request $request): Response { try { $param = $request->all(); echo getDateFull()."===小程序退款返回\n"; $data = !empty($param['msg']) ? json_decode($param['msg'],true) : []; print_r($data); $orderSn = $data['cp_extra']; if ($data['status'] <> "SUCCESS") return json(['err_no' => 0,'err_tips' => "success"]); if (empty($data)) return json(['err_no' => 0,'err_tips' => "success"]); $order = (new SaasOrder)->where("order_sn",$orderSn)->findOrEmpty(); if ($order['status'] <> 4) return json(['err_no' => 0,'err_tips' => "success"]); $order->status = 3; $order->refund_at = getDateFull(); $order->save(); return json(['err_no' => 0,'err_tips' => "success"]); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } }