|
|
|
@ -166,11 +166,21 @@ class PromoteService {
|
|
|
|
|
|
|
|
|
|
$coinRecordService = new PromoteCoinRecordService();
|
|
|
|
|
$promoteCoinService = new PromoteCoinService();
|
|
|
|
|
$shiftIds = json_decode($task['shift_ids'], true) ?? [];
|
|
|
|
|
|
|
|
|
|
$balanceCoinMode = $task['balance_coin_mode'];
|
|
|
|
|
|
|
|
|
|
$toPromote = M('promote', 'tab_')->where(['id' => $task['to_promote_id']])->find();
|
|
|
|
|
$fromPromote = M('promote', 'tab_')->where(['id' => $task['from_promote_id']])->find();
|
|
|
|
|
|
|
|
|
|
$childrenMap = ['parent_id' => $fromPromote['id']];
|
|
|
|
|
if (count($shiftIds) > 0) {
|
|
|
|
|
$childrenMap['id'] = ['in', $shiftIds];
|
|
|
|
|
}
|
|
|
|
|
$count = M('promote', 'tab_')->where($childrenMap)->count();
|
|
|
|
|
if ($count == 0) {
|
|
|
|
|
return ['status' => true, 'msg' => '推广帐号迁移成功,无子账号需要迁移'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$topPromote = $this->getTopPromote($fromPromote);
|
|
|
|
|
$status = $this->shiftRemoveCoin($fromPromote, $task);
|
|
|
|
|
|
|
|
|
@ -181,7 +191,6 @@ class PromoteService {
|
|
|
|
|
|
|
|
|
|
$firstMap = ['parent_id' => $fromPromote['id']];
|
|
|
|
|
$secondMap = ['chain' => ['like', $fromPromote['chain'] . $fromPromote['id'] . '/%']];
|
|
|
|
|
$shiftIds = json_decode($task['shift_ids'], true) ?? [];
|
|
|
|
|
if (count($shiftIds) > 0) {
|
|
|
|
|
$firstMap['id'] = ['in', $shiftIds];
|
|
|
|
|
$secondMap['parent_id'] = ['in', $shiftIds];
|
|
|
|
|