From 8d78b2f27f364d7d4df50b5a48e14e6f8421feaa Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Fri, 3 Sep 2021 15:15:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A4=84=E7=90=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/ConsoleController.class.php | 9 +++++---- Application/Base/Service/PromoteService.class.php | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Application/Admin/Controller/ConsoleController.class.php b/Application/Admin/Controller/ConsoleController.class.php index 7f9a96213..413a48300 100644 --- a/Application/Admin/Controller/ConsoleController.class.php +++ b/Application/Admin/Controller/ConsoleController.class.php @@ -758,9 +758,9 @@ class ConsoleController extends Think { public function shiftPromote() { - $fromAccount = 'nola2021'; - $toAccount = 'shanye001'; - $shiftIds = [7805]; + $fromAccount = 'hskj6868'; //1874 + $toAccount = 'huyou1'; //1068 + $shiftIds = [3706]; $formPromote = M('promote', 'tab_')->where(['account' => $fromAccount])->find(); $toPromote = M('promote', 'tab_')->where(['account' => $toAccount])->find(); @@ -777,7 +777,8 @@ class ConsoleController extends Think { 'to_promote_id' => $toPromote['id'], 'shift_ids' => json_encode($shiftIds), ]); - M('promote', 'tab_')->where(['level1_id' => $formPromote['id'], 'level2_id' => 7805, 'company_id' => $formPromote['company_id']])->save([ + + M('promote', 'tab_')->where(['level1_id' => $toPromote['id'], 'level2_id' => 3706, 'company_id' => $formPromote['company_id']])->save([ 'company_id' => $toPromote['company_id'], 'admin_id' => $toPromote['admin_id'], ]); diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index 19545424c..8ea8ddb67 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -236,11 +236,13 @@ class PromoteService { return ['status' => false, 'msg' => '系统异常, 处理推广员平台币失败']; } */ + $levelColumn = 'level' . $toPromote['level'] . '_id'; + $subLevelColumn = 'level' . ($toPromote['level'] + 1) . '_id'; $firstMap = ['parent_id' => $fromPromote['id']]; $secondMap = ['chain' => ['like', $fromPromote['chain'] . $fromPromote['id'] . '/%']]; if (count($shiftIds) > 0) { $firstMap['id'] = ['in', $shiftIds]; - $secondMap['parent_id'] = ['in', $shiftIds]; + $secondMap[$subLevelColumn] = ['in', $shiftIds]; } try { @@ -248,12 +250,12 @@ class PromoteService { 'parent_id' => $toPromote['id'], 'parent_name' => $toPromote['account'], 'chain' => $toPromote['chain'] . $toPromote['id'] . '/', - 'level' . $toPromote['level'] . '_id' => $toPromote['id'] + $levelColumn => $toPromote['id'] ]); M('promote', 'tab_')->where($secondMap)->save([ 'chain' => ['exp', 'REPLACE(chain, "/' . $fromPromote['id'] . '/","/' . $toPromote['id'] . '/")'], - 'level' . $toPromote['level'] . '_id' => $toPromote['id'] + $levelColumn => $toPromote['id'] ]); $model->commit(); From 9f5c83142967466abbea23067e4c02072d65e02d Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Fri, 3 Sep 2021 15:16:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A4=84=E7=90=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/ConsoleController.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Application/Admin/Controller/ConsoleController.class.php b/Application/Admin/Controller/ConsoleController.class.php index 413a48300..0fb7f9b3d 100644 --- a/Application/Admin/Controller/ConsoleController.class.php +++ b/Application/Admin/Controller/ConsoleController.class.php @@ -758,6 +758,7 @@ class ConsoleController extends Think { public function shiftPromote() { + return; $fromAccount = 'hskj6868'; //1874 $toAccount = 'huyou1'; //1068 $shiftIds = [3706]; @@ -777,7 +778,7 @@ class ConsoleController extends Think { 'to_promote_id' => $toPromote['id'], 'shift_ids' => json_encode($shiftIds), ]); - + M('promote', 'tab_')->where(['level1_id' => $toPromote['id'], 'level2_id' => 3706, 'company_id' => $formPromote['company_id']])->save([ 'company_id' => $toPromote['company_id'], 'admin_id' => $toPromote['admin_id'],