Created
January 5, 2022 02:55
-
-
Save 330132662/80a1bd65191db99f653080ccfd4f5c16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wxrefund(Request $request) | |
{ | |
$order_num = $request->input("sn"); | |
$uid = $request->input("uid", 0); | |
if ($uid > 0) { | |
// 先退管家订单 再推普通订单 | |
// $cond["total_price"] = array("=", 0); | |
$cond["user_id"] = $uid; | |
$orderData = Order::where($cond) | |
->where("total_price", ">", 0) | |
->get(); | |
if (count($orderData) < 1) { | |
return format(0, "无订单"); | |
} | |
foreach ($orderData as $o) { | |
$order = [ | |
'out_trade_no' => $o["order_sn"], | |
'out_refund_no' => time(), | |
'total_fee' => $o["total_price"], | |
'refund_fee' => $o["total_price"], | |
'refund_desc' => '测试退款haha', | |
'type' => 'miniapp' | |
]; | |
// var_dump($order); | |
// $res = $this->wechat->refund($order); | |
} | |
} else { | |
$orderData = Order::where(["order_sn" => $order_num])->first(); | |
if (!$orderData) { | |
$orderData = BulterOrder::where(["order_sn" => $order_num])->first(); | |
} | |
$order = [ | |
'out_trade_no' => $order_num, | |
'out_refund_no' => time(), | |
'total_fee' => $orderData["total_price"], | |
'refund_fee' => $orderData["total_price"], | |
'refund_desc' => '测试退款haha', | |
'type' => 'miniapp' | |
]; | |
$result = $this->wechat->refund($order); | |
return format("", $result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment