From 85e466c3fd046c5f895037cbba381ba8d71f080d Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Sat, 9 Nov 2019 15:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Service/PromoteService.class.php | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index ecfe350bf..ae08feb7e 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -319,17 +319,19 @@ class PromoteService { $toPromote = M('promote', 'tab_')->where(['id' => $toPromoteId])->find(); $fromPromote = M('promote', 'tab_')->where(['id' => $fromPromoteId])->find(); - if (!$fromPromote && count($shiftIds) == 0) { + $toPromote = $toPromote ?? ['id' => 0, 'account' => '官方渠道']; + $fromPromote = $fromPromote ?? ['id' => 0, 'account' => '官方渠道']; + + + if ($fromPromote['id'] == 0 && count($shiftIds) == 0) { return ['status' => false, 'msg' => '官方渠道玩家不能全部迁移']; } $map = []; + $map['promote_id'] = $fromPromote['id']; if (count($shiftIds) > 0) { $map['id'] = ['in', $shiftIds]; } - if ($fromPromote) { - $map['promote_id'] = $fromPromote['id']; - } $users = M('user', 'tab_')->field(['id', 'account', 'nickname'])->where($map)->select(); @@ -339,14 +341,14 @@ class PromoteService { 'user_id' => $item['id'], 'user_account' => $item['account'], 'user_nickname' => $item['nickname'], - 'promote_id' => $fromPromote ? $fromPromote['id'] : 0, - 'promote_account' => $fromPromote ? $fromPromote['account'] : '官方渠道', - 'promote_id_to' => $toPromote ? $toPromote['id'] : 0, - 'promote_account_to' => $toPromote ? $toPromote['account'] : '官方渠道', + 'promote_id' => $fromPromote['id'], + 'promote_account' => $fromPromote['account'], + 'promote_id_to' => $toPromote['id'], + 'promote_account_to' => $toPromote['account'], 'remark' => '玩家迁移', 'create_time' => time(), - 'op_id' => $createPromote['id'], - 'op_account' => $createPromote['account'], + 'op_id' => $createPromote ? $createPromote['id'] : 0, + 'op_account' => $createPromote ? $createPromote['account'] : '', 'op_type' => 1, 'bind_type' => 1, ]; @@ -362,8 +364,8 @@ class PromoteService { } $updateData = [ - 'promote_id' => $toPromote ? $toPromote['id'] : 0, - 'promote_account' => $toPromote ? $toPromote['account'] : '官方渠道' + 'promote_id' => $toPromote['id'], + 'promote_account' => $toPromote['account'] ]; $map = $otherMap = ['promote_id' => $fromPromote['id']];