diff --git a/plugin/think-plugs-wemall/src/controller/api/auth/Rebate.php b/plugin/think-plugs-wemall/src/controller/api/auth/Rebate.php index 1359b01d3..9903c7242 100644 --- a/plugin/think-plugs-wemall/src/controller/api/auth/Rebate.php +++ b/plugin/think-plugs-wemall/src/controller/api/auth/Rebate.php @@ -39,7 +39,9 @@ class Rebate extends Auth */ public function get() { - $query = PluginWemallUserRebate::mQuery()->where(['unid' => $this->unid]); + $query = PluginWemallUserRebate::mQuery()->where([ + 'unid' => $this->unid, 'deleted' => 0 + ]); $query->equal('type,status')->like('name|code|order_no#keys')->whereRaw('amount>0'); $this->success('获取返佣统计', $query->order('id desc')->page(true, false, false, 15)); } diff --git a/plugin/think-plugs-wemall/src/controller/shop/Refund.php b/plugin/think-plugs-wemall/src/controller/shop/Refund.php index fd930243e..b05300c6e 100644 --- a/plugin/think-plugs-wemall/src/controller/shop/Refund.php +++ b/plugin/think-plugs-wemall/src/controller/shop/Refund.php @@ -138,7 +138,7 @@ class Refund extends Controller // 如果已经退款了,不让改金额 if ($refund->getAttr('status') > 4) { // 取消订单奖励 - UserOrder::cancel($refund->getAttr('order_no')); + UserOrder::cancel($refund->getAttr('order_no'), true); // 去除不相关的字段 unset($data['payment_amount'], $data['balance_amount'], $data['integral_amount']); } diff --git a/plugin/think-plugs-wemall/src/controller/user/Rebate.php b/plugin/think-plugs-wemall/src/controller/user/Rebate.php index b3a4db8fa..8b6c17950 100644 --- a/plugin/think-plugs-wemall/src/controller/user/Rebate.php +++ b/plugin/think-plugs-wemall/src/controller/user/Rebate.php @@ -46,6 +46,8 @@ class Rebate extends Controller $this->title = '代理返佣管理'; $this->rebate = UserRebate::recount(0); }, static function (QueryHelper $query) { + // 删除状态 + $query->where(['deleted' => 0]); // 数据关联 $query->equal('type,status')->like('name,order_no')->dateBetween('create_time')->with([ 'user' => function (Query $query) { diff --git a/plugin/think-plugs-wemall/src/service/UserRebate.php b/plugin/think-plugs-wemall/src/service/UserRebate.php index 37e520d84..b538131e7 100644 --- a/plugin/think-plugs-wemall/src/service/UserRebate.php +++ b/plugin/think-plugs-wemall/src/service/UserRebate.php @@ -214,7 +214,7 @@ abstract class UserRebate public static function cancel($order): bool { $order = UserOrder::widthOrder($order); - if ($order->isEmpty() || $order->getAttr('status') > 0) { + if ($order->isEmpty()) { throw new Exception('订单状态异常!'); } // 更新返佣记录