mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-06-07 12:38:11 +08:00
fix: 优化售后返利退回
This commit is contained in:
parent
be578184d5
commit
b83331d7e0
@ -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));
|
||||
}
|
||||
|
||||
@ -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']);
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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('订单状态异常!');
|
||||
}
|
||||
// 更新返佣记录
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user