Merge branch 'dev' of 47.111.118.107:wmtx/platform into dev

master
sunke 5 years ago
commit 2f83a85690

@ -11,25 +11,25 @@ class BehaviorLogController extends ThinkController
$map = [];
if (isset($params['user_account'])) {
$map['tab_pay_info.user_account'] = $params['user_account'];
$map['user_account'] = $params['user_account'];
}
if (isset($params['extend'])) {
$map['tab_pay_info.extend'] = $params['extend'];
$map['_string'] = 'extend = "'.$params["extend"]. '" or order_id = "'.$params["extend"] . '"';
}
if (isset($params['game_name'])) {
$game_id = ['in', array_column(getGameByName($params['game_name'], $params['sdk_version']), 'id')];
$map['tab_pay_info.game_id'] = $game_id;
$map['game_id'] = $game_id;
}
if (isset($params['server_name'])) {
$game_id = M('game', 'tab_')->where(['relation_game_name' => $params['game_name'],'sdk_version' => $params['sdk_version']])->getField('id');
$server_id = M('server', 'tab_')->where(['server_name' => $params['server_name'], 'game_id' => $game_id])->getField('server_num');
$map['tab_pay_info.server_id'] = $server_id;
$map['server_id'] = $server_id;
}
if (isset($params['game_player_name'])) {
$map['tab_pay_info.game_player_name'] = $params['game_player_name'];
$map['game_player_name'] = $params['game_player_name'];
}
if (isset($params['game_player_id'])) {
$map['tab_pay_info.game_player_id'] = $params['game_player_id'];
$map['game_player_id'] = $params['game_player_id'];
}
@ -40,7 +40,7 @@ class BehaviorLogController extends ThinkController
$endDate = empty($params['timeend']) ? date('Y-m-d') : $params['timeend'];
$startTime = strtotime($startDate);
$endTime = strtotime($endDate) + 86399;
$map['tab_pay_info.create_time'] = array('BETWEEN', [$startTime, $endTime]);
$map['create_time'] = array('BETWEEN', [$startTime, $endTime]);
if (isset($params['promote_id'])) {
$promoteId = $params['promote_id'];
if ($promoteId == 0) {
@ -52,13 +52,22 @@ class BehaviorLogController extends ThinkController
$map['promote_id'] = ['in', $promoteIds];
}
}
$data = M('pay_info', 'tab_')->field('tab_pay_info.id,tab_pay_info.user_account,extend,tab_pay_info.create_time,tab_pay_info.game_name,tab_pay_info.server_name,tab_pay_info.promote_account,tab_pay_info.order_id,tab_pay_info.game_player_id,tab_pay_info.game_player_name,price,tab_server.server_name')->join('LEFT JOIN tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id')->where($map)->order('tab_pay_info.id DESC')->page($p, $row)->select();
// $data = M('pay_info', 'tab_')->field('tab_pay_info.id,tab_pay_info.user_account,extend,tab_pay_info.create_time,tab_pay_info.game_name,tab_pay_info.server_name,tab_pay_info.promote_account,tab_pay_info.order_id,tab_pay_info.game_player_id,tab_pay_info.game_player_name,price,tab_server.server_name')->join('LEFT JOIN tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id AND tab_pay_info.server_id <> 0')->where($map)->order('tab_pay_info.id DESC')->page($p, $row)->select();
$data = M('pay_info', 'tab_')->where($map)->order('id DESC')->page($p, $row)->select();
foreach($data as $k => $v) {
if(empty($v['extend'])) {
$data[$k]['extend'] = $v['order_id'];
}
if ($v['server_id'] > 0 && !empty($v['extend'])){
$data[$k]['server_name'] = M('server', 'tab_')->where(['game_id' => $v['game_id'],'server_num' =>$v['server_id']])->getField('server_name');
} else {
$data[$k]['server_name'] = '';
$data[$k]['game_player_name'] = '';
$data[$k]['game_player_id'] = '';
}
}
$count = M('pay_info', 'tab_')->join('tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id')->where($map)->count();
$count = M('pay_info', 'tab_')->where($map)->count();
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);

@ -66,15 +66,13 @@ class PromoteGameRatioController extends ThinkController
$thisPromoteVerStatus = '未知';
$thisGameName = '未知';
$thisGameRatio = '0.00';
$thisLastRatio = $promoteGameRatio['last_ratio'];
$thisLastRatioStatus = $promoteGameRatio['last_ratio_status'];
$thisStatusText = self::$statusList[$promoteGameRatio['status']];
$thisStatusText = ($promoteGameRatio['status'] == -1) ? '<span style="color: red;">' . $thisStatusText . '</span>' : $thisStatusText;
$thisApplicant = getPromoteAccount($promoteGameRatio['applicant_id']);
$thisReviewer = $promoteGameRatio['reviewer_id'] ? getPromoteAccount($promoteGameRatio['reviewer_id']) : '待确认';
if ($promoteGameRatio['ratio'] > 0 && $promoteGameRatio['begin_time']) {
$thisBeninTime = date('Y/m/d', $promoteGameRatio['begin_time']);
} else {
$thisBeninTime = date('Y/m/d', $this->getPromoteApplyCreateTime($thisPromoteId, $thisGameId));
}
$thisBeninTime = date('Y/m/d', $promoteGameRatio['begin_time']);
$thisEndTime = $promoteGameRatio['end_time'] ? date('Y/m/d', $promoteGameRatio['end_time']) : '永久';
$validDate = $thisBeninTime . ' - ' . $thisEndTime;
if ($issetPromote) {
@ -100,7 +98,7 @@ class PromoteGameRatioController extends ThinkController
'promote_status_text' => $thisPromoteStatus,
'promote_ver_status_text' => $thisPromoteVerStatus,
'game_name' => $thisGameName,
'game_ratio' => $thisGameRatio . '%',
'last_ratio' => (($thisLastRatioStatus == 1) ? $thisLastRatio : $thisGameRatio) . '%',
'ratio' => $promoteGameRatio['ratio'] . '%',
'valid_date' => $validDate,
'remark' => $promoteGameRatio['remark'],
@ -129,8 +127,11 @@ class PromoteGameRatioController extends ThinkController
if ($_POST) {
$params = I('post.');
$time = time();
if (empty($params['begin_time'])) {
$this->error('请选择开始时间');
}
$save['ratio'] = $params['ratio'] ?? 0;
$save['begin_time'] = $params['begin_time'] ? strtotime($params['begin_time']) : 0;
$save['begin_time'] = strtotime($params['begin_time']);
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time']) : 0;
$save['remark'] = $params['remark'] ?? '';
$save['status'] = 0;
@ -140,6 +141,10 @@ class PromoteGameRatioController extends ThinkController
if (empty($promoteGameRatio)) {
$this->error('参数异常');
}
if ($promoteGameRatio['status'] == 1) {
$save['last_ratio'] = $promoteGameRatio['ratio'];
$save['last_ratio_status'] = 1;
}
$save['id'] = intval($params['id']);
$result = D(self::MODEL_NAME)->save($save);
} else {//新增
@ -176,19 +181,22 @@ class PromoteGameRatioController extends ThinkController
$metaTitle = '游戏分成比例申请';
if ($id) {
$metaTitle .= '--修改';
$field = 'id, promote_id, game_id, ratio, begin_time, end_time, remark';
$map['id'] = $id;
$promoteGameRatio = D(self::MODEL_NAME)->field($field)->where($map)->find();
$promoteGameRatio = D(self::MODEL_NAME)->where($map)->find();
if (empty($promoteGameRatio)) {
$this->error('数据异常');
}
$promoteGameRatio['begin_time'] = $promoteGameRatio['begin_time'] ? date('Y-m-d', $promoteGameRatio['begin_time']) : '';
$promoteGameRatio['end_time'] = $promoteGameRatio['end_time'] ? date('Y-m-d', $promoteGameRatio['end_time']) : '';
$gameRatio = M('game', 'tab_')->where(array(['id' => $promoteGameRatio['game_id']]))->getField('ratio');
$gameRatio = ($gameRatio ?? '0.00') . '%';
if ($promoteGameRatio['last_ratio_status'] == 1) {
$lastRatio = $promoteGameRatio['last_ratio'];
} else {
$gameRatio = M('game', 'tab_')->where(array(['id' => $promoteGameRatio['game_id']]))->getField('ratio');
$lastRatio = ($gameRatio ?? '0.00') . '%';
}
$this->assign('record', $promoteGameRatio);
$this->assign('gameRatio', $gameRatio);
$this->assign('lastRatio', $lastRatio);
}
$this->assign('gameList', getAllGameList());
@ -245,20 +253,51 @@ class PromoteGameRatioController extends ThinkController
return $reviewRule;
}
public function getGameRatio()
public function getPromoteGameRatio()
{
$promoteId = I('post.promote_id', 0);
$promoteId = intval($promoteId);
$gameId = I('post.game_id', 0);
$gameId = intval($gameId);
$gameRatio = '';
$record['last_ratio'] = '';
$status = 0;
if ($promoteId || $gameId) {
if ($promoteId && $gameId) {
$map['promote_id'] = $promoteId;
$map['game_id'] = $gameId;
$record = D(self::MODEL_NAME)->where($map)->find();
if ($record) {
$status = 2;
$record['begin_time'] = date('Y-m-d', $record['begin_time']);
$record['end_time'] = empty($record['end_time']) ? '' : date('Y-m-d', $record['end_time']);
if ($record['last_ratio_status'] == 0) {
$record['last_ratio'] = $this->getGameRatio($gameId);
}
} else {
$status = 1;
$record['last_ratio'] = $this->getGameRatio($gameId);
}
} elseif ($gameId) {
$status = 1;
$record['last_ratio'] = $this->getGameRatio($gameId);
}
}
$data = [
'status' => $status,
'record' => $record,
];
$this->ajaxReturn($data);
}
public function getGameRatio($gameId)
{
$gameId = intval($gameId);
$gameRatio = '0.00';
if ($gameId) {
$map['id'] = $gameId;
$gameRatio = M('game', 'tab_')->where($map)->getField('ratio');
$gameRatio = ($gameRatio ?? '0.00') . '%';
}
$data = [
'status' => 1,
'ratio' => $gameRatio,
];
$this->ajaxReturn($data);
return $gameRatio;
}
}

@ -19,6 +19,9 @@
.tabcon1711 .form_unit {
margin-left: 2px;
}
.tabcon1711 .mustmark {
margin-left:-7px;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
@ -35,7 +38,7 @@
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>会长账号:</td>
<td class="l"><i class="mustmark">*</i>会长账号:</td>
<td class="r">
<select name="promote_id" id="promote_id" class="select_gallery" <notempty name="record">disabled</notempty>>
<option value="">会长账号</option>
@ -53,7 +56,7 @@
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>已申请游戏:</td>
<td class="l"><i class="mustmark">*</i>已申请游戏:</td>
<td class="r">
<select id="game_id" name="game_id" class="select_gallery" <notempty name="record">disabled</notempty>>
<option value="">游戏名称</option>
@ -73,25 +76,25 @@
<tr>
<td class="l">原分成比例:</td>
<td class="r table_radio">
<span class="form_radio table_btn" id="game_ratio" style="color: red;">{$gameRatio|default=''}</span>
<span class="form_radio table_btn" id="last_ratio" style="color: red;">{$lastRatio|default=''}</span>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l">现分成比例:</td>
<td class="r table_radio">
<input type="text" class="txt" name="ratio" value="{$record.ratio|default='0.00'}" placeholder="" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
<input type="text" class="txt" name="ratio" id="ratio" value="{$record.ratio|default='0.00'}" placeholder="" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
<span class="form_unit">%</span>
<span class="notice-text">当前需要修改成的分成比例</span>
</td>
</tr>
<tr>
<td class="l">开始时间:</td>
<td class="l"><i class="mustmark">*</i>开始时间:</td>
<td class="r table_radio">
<div style="float: left;">
<input type="text" class="txt time" name="begin_time" placeholder="开始时间" value="{$record['begin_time']|default=''}">
<input type="text" class="txt time" name="begin_time" id="begin_time" placeholder="开始时间" value="{$record['begin_time']|default=''}">
-
<input type="text" class="txt time" name="end_time" placeholder="结束时间" value="{$record['end_time']|default=''}">
<input type="text" class="txt time" name="end_time" id="end_time" placeholder="结束时间" value="{$record['end_time']|default=''}">
</div>
<span class="notice-text">结束时间不填则默认永久。</span>
</td>
@ -99,14 +102,14 @@
<tr>
<td class="l">备注:</td>
<td class="r table_radio">
<textarea type="text" name="remark" class="txt_area">{$record['remark']|default=''}</textarea>
<textarea type="text" name="remark" id="remark" class="txt_area">{$record['remark']|default=''}</textarea>
<span class="notice-text"></span>
</td>
</tr>
</tbody>
</table>
</div>
<input type="hidden" name="id" value="{$record['id']|default=''}" />
<input type="hidden" name="id" id="id" value="{$record['id']|default=''}" />
<div class="form-item cf">
<button class="submit_btn ajax-post mlspacing" id="submit" type="submit" target-form="form-horizontal">
@ -154,26 +157,48 @@ $(function(){
});
showTab();
$('#game_id').change(function () {
var gameId = parseInt($(this).val());
getGameRatio(gameId);
var promoteGameRatioData = {};
promoteGameRatioData.ratio = '0.00';
promoteGameRatioData.begin_time = '';
promoteGameRatioData.end_time = '';
promoteGameRatioData.remark = '';
$('#ratio, #begin_time, #end_time, #remark').change(function () {
var val = $(this).val();
var elementIdName = $(this).attr('id');
promoteGameRatioData[elementIdName] = val;
});
$('#promote_id, #game_id').change(function () {
var promoteId = parseInt($('#promote_id').val());
var gameId = parseInt($('#game_id').val());
getPromoteGameRatio(promoteId, gameId);
});
function getGameRatio(gameId) {
function getPromoteGameRatio(promoteId, gameId)
{
$.ajax({
type: "post",
url: "{:U('getGameRatio')}",
dataType: "json",
data: {'game_id': gameId},
type: 'post',
url: "{:U('getPromoteGameRatio')}",
dataType: 'json',
data: {'promote_id': promoteId, 'game_id': gameId},
success: function (data) {
if (data.status == 1) {
$('#game_ratio').text(data.ratio);
var record = data.record;
if (data.status == 2) {
$('#ratio').val(record.ratio);
$('#last_ratio').text(record.last_ratio);
$('#begin_time').val(record.begin_time);
$('#end_time').val(record.end_time);
$('#remark').val(record.remark);
$('#id').val(record.id);
} else {
console.log(data);
// $('#ratio').val(promoteGameRatioData.ratio);
$('#last_ratio').text(record.last_ratio);
// $('#begin_time').val(promoteGameRatioData.begin_time);
// $('#end_time').val(promoteGameRatioData.end_time);
// $('#remark').val(promoteGameRatioData.remark);
$('#id').val('');
}
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
}

@ -146,7 +146,7 @@
<td>{$record.promote_status_text}</td>
<td>{$record.promote_ver_status_text}</td>
<td>{$record.game_name}</td>
<td>{$record.game_ratio}</td>
<td>{$record.last_ratio}</td>
<td>{$record.ratio}</td>
<td>{$record.valid_date}</td>
<td>{$record.remark}</td>

@ -1070,12 +1070,54 @@ function is_check_account($account){
return $data['game_name'];
}
//获取游戏cp比例
function get_game_selle_ratio($game_id=null,$field='id'){
$map[$field]=$game_id;
$data=M('game','tab_')->where($map)->find();
if(empty($data)){return '';}
function get_game_selle_ratio($game_id = null, $field = 'id')
{
$map[$field] = $game_id;
$data = M('game', 'tab_')->where($map)->find();
if (empty($data)) {
return '';
}
return $data['ratio'];
}
//获取游戏cp比例
function getGameSelleRatio($gameId = null, $promoteId = null, $field = 'id')
{
$promoteGameRatio = getGameSelleRatioByPromote($promoteId, $gameId);
if ($promoteGameRatio === false) {
$map[$field] = $gameId;
$data = M('game', 'tab_')->where($map)->find();
if (empty($data)) {
return 0;
}
return $data['ratio'];
} else {
return $promoteGameRatio;
}
}
//获取推广员设置的游戏cp比例
function getGameSelleRatioByPromote($promoteId = null, $gameId = null)
{
if (empty($promoteId) || empty($gameId)) {
return false;
}
$map['promote_id'] = intval($promoteId);
$map['game_id'] = intval($gameId);
$promoteGameRatio = M('promote_game_ratio', 'tab_')->where($map)->find();
if (empty($promoteGameRatio) || $promoteGameRatio['status'] != 1) {
return false;
}
if ($promoteGameRatio['begin_time'] > time()) {
return false;
}
if (!empty($promoteGameRatio['end_time']) && $promoteGameRatio['end_time'] < time()) {
return false;
}
return $promoteGameRatio['ratio'];
}
/**
* [获取管理员昵称]

@ -1761,8 +1761,8 @@ class QueryController extends BaseController
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day', 'create_time', 'user_game_login_count'];
$nowTime = date('Y-m-d', time() - 3600 * 24);
$sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day', 'register_time', 'user_game_login_count'];
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
$initEndTime = $nowTime;
@ -1771,6 +1771,7 @@ class QueryController extends BaseController
$endTime = strtotime($initEndTime);
$endTime += 3600 * 24;
$nowTime = strtotime($nowTime);
$nowTimeEnd = $nowTime + 3600 * 24 - 1;
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
@ -1785,60 +1786,49 @@ class QueryController extends BaseController
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$ids[] = $queryPromote['id'];
$map = ['uc.promote_id' => ['in', $ids]];
$subMap = ['promote_id' => ['in', $ids]];
$map = ['s.promote_id' => ['in', $ids]];
$map['s.pay_status'] = 1;
if ($relationGameId != 0 || $sdkVersion != 0) {
$gameIds = gameSearch($relationGameId, $sdkVersion);
$map['uc.game_id'] = ['in', $gameIds];
$subMap['game_id'] = ['in', $gameIds];
$map['s.game_id'] = ['in', $gameIds];
}
if ($serverId != 0) {
$map['uc.server_id'] = $serverId;
$subMap['server_id'] = $serverId;
$map['s.server_id'] = $serverId;
}
if ($roleName != '') {
$map['ui.role_name'] = ['like', $roleName . '%'];
$map['s.game_player_name'] = ['like', $roleName . '%'];
}
if ($userAccount != '') {
$userId = M('user', 'tab_')->where(array('account' => ['like', $userAccount . '%']))->getField('id');
$userId = $userId ?? 0;
$map['uc.user_id'] = $userId;
$map['s.user_account'] = ['like', $userAccount . '%'];
}
if ($isSelf) {
$map['uc.promote_id'] = $queryPromote['id'];
$map['s.promote_id'] = $queryPromote['id'];
}
$subMap['create_time'] = ['between', [$begTime, $endTime - 1]];
$having = '1 = 1';
if ($costBegin != '' || $costEnd != '') {
$having = '';
if ($costBegin != '' && $costEnd != '') {
$having = 'sum(recharge_cost) between ' . $costBegin . ' and ' . $costEnd;
$having = 'recharge_cost between ' . $costBegin . ' and ' . $costEnd;
} elseif ($costBegin != '' && $costEnd == '') {
$having = 'sum(recharge_cost) >= ' . $costBegin;
$having = 'recharge_cost >= ' . $costBegin;
} elseif ($costBegin == '' && $costEnd != '') {
$having = 'sum(recharge_cost) <= ' . $costEnd;
$having = 'recharge_cost <= ' . $costEnd;
}
$subQuery = M('user_play_data_count', 'tab_')->field('role_id')
->where($subMap)
->group('game_id,server_id,role_id')
->having($having)
->buildSql();
$map['_string'] = 'ui.role_id in(' . $subQuery . ')';
}
$orderBy = 'play_time desc';
$orderBy = 'login_time desc';
if (!empty($sortName)) {
if (in_array($sortName, $sortNameData)) {
$desc = ' desc';
$asc = ' asc';
if ($sortName == 'unlogin_day') {
$sortName = 'play_time';
$sortName = 'login_time';
$desc = ' asc';
$asc = ' desc';
}
if ($lastSortName == 'unlogin_day') {
$lastSortName = 'play_time';
$lastSortName = 'login_time';
}
if ($lastSortName != $sortName) {
$sortString = $desc;
@ -1850,22 +1840,31 @@ class QueryController extends BaseController
}
}
$map['uc.create_time'] = ['between', [$begTime, $endTime - 1]];
$fieldUC = "sum(uc.recharge_cost) recharge_cost,sum(uc.recharge_count) recharge_count,sum(if(uc.create_time = {$nowTime},uc.recharge_cost,0)) as recharge_cost_today,uc.user_id";
$fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version,ui.create_time";
$map['s.pay_time'] = ['between', [$begTime, $endTime - 1]];
$fieldS = "sum(s.pay_amount) recharge_cost, count(*) recharge_count, s.user_id, s.user_account, s.promote_account, s.game_name, s.sdk_version, s.server_name, s.game_player_name";
$fieldUser = 'u.register_time, u.login_time';
$loginRecordMap['lr.create_time'] = $map['uc.create_time'];
$loginRecordMap['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id';
$spendMap['_string'] = 'today.user_id = s.user_id and today.game_id = s.game_id and today.server_id = s.server_id and today.game_player_id = s.game_player_id and today.promote_id = s.promote_id';
$spendMap['today.pay_status'] = 1;
$spendMap['today.pay_time'] = ['between', [$nowTime, $nowTimeEnd]];
$fieldToday = M('spend', 'tab_')->alias('today')
->field('sum(pay_amount) as recharge_cost_today')
->where($spendMap)
->buildSql();
$loginRecordMap['lr.create_time'] = $map['s.pay_time'];
$loginRecordMap['_string'] = 'lr.user_id = s.user_id and lr.game_id = s.game_id';
$fieldLR = M('login_daily_record', 'tab_')->alias('lr')
->field("count(*) as count")
->where($loginRecordMap)
->buildSql();
$field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count';
$subQuery = M('user_play_data_count', 'tab_')->alias('uc')
$field = "$fieldS, $fieldUser, $fieldToday as recharge_cost_today, $fieldLR as user_game_login_count";
$subQuery = M('spend', 'tab_')->alias('s')
->field($field)
->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->join('join tab_user as u on u.id = s.user_id')
->where($map)
->group('uc.role_id,uc.server_id,uc.game_id')
->group('s.game_player_id, s.server_id, s.game_id')
->having($having)
->buildSql();
$query = M()->alias('record')
->table($subQuery)
@ -1873,31 +1872,24 @@ class QueryController extends BaseController
list($records, $pagination, $count) = $this->paginate($query);
$totalQuery = M('user_play_data_count', 'tab_')->alias('uc')
->field($fieldUC)
->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and uc.server_id = ui.server_id and ui.role_id = uc.role_id')
->group('uc.role_id,uc.game_id,uc.server_id,uc.user_id')
$total = M('spend', 'tab_')->alias('s')
->field($fieldS)
->where($map)
->buildSql();
$total = M()->alias('totals')
->table($totalQuery)
->field('sum(recharge_cost) recharge_cost,sum(recharge_count) recharge_count,sum(recharge_cost_today) as recharge_cost_today')
->find();
foreach ($records as &$list) {
if (empty($list['user_account']) ) {
$list['user_account'] = M('user', 'tab_')->where("id = {$list['user_id']}")->getField('account');
if (!empty($records)) {
foreach ($records as &$list) {
$list['user_account'] = empty($list['user_account']) ? '--' : encryption($list['user_account']);
$list['game_name'] = empty($list['game_name']) ? '--' : $list['game_name'];
$list['sdk_version'] = empty($list['sdk_version']) ? '--' : getSDKTypeName($list['sdk_version']);
$list['server_name'] = empty($list['server_name']) ? '--' : $list['server_name'];
$list['game_player_name'] = empty($list['game_player_name']) ? '--' : $list['game_player_name'];
$list['unlogin_day'] = empty($list['login_time']) ? '--' : intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $list['login_time']))) / (24 * 3600));
$list['login_time'] = empty($list['login_time']) ? '--' : date('Y-m-d H:i:s', $list['login_time']);
$list['register_time'] = empty($list['register_time']) ? '--' : date('Y-m-d H:i:s', $list['register_time']);
$list['promote_account'] = empty($list['promote_account']) ? '--' : $list['promote_account'];
$list['recharge_cost_today'] = empty($list['recharge_cost_today']) ? '0.00' : $list['promote_account'];
}
$list['user_account'] = empty($list['user_account']) ? '--' : $list['user_account'];
$list['game_name'] = empty($list['game_name']) ? '--' : $list['game_name'];
$list['sdk_version'] = empty($list['sdk_version']) ? '--' : getSDKTypeName($list['sdk_version']);
$list['server_name'] = empty($list['server_name']) ? '--' : $list['server_name'];
$list['role_name'] = empty($list['role_name']) ? '--' : $list['role_name'];
$list['role_level'] = empty($list['role_level']) ? '--' : $list['role_level'];
$list['unlogin_day'] = empty($list['play_time']) ? '--' : intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $list['play_time']))) / (24 * 3600));
$list['play_time'] = empty($list['play_time']) ? '--' : date('Y-m-d H:i:s', $list['play_time']);
$list['create_time'] = empty($list['create_time']) ? '--' : date('Y-m-d H:i:s', $list['create_time']);
$list['promote_account'] = empty($list['promote_account']) ? '--' : $list['promote_account'];
}
}
$games = get_promote_serach_game();

@ -34,7 +34,7 @@
</div>
<img src="__IMG__/20180207/icon_normal_game.png">
<span class="title_main">玩家充值</span>
<span class="details">说明:充值数据不包含当日</span>
<span class="details">说明:玩家角色充值统计</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
@ -104,8 +104,7 @@
<th class="title-cursor-pointer" title="设备类型安卓或者ios">平台</th>
<th class="title-cursor-pointer" title="游戏内区服">游戏区服</th>
<th class="title-cursor-pointer" title="游戏角色">角色名</th>
<th class="title-cursor-pointer" title="游戏区服内等级">等级</th>
<th class="sort" sort-name="recharge_cost" class="title-cursor-pointer" title="该游戏区服 内的充值总额">充值总额
<th class="sort" sort-name="recharge_cost" class="title-cursor-pointer" title="该角色的充值总额">充值总额
<if condition="'recharge_cost' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -116,7 +115,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="recharge_count" class="title-cursor-pointer" title="在游戏区服内的充值次数">充值次数
<th class="sort" sort-name="recharge_count" class="title-cursor-pointer" title="该角色的充值次数">充值次数
<if condition="'recharge_count' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -127,7 +126,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="recharge_cost_today" class="title-cursor-pointer" title="玩家昨日游戏区服的充值总额">日充值
<th class="sort" sort-name="recharge_cost_today" class="title-cursor-pointer" title="该角色的今日充值总额">日充值
<if condition="'recharge_cost_today' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -138,7 +137,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="unlogin_day" class="title-cursor-pointer" title="玩家该角色未登录天数">未登录天数
<th class="sort" sort-name="unlogin_day" class="title-cursor-pointer" title="玩家未登录天数">未登录天数
<if condition="'unlogin_day' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -149,7 +148,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="user_game_login_count" class="title-cursor-pointer" title="游戏累计登陆天数:玩家在该游戏累计登陆的天数(不分区服)">游戏累计登录天数
<th class="sort" sort-name="user_game_login_count" class="title-cursor-pointer" title="玩家在该游戏累计登陆的天数(不分区服)">游戏累计登录天数
<if condition="'user_game_login_count' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -160,7 +159,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="create_time" class="title-cursor-pointer" title="角色创建的时间">注册时间
<th class="sort" sort-name="create_time" class="title-cursor-pointer" title="玩家账号注册的时间">注册时间
<if condition="'create_time' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
@ -171,7 +170,7 @@
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="title-cursor-pointer" title="玩家角色上次登录的时间">最后登录时间</th>
<th class="title-cursor-pointer" title="玩家上次登录的时间">最后登录时间</th>
<th class="title-cursor-pointer" title="对应推广员的账号">推广员账号</th>
</tr>
<empty name="records">
@ -183,15 +182,14 @@
<td>{$record.game_name}</td>
<td>{$record.sdk_version}</td>
<td>{$record.server_name}</td>
<td>{$record.role_name}</td>
<td>{$record.role_level}</td>
<td>{$record.game_player_name}</td>
<td>{$record.recharge_cost}</td>
<td>{$record.recharge_count}</td>
<td>{$record.recharge_cost_today}</td>
<td>{$record.unlogin_day}</td>
<td>{$record.user_game_login_count}</td>
<td>{$record.create_time}</td>
<td>{$record.play_time}</td>
<td>{$record.register_time}</td>
<td>{$record.login_time}</td>
<td>{$record.promote_account}</td>
</tr>
</volist>
@ -201,7 +199,6 @@
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>{$total.recharge_cost}</td>
<td>{$total.recharge_count}</td>
<td>{$total.recharge_cost_today}</td>

@ -783,6 +783,8 @@ CREATE TABLE `tab_promote_game_ratio` (
`promote_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广员id',
`game_id` int(11) NOT NULL DEFAULT '0' COMMENT '游戏id',
`ratio` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '分成比例',
`last_ratio` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '上次的分成比例',
`last_ratio_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '上次的分成比例状态0-未设置 1-已设置',
`begin_time` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间',
`end_time` int(10) NOT NULL DEFAULT '0' COMMENT '过期时间',
`remark` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '备注',
@ -794,7 +796,7 @@ CREATE TABLE `tab_promote_game_ratio` (
`update_time` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `promote_id` (`promote_id`,`game_id`,`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- 超级签统计菜单
INSERT INTO `sys_menu`( `title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) VALUES ('游戏统计', 137, 0, 'SuperStatistical/index', 0, '', '财务管理', 0, 1);

Loading…
Cancel
Save