推广平台->数据管理-充值统计|财务管理-结算明细--合计

master
chenxiaojun 5 years ago
commit 0ea1cf04ec

@ -955,4 +955,82 @@ public function auto_rrdae(){
}
}
}
//用户推广员数据刷新
public function updateUserPromoteAccount()
{
$map['promote_id'] = ['gt', 0];
$map['_string'] = "promote_account = '' or promote_account = '自然注册' or promote_account = '官方渠道' or promote_account is NULL";
$userData = M('user', 'tab_')->field('id,promote_id')->where($map)->select();
$userPlayData = M('user_play', 'tab_')->field('id,promote_id')->where($map)->select();
$userPlayInfoData = M('user_play_info', 'tab_')->field('id,promote_id')->where($map)->select();
$promoteData = [];
$userModel = 'tab_user';
$userRet = $this->updateUserPromoteAccountSql($userModel, $userData, $promoteData);
$userSuccess = $userRet['success'];
$userError = $userRet['error'];
$userErrorData = empty($userRet['error_data']) ? '' : implode(',', $userRet['error_data']);
$promoteData = $userRet['promote_data'];
$userAll = count($userData);
unset($userData);
$userPlayModel = 'tab_user_play';
$userPlayRet = $this->updateUserPromoteAccountSql($userPlayModel, $userPlayData, $promoteData);
$userPlaySuccess = $userPlayRet['success'];
$userPlayError = $userPlayRet['error'];
$userPlayErrorData = empty($userPlayRet['error_data']) ? '' : implode(',', $userPlayRet['error_data']);
$promoteData = $userPlayRet['promote_data'];
$userPlayAll = count($userPlayData);
unset($userPlayData);
$userPlayInfoModel = 'tab_user_play_info';
$userPlayInfoRet = $this->updateUserPromoteAccountSql($userPlayInfoModel, $userPlayInfoData, $promoteData);
$userPlayInfoSuccess = $userPlayInfoRet['success'];
$userPlayInfoError = $userPlayInfoRet['error'];
$userPlayInfoErrorData = empty($userPlayInfoRet['error_data']) ? '' : implode(',', $userPlayInfoRet['error_data']);
$promoteData = $userPlayInfoRet['promote_data'];
$userPlayInfoAll = count($userPlayInfoData);
unset($userPlayInfoData);
echo $userModel . "all--{$userAll} success--{$userSuccess} error--{$userError} error_ids--{$userErrorData}";
echo '<br>';
echo $userPlayModel . "all--{$userPlayAll} success--{$userPlaySuccess} error--{$userPlayError} error_ids--{$userPlayErrorData}";
echo '<br>';
echo $userPlayInfoModel . "all--{$userPlayInfoAll} success--{$userPlayInfoSuccess} error--{$userPlayInfoError} error_ids--{$userPlayInfoErrorData}";
echo '<br>';
}
private function updateUserPromoteAccountSql($model, $data = [], $promoteData = [])
{
$success = 0;
$error = 0;
$errorData = [];
foreach ($data as &$list) {
if (isset($promoteData[$list['promote_id']])) {
$promoteAccount = $promoteData[$list['promote_id']];
} else {
$promoteAccount = M('promote', 'tab_')->where(array('id' => $list['promote_id']))->getField('account');
$promoteAccount = empty($promoteAccount) ? '未知推广员' : $promoteAccount;
$promoteData[$list['promote_id']] = $promoteAccount;
}
$res = M()->query("update `$model` set promote_account = '{$promoteAccount}' where id = {$list['id']}");
if ($res === false) {
$error++;
$errorData = $list['id'];
} else {
$success++;
}
unset($list);
}
$ret = [
'success' => $success,
'error' => $error,
'error_data' => $errorData,
'promote_data' => $promoteData,
];
return $ret;
}
}

@ -1828,7 +1828,7 @@ class QueryController extends BaseController
$field = $fieldUC . ',' . $fieldUI;
$subQuery = M('user_play_data_count', 'tab_')->alias('uc')
->field($field)
->join('tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->where($map)
->group('uc.role_id,uc.server_id,uc.game_id')
->buildSql();
@ -1837,7 +1837,7 @@ class QueryController extends BaseController
->order($orderBy);
$total = M('user_play_data_count', 'tab_')->alias('uc')
->field($fieldUC)
->join('tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->where($map)
->find();

@ -182,13 +182,8 @@
<td>--</td>
<td>--</td>
<td>{$total.pay_amount}</td>
<if condition="$total.pay_way eq -1">
<td>0.00</td>
<td>{$total.pay_amount}</td>
<else/>
<td>{$total.pay_amount}</td>
<td>0.00</td>
</if>
<td>{$total.direct_pay_amount}</td>
<td>{$total.inner_pay_amount}</td>
<td>--</td>
<td>{$total.income}</td>
<td>--</td>

Loading…
Cancel
Save