Merge branch 'dev' into release-1.0.0

master
ELF 5 years ago
commit 8a2f36b5a3

@ -2,6 +2,7 @@
namespace Admin\Controller; namespace Admin\Controller;
use Think\Controller; use Think\Controller;
use GuzzleHttp\Client;
class ExportController extends Controller class ExportController extends Controller
{ {
@ -3029,7 +3030,91 @@ class ExportController extends Controller
return $total; return $total;
} }
public function userretention_export($p = 0) public function userretention_export()
{
$this->meta_title = '留存统计';
$start = I('start', date('Y-m-d',strtotime('-7 day')));
$end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end');
$gameId = I('game_id', 0);
$promoteId = I('promote_id', 0);
$status = true;
$data = false;
$error = '';
if ($gameId == 0) {
$error = '请选择游戏!';
$status = false;
}
$startTime = strtotime($start . ' 00:00:00');
$endTime = strtotime($end . ' 23:59:59') + 1;
if ((($endTime - $startTime)/(24*3600)) > 31) {
$error = '时间间隔不能超过31天';
$status = false;
}
if ($status) {
$client = new Client([
'base_uri' => C('PACKAGE_SERVER_URL'),
'timeout' => 10.0,
]);
$response = $client->post('/statistics/player-retention', [
'verify' => false,
'form_params' => [
'start_time' => $start,
'end_time' => $end,
'promote_id' => I('promote_id', 0),
'game_id' => $gameId,
]
]);
$result = (string)$response->getBody();
$result = json_decode($result, true);
if (!$result) {
$this->error('数据请求异常!');
}
$gameName = get_game_name($gameId);
$promoteName = '全部';
if ($promoteId) {
$promoteName = get_promote_account($promoteId);
}
$data = $result['data']['records'];
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
foreach ($data as $key => $item) {
$item['game_name'] = $gameName;
$item['promote_name'] = $promoteName;
foreach ($dayList as $day) {
if ($item['register_count'] > 0) {
$item['retention_day'. $day] = (round($item['retention_day'. $day]/$item['register_count'], 4)*100) . '%';
} else {
$item['retention_day'. $day] = '--';
}
}
$data[$key] = $item;
}
} else {
$this->error($error);
}
$xlsCell = [
['date', "日期"],
['game_name', "游戏名称"],
['promote_name', "推广员账号"],
['register_count', '新增玩家', 'time_format', '*'],
['retention_day1', '1日留存', 'time_format', '*'],
['retention_day2', '2日留存'],
['retention_day3', "3日留存"],
['retention_day4', '4日留存'],
['retention_day5', '5日留存'],
['retention_day6', '6日留存'],
['retention_day7', '7日留存'],
['retention_day15', '15日留存'],
['retention_day30', '30日留存'],
];
$xlsData = $data;
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'留存分析';
$this->exportExcel($xlsName, $xlsCell, $xlsData);
}
public function userretention($p = 0)
{ {
$request=$_REQUEST; $request=$_REQUEST;
$page = intval($p); $page = intval($p);

@ -298,8 +298,8 @@ class GameController extends ThinkController
$this->error('一句话简介不能超过30个字'); $this->error('一句话简介不能超过30个字');
exit; exit;
} }
if (!preg_match("/^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/i", $_POST['beta_url'])) { if (!empty($_POST['beta_url']) && !preg_match("/^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/i", $_POST['beta_url'])) {
return $this->error("请填写正确的Bata链接"); return $this->error("请填写正确的Beta链接");
} }
/*if($_POST['apply_status']==0&&$_POST['game_status']==1){ /*if($_POST['apply_status']==0&&$_POST['game_status']==1){
$this->error('游戏未审核不允许显示');//游戏添加完成 $this->error('游戏未审核不允许显示');//游戏添加完成

@ -118,14 +118,25 @@ class StatController extends ThinkController
public function multisort($records, $column, $type = 'asc') public function multisort($records, $column, $type = 'asc')
{ {
$records = index_by_column($column, $records); $length = count($records);
// var_dump($records);die(); for ($i = 0; $i < $length; $i ++) {
if ($type == 'asc') { for ($j = $i + 1; $j < $length; $j ++) {
ksort($records); if ($type == 'asc') {
} else { if ($records[$i][$column] > $records[$j][$column]) {
krsort($records); $temp = $records[$i];
$records[$i] = $records[$j];
$records[$j] = $temp;
}
} else if ($type == 'desc') {
if ($records[$i][$column] < $records[$j][$column]) {
$temp = $records[$i];
$records[$i] = $records[$j];
$records[$j] = $temp;
}
}
}
} }
return array_values($records); return $records;
} }
public function userretention() public function userretention()
@ -135,6 +146,16 @@ class StatController extends ThinkController
$end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end'); $end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end');
$dataOrder = I('data_order', ''); $dataOrder = I('data_order', '');
$gameId = I('game_id', 0); $gameId = I('game_id', 0);
$promoteId = I('promote_id', 0);
$orderType = 'asc';
$orderColumn = 'date';
if ($dataOrder != '')
{
$dataOrder = explode(',', $dataOrder);
$orderType = $dataOrder[1];
$orderColumn = $dataOrder[0];
}
$status = true; $status = true;
$data = false; $data = false;
@ -171,7 +192,14 @@ class StatController extends ThinkController
} }
$data = $result['data']['records']; $data = $result['data']['records'];
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30]; $dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
$gameName = get_game_name($gameId);
$promoteName = '全部';
if ($promoteId) {
$promoteName = get_promote_account($promoteId);
}
foreach ($data as $key => $item) { foreach ($data as $key => $item) {
$item['promote_name'] = $promoteName;
$item['game_name'] = $gameName;
foreach ($dayList as $day) { foreach ($dayList as $day) {
if ($item['register_count'] > 0) { if ($item['register_count'] > 0) {
$item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100; $item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100;
@ -182,12 +210,15 @@ class StatController extends ThinkController
$data[$key] = $item; $data[$key] = $item;
} }
if ($dataOrder) { if ($dataOrder) {
$data = $this->multisort($data, $dataOrder); $data = $this->multisort($data, $orderColumn, $orderType);
} }
} else { } else {
$this->assign('error', $error); $this->assign('error', $error);
} }
$this->assign('data', $data);
$this->assign('order_type', $orderType);
$this->assign('order_column', $orderColumn);
$this->assign('data', $data); $this->assign('data', $data);
$this->meta_title = '留存统计'; $this->meta_title = '留存统计';
$this->display(); $this->display();

@ -11,6 +11,8 @@
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all"> <link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all"> <link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script> <script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/select2.min.js"></script>
</head> </head>
<style> <style>
html { html {
@ -19,6 +21,26 @@
body { body {
padding: 0px; padding: 0px;
} }
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
</style> </style>
<body> <body>
<div id="main" class="main" style="min-height: 342px;"> <div id="main" class="main" style="min-height: 342px;">
@ -134,6 +156,7 @@
<script> <script>
$(function(){ $(function(){
$(".select_gallery").select2();
//搜索功能 //搜索功能
$("#search").click(function(){ $("#search").click(function(){
console.log(222); console.log(222);

@ -430,14 +430,14 @@
</tr> </tr>
<tr> <tr>
<td class="l" >Bata版本链接</td> <td class="l" >Beta版本链接</td>
<td class="r" colspan="3"> <td class="r" colspan="3">
<input type="text" class="txt " name="beta_url" value="{$data['beta_url']}" placeholder="请输入Bata版本下载链接"> <input type="text" class="txt " name="beta_url" value="{$data['beta_url']}" placeholder="请输入Bata版本下载链接">
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="l">Bata版本是否开启</td> <td class="l">Beta版本是否开启</td>
<td class="r" > <td class="r" >
<span class="form_radio table_btn"> <span class="form_radio table_btn">
<label> <label>

@ -70,59 +70,47 @@
<!-- 数据列表 --> <!-- 数据列表 -->
<div class="data_list"> <div class="data_list">
<div class=""> <div class="">
<?php $noOrder = '<img src="__IMG__/up-down.png" width="13px">';?>
<table> <table>
<!-- 表头 --> <!-- 表头 -->
<thead> <thead>
<tr> <tr>
<th ><a class="paixu" data-order='date'>日期</a></th> <th ><a class="paixu" data-order='date'>日期 <?=$order_column=='date'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<th>游戏名称</th>
<th>渠道名称</th>
<th ><a class="paixu" data-order='register_count'>新增玩家 <?=$order_column=='register_count'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<if condition="$game_name neq ''"> <th ><a class="paixu" data-order='retention_day1'>1日留存 <?=$order_column=='retention_day1'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<th ><a class="paixu" data-order='retention_day2'>2日留存 <?=$order_column=='retention_day2'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<th>游戏名称</th> <th ><a class="paixu" data-order='retention_day3'>3日留存 <?=$order_column=='retention_day3'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
</if>
<if condition="$promote_name neq ''"> <th ><a class="paixu" data-order='retention_day4'>4日留存 <?=$order_column=='retention_day4'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<th>渠道名称</th>
</if>
<th ><a class="paixu" data-order='register_count'>新增玩家</a></th> <th ><a class="paixu" data-order='retention_day5'>5日留存 <?=$order_column=='retention_day5'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<th ><a class="paixu" data-order='retention_day1'>1日留存</a></th> <th ><a class="paixu" data-order='retention_day6'>6日留存 <?=$order_column=='retention_day6'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<th ><a class="paixu" data-order='retention_day2'>2日留存</a></th> <th ><a class="paixu" data-order='retention_day7'>7日留存 <?=$order_column=='retention_day7'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<th ><a class="paixu" data-order='retention_day3'>3日留存</a></th> <th ><a class="paixu" data-order='retention_day15'>15日留存 <?=$order_column=='retention_day15'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<th ><a class="paixu" data-order='retention_day4'>4日留存</a></th> <th ><a class="paixu" data-order='retention_day30'>30日留存 <?=$order_column=='retention_day30'?($order_type=='desc'?'▼':'▲'):$noOrder?></a></th>
<th ><a class="paixu" data-order='retention_day5'>5日留存</a></th>
<th ><a class="paixu" data-order='retention_day6'>6日留存</a></th>
<th ><a class="paixu" data-order='retention_day7'>7日留存</a></th>
<th ><a class="paixu" data-order='retention_day15'>15日留存</a></th>
<th ><a class="paixu" data-order='retention_day30'>30日留存</a></th>
</tr> </tr>
</thead> </thead>
<!-- 列表 --> <!-- 列表 -->
<tbody> <tbody>
<empty name="data" > <empty name="data" >
<tr> <tr>
<td colspan="11" class="text-center"><?= $error ? '<span style="color: #ff0000;">' . $error . '</span>': 'aOh! 暂时还没有内容!' ?></td> <td colspan="13" class="text-center"><?= $error ? '<span style="color: #ff0000;">' . $error . '</span>': 'aOh! 暂时还没有内容!' ?></td>
</tr> </tr>
<else /> <else />
<volist name="data" id="vo"> <volist name="data" id="vo">
<tr> <tr>
<td>{$vo.date}</td> <td>{$vo.date}</td>
<if condition="$game_name neq ''"> <td>{$vo.game_name}</td>
<td>{$game_name}</td> <td>{$vo.promote_name}</td>
</if>
<if condition="$promote_name neq ''">
<td>{$promote_name}</td>
</if>
<td>{$vo.register_count}</td> <td>{$vo.register_count}</td>
<?php if ($vo['register_count']>0):?> <?php if ($vo['register_count']>0):?>
<td>{$vo['retention_day1']}%</td> <td>{$vo['retention_day1']}%</td>
@ -229,10 +217,16 @@ $(function(){
$(".paixu").click(function(){ $(".paixu").click(function(){
var that=$(this); var that=$(this);
$data_order=that.attr('data-order'); $data_order=that.attr('data-order');
$order_type='{$userarpu_order}'; $order_type='{$order_type}';
$(".sortBy").attr('name','data_order'); if ($order_type == '' || $order_type == 'asc') {
$(".sortBy").attr('value',$data_order); $(".sortBy").attr('name', 'data_order');
$("#search").click(); $(".sortBy").attr('value', $data_order + ',desc');
$("#search").click();
} else if ($order_type=='desc') {
$(".sortBy").attr('name', 'data_order');
$(".sortBy").attr('value', $data_order + ',asc');
$("#search").click();
}
}); });
//回车自动提交 //回车自动提交
$('.jssearch').find('input').keyup(function(event){ $('.jssearch').find('input').keyup(function(event){

@ -985,6 +985,9 @@ class PromoteController extends BaseController
} else { } else {
$parent = $loginPromote; $parent = $loginPromote;
} }
if (C('PROMOTE_AUTO_AUDIT') == 1) {
$params['status'] = 1;
}
$promoteService = new PromoteService(); $promoteService = new PromoteService();
$result = $promoteService->checkAddPromote($params); $result = $promoteService->checkAddPromote($params);
if (!$result['status']) { if (!$result['status']) {

@ -133,10 +133,10 @@ class CommonController extends BaseController {
$this->respondError('用户不存在'); $this->respondError('用户不存在');
} }
//更新用户 //更新用户
$upres = $userApi->updatePassword($userInfo['id'], $user['password']); $upres = $userApi->updatePassword($userInfo['id'], $params['password']);
if($upres){ if($upres){
//自动登陆 //自动登陆
$userId = $userApi->login($user['account'], $user['password'],1); // $userId = $userApi->login($params['account'], $params['password'], 1);
$this->respondSuccess('修改成功'); $this->respondSuccess('修改成功');
}else{ }else{
@ -180,18 +180,18 @@ class CommonController extends BaseController {
} }
$data = [ $data = [
'account' => $account, 'account' => $account,
'password' => think_ucenter_md5($password, UC_AUTH_KEY), 'password' => think_ucenter_md5($password, UC_AUTH_KEY),
'phone' => $phone, 'phone' => $phone,
'head_img' =>'', 'head_img' => '',
'promote_id' => $promote_id, 'promote_id' => $promote_id,
'promote_account' =>get_promote_account($promote_id), 'promote_account' => get_promote_account($promote_id),
'register_way' => $register_way, 'register_way' => $register_way,
'register_type' => $register_type, 'register_type' => $register_type,
'register_ip' => get_client_ip(), 'register_ip' => get_client_ip(),
'parent_id'=>get_fu_id($promote_id), 'parent_id' => get_fu_id($promote_id),
'parent_name'=>get_parent_name($promote_id), 'parent_name' => get_parent_name($promote_id),
'register_time'=>time(), 'register_time' => time(),
'check_time' => time(), 'check_time' => time(),
]; ];

Loading…
Cancel
Save