推广平台->数据管理->订单查询--更新

master
chenxiaojun 5 years ago
parent 13be456146
commit 1a4bdc424a

@ -94,7 +94,7 @@ class QueryController extends BaseController
$income = '0.00'; $income = '0.00';
if (intval($endTime - $begTime) / (24 * 3600) <= 31) { if (intval($endTime - $begTime) / (24 * 3600) <= 31) {
$data = M('Spend', 'tab_') $data = M('Spend', 'tab_')
->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.chain as chain') ->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.chain as chain,tab_promote.level,tab_promote.parent_id')
->join('tab_game on tab_spend.game_id = tab_game.id') ->join('tab_game on tab_spend.game_id = tab_game.id')
->join('left join tab_promote on tab_spend.promote_id = tab_promote.id') ->join('left join tab_promote on tab_spend.promote_id = tab_promote.id')
->where($map) ->where($map)
@ -116,32 +116,49 @@ class QueryController extends BaseController
->find()['income']; ->find()['income'];
} }
if (!empty($data)) { if (!empty($data)) {
$promoteIdData = [];
foreach ($data as $list) {
switch ($list['level']) {
case 3:
$promoteIdData[] = $list['parent_id'];
break;
case 4:
$promoteIdData[] = $list['parent_id'];
$chain = trim($list['chain'], '/');
$chainArr = explode('/', $chain);
$promoteIdData[] = $chainArr[1];
break;
}
}
$promoteData = [];
if (!empty($promoteIdData)) {
$promoteIdData = array_unique($promoteIdData);
$promoteData = M('promote', 'tab_')->where(array('id' => ['in',$promoteIdData]))->getField('id,account,real_name');
}
foreach ($data as &$list) { foreach ($data as &$list) {
$list['p_p_pro_account'] = $list['pro_account']; switch ($list['level']) {
$list['p_p_pro_real_name'] = $list['pro_real_name']; case 1:
$list['p_pro_account'] = $list['pro_account']; case 2:
$list['p_pro_real_name'] = $list['pro_real_name']; $list['p_p_pro_account'] = $list['pro_account'];
if (!empty($list['chain'])) { $list['p_p_pro_real_name'] = $list['pro_real_name'];
$chain = trim($list['chain'], '/'); $list['p_pro_account'] = $list['pro_account'];
$chainArr = explode('/', $chain); $list['p_pro_real_name'] = $list['pro_real_name'];
if (!empty($chainArr[1])) { break;
$thisPromoteData1 = D('Promote') case 3:
->field('account,real_name') $list['p_p_pro_account'] = $promoteData[$list['parent_id']]['account'];
->where(array('id' => $chainArr[1])) $list['p_p_pro_real_name'] = $promoteData[$list['parent_id']]['real_name'];
->find(); $list['p_pro_account'] = $list['pro_account'];
$list['p_p_pro_account'] = $thisPromoteData1['account']; //部门长 $list['p_pro_real_name'] = $list['pro_real_name'];
$list['p_p_pro_real_name'] = $thisPromoteData1['real_name']; break;
} case 4:
if (!empty($chainArr[2])) { $promoteIdData[] = $list['parent_id'];
$thisPromoteData2 = D('Promote') $chain = trim($list['chain'], '/');
->field('account,real_name') $chainArr = explode('/', $chain);
->where(array('id' => $chainArr[2])) $list['p_p_pro_account'] = $promoteData[$chainArr[1]]['account'];
->find(); $list['p_p_pro_real_name'] = $promoteData[$chainArr[1]]['real_name'];
$list['p_pro_account'] = $thisPromoteData2['account']; //组长 $list['p_pro_account'] = $promoteData[$list['parent_id']]['account'];
$list['p_pro_real_name'] = $thisPromoteData2['real_name']; $list['p_pro_real_name'] = $promoteData[$list['parent_id']]['real_name'];
} break;
} }
$list['user_account'] = substr($list['user_account'], 0, 2) . '******' . substr($list['user_account'], 8); $list['user_account'] = substr($list['user_account'], 0, 2) . '******' . substr($list['user_account'], 8);

Loading…
Cancel
Save