Merge remote-tracking branch 'origin/dev' into dev

master
liuweiwen 5 years ago
commit 0abb2cce0c

@ -926,7 +926,6 @@ public function auto_rrdae(){
{
if (isset($map['pay_time'])) {
$map['pay_status'] = 1;
$map['pay_game_status'] = 1;
$map['game_player_id'] = ['gt', 0];
$map['server_id'] = ['gt', 0];
$field = 'FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,promote_id,user_id,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count';
@ -964,11 +963,70 @@ public function auto_rrdae(){
$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);
$userPlayModel = 'tab_user_play';
$userPlayRet = $this->updateUserPromoteAccountSql($userPlayModel, $userData, $promoteData);
$userPlaySuccess = $userPlayRet['success'];
$userPlayError = $userPlayRet['error'];
$userPlayErrorData = empty($userPlayRet['error_data']) ? '' : implode(',', $userPlayRet['error_data']);
$promoteData = $userPlayRet['promote_data'];
$userPlayAll = count($userPlayData);
$userPlayInfoModel = 'tab_user_play_info';
$userPlayInfoRet = $this->updateUserPromoteAccountSql($userPlayInfoModel, $userData, $promoteData);
$userPlayInfoSuccess = $userPlayInfoRet['success'];
$userPlayInfoError = $userPlayInfoRet['error'];
$userPlayInfoErrorData = empty($userPlayInfoRet['error_data']) ? '' : implode(',', $userPlayInfoRet['error_data']);
$promoteData = $userPlayInfoRet['promote_data'];
$userPlayInfoAll = count($userPlayInfoData);
echo $userModel . "all--{$userAll} success--{$userSuccess} error--{$userError} error_data--{$userErrorData}";
echo '<br>';
echo $userPlayModel . "all--{$userPlayAll} success--{$userPlaySuccess} error--{$userPlayError} error_data--{$userPlayErrorData}";
echo '<br>';
echo $userPlayInfoModel . "all--{$userPlayInfoAll} success--{$userPlayInfoSuccess} error--{$userPlayInfoError} error_data--{$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;
}
foreach ($userData as $list) {
$promoteAccount = M('promote', 'tab_')->where(array('id' => $list['promote_id']))->getField('account');
$res = M()->query("update `tab_user` set promote_account = '{$promoteAccount}' where id = {$list['id']}");
$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;
}
}

@ -1182,13 +1182,20 @@ class DownloadController extends BaseController {
}
if (!empty(I('begtime')) && empty(I('endtime'))) {
$map['tab_spend.pay_time'] = ['egt', strtotime(I('begtime'))];
} elseif (empty(I('begtime')) && !empty(I('endtime'))) {
$map['tab_spend.pay_time'] = ['elt', strtotime(I('endtime')) + 86399];
} elseif (!empty(I('begtime')) && !empty(I('endtime'))) {
$map['tab_spend.pay_time'] = ['between', [strtotime(I('begtime')), strtotime(I('endtime')) + 86399]];
}else {
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initEndTime = date('Y-m-d');
$initBegTime = strtotime($initBegTime);
$initEndTime = strtotime($initEndTime);
$map['tab_spend.pay_time'] = ['between',[$initBegTime,$initEndTime]];
}
empty(I('relation_game_id')) || $map['tab_game.relation_game_id'] = I('relation_game_id');

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

@ -613,3 +613,6 @@ order_time:切分时间' WHERE `id` = 29;
--
ALTER TABLE `tab_device_bans`
MODIFY COLUMN `type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '类型 0未知 1设备号 2IP 3落地页链接 4下载链接' AFTER `tag`;
-- user表注册类型添加7虚拟
ALTER TABLE `tab_user` MODIFY COLUMN `register_type` tinyint(2) DEFAULT '1' COMMENT '注册方式 0游客1账号 2 手机 3微信 4QQ 5百度 6微博 7虚拟'
Loading…
Cancel
Save