From af3cb12d68bdd4f7b3b01b8a40d1820e26fd7257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=A7=AC=E6=A1=91?= Date: Tue, 26 Jan 2021 14:04:04 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20=E6=AF=8F=E6=97=A5&=E8=BF=94=E5=88=A9?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=94=99=E8=AF=AF=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 修复每日任务-重置流量中订单关系未正确使用的错误; 2. 修复商品返利建立返利单时,未正确使用上下级关系与数据名称错误的问题; --- app/Console/Commands/DailyJob.php | 4 ++-- app/Services/OrderService.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/DailyJob.php b/app/Console/Commands/DailyJob.php index 24b6c7e4..e52dbb0a 100644 --- a/app/Console/Commands/DailyJob.php +++ b/app/Console/Commands/DailyJob.php @@ -98,7 +98,7 @@ class DailyJob extends Command ->where('expired_at', '>', date('Y-m-d')) ->where('reset_time', '<=', date('Y-m-d')) ->whereNotNull('reset_time') - ->with('order')->whereHas('order') + ->with('orders')->whereHas('orders') ->chunk(config('tasks.chunk'), function ($users) { foreach ($users as $user) { $order = $user->orders()->activePlan()->first(); // 取出用户正在使用的套餐 @@ -107,7 +107,7 @@ class DailyJob extends Command continue; } - $user->order()->activePackage()->update(['is_expire' => 1]); // 过期生效中的加油包 + $user->orders()->activePackage()->update(['is_expire' => 1]); // 过期生效中的加油包 $oldData = $user->transfer_enable; // 重置流量与重置日期 diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 3886a580..32b10064 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -168,9 +168,9 @@ class OrderService } // 按照返利模式进行返利判断 if ($referralType === '2' || $referral) { - return $user->commissionLogs() + return $inviter->commissionLogs() ->create([ - 'inviterId' => $inviter->id, + 'invitee_id' => $user->id, 'order_id' => self::$order->id, 'amount' => self::$order->amount, 'commission' => self::$order->amount * sysConfig('referral_percent'),