fix: 优化售后返利退回

This commit is contained in:
邹景立 2024-11-05 01:19:07 +08:00
parent be578184d5
commit b83331d7e0
4 changed files with 7 additions and 3 deletions

View File

@ -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));
}

View File

@ -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']);
}

View File

@ -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) {

View File

@ -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('订单状态异常!');
}
// 更新返佣记录