master
ELF 3 years ago
parent 3b1aeaa632
commit 69922e73a1

@ -743,4 +743,23 @@ class ConsoleController extends Think {
}
} while($hasNext);
}
/* public function shiftPromote()
{
$service = new PromoteService();
$fromPromoteId = 0;
$fromCompanyId = 0;
$toPromoteId = 0;
$toCompanyId = 0;
$adminId = 0;
$service->shiftPromote([
'from_promote_id' => $fromPromoteId,
'to_promote_id' => $toPromoteId,
'shift_ids' => '',
]);
M('promote', 'tab_')->where(['level1_id' => $fromPromoteId, 'company_id' => $fromCompanyId])->save([
'company_id' => $toCompanyId,
'admin_id' => $adminId
]);
} */
}

@ -4147,6 +4147,7 @@ class ExportController extends Controller
$promoteId = I('promote_id', 0);
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
$companyId = I('company_id', 0);
$status = true;
$data = false;
@ -4183,6 +4184,7 @@ class ExportController extends Controller
'start_time' => $start,
'end_time' => $end,
'promote_id' => I('promote_id', 0),
'company_id' => I('company_id', 0),
'game_ids' => $gameIds,
]
]);
@ -4198,6 +4200,11 @@ class ExportController extends Controller
if ($promoteId) {
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$promoteName = $promote['account'];
$promote['model_type'] = 'promote';
} elseif ($companyId) {
$promote = M('promote_company', 'tab_')->where(['id' => $companyId])->find();
$promoteName = $promote['company_name'];
$promote['model_type'] = 'company';
}
$data = $result['data']['records'];
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
@ -4232,7 +4239,7 @@ class ExportController extends Controller
$xlsCell = [
['date', "日期"],
['game_name', "游戏名称"],
['promote_name', "推广员账号"],
['promote_name', "渠道名称"],
['register_count', '新增玩家', 'time_format', '*'],
['retention_day1', '1日留存', 'time_format', '*'],
['retention_day2', '2日留存'],

@ -72,6 +72,13 @@ class GameRebateController extends ThinkController
$where['_string'] .= ' and send_time<=' . strtotime(I('send_time_end') . ' 23:59:59');
}
if (I('create_time_start', '') != '') {
$where['_string'] .= ' and create_time>=' . strtotime(I('create_time_start') . ' 00:00:00');
}
if (I('create_time_end', '') != '') {
$where['_string'] .= ' and create_time<=' . strtotime(I('create_time_end') . ' 23:59:59');
}
$query = M('rebate_orders', 'tab_')->where($where);
$records = [];
@ -116,6 +123,7 @@ class GameRebateController extends ThinkController
$records[$key]['review_time'] = $record['review_time'] > 0 ? date('Y-m-d H:i:s', $record['review_time']) : '--';
$records[$key]['send_status_text'] = $sendStatusList[$record['send_status']];
$records[$key]['send_time'] = $record['send_time'] > 0 ? date('Y-m-d H:i:s', $record['send_time']) : '--';
$records[$key]['create_time'] = $record['create_time'] > 0 ? date('Y-m-d H:i:s', $record['create_time']) : '--';
$records[$key]['award_date_range'] = is_null($record['award_started_at']) || is_null($record['award_ended_at'])
? '' : $record['award_started_at'] . ' ~ ' . $record['award_ended_at'];
$records[$key]['gift_content'] = implode($newLine, explode('|', $record['gift_content']));
@ -128,6 +136,7 @@ class GameRebateController extends ThinkController
'role_id' => '角色ID',
'role_name' => '角色名称',
'gift_content' => '奖励内容',
'create_time' => '订单生成时间',
'review_status_text' => '审核状态',
'review_time' => '审核时间',
'send_status_text' => '发放状态',

@ -151,6 +151,7 @@ class StatController extends ThinkController
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
$promoteId = I('promote_id', 0);
$companyId = I('company_id', 0);
$orderType = 'asc';
$orderColumn = 'date';
@ -196,6 +197,7 @@ class StatController extends ThinkController
'start_time' => $start,
'end_time' => $end,
'promote_id' => I('promote_id', 0),
'company_id' => I('company_id', 0),
'game_ids' => $gameIds,
]
]);
@ -213,6 +215,11 @@ class StatController extends ThinkController
if ($promoteId) {
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$promoteName = $promote['account'];
$promote['model_type'] = 'promote';
} elseif ($companyId) {
$promote = M('promote_company', 'tab_')->where(['id' => $companyId])->find();
$promoteName = $promote['company_name'];
$promote['model_type'] = 'company';
}
foreach ($data as $key => $item) {
$item['promote_name'] = $promoteName;
@ -246,7 +253,15 @@ class StatController extends ThinkController
}
$baseGames = M('base_game', 'tab_')->select();
$companies = M('promote_company', 'tab_')->field(['id', 'company_name'])->select();
$promoteMap = ['_string' => '1=1'];
if ($companyId) {
$promoteMap['company_id'] = $companyId;
}
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where($promoteMap)->select();
$this->assign('promoteName', $promoteName);
$this->assign('promotes', $promotes);
$this->assign('companies', $companies);
$this->assign('baseGames', $baseGames);
$this->checkListOrCountAuthRestMap($map,[]);
@ -712,6 +727,7 @@ AND UNIX_TIMESTAMP(
$end = I('end', date('Y-m-d'));
$baseGameIds = I('game_ids', '');
$promoteId = I('promote_id', 0);
$companyId = I('company_id', 0);
$dataOrder = I('data_order', '');
$deviceType = I('device_type', '');
$containBindCoins = I('contain_bind_coins', 0);
@ -729,6 +745,8 @@ AND UNIX_TIMESTAMP(
$promote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $promoteId])->find();
$promoteIds = M('promote', 'tab_')->where(['chain' => ['like', $promote['chain'] . $promote['id'] . '/%']])->getField('id', true);
$promoteIds[] = $promote['id'];
} elseif ($companyId > 0) {
$promoteIds = M('promote', 'tab_')->where(['company_id' => $companyId])->getField('id', true);
}
$startTime = strtotime($start . ' 00:00:00');
@ -859,6 +877,16 @@ AND UNIX_TIMESTAMP(
$this->checkListOrCountAuthRestMap($map,[]);
$this->meta_title = 'ARPU统计';
$companies = M('promote_company', 'tab_')->field(['id', 'company_name'])->select();
$promoteMap = ['_string' => '1=1'];
if ($companyId) {
$promoteMap['company_id'] = $companyId;
}
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where($promoteMap)->select();
$this->assign('promotes', $promotes);
$this->assign('companies', $companies);
$this->assign('showPromote', session('user_auth')['show_promote']);
$this->assign('baseGames', $baseGames);
$this->assign('records', $rows);
@ -2057,6 +2085,14 @@ AND UNIX_TIMESTAMP(
}
public function getPromotes()
{
$companyId = I('company_id', 0);
$companyMap = ['_string' => '1=1'];
if ($companyId > 0) {
$companyMap['company_id'] = $companyId;
}
$promotes = M('promote', 'tab_')->where($companyMap)->field(['id', 'account'])->select();
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['promotes' => $promotes]]);
}
}

@ -104,6 +104,16 @@
<div class="input-list">
<input type="text" name="role_name" class="" placeholder="角色名" value="{:I('role_name')}"/>&nbsp;
</div>
<div class="input-list input-list-promote search_label_rehab">
<input type="text" readonly name="create_time_start" class="time-select" value="{:I('create_time_start')}"
placeholder="订单生成开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly name="create_time_end" class="time-select" value="{:I('create_time_end')}"
placeholder="订单生成结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-promote search_label_rehab">
<input type="text" readonly name="send_time_start" class="time-select" value="{:I('send_time_start')}"
placeholder="发放开始时间"/>
@ -184,6 +194,7 @@
<th>达到档位金额</th>
<?php endif;?>
<th>奖励内容</th>
<th>订单生成时间</th>
<th>发放状态</th>
<th>发放时间</th>
<th>审核状态</th>
@ -222,6 +233,7 @@
<?php endif;?>
<td>{$data.gift_content}</td>
<td>{$data.create_time}</td>
<td>
<span class="status-{$data.send_status}">{$data.send_status_text}</span>
</td>

@ -117,13 +117,21 @@
<option value="ios" <?php if(I('device_type', '') == 'ios'):?>selected<?php endif;?>>IOS</option>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="company_id" name="company_id" class="select_gallery">
<option value="">推广公司</option>
<?php foreach($companies as $company):?>
<option company-id="<?= $company['id'] ?>" value="<?=$company['id']?>"><?= $company['company_name'] ?></option>
<?php endforeach;?>
</select>
</div>
<?php if($showPromote == 1):?>
<div class="input-list input-list-promote search_label_rehab">
<select id="promote_id" name="promote_id" class="select_gallery" >
<option value="">推广员账号</option>
<volist name=":get_promote_list(1)" id="vo">
<option promote-id="{$vo.account}" value="{$vo.id}">{$vo.account}</option>
</volist>
<?php foreach($promotes as $promote):?>
<option promote-id="<?= $promote['id'] ?>" value="<?=$promote['id']?>"><?= $promote['account'] ?></option>
<?php endforeach;?>
</select>
</div>
<?php endif;?>
@ -183,6 +191,7 @@
'end'=>$_GET['end'],
'game_ids'=>$_GET['game_ids'],
'promote_id'=>$_GET['promote_id'],
'company_id'=>$_GET['company_id'],
'device_type'=>$_GET['device_type'],
'export'=>1,
),false)}">导出</a>
@ -199,6 +208,7 @@ Think.setValue('start',"{$Think.get.start|default=''}");
Think.setValue('end',"{$Think.get.end|default=''}");
Think.setValue('promote_id',{$Think.get.promote_id|default='""'});
Think.setValue('game_ids',{$Think.get.game_ids|default='""'});
Think.setValue('company_id',{$Think.get.company_id|default='""'});
Think.setValue('device_type',{$Think.get.device_type|default='""'});
Think.setValue('row',{$Think.get.row|default=10});
$(".select_gallery").select2();
@ -294,6 +304,27 @@ $(function(){
autoclose:1,
});
$("#company_id").change(function () {
$.ajax({
url: "{:U('getPromotes')}",
type: "post",
data: { company_id: $("#company_id").val() },
dataType: 'json',
success: function (result ) {
if (result.status == 1) {
var promotes = result.data.promotes
var str = "<option value=''>推广员账号</option>"
for (var i in promotes){
str += "<option value='"+promotes[i].id+"'>"+promotes[i].account+"</option>"
}
$("#promote_id").empty()
$("#promote_id").append(str)
$("#promote_id").select2()
}
}
})
})
$('#time-end').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",

@ -59,13 +59,21 @@
<option value="ios" <?php if(I('device_type', '') == 'ios'):?>selected<?php endif;?>>IOS</option>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="company_id" name="company_id" class="select_gallery">
<option value="">推广公司</option>
<?php foreach($companies as $company):?>
<option game-id="<?= $company['id'] ?>" value="<?= $company['id'] ?>"><?= $company['company_name'] ?></option>
<?php endforeach;?>
</select>
</div>
<?php if($showPromote == 1):?>
<div class="input-list input-list-promote search_label_rehab">
<select id="promote_id" name="promote_id" class="select_gallery" >
<option value="">推广员账号</option>
<volist name=":get_promote_list()" id="vo">
<option promote-id="{$vo.id}" value="{$vo.id}">{$vo.account}</option>
</volist>
<?php foreach($promotes as $promote):?>
<option promote-id="<?= $promote['id'] ?>" value="<?=$promote['id']?>"><?= $promote['account'] ?></option>
<?php endforeach;?>
</select>
</div>
<?php endif;?>
@ -126,7 +134,7 @@
<td>{$vo.date}</td>
<td>{$vo.game_name}</td>
<?php if($showPromote == 1):?>
<td>{$vo.promote_name}</td>
<td>{$promoteName}</td>
<?php endif;?>
<td>{$vo.register_count}</td>
<?php if ($vo['register_count']>0):?>
@ -169,6 +177,7 @@
'end' =>I('end',date('Y-m-d',time())),
'game_id'=>I('game_id'),
'promote_id'=>I('promote_id'),
'company_id'=>I('company_id'),
'device_type'=>I('device_type'),
'xlsname'=>'数据分析_留存率分析',)
,false)}">导出</a>
@ -354,6 +363,27 @@ $(function(){
$(this).closest('.drop-down').find('#i_list_idh').val($(this).attr('value'));
})
});
$("#company_id").change(function () {
$.ajax({
url: "{:U('getPromotes')}",
type: "post",
data: { company_id: $("#company_id").val() },
dataType: 'json',
success: function (result ) {
if (result.status == 1) {
var promotes = result.data.promotes
var str = "<option value=''>推广员账号</option>"
for (var i in promotes){
str += "<option value='"+promotes[i].id+"'>"+promotes[i].account+"</option>"
}
$("#promote_id").empty()
$("#promote_id").append(str)
$("#promote_id").select2()
}
}
})
})
})
</script>
</block>

@ -98,7 +98,11 @@ class GameRepository
if ($promote) {
$promoteService = new PromoteService();
$sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
if ($promote['model_type'] == 'company') {
$sqlStr .= ' and promote_id in (' . $promoteService->subInCompanySql($promote) . ')';
} else {
$sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
}
}
return M('user_play', 'tab_')->where([
@ -126,7 +130,11 @@ class GameRepository
$sqlStr = 'exists (' . $subSql . ')';
if ($promote) {
$promoteService = new PromoteService();
$sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
if ($promote['model_type'] == 'company') {
$sqlStr .= ' and promote_id in (' . $promoteService->subInCompanySql($promote) . ')';
} else {
$sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
}
}
return M('user_play', 'tab_')->where([

@ -212,11 +212,8 @@ class PromoteService {
{
$model = new Model();
$model->startTrans();
$coinRecordService = new PromoteCoinRecordService();
$promoteCoinService = new PromoteCoinService();
$shiftIds = json_decode($task['shift_ids'], true) ?? [];
$shiftIds = $task['shift_ids'] ? (json_decode($task['shift_ids'], true) ?? []) : [];
$toPromote = M('promote', 'tab_')->where(['id' => $task['to_promote_id']])->find();
$fromPromote = M('promote', 'tab_')->where(['id' => $task['from_promote_id']])->find();
@ -983,6 +980,11 @@ class PromoteService {
return M('promote', 'tab_')->field(['id'])->where($conditions)->select(false);
}
public function subInCompanySql($companyId, $withSelf = true)
{
return M('promote', 'tab_')->field(['id'])->where(['company_id' => $companyId])->select(false);
}
public function getLevelName($level)
{
return self::$levels[$level] ?? '未知';

@ -13,7 +13,7 @@ class BaseController extends HomeController
protected $promotePermissions;
protected $loginPromote = null;
protected $canViewUserRecharge = true;
protected $canViewMend = true;
protected $permControlUrls = [
'Home/Query/recharge',
@ -63,6 +63,11 @@ class BaseController extends HomeController
$this->assign("parent_id", $loginer['parent_id']);
$this->assign("grand_id", $loginer['grand_id']);
$this->assign('canViewUserRecharge', $this->canViewUserRecharge);
if ($loginer['level1_id'] == 8038 && $loginer['level'] > 1) {
$this->canViewMend = false;
}
$this->assign('canViewMend', $this->canViewMend);
$result = M('site_apply', 'tab_')->where("promote_id=$pid")->getField('status');
if ($result['status'] == 1) {

@ -4436,7 +4436,7 @@ public function iosDetailExcelInfo($id,$map) {
$now = date('Y-m-d');
$now = strtotime($now);
$nowTimeEnd = $now + 3600 * 24 - 1;
$spendMap['_string'] = 'today.user_id = uc.user_id and today.game_id = uc.game_id and today.server_id = uc.server_id and today.game_player_id = uc.game_player_id'; // and today.promote_id = uc.promote_id';
$spendMap['_string'] = 'today.user_id = uc.user_id and today.game_id = uc.game_id and today.server_id = uc.server_id and today.game_player_id = uc.game_player_id and today.promote_id = uc.promote_id';
$spendMap['today.pay_status'] = 1;
$spendMap['today.pay_time'] = ['between', [$now, $nowTimeEnd]];
@ -4461,7 +4461,7 @@ public function iosDetailExcelInfo($id,$map) {
// ->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 = uc.user_id')
->where($map)
->group('uc.game_player_id,uc.server_id,uc.game_id,uc.user_id')
->group('uc.game_player_id,uc.server_id,uc.game_id,uc.user_id,uc.promote_id')
->buildSql();
$roles = M()->alias('record')
->table($subQuery)

@ -18,6 +18,10 @@ class MendController extends BaseController
public function index()
{
if (!$this->canViewMend) {
return $this->error('没有权限');
}
$page = intval(I('p', 1));
$row = intval(I('row', 10));
$params = I('get.');
@ -79,6 +83,10 @@ class MendController extends BaseController
public function add()
{
if (!$this->canViewMend) {
return $this->error('没有权限');
}
$userId = I('user_id', 0);
$user = M('user', 'tab_')->where(['id' => $userId])->find();
if (!$user) {

@ -1994,7 +1994,7 @@ class QueryController extends BaseController
$fieldS = "sum(s.pay_amount) recharge_cost, count(*) recharge_count, s.user_id, s.user_account, s.promote_id, s.promote_account, s.game_name, s.sdk_version, s.server_name, SUBSTRING_INDEX(GROUP_CONCAT(s.game_player_name order by s.id desc), ',', 1) as game_player_name";
$fieldUser = 'u.register_time, u.login_time';
$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['_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]];
@ -2017,7 +2017,7 @@ class QueryController extends BaseController
->field($field)
->join('join tab_user as u on u.id = s.user_id')
->where($map)
->group('s.game_player_id, s.server_id, s.game_id, s.user_id')
->group('s.game_player_id, s.server_id, s.game_id, s.user_id, s.promote_id')
->having($having)
->buildSql();
$query = M()->alias('record')

@ -89,7 +89,9 @@
<a href="{:U('Query/iosDownLoadData')}" class="<?=is_active_class(['Query'], ['iosDownLoadData'])?>">IOS下载数统计</a>
<a href="{:U('Query/userretention')}" class="<?=is_active_class(['Query'], ['userretention'])?>">用户留存率</a>
<a href="{:U('Query/gameData')}" class="<?=is_active_class(['Query'], ['gameData'])?>">游戏分区数据汇总</a>
<?php if($canViewMend):?>
<a href="{:U('Mend/index')}" class="<?=is_active_class(['Mend'], ['index', 'add'])?>">补链记录</a>
<?php endif;?>
</div>
<?php endif;?>
<?php if ($canViewUserRecharge && $loginer['level'] == 1) :?>

Loading…
Cancel
Save