|
|
|
@ -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']];
|
|
|
|
|