From b83331d7e0c58ca043fdd3d0a89a1cb550bc4866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Tue, 5 Nov 2024 01:19:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=94=AE=E5=90=8E?= =?UTF-8?q?=E8=BF=94=E5=88=A9=E9=80=80=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/think-plugs-wemall/src/controller/api/auth/Rebate.php | 4 +++- plugin/think-plugs-wemall/src/controller/shop/Refund.php | 2 +- plugin/think-plugs-wemall/src/controller/user/Rebate.php | 2 ++ plugin/think-plugs-wemall/src/service/UserRebate.php | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) 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('订单状态异常!'); } // 更新返佣记录