|
|
|
@ -7,6 +7,7 @@ use Base\Model\UserPlayModel;
|
|
|
|
|
use Base\Model\UserModel;
|
|
|
|
|
use Base\Tool\IdCard;
|
|
|
|
|
use Base\Tool\Registry;
|
|
|
|
|
use Base\Tool\Redis;
|
|
|
|
|
use Think\Model;
|
|
|
|
|
use Base\Repository\SpendRepository;
|
|
|
|
|
|
|
|
|
@ -205,11 +206,13 @@ class PromoteService {
|
|
|
|
|
M('promote', 'tab_')->where($firstMap)->save([
|
|
|
|
|
'parent_id' => $toPromote['id'],
|
|
|
|
|
'parent_name' => $toPromote['account'],
|
|
|
|
|
'chain' => $toPromote['chain'] . $toPromote['id'] . '/'
|
|
|
|
|
'chain' => $toPromote['chain'] . $toPromote['id'] . '/',
|
|
|
|
|
'level' . $toPromote['level'] => $toPromote['id']
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
M('promote', 'tab_')->where($secondMap)->save([
|
|
|
|
|
'chain' => ['exp', 'REPLACE(chain, "/' . $fromPromote['id'] . '/","/' . $toPromote['id'] . '/")'],
|
|
|
|
|
'level' . $toPromote['level'] => $toPromote['id']
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$status = M('ShiftTask')->where('id=' . $task['id'])->save(['status' => 1, 'handle_time' => time()]);
|
|
|
|
@ -394,6 +397,11 @@ class PromoteService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$toTopPromote = $this->getTopPromote($toPromote);
|
|
|
|
|
$hasGameIds = $toTopPromote['game_ids'] == '' ? [] : explode(',', $toTopPromote['game_ids']);
|
|
|
|
|
$hasNotGameIds = M('game', 'tab_')->where(['game_id' => ['not in', $hasGameIds]])->getField('id', true);
|
|
|
|
|
$hasNotGameIds = $hasNotGameIds ?? [];
|
|
|
|
|
|
|
|
|
|
$model = new Model();
|
|
|
|
|
$model->startTrans();
|
|
|
|
|
|
|
|
|
@ -431,7 +439,17 @@ class PromoteService {
|
|
|
|
|
M('user_play_info', 'tab_')->where($otherMap)->save($updateData);
|
|
|
|
|
|
|
|
|
|
unset($spendMap['pay_status']);
|
|
|
|
|
M('spend', 'tab_')->where($spendMap)->save(array_merge($updateData, $updateMarket)); // 只改未对账的数据
|
|
|
|
|
|
|
|
|
|
$updateCheck = [];
|
|
|
|
|
if (count($hasGameIds) > 0) {
|
|
|
|
|
$spendMap['game_id'] = ['in', $hasGameIds];
|
|
|
|
|
M('spend', 'tab_')->where($spendMap)->save(array_merge($updateData, $updateMarket, ['is_check' => 1]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count($hasNotGameIds) > 0) {
|
|
|
|
|
$spendMap['game_id'] = ['in', $hasNotGameIds];
|
|
|
|
|
M('spend', 'tab_')->where($spendMap)->save(array_merge($updateData, $updateMarket, ['is_check' => 0]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$bindMap = $otherMap;
|
|
|
|
|
$bindMap['pay_time'] = ['egt', $orderTime];
|
|
|
|
@ -1069,6 +1087,16 @@ class PromoteService {
|
|
|
|
|
resetUserAuth();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$fullChain = $data['chain'] . $insert;
|
|
|
|
|
$fullChainList = explode('/', trim($fullChain, '/'));
|
|
|
|
|
|
|
|
|
|
M('promote', 'tab_')->where(['id' => $insert])->update([
|
|
|
|
|
'level1_id' => $fullChainList[0] ?? 0,
|
|
|
|
|
'level2_id' => $fullChainList[1] ?? 0,
|
|
|
|
|
'level3_id' => $fullChainList[2] ?? 0,
|
|
|
|
|
'level4_id' => $fullChainList[3] ?? 0,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
return $insert;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1241,17 +1269,9 @@ class PromoteService {
|
|
|
|
|
public function getHistoryGameIds($promote)
|
|
|
|
|
{
|
|
|
|
|
$topPromote = $this->getTopPromote($promote);
|
|
|
|
|
|
|
|
|
|
$spendRepository = new SpendRepository();
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
$map['_string'] = ' promote_id in(' . $this->subInSql($topPromote) . ')';
|
|
|
|
|
$map = $spendRepository->withIsCheck($map);
|
|
|
|
|
$historyGames = M('spend', 'tab_')->field(['distinct game_id'])->where($map)->select();
|
|
|
|
|
$historyGameIds = [];
|
|
|
|
|
if ($historyGames) {
|
|
|
|
|
$historyGameIds = array_column($historyGames, 'game_id');
|
|
|
|
|
}
|
|
|
|
|
$key = Redis::getKey('promote_history_games', ['promote_id' => $item['level1_id']]);
|
|
|
|
|
$value = Redis::get($key);
|
|
|
|
|
$historyGameIds = $value ? explode(',', $value) : [];
|
|
|
|
|
$nowGameIds = $topPromote['game_ids'] == '' ? [] : explode(',', $topPromote['game_ids']);
|
|
|
|
|
return array_unique(array_merge($historyGameIds, $nowGameIds));
|
|
|
|
|
}
|
|
|
|
|