...
|
...
|
@@ -644,22 +644,29 @@ class Order extends Api |
|
|
$skumodel->where('goods_spec_id',$value['goods_spec_id'])->setInc('stock_num',$value['total_num']);
|
|
|
}
|
|
|
}
|
|
|
$config = Service::getConfig('wechat');
|
|
|
$config['notify_url'] = $this->request->domain().'api/notify/refund/type/wechat';
|
|
|
$config['return_url'] = '';
|
|
|
$wechat = Pay::wechat($config);
|
|
|
$refund_no = 'LQ-'.time().mt_rand(10000,99999);
|
|
|
$param = [
|
|
|
// 已支付就退款
|
|
|
if($order['pay_status'] == '20'){
|
|
|
$config = Service::getConfig('wechat');
|
|
|
$config['app_id'] = $config['miniapp_id'];
|
|
|
$config['notify_url'] = $this->request->domain().'api/notify/refund/type/wechat';
|
|
|
$config['return_url'] = '';
|
|
|
$wechat = Pay::wechat($config);
|
|
|
$refund_no = 'LQ-'.time().mt_rand(10000,99999);
|
|
|
$param = [
|
|
|
// 'total_fee' => $order['pay_price'],
|
|
|
// 'refund_fee' => $order['pay_price'],
|
|
|
'total_fee' => 0.01,
|
|
|
'refund_fee' => 0.01,
|
|
|
'out_trade_no' => $order['order_no'],
|
|
|
'out_refund_no' => $refund_no
|
|
|
];
|
|
|
$wechat->refund($param);
|
|
|
$order->refund_no = $refund_no;
|
|
|
$order->isUpdate()->save();
|
|
|
'total_fee' => 1,
|
|
|
'refund_fee' => 1,
|
|
|
'out_trade_no' => $order['order_no'],
|
|
|
'out_refund_no' => $refund_no
|
|
|
];
|
|
|
$wechat->refund($param);
|
|
|
$order->refund_no = $refund_no;
|
|
|
$order->refund_time = time();
|
|
|
}
|
|
|
// 状态变为已取消
|
|
|
$order->order_status = '20';
|
|
|
$order->isUpdate(true)->save();
|
|
|
$this->success('取消成功');
|
|
|
}
|
|
|
|
...
|
...
|
|