Merge branch 'feature/promote' of 47.111.118.107:/srv/git/platform into feature/promote

master
chenzhi 5 years ago
commit ad6eb5b0d7

@ -171,6 +171,15 @@ class SpendRepository
return $this->assembleRecords($items, $gameIds, 'amount', 'game_id');
}
/**
* 按游戏统计付款总额--cxj
*/
public function getPayAmountByGameAndType($params)
{
$conditions = $this->getGameGroupConditionsNew($params);
return M('spend', 'tab_')->where($conditions)->sum('pay_amount');
}
/**
* 按天统计付款用户数
*/
@ -219,6 +228,15 @@ class SpendRepository
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
/**
* 按游戏统计付款次数--cxj
*/
public function getPayCountByGame($params)
{
$conditions = $this->getGameGroupConditions($params);
return M('spend', 'tab_')->where($conditions)->count();
}
/**
* 游戏统计付款用户数
*/
@ -231,6 +249,20 @@ class SpendRepository
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
/**
* 游戏统计付款用户数--cxj
*/
public function getPayUserCountByGame($params)
{
$conditions = $this->getGameGroupConditions($params);
$sql = M('spend', 'tab_')->field('distinct game_id, user_id')
->where($conditions)
->fetchSql(true)
->select();
$model = new \Think\Model();
return $model->query("select count(*) as num from ($sql) as t")[0]['num'];
}
/**
* 按照时间分组统计新增付费用户数
*/

@ -66,9 +66,11 @@ class UserRepository
$conditions = [];
$conditions['promote_id'] = ['in', $ids];
$conditions[$params['time_column']] = ['between', [$beginTime, $endTime]];
$conditions['game_id'] = ['in', $gameIds];
if (!empty($params['server_id'])) {
$conditions['server_id'] = $params['server_id'];
if (!empty($gameIds)) {
$conditions['game_id'] = ['in', $gameIds];
if (!empty($params['server_id'])) {
$conditions['server_id'] = $params['server_id'];
}
}
return $conditions;
@ -154,12 +156,21 @@ class UserRepository
$gameIds = $params['game_ids'] ?? [];
$params['time_column'] = 'login_time';
$conditions = $this->getGameGroupConditions($params);
$items = M('user_login_record', 'tab_')->field('game_id, count(DISTINCT user_id) as count')
->where($conditions)
->group('game_id')
->select();
if (isset($params['all_data'])) {
$sql = M('user_login_record', 'tab_')->field('distinct game_id, user_id')
->where($conditions)
->fetchSql(true)
->select();
$model = new \Think\Model();
return $model->query("select count(*) as num from ($sql) as t")[0]['num'];
} else {
$items = M('user_login_record', 'tab_')->field('game_id, count(DISTINCT user_id) as count')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -268,11 +279,17 @@ class UserRepository
$params['time_column'] = 'create_time';
$conditions = $this->getCreateRoleByGameConditions($params);
$items = M('user_play_info', 'tab_')->field('count(*) count, game_id')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
return M('user_play_info', 'tab_')
->where($conditions)
->count();
} else {
$items = M('user_play_info', 'tab_')->field('count(*) count, game_id')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -300,11 +317,20 @@ class UserRepository
$params['time_column'] = 'create_time';
$conditions = $this->getCreateRoleByGameConditions($params);
$items = M('user_play_info', 'tab_')->field('count(distinct game_id,user_id) count, game_id')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
$sql = M('user_play_info', 'tab_')->field('distinct game_id, user_id')
->where($conditions)
->fetchSql(true)
->select();
$model = new \Think\Model();
return $model->query("select count(*) as num from ($sql) as t")[0]['num'];
} else {
$items = M('user_play_info', 'tab_')->field('count(distinct user_id) count, game_id')
->where($conditions)
->group('game_id')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -356,12 +382,20 @@ class UserRepository
->where("ti.user_id = user_id and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
->fetchSql(true)
->count();
$items = $model->field("count(distinct game_id,user_id) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
return count($model->field("game_id, (" . $sql . ") as num")
->where($conditions)
->group('game_id, user_id')
->having('num = 0')
->select());
} else {
$items = $model->field("count(distinct user_id) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -413,12 +447,20 @@ class UserRepository
->where("ti.create_device_number = create_device_number and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
->fetchSql(true)
->count();
$items = $model->field("count(distinct game_id,create_device_number) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
return count($model->field("game_id, (" . $sql . ") as num")
->where($conditions)
->group('game_id, create_device_number')
->having('num = 0')
->select());
} else {
$items = $model->field("count(distinct game_id,create_device_number) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
/**
@ -470,11 +512,19 @@ class UserRepository
->where("ti.create_ip = create_ip and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
->fetchSql(true)
->count();
$items = $model->field("count(distinct game_id,create_ip) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
if (isset($params['all_data'])) {
return count($model->field("game_id, (" . $sql . ") as num")
->where($conditions)
->group('game_id, create_ip')
->having('num = 0')
->select());
} else {
$items = $model->field("count(distinct game_id,create_ip) count, game_id, (" . $sql . ") as num")
->where($conditions)
->group("game_id")
->having('num = 0')
->select();
return $this->assembleRecords($items, $gameIds, 'count', 'game_id');
}
}
}

@ -1194,6 +1194,7 @@ class QueryController extends BaseController
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row = intval(I('get.row', 10));
$ownId = intval(I('own_id'), 0);//本账号
$relationGameId = intval(I('relation_game_id', 0));
$sdkVersion = intval(I('sdk_version', 0));
$serverId = intval(I('server_id'), 0);
@ -1216,13 +1217,13 @@ class QueryController extends BaseController
$parameter['level_promote_4'] = $levelPromote[2];
$parameter['begtime'] = $initBegTime;
$parameter['endtime'] = $initEndTime;
$parameter['own_id'] = $ownId;
$parameter['p'] = $page;
$parameter['row'] = $row;
$loginPromote = $this->getLoginPromote();
$map = [];
$ownId = intval(I('own_id'), 0);//本账号
if ($ownId) {
$map['a.promote_id'] = $queryPromote['id'];
$params['promote_ids'] = $queryPromote['id'];
@ -1265,6 +1266,13 @@ class QueryController extends BaseController
->join($serverJoin)
->where($map)
->count('distinct a.game_id');
$allGameIs = M('Apply', 'tab_')->alias('a')
->field('distinct a.game_id')
->join('tab_game as g on g.id = a.game_id')
->join($serverJoin)
->where($map)
->select();
$allGameIs = array_column($allGameIs, 'game_id');
$records = [];
$allData['role_num'] = 0;
@ -1327,22 +1335,25 @@ class QueryController extends BaseController
'spend_discount' => 0,
'spend_voucher' => 0,
];
$allData['role_num'] += $roleNumList[$gameId];
$allData['user_num'] += $userNumList[$gameId];
$allData['new_user_num'] += $newUserNumList[$gameId];
$allData['new_device_num'] += $newDeviceNumList[$gameId];
$allData['new_ip_num'] += $newIpNumList[$gameId];
$allData['login_user_num'] += $loginUserNumList[$gameId];
$allData['spend_user_num'] += $spendUserNumList[$gameId];
$allData['spend_num'] += $spendNumList[$gameId];
$allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$gameId], 2);
$allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$gameId], 2);
$allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$gameId], 2);
$allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$gameId], 2);
$allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2);
$allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2);
}
$params['all_data'] = 1;
$params['game_ids'] = $allGameIs;
$allData['role_num'] = $userRepository->getCreateRoleCountByGame($params);//创角数
$allData['user_num'] = $userRepository->getCreateRoleUserCountByGame($params);//创角用户
$allData['new_user_num'] = $userRepository->getNewCreateRoleUserCountByGame($params);//新创角用户
$allData['new_device_num'] = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备
$allData['new_ip_num'] = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP
$allData['login_user_num'] = $userRepository->getLoginCountGroupByGame($params);//登录用户数
$allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数
$allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数
unset($params['pay_way']);
$allData['spend_all_amount'] = $spendRepository->getPayAmountByGameAndType($params);//充值总额
$params['pay_way'] = ['in', '1,2,3,4,5,6'];
$allData['spend_cash'] = $spendRepository->getPayAmountByGameAndType($params);//现金充值
$params['pay_way'] = 0;
$allData['spend_generic'] = $spendRepository->getPayAmountByGameAndType($params);//通用币充值
$params['pay_way'] = -1;
$allData['spend_binding'] = $spendRepository->getPayAmountByGameAndType($params);//绑定币充值
}
}

@ -81,7 +81,7 @@
<div class="form-group normal_space">
<select id="relation_game_id" name="relation_game_id" class="reselect select_gallery">
<option value="">请选择游戏</option>
<option value="0">请选择游戏</option>
<volist name=":get_promote_serach_game()" id="vo">
<option value="{$vo.relation_game_id}" title="{$vo.relation_game_name}">{$vo.relation_game_name}</option>
</volist>
@ -99,7 +99,7 @@
<div class="form-group normal_space">
<select id="server_id" name="server_id" class=" reselect select_gallery">
<option value="">请选择区服</option>
<option value="0">请选择区服</option>
<volist name="serverData" id="vo">
<option value="{$vo.server_id}">{$vo.server_name}</option>
</volist>

@ -16,108 +16,164 @@
<div class="recharge-heard">
<!-- 子页公共头部 -->
<div class="subpage-heard">充值中心
<a href="#" class="arrows"></a>
<a href="{:U('/User/index')}" class="arrows"></a>
</div>
<div class="recharge-tabbar">
<li class="selected" name="currency">平台币充值</li>
<li name="iscurrency">折扣充值</li>
</div>
</div>
<div class="content">
<div class="recharge-flat" >
<form class="" id="form1" action="{:U('User/recharge')}" method="post">
<div class="flat-box">
<div class="flat-info">
<div>充值账户</div>
<input type="hidden" class="txt" name="account" value="{:session('suser_auth.account')}" readonly="readonly" placeholder="请输入充值账户">
<span>{:session('suser_auth.account')}</span>
</div>
</div>
<div class="flat-box">
<div class="flat-info">
<div>充值金额</div>
<input type="text" class="rcmoney" name="pay_amount" placeholder="请输入金额最低金额1元">
<input type="text" class="rcmoney1" name="pay_amount" placeholder="请输入金额最低金额1元" style="text-align:right;width: 2.88rem">
</div>
</div>
<div class="flat-box">
<div class="flat-info">
<div>获得平台币</div>
<input type="text" class="rcplatform" name="balance" readonly placeholder="" value="">
<input type="text" class="rcplatform" name="balance" readonly placeholder="" value="" style="text-align:right;">
</div>
</div>
<div class="recharge-payment">
<div class="title">请选择支付方式</div>
<div class="alipay">
<div class="alipay_img">
<img src="__IMG__/zhifubaozhifu.png" alt="">
<div class="img_text">
<div>支付宝支付</div>
<div>推荐支付宝用户使用</div>
</div>
</div>
<div class="radio_select">
<input id="zhifubao" name="way" type="radio" value="1" checked>
<label for="zhifubao" class="radio-label"></label>
</div>
</div>
<div class="alipay" id="ch_weixin">
<div class="alipay_img">
<img src="__IMG__/weixin.png" alt="">
<div class="img_text">
<div>微信支付</div>
<div>推荐微信用户使用</div>
</div>
</div>
<div class="radio_select">
<input id="weixin" name="way" type="radio" value="2" >
<label for="weixin" class="radio-label"></label>
</div>
</div>
</div>
<div style="text-align: center;">
<input type="hidden" name="spendType" value="1">
<div class="payment_btn" style="margin-left: 1rem;">
确认支付</div>
</div>
</form>
</div>
<div class="recharge-discount" style="display: none;">
<form class="" id="form2" action="{:U('User/recharge')}" method="post">
<div class="flat-box">
<div class="flat-info">
<div>充值账户</div>
<input type="hidden" class="txt" name="account" value="{:session('suser_auth.account')}" readonly="readonly" placeholder="请输入充值账户">
<span>{:session('suser_auth.account')}</span>
</div>
</div>
<div class="flat-box">
<div class="flat-info">
<div>选择游戏</div>
<select name="" id="game_id">
<select name="game_id" id="game_id">
<option value="">请选择游戏</option>
<option value="">落梦星辰</option>
<volist name="gameList" id="vo">
<option value="{$vo.id}" data-radio="{$vo.bind_recharge_discount}">{$vo.game_name}</option>
</volist>
</select>
</div>
</div>
<div class="flat-box">
<div class="flat-info">
<div>充值金额</div>
<input type="text" placeholder="请输入金额最低金额1元">
<input type="text" class="txt rcmoney" id="pay_amount" name="pay_amount" placeholder="请输入金额最低金额1元" style="width:2.88rem;text-align:right;">
</div>
</div>
<div class="flat-box">
<div class="flat-info">
<div>折扣比例</div>
<span></span>
<input type="text" class="txt discount" value="" readonly style="color: #FE9C22;text-align:right;">
<input class="rcratio" name="ratio" type="hidden" value="" style="text-align:right;">
</div>
</div>
<div class="flat-box">
<div class="flat-info">
<div>实付金额</div>
<span></span>
<input type="text" class="txt realmoney" name="realmoney" readonly style="text-align:right;">
</div>
</div>
<div class="flat-box">
<div class="flat-info">
<div>获得绑币</div>
<span></span>
</div>
</div>
</div>
</div>
<div class="recharge-payment">
<div class="title">请选择支付方式</div>
<div class="alipay">
<div class="alipay_img">
<img src="__IMG__/zhifubaozhifu.png" alt="">
<div class="img_text">
<div>支付宝支付</div>
<div>推荐支付宝用户使用</div>
<input type="text" class="txt rcplatform" name="rcplatform" readonly style="text-align:right;">
</div>
</div>
<div class="recharge-payment">
<div class="title">请选择支付方式</div>
<div class="alipay">
<div class="alipay_img">
<img src="__IMG__/zhifubaozhifu.png" alt="">
<div class="img_text">
<div>支付宝支付</div>
<div>推荐支付宝用户使用</div>
</div>
</div>
<div class="radio_select">
<input id="zhifubao" name="radio" type="radio" value="支付宝" checked>
<label for="zhifubao" class="radio-label"></label>
</div>
<div class="radio_select">
<input id="zhifubao1" name="way" type="radio" value="1" checked>
<label for="zhifubao1" class="radio-label"></label>
</div>
</div>
<div class="alipay" id="ch_weixin">
<div class="alipay_img">
<img src="__IMG__/weixin.png" alt="">
<div class="img_text">
<div>微信支付</div>
<div>推荐微信用户使用</div>
</div>
<div class="alipay" id="ch_weixin1">
<div class="alipay_img">
<img src="__IMG__/weixin.png" alt="">
<div class="img_text">
<div>微信支付</div>
<div>推荐微信用户使用</div>
</div>
</div>
<div class="radio_select">
<input id="weixin1" name="way" type="radio" value="2" >
<label for="weixin1" class="radio-label"></label>
</div>
</div>
</div>
</div>
<div class="radio_select">
<input id="weixin" name="radio" type="radio" value="微信" >
<label for="weixin" class="radio-label"></label>
</div>
<div style="text-align: center;">
<input type="hidden" name="spendType" value="1">
<div class="payment_btn" style="margin-left: 1rem;">
确认支付</div>
</div>
</form>
</div>
</div>
<div class="payment_btn">立即充值</div>
</div>
<!--<div class="popmsg pop-dialog"></div>-->
</body>
@ -153,7 +209,7 @@
$('#game_id').change(function() {
var that = $(this),cur = that.find('option:selected');
var ratio = cur.attr('data-radio');
var parent = that.closest('.jsinfo');
var parent = that.closest('.recharge-discount');
var rr = parent.find('.rcratio');
var sib = rr.siblings('input');
var rm = parent.find('.realmoney');
@ -173,7 +229,28 @@
}
});
$('.rcmoney').keyup(function() {
var that = $(this),val = $.trim(that.val()),parent=that.closest('.jsinfo'),pf=parent.find('.rcplatform');
var that = $(this),val = $.trim(that.val()),parent=that.closest('.recharge-discount'),pf=parent.find('.rcplatform');
var rm = parent.find('.realmoney');
if(val == ""){return true;}
if (val) {
if (val>0 && /^(0|[1-9][0-9]*)$/.test(val)) {
pf.val(val);
if (rm) {
var ratio = $.trim(parent.find('.rcratio').val()) || 10;
var rmnum = Math.floor(ratio*100 * val/10)/100;
rm.val(rmnum);
}
} else {
popmsg.msg('请输入非零开头的正整数');that.val('').focus();
pf.val('');if(rm) {rm.val('');}
}
} else {
popmsg.msg('请输入充值金额');that.val('').focus();
pf.val('');if(rm) {rm.val('');}
}
});
$('.rcmoney1').keyup(function() {
var that = $(this),val = $.trim(that.val()),parent=that.closest('.recharge-flat'),pf=parent.find('.rcplatform');
var rm = parent.find('.realmoney');
if(val == ""){return true;}
if (val) {
@ -263,6 +340,7 @@
return false;
}
if(validation(form)){
console.log(form.serialize())
$.ajax({
url:form.attr('active'),
type:"post",

Loading…
Cancel
Save