作者 lihan
1 个管道 的构建 通过 耗费 1 秒

退货&退款

... ... @@ -341,15 +341,16 @@ class ZjOrderController extends AdminBaseController
}
$param['step'] = 9;
unset($param['tui']);//删除无用数据
$return = $this->wxRefund($param['id'], 1);
$this->error($return);
exit();
$edit = Db::name('zj_order')->update($param);
if (empty($edit)) {
$this->error('订单退款失败');
$return = $this->wxRefund($param['id'], $param['refund_fee'] * 100);
if ($return) {
$edit = Db::name('zj_order')->update($param);
if (empty($edit)) {
$this->error('订单退款失败');
} else {
$this->success('订单退款成功');
}
} else {
$this->success('订单退款成功');
$this->error('订单退款失败');
}
} else {
$this->error('非法操作');
... ... @@ -362,20 +363,21 @@ class ZjOrderController extends AdminBaseController
$info = Db::name('zj_order')->field('order_num,whole,whole_num,out_trade_no,step')->where(['id' => $oid])->find();
if ($info['step'] == 8) {
$totalFee = $info['whole'] - $info['whole_num'];
if($refundFee > $totalFee) {
if ($refundFee > $totalFee) {
$this->error('退款金额不能大于实际支付金额');
}else {
} else {
require_once EXTEND_PATH . '/Refund.php';
$refund = new \Refund($info['out_trade_no'], $totalFee * 100, $info['order_num'], $refundFee);
var_dump($refund->refund());
$return = $refund->refund();
if ($return['return_code'] == 'SUCCESS' && $return['result_code'] == 'SUCCESS') {
return true;
} else {
return false;
}
}
} else {
$this->error('非法操作');
}
}
public function test() {
$this->wxRefund(148, 1);
}
}
\ No newline at end of file
... ...
... ... @@ -127,7 +127,7 @@
<tr>
<th>退款额度</th>
<td>
<input type="number" name="tui" class="form-control">
<input type="number" name="refund_fee" class="form-control">
</td>
</tr>
<tr>
... ...