|
|
|
@ -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();
|
|
|
|
|