作者 王智

修改

... ... @@ -500,10 +500,9 @@ class Common extends Api
}
$res = Db::name('tuikuan')->where('OrderSn', $OrderInfo['OrderSn'])->where('seller_id', $IsSeller)->update(['status' => $params['status']]);
if ($params['type'] == 1) {
//拒绝签订协议 给予用户退款
$OrderSn = Db::name('agreement')->where('id', $params['id'])->value('OrderSn');
$PayOrderInfo = Db::name('pay_order')->where('OrderSn', $OrderSn)->where('type', 1)->find();
$TuiMoney = $PayOrderInfo['UpMoney'] * $params['bili'] + $PayOrderInfo['Money'];
$OrderSn = Db::name('agreement')->where('id', $params['id'])->find();
$PayOrderInfo = Db::name('pay_order')->where('OrderSn', $OrderSn['OrderSn'])->where('type', 1)->find();
$TuiMoney = $OrderSn['UpMoney'] + $OrderSn['Money'];
//配置
$config = [
'app_id' => 'wx6a9080f20326f817',
... ... @@ -519,7 +518,7 @@ class Common extends Api
try {
$result = $payment->refundByTransactionId($PayOrderInfo['WeChatOrder'], $PayOrderInfo['PayOrder'], $PayOrderInfo['money'] * 100, $TuiMoney * 100); // 总金额 100, 退款 80,操作员:商户号
//更改订单状态为已退款
Db::name('pay_order')->where('OrderSn', $OrderSn)->where('PayOrder', $PayOrderInfo['PayOrder'])->update(['type' => 0]);
Db::name('pay_order')->where('OrderSn', $OrderSn['OrderSn'])->where('PayOrder', $PayOrderInfo['PayOrder'])->update(['type' => 0]);
} catch (Exception $e) {
$e->getMessage();
}
... ...