master
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'];
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
Loading…
Reference in New Issue