Merge pull request '处理bug' (#496) from hotfix/mig_promote into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/496
master
廖金灵 3 years ago
commit 43ec0f1656

@ -758,9 +758,10 @@ class ConsoleController extends Think {
public function shiftPromote() public function shiftPromote()
{ {
$fromAccount = 'nola2021'; return;
$toAccount = 'shanye001'; $fromAccount = 'hskj6868'; //1874
$shiftIds = [7805]; $toAccount = 'huyou1'; //1068
$shiftIds = [3706];
$formPromote = M('promote', 'tab_')->where(['account' => $fromAccount])->find(); $formPromote = M('promote', 'tab_')->where(['account' => $fromAccount])->find();
$toPromote = M('promote', 'tab_')->where(['account' => $toAccount])->find(); $toPromote = M('promote', 'tab_')->where(['account' => $toAccount])->find();
@ -777,7 +778,8 @@ class ConsoleController extends Think {
'to_promote_id' => $toPromote['id'], 'to_promote_id' => $toPromote['id'],
'shift_ids' => json_encode($shiftIds), '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'], 'company_id' => $toPromote['company_id'],
'admin_id' => $toPromote['admin_id'], 'admin_id' => $toPromote['admin_id'],
]); ]);

@ -236,11 +236,13 @@ class PromoteService {
return ['status' => false, 'msg' => '系统异常, 处理推广员平台币失败']; return ['status' => false, 'msg' => '系统异常, 处理推广员平台币失败'];
} */ } */
$levelColumn = 'level' . $toPromote['level'] . '_id';
$subLevelColumn = 'level' . ($toPromote['level'] + 1) . '_id';
$firstMap = ['parent_id' => $fromPromote['id']]; $firstMap = ['parent_id' => $fromPromote['id']];
$secondMap = ['chain' => ['like', $fromPromote['chain'] . $fromPromote['id'] . '/%']]; $secondMap = ['chain' => ['like', $fromPromote['chain'] . $fromPromote['id'] . '/%']];
if (count($shiftIds) > 0) { if (count($shiftIds) > 0) {
$firstMap['id'] = ['in', $shiftIds]; $firstMap['id'] = ['in', $shiftIds];
$secondMap['parent_id'] = ['in', $shiftIds]; $secondMap[$subLevelColumn] = ['in', $shiftIds];
} }
try { try {
@ -248,12 +250,12 @@ class PromoteService {
'parent_id' => $toPromote['id'], 'parent_id' => $toPromote['id'],
'parent_name' => $toPromote['account'], 'parent_name' => $toPromote['account'],
'chain' => $toPromote['chain'] . $toPromote['id'] . '/', 'chain' => $toPromote['chain'] . $toPromote['id'] . '/',
'level' . $toPromote['level'] . '_id' => $toPromote['id'] $levelColumn => $toPromote['id']
]); ]);
M('promote', 'tab_')->where($secondMap)->save([ M('promote', 'tab_')->where($secondMap)->save([
'chain' => ['exp', 'REPLACE(chain, "/' . $fromPromote['id'] . '/","/' . $toPromote['id'] . '/")'], 'chain' => ['exp', 'REPLACE(chain, "/' . $fromPromote['id'] . '/","/' . $toPromote['id'] . '/")'],
'level' . $toPromote['level'] . '_id' => $toPromote['id'] $levelColumn => $toPromote['id']
]); ]);
$model->commit(); $model->commit();

Loading…
Cancel
Save