master
ELF 5 years ago
parent 0bc8468ae4
commit e020b09e4d

@ -0,0 +1,221 @@
<?php
namespace Base\Repository;
class PromoteRepository {
private $model;
public function __construct()
{
}
private function assembleZero($allKeys, $records, $zeroValue) {
$noExistKeys = array_diff($allKeys, array_keys($records));
foreach ($noExistKeys as $key) {
$records[$key] = $zeroValue;
}
return $records;
}
/**
* 获取指定推广员底下的角色创建数
*/
public function getCreateRoleCountByIds(array $ids, $params)
{
$map = [];
$map['id'] = ['in', $ids];
if (isset($params['begin_time']) && isset($params['begin_time'])) {
$map['create_time'] = ['between', [$params['begin_time'], $params['end_time']]];
}
if (isset($params['game_id'])) {
$map['game_id'] = $params['game_id'];
}
if (isset($params['server_id'])) {
$map['server_id'] = $params['server_id'];
}
if (isset($params['sdk_version'])) {
$map['sdk_version'] = $params['sdk_version'];
}
$items = M('user_play_info', 'tab_')->field(['count(*) count', 'promote_id'])->where($map)->groupBy('promote_id')->select();
$records = [];
foreach ($items as $item) {
$records[$item['promote_id']] = $item['count'];
}
$records = $this->assembleZero($ids, $records, 0);
return $records;
}
/**
* 获取指定推广员底下的角色创建的用户数
*/
public function getCreateRoleUserCountByIds($ids, $beginTime, $endTime)
{
$map = [];
$map['id'] = ['in', $ids];
if (isset($params['begin_time']) && isset($params['begin_time'])) {
$map['create_time'] = ['between', [$params['begin_time'], $params['end_time']]];
}
if (isset($params['game_id'])) {
$map['game_id'] = $params['game_id'];
}
if (isset($params['server_id'])) {
$map['server_id'] = $params['server_id'];
}
if (isset($params['sdk_version'])) {
$map['sdk_version'] = $params['sdk_version'];
}
$items = M('user_play_info', 'tab_')->field(['count(distinct user_id) count', 'promote_id'])->where($map)->groupBy('promote_id')->select();
$records = [];
foreach ($items as $item) {
$records[$item['promote_id']] = $item['count'];
}
$records = $this->assembleZero($ids, $records, 0);
return $records;
}
/**
*
*/
public function getCreateRoleDeviceCountByIds($ids, $beginTime, $endTime)
{
}
public function getCreateRoleIpCountByIds($ids, $beginTime, $endTime)
{
}
/**
* 获取指定推广员底下的登录用户数
*/
public function getLoginUserCountByIds($ids, $beginTime, $endTime)
{
$map = [];
$map['id'] = ['in', $ids];
if (isset($params['begin_time']) && isset($params['begin_time'])) {
$map['login_time'] = ['between', [$params['begin_time'], $params['end_time']]];
}
if (isset($params['game_id'])) {
$map['game_id'] = $params['game_id'];
}
if (isset($params['server_id'])) {
$map['server_id'] = $params['server_id'];
}
if (isset($params['sdk_version'])) {
$map['sdk_version'] = $params['sdk_version'];
}
$items = M('user', 'tab_')->field(['count(*) count', 'promote_id'])->where($map)->groupBy('promote_id')->select();
$records = [];
foreach ($items as $item) {
$records[$item['promote_id']] = $item['count'];
}
$records = $this->assembleZero($ids, $records, 0);
return $records;
}
/**
* 获取指定推广员底下的充值次数
*/
public function getRechargeCountByIds($ids, $beginTime, $endTime)
{
$map = ['pay_status' => 1, 'id' => ['in', $ids]];
if (isset($params['begin_time']) && isset($params['begin_time'])) {
$map['pay_time'] = ['between', [$params['begin_time'], $params['end_time']]];
}
if (isset($params['game_id'])) {
$map['game_id'] = $params['game_id'];
}
if (isset($params['server_id'])) {
$map['server_id'] = $params['server_id'];
}
if (isset($params['sdk_version'])) {
$map['sdk_version'] = $params['sdk_version'];
}
$items = M('spend', 'tab_')->field(['count(*) count', 'promote_id'])->where($map)->groupBy('promote_id')->select();
$records = [];
foreach ($items as $item) {
$records[$item['promote_id']] = $item['count'];
}
$records = $this->assembleZero($ids, $records, 0);
return $records;
}
/**
* 获取指定推广员底下的充值用户数
*/
public function getRechargeUserCountByIds($ids, $beginTime, $endTime)
{
$map = ['pay_status' => 1, 'id' => ['in', $ids]];
if (isset($params['begin_time']) && isset($params['begin_time'])) {
$map['pay_time'] = ['between', [$params['begin_time'], $params['end_time']]];
}
if (isset($params['game_id'])) {
$map['game_id'] = $params['game_id'];
}
if (isset($params['server_id'])) {
$map['server_id'] = $params['server_id'];
}
if (isset($params['sdk_version'])) {
$map['sdk_version'] = $params['sdk_version'];
}
$items = M('spend', 'tab_')->field(['count(distinct user_id) count', 'promote_id'])->where($map)->groupBy('promote_id')->select();
$records = [];
foreach ($items as $item) {
$records[$item['promote_id']] = $item['count'];
}
$records = $this->assembleZero($ids, $records, 0);
return $records;
}
public function getRechargeAmountByIds($ids, $beginTime, $endTime)
{
$map = ['pay_status' => 1, 'id' => ['in', $ids]];
if (isset($params['begin_time']) && isset($params['begin_time'])) {
$map['pay_time'] = ['between', [$params['begin_time'], $params['end_time']]];
}
if (isset($params['game_id'])) {
$map['game_id'] = $params['game_id'];
}
if (isset($params['server_id'])) {
$map['server_id'] = $params['server_id'];
}
if (isset($params['sdk_version'])) {
$map['sdk_version'] = $params['sdk_version'];
}
$items = M('spend', 'tab_')->field(['sum(pay_amount) amount', 'promote_id', 'pay_way'])->where($map)->groupBy('promote_id, pay_way')->select();
$records = [];
foreach ($items as $item) {
if (isset($records[$item['promote_id']])) {
if ($item['pay_way'] == -1) {
$records[$item['promote_id']]['ban_coin'] = $item['amount'];
} elseif ($item['pay_way'] == 0) {
$records[$item['promote_id']]['coin'] = $item['amount'];
} else {
$records[$item['promote_id']]['cash'] = isset$item['amount'];
}
} else {
}
$records[$item['promote_id']] = $item['count'];
}
}
}

@ -4,6 +4,7 @@ namespace Home\Controller;
use OT\DataDictionary;
use User\Api\PromoteApi;
use Base\Repository\PromoteRepository;
/**
* 前台首页控制器
@ -1882,4 +1883,52 @@ class QueryController extends BaseController
$this->assign('list_data', $spendData);
$this->display('view_spend_detailed');
}
public function achievement()
{
$time = I('time', '');
$sdkVersion = I('sdk_version', 0);
$gameId = I('game_id', 0);
$serverId = I('server_id', 0);
$promoteId = I('promote_id', 0);
$promote = $this->getLoginPromote();
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promote['id']])->select();
list($promotes, $pagination, $count) = $this->paginate($query);
$ids = array_column($promotes, 'id');
$promoteRepository = new PromoteRepository();
$createRoleCountList = $promoteRepository->getCreateRoleCountByIds($ids, $beginTime, $endTime);
$createRoleUserCountList = $promoteRepository->getCreateRoleUserCountByIds($ids, $beginTime, $endTime);
$createRoleDeviceCountList = $promoteRepository->getCreateRoleDeviceCountByIds($ids, $beginTime, $endTime);
$createRoleIpCountList = $promoteRepository->getCreateRoleIpCountByIds($ids, $beginTime, $endTime);
$loginUserCountList = $promoteRepository->getLoginUserCountByIds($ids, $beginTime, $endTime);
$rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $beginTime, $endTime);
$rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $beginTime, $endTime);
$rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $beginTime, $endTime);
$records = [];
foreach ($promotes as $promote) {
$id = $promote['id'];
$records[] = [
'id' => $id,
'account' => $promote['account'],
'real_name' => $promote['real_name'],
'create_role_count' => $createRoleCountList[$id],
'create_role_user_count' => $createRoleUserCountList[$id],
'create_role_device_count' => $createRoleDeviceCountList[$id],
'create_role_ip_count' => $createRoleIpCountList[$id],
'login_user_count' => $loginUserCountList[$id],
'recharge_count' => $rechargeCountList[$id],
'recharge_user_count' => $rechargeUserCountList[$id],
'recharge_amount' => $rechargeAmountList[$id],
];
}
$this->assign('records', $records);
$this->assign('pagination', $pagination);
$this->assign('count', $count);
$this->display();
}
}

@ -47,17 +47,18 @@
<a href="{:U('Promote/mygrand')}" class="<if condition='CONTROLLER_NAME eq Promote and (ACTION_NAME eq mygrand or ACTION_NAME eq add_chlid or ACTION_NAME eq edit_chlid) '>active</if> ">推广员管理</a>
</if>
</div>
<!-- <div class="subNav jssubNav"><i class="prev_icon icon_shujvi"></i><span>数据管理</span><i class="arrow_icon"></i></div>-->
<!-- <div class="navContent jsnavContent">-->
<!-- <a href="{:U('Query/dailySummary')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq dailySummary '>active</if> ">每日概况</a>-->
<!-- <a href="{:U('Query/summary')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq summary '>active</if> ">数据汇总</a>-->
<!-- <a href="{:U('Query/recharge')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq recharge or ACTION_NAME eq viewSpendDetailed) '>active</if> ">充值明细</a>-->
<!-- <a href="{:U('Query/register')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq register or ACTION_NAME eq viewRole) '>active</if> ">注册明细</a>-->
<!-- <a href="{:U('Query/arpu_analysis')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq arpu_analysis '>active</if> ">ARPU统计</a>-->
<!-- <a href="{:U('Query/retention_analysis')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq retention_analysis '>active</if> ">留存统计</a>-->
<!-- <a href="{:U('Query/userRoles')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq userRoles '>active</if> ">角色查询</a>-->
<!-- <a href="{:U('Query/userRecharges')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq userRecharges '>active</if> ">充值玩家</a>-->
<!-- </div>-->
<div class="subNav jssubNav"><i class="prev_icon icon_shujvi"></i><span>数据管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Query/dailySummary')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq dailySummary '>active</if> ">每日概况</a>
<a href="{:U('Query/summary')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq summary '>active</if> ">数据汇总</a>
<a href="{:U('Query/recharge')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq recharge or ACTION_NAME eq viewSpendDetailed) '>active</if> ">充值明细</a>
<a href="{:U('Query/register')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq register or ACTION_NAME eq viewRole) '>active</if> ">注册明细</a>
<a href="{:U('Query/arpu_analysis')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq arpu_analysis '>active</if> ">ARPU统计</a>
<a href="{:U('Query/retention_analysis')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq retention_analysis '>active</if> ">留存统计</a>
<a href="{:U('Query/userRoles')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq userRoles '>active</if> ">角色查询</a>
<a href="{:U('Query/userRecharges')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq userRecharges '>active</if> ">充值玩家</a>
<a href="{:U('Query/achievement')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq achievement '>active</if> ">团队/推广员业绩</a>
</div>
<!-- <div class="subNav jssubNav"><i class="prev_icon icon_caiwu"></i><span>财务管理</span><i class="arrow_icon"></i></div> -->
<!-- <div class="navContent jsnavContent"> -->

@ -0,0 +1,201 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
<style>
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
</style>
</block>
<block name="body">
<div class="page-list normal_list promote-mychlid-list">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>数据中心></span><span>团队推广业绩</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_game.png">
<span class="title_main">团队推广业绩</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<form action="{:U('Query/userRoles',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<div class="form-group normal_space">
<select id="game-select" name="game_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option>
<volist name="games" id="game">
<option value="{$game.game_id}" <if condition="I('game_id') eq $game['game_id']">selected</if>>{$game.game_name}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
<select id="server-select" name="server_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择区服</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
<select name="sdk_version" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择设备类型</option>
<option value="1" <if condition="I('sdk_version') === '1'">selected</if>>Andriod</option>
<option value="2" <if condition="I('sdk_version') === '2'">selected</if>>IOS</option>
</select>
</div>
<div class="form-group normal_space">
<select name="status" class="reselect select_gallery" style="width: 220px;" >
<option value="0">帐号状态</option>
<option value="1" <if condition="I('status') === '1'">selected</if>>正常</option>
<option value="2" <if condition="I('status') === '2'">selected</if>>冻结</option>
</select>
</div>
<div class="form-group normal_space">
<input type="text" name="role_name" class="txt normal_txt" id="uid" placeholder="请输入角色名" value="{:I('role_name')}">
</div>
<div class="form-group normal_space">
<input type="text" name="user_account" class="txt normal_txt" id="uid" placeholder="请输入玩家账号" value="{:I('user_account')}">
</div>
<if condition="$parent_id eq 0">
<div class="form-group normal_space">
<select id="group-select" name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择组长</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('headman_promote_id') == $promote['id']">selected</if>>{$promote.account}</option>
</volist>
</select>
</div>
</if>
<if condition="$grand_id eq 0">
<div class="form-group normal_space">
<select id="promote-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广员</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}</option>
</volist>
</select>
</div>
</if>
<div class="form-group normal_space fr">
<label>起止时间:</label>
<input type="text" class="txt range-date" name="time" placeholder="起止时间" value="{:I('time')}" >
</div>
<div class="form-group">
<input type="submit" class="submit normal_space" value="查询">
</div>
</form>
</div>
<div class="trunk-list list_normal">
<table class="table normal_table">
<tr class="odd">
<th>账号(姓名)</th>
<th>创角数</th>
<th>创角用户</th>
<th>新创角用户</th>
<th>新创角设备</th>
<th>新创角IP</th>
<th>登录用户数</th>
<th>充值人数</th>
<th>充值次数</th>
<th>充值总额</th>
<th>现金充值</th>
<th>通用币充值</th>
<th>绑定币充值</th>
<th>操作</th>
</tr>
<empty name="records">
<tr><td colspan="8" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
<else />
<volist name="records" id="record" mod="2">
<tr data-id="{$vo.id}" class="<eq name='mod' value='1'>odd</eq>">
<td>{$record.account}({$record.real_name})</td>
<td>{$record.create_role_count}</td>
<td>{$record.create_role_user_count}</td>
<td></td>
<td></td>
<td></td>
<td>{$record.login_user_count}</td>
<td>{$record.create_role_user_count}</td>
<td>{$record.recharge_count}</td>
<td>{$record.recharge_user_count}</td>
<td>{$record.recharge_amount}</td>
<td></td>
<td></td>
<td></td>
<td><a href="">查看下级</a></td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$pagination}
</div>
</div>
<div class="page-explain promote-mychlid-explain">
<div class="trunk-content article border_normal">
<!-- <table class="desccontent">
<tr><td class="title" style="width: 100px;display: inline-block;">二级渠道说明:</td><td class="det">推广员默认为一级渠道,一级渠道可通过推广员后台新增二级渠道;二级渠道由一级渠道管理开启权限,并由一级渠道给二级渠道结算,结算可到财务管理操作。</td></tr>
</table>-->
</div>
</div>
</div>
</block>
<block name="script">
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript">
$(function() {
$('.range-date').flatpickr({
mode: 'range',
locale: 'zh',
})
$('.select_gallery').select2()
$('#game-select').on({
change: function name() {
var gameId = $('#game-select').val()
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId},
success: function(response) {
$("#server-select").val(0).trigger("change")
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
var server = response.data.servers[i]
options += '<option value="' + server.id + '">' + server.server_name + '</option>'
}
$('#server-select').html(options)
}
})
}
})
$('#group-select').on({
change: function name() {
var groupId = $('#group-select').val()
$.ajax({
url: "{:U('Query/getSubPromotes')}",
dataType: 'json',
data: {promote_id: groupId},
success: function(response) {
$("#promote-select").val(0).trigger("change")
var options = '<option value="0">请选择推广员</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
options += '<option value="' + promote.id + '">' + promote.account + '</option>'
}
$('#promote-select').html(options)
}
})
}
})
})
</script>
</block>

@ -59,6 +59,9 @@ INSERT INTO `tab_promote_quick_menu` VALUES ('15', '1', '9', '1569719870');
INSERT INTO `tab_promote_quick_menu` VALUES ('16', '1', '10', '1569719877');
INSERT INTO `tab_promote_quick_menu` VALUES ('18', '1', '1', '1569720739');
-- 2019-10-01
-- 2019-10-01 by elf
alter table tab_game_source add column `original_url` varchar(255) NOT NULL default '' COMMENT '原包路径';
alter table tab_game_source add column `org_plist_url` varchar(255) NOT NULL default '' COMMENT '原包Plist路径';
-- 2019-10-09 by elf
alter table tab_user_play_info add column `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '角色创建时间';
Loading…
Cancel
Save