处理bug

master
ELF 3 years ago
parent 71a07289e9
commit 8d78b2f27f

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

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

Loading…
Cancel
Save