推广后台功能开发

master
ELF 4 years ago
parent 81fbe02e9f
commit 3f92608468

@ -1950,8 +1950,9 @@ class DownloadController extends BaseController {
$this->success('添加下载成功', U('listsIndex'));
}
//玩家角色
public function userRoles_data_export() {
$gameId = I('relation_game_id', 0);
public function userRoles_data_export()
{
$relationGameId = I('relation_game_id', 0);
$serverId = I('server_id', 0);
$isSelf = I('is_self', 0);
$roleName = I('role_name', '');
@ -1961,65 +1962,30 @@ class DownloadController extends BaseController {
$roleLevelBegin = intval(I('role_level_begin', 0));
$roleLevelEnd = intval(I('role_level_end', 0));
$headmanPromoteId = I('headman_promote_id', 0);
$playTime = I('create_time', '');
$promote = $this->getLoginPromote();
if (empty($playTime)) {
$createTime = I('create_time', date('Y-m-d') . ' 至 ' . date('Y-m-d', time()-7*24*3600));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
if (empty($createTime)) {
$this->error('请选择创建时间');
}
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
$childPromoteIds = '';
if(empty($rs)) {
$map['tab_user.promote_id'] = PID;
}else {
foreach ($rs as $rsKey => $rsValue) {
$id = $rsValue['id'];
$childPromoteIds .= $id.',';
}
$childPromoteIds = rtrim($childPromoteIds, ',');
$childPromoteIds .= ',' . PID;
$map['promote_id'] = ['in', $childPromoteIds];
}
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$map2[] = [
'_logic' => 'or',
'id' => $queryPromote['id'],
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
];
$ids = M('promote', 'tab_')->where($map2)->getField('id', true);
if(empty($ids)) {
$ids = array();
}
if(empty($levelPromote)) {
array_push($ids,PID);
}
//array_push($ids,$queryPromote['id']);
if (!empty($ids)) {
$map['promote_id'] = ['in',$ids];
}else {
$map['_string'] = '1<>1';
}
if ($gameId != 0 || $sdkVersion != 0) {
if ($gameId != 0) {
$gameMap['relation_game_id'] = $gameId;
}
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
if(empty($gameId1)) {
$gameId1 = [-100];
}
$map['game_id'] = ['in', $gameId1];
$promoteService = new PromoteService();
$subInSql = $promoteService->subInSql($queryPromote);
$map = [];
$map['_string'] = '1=1';
$map['_string'] .= ' and role.promote_id in (' . $subInSql . ')';
if ($relationGameId != 0 || $sdkVersion != 0) {
$gameIds = gameSearch($relationGameId, $sdkVersion);
$map['game_id'] = ['in', $gameIds];
}
if ($serverId != 0) {
$map['serverId'] = $serverId;
$map['server_id'] = $serverId;
}
if ($roleName != '') {
$map['role_name'] = ['like', '%' . $roleName . '%'];
@ -2027,9 +1993,6 @@ class DownloadController extends BaseController {
if ($userAccount != '') {
$map['user_account'] = ['like', '%' . $userAccount . '%'];
}
if ($sdkVersion != 0) {
$map['sdk_version'] = $sdkVersion;
}
if ($roleLevelBegin != 0 && $roleLevelEnd == 0) {
$map['role_level'] = ['egt', $roleLevelBegin];
} elseif ($roleLevelEnd != 0 && $roleLevelBegin == 0) {
@ -2037,37 +2000,46 @@ class DownloadController extends BaseController {
} elseif ($roleLevelEnd != 0 && $roleLevelBegin != 0) {
$map['role_level'] = ['between', [$roleLevelBegin, $roleLevelEnd]];
}
if ($playTime != '') {
$playTimeRow = explode(' 至 ', $playTime);
$playTimeBegin = 0;
$playTimeEnd = 0;
if (count($playTimeRow) == 2) {
$playTimeBegin = strtotime($playTimeRow[0] . ' 00:00:00');
$playTimeEnd = strtotime($playTimeRow[1] . ' 23:59:59');
if ($createTime != '') {
$createTimeRow = explode(' 至 ', $createTime);
$createTimeBegin = 0;
$createTimeEnd = 0;
if (count($createTimeRow) == 2) {
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[1] . ' 23:59:59');
} else {
$playTimeBegin = strtotime($playTimeRow[0] . ' 00:00:00');
$playTimeEnd = strtotime($playTimeRow[0] . ' 23:59:59');
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[0] . ' 23:59:59');
}
if (($playTimeEnd - $playTimeBegin) > 31 * 24 * 3600) {
$this->error('时间范围不能超过31天');
if (($createTimeEnd - $createTimeBegin) > 7*24*3600) {
$this->error('时间范围不能超过7天');
}
$map['create_time'] = ['between', [$playTimeBegin, $playTimeEnd]];
$map['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
}
if ($isSelf) {
$map['promote_id'] = $queryPromote['id'];
} else {
if ($headmanPromoteId != 0) {
$map['promote_id'] = $headmanPromoteId;
}
if ($promoteId != 0) {
$map['promote_id'] = $promoteId;
}
$orderBy = 'create_time desc';
$sortNameData = ['login_time', 'create_time', 'role_level', 'register_time', 'role.promote_account'];
if (!empty($sortName)) {
if (in_array($sortName, $sortNameData)) {
$desc = ' desc';
$asc = ' asc';
if ($lastSortName != $sortName) {
$sortString = $desc;
$sort = 1;
} else {
$sortString = ($sort == 1) ? $desc : $asc;
}
$orderBy = $sortName . $sortString;
}
}
$conditions = json_encode($map,TRUE);
$addtime = time();
$data = [
$conditions = json_encode(['map' => $map, 'order' => $orderBy], true);
$addtime = time();
$data = [
'logid' => 'js_'.time(),
'promote_id' => PID,
'type' => '/Home/Query/userRoles',
@ -2076,13 +2048,12 @@ class DownloadController extends BaseController {
'addtime' => $addtime,
'begintime' => 0,
'content' => '',
'conditions' =>$conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
// $this->ajaxReturn(array("status" => -1, "msg" => "添加导出日志失败", 'ret' => $res));
$this->error('添加下载失败');
}
'conditions' => $conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
$this->error('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
@ -2195,7 +2166,7 @@ class DownloadController extends BaseController {
$dataname = $downloadStatus[0]['dataname'];
$conditions = $downloadStatus[0]['conditions'];
$map = array();
foreach (json_decode($conditions,FALSE) as $key => $value) {
foreach (json_decode($conditions, FALSE) as $key => $value) {
if($value !== 0 && $value !== "" ) {
$map[$key] = $value;
}
@ -2938,7 +2909,7 @@ public function iosDetailExcelInfo($id,$map) {
}
//玩家角色excel信息
public function userRolesExcelInfo($id,$map) {
public function userRolesExcelInfo($id, $map) {
$xlsName = "角色查询";
$xlsCell = array(
array('user_account','玩家账号'),
@ -2957,16 +2928,35 @@ public function iosDetailExcelInfo($id,$map) {
array('create_time','创建时间'),
);
$records = recordPromoteLogs('数据管理','角色查询导出');
$model = M('user_play_info','tab_');
$data = $model->field('user_id,user_account,promote_account,game_name,server_name,role_name,role_level,create_time,play_time')->where($map)->order('create_time desc')->select();
$users = [];
if (count($data) > 0) {
$userIds = array_column($data, 'user_id');
$users = M('user', 'tab_')->field(['id', 'register_time', 'login_time', 'register_ip', 'login_ip', 'device_number'])->where(['id' => ['in', $userIds]])->select();
$users = index_by_column('id', $users);
}
$map = json_decode(json_encode($map), true);
$columns = [
'user_account',
'role.promote_account',
'role.game_name',
'user.device_number',
'user.register_time',
'user.register_ip',
'user.login_time',
'user.login_ip',
'role.server_name',
'role.sdk_version',
'role.role_name',
'role.role_level',
'role.create_time',
'role.play_time',
'role.play_ip'
];
$data = M('user_play_info', 'tab_')
->field($columns)
->alias('role')
->join('tab_user user on role.user_id = user.id')
->where($map['map'])
->order($map['order'])
->select();
$xlsData = [];
foreach ($data as $key1 => $value1) {
$value1['user_account'] = $this->encryption($value1['user_account']);
@ -2975,20 +2965,8 @@ public function iosDetailExcelInfo($id,$map) {
} else {
$value1['create_time'] = date('Y-m-d H:i:s', $value1['create_time']);
}
if (isset($users[$value1['user_id']])) {
$user = $users[$value1['user_id']];
$value1['register_time'] = date('Y-m-d H:i:s', $user['register_time']);
$value1['login_time'] = date('Y-m-d H:i:s', $user['login_time']);
$value1['register_ip'] = $user['register_ip'];
$value1['login_ip'] = $user['login_ip'];
$value1['device_number'] = $user['device_number'];
} else {
$value1['register_time'] = '--';
$value1['login_time'] = '--';
$value1['register_ip'] = '--';
$value1['login_ip'] = '--';
$value1['device_number'] = '--';
}
$value1['register_time'] = date('Y-m-d H:i:s', $value1['register_time']);
$value1['login_time'] = date('Y-m-d H:i:s', $value1['login_time']);
$xlsData[] = $value1;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);

@ -8,6 +8,7 @@ use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository;
use Base\Repository\UserRepository;
use Base\Service\PromoteService;
use GuzzleHttp\Client;
/**
* 前台首页控制器
@ -1681,7 +1682,10 @@ class QueryController extends BaseController
$roleLevelBegin = intval(I('role_level_begin', 0));
$roleLevelEnd = intval(I('role_level_end', 0));
$headmanPromoteId = I('headman_promote_id', 0);
$createTime = I('create_time', '');
$createTime = I('create_time', date('Y-m-d') . ' 至 ' . date('Y-m-d', time()-7*24*3600));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
@ -1692,20 +1696,7 @@ class QueryController extends BaseController
$map = [];
$map['_string'] = '1=1';
$map['_string'] .= ' and promote_id in (' . $subInSql . ')';
/* $map[] = [
'_logic' => 'or',
'id' => $queryPromote['id'],
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$map = [];
if (count($ids) > 0) {
$map = ['promote_id' => ['in', $ids]];
} else {
$map['_string'] = '1<>1';
} */
$map['_string'] .= ' and role.promote_id in (' . $subInSql . ')';
if ($relationGameId != 0 || $sdkVersion != 0) {
$gameIds = gameSearch($relationGameId, $sdkVersion);
@ -1743,26 +1734,69 @@ class QueryController extends BaseController
if ($isSelf) {
$map['promote_id'] = $queryPromote['id'];
}
$query = M('user_play_info', 'tab_')->where($map)->order('create_time desc');
list($records, $pagination, $count) = $this->paginate($query);
$countRow = M('user_play_info', 'tab_')->field(['count(distinct user_id) user_count'])->where($map)->find();
$orderBy = 'create_time desc';
$sortNameData = ['login_time', 'create_time', 'role_level', 'register_time', 'role.promote_account'];
if (!empty($sortName)) {
if (in_array($sortName, $sortNameData)) {
$desc = ' desc';
$asc = ' asc';
if ($lastSortName != $sortName) {
$sortString = $desc;
$sort = 1;
} else {
$sortString = ($sort == 1) ? $desc : $asc;
}
$orderBy = $sortName . $sortString;
}
}
$columns = [
'user_account',
'role.promote_account',
'role.game_name',
'user.device_number',
'user.register_time',
'user.register_ip',
'user.login_time',
'user.login_ip',
'role.server_name',
'role.sdk_version',
'role.role_name',
'role.role_level',
'role.create_time',
'role.play_time',
'role.play_ip'
];
$query = M('user_play_info', 'tab_')
->field($columns)
->alias('role')
->join('tab_user user on role.user_id = user.id')
->where($map)
->order($orderBy);
$countQuery = clone $query;
list($records, $pagination, $count) = $this->paginate($query->order($orderBy));
$countRow = $countQuery->field(['count(distinct user_id) user_count'])->find();
$countMap = $map;
$subSql = M('user', 'tab_')->field('id')->where(['is_repeat' => 0])->select(false);
$countMap['_string'] .= ' and user_id in (' . $subSql . ')';
$uniqueCountRow = M('user_play_info', 'tab_')->field(['count(distinct user_id) user_count, count(*) count'])->where($countMap)->find();
$map['_string'] = str_replace('role.promote_id', 'promote_id', $map['_string']) . ' and user_id in (' . $subSql . ')';
$uniqueCountRow = M('user_play_info', 'tab_')->field(['count(distinct user_id) user_count, count(*) count'])->where($map)->find();
$users = [];
/* $users = [];
if (count($records) > 0) {
$userIds = array_column($records, 'user_id');
$users = M('user', 'tab_')->field(['id', 'register_time', 'login_time', 'register_ip', 'login_ip', 'device_number'])->where(['id' => ['in', $userIds]])->select();
$users = index_by_column('id', $users);
}
} */
// var_dump($records);die();
foreach ($records as $key => $value) {
//订单隐藏算法
//隐藏算法
$orderLen = strlen($value['user_account']);
$strLen = 3;
$hideChar = '';
@ -1780,7 +1814,10 @@ class QueryController extends BaseController
}
$records[$key]['user_account'] = substr($value['user_account'], 0, $strLen) . $hideChar . substr($value['user_account'], $orderLen - $strLen);
if (isset($users[$value['user_id']])) {
$records[$key]['register_time'] = date('Y-m-d', $value['register_time']) . '<br>' . date('H:i:s', $value['register_time']);
$records[$key]['login_time'] = date('Y-m-d', $value['login_time']) . '<br>' . date('H:i:s', $value['login_time']);
/* if (isset($users[$value['user_id']])) {
$user = $users[$value['user_id']];
$records[$key]['register_time'] = date('Y-m-d', $user['register_time']) . '<br>' . date('H:i:s', $user['register_time']);
$records[$key]['login_time'] = date('Y-m-d', $user['login_time']) . '<br>' . date('H:i:s', $user['login_time']);
@ -1793,7 +1830,7 @@ class QueryController extends BaseController
$records[$key]['register_ip'] = '--';
$records[$key]['login_ip'] = '--';
$records[$key]['device_number'] = '--';
}
} */
}
$games = get_promote_serach_game();
@ -1801,11 +1838,13 @@ class QueryController extends BaseController
$this->assign('user_count', $countRow['user_count']);
$this->assign('unique_user_count', $uniqueCountRow['user_count']);
$this->assign('unique_count', $uniqueCountRow['count']);
$this->assign('sort', $sort);
$this->assign('setdate', date('Y-m-d', $nowTime));
$this->assign('games', $games);
$this->assign('records', $records);
$this->assign('pagination', $pagination);
$this->assign('count', $count);
$this->assign('createTime', $createTime);
$this->display('userRoles');
}
@ -2772,4 +2811,143 @@ class QueryController extends BaseController
$this->assign('initEndTime', $initEndTime);
$this->display();
}
public function userretention()
{
$dataOrder = I('data_order', '');
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$start = '';
$end = '';
$timeRangeRow = explode(' 至 ', $timeRange);
if (count($timeRangeRow) == 2) {
$start = $timeRangeRow[0];
$end = $timeRangeRow[1];
} else {
$start = $timeRangeRow[0];
$end = $timeRangeRow[0];
}
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$orderType = 'asc';
$orderColumn = 'date';
if ($dataOrder != '')
{
$dataOrder = explode(',', $dataOrder);
$orderType = $dataOrder[1];
$orderColumn = $dataOrder[0];
}
$status = true;
$data = false;
$error = '';
if ($baseGameId == 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;
}
$searchGameId = 0;
if ($status) {
$baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find();
$gameIds = [];
if ($deviceType) {
$searchGameId = $deviceType == 'android' ? $baseGame['android_game_id'] : $baseGame['ios_game_id'];
$gameIds[] = $searchGameId;
} else {
$gameIds = [$baseGame['android_game_id'], $baseGame['ios_game_id']];
}
$client = new Client([
'base_uri' => C('TASK_URL'),
'timeout' => 10.0,
]);
$response = $client->post('/statistics/player-retention', [
'verify' => false,
'form_params' => [
'start_time' => $start,
'end_time' => $end,
'promote_id' => $queryPromote['id'],
'game_ids' => $gameIds,
]
]);
$result = (string)$response->getBody();
$result = json_decode($result, true);
if (!$result) {
$this->assign('error', '数据请求异常!');
}
$data = $result['data']['records'];
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
$gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name'];
$promoteName = '全部';
if ($promoteId) {
$promoteName = get_promote_account($promoteId);
}
foreach ($data as $key => $item) {
$item['promote_name'] = $promoteName;
$item['game_name'] = $gameName;
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;
}
if ($dataOrder) {
$data = $this->multisort($data, $orderColumn, $orderType);
}
} else {
$this->assign('error', $error);
}
$baseGames = M('base_game', 'tab_')->select();
$this->assign('baseGames', $baseGames);
// $this->checkListOrCountAuthRestMap($map,[]);
$this->assign('order_type', $orderType);
$this->assign('order_column', $orderColumn);
$this->assign('data', $data);
$this->assign('start', $start);
$this->assign('end', $end);
$this->display();
}
public function gameData()
{
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$start = '';
$end = '';
$timeRangeRow = explode(' 至 ', $timeRange);
if (count($timeRangeRow) == 2) {
$start = $timeRangeRow[0];
$end = $timeRangeRow[1];
} else {
$start = $timeRangeRow[0];
$end = $timeRangeRow[0];
}
$query = M('game', 'tab_')->where();
list($games, $pagination, $count) = $this->paginate($query);
M('spend', 'tab_')->field(['game_id', 'server_id', 'sum(pay_amount) amount'])->where()->groupBy('game_id, server_id')->select();
M('user_play_info', 'tab_')->field(['game_id', 'server_id', 'count(*) count'])->where()->groupBy('game_id, server_id')->select();
}
}

@ -1,6 +1,7 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.3" rel="stylesheet">
<style>
.form-group {
float: left;
@ -10,6 +11,19 @@
line-height: 34px;
height: 34px;
}
.iconsort {
font-size: 1rem;
}
.normal_table tr .sort {
color: #145ccd;
cursor: pointer;
}
.trunk-search .select-time .txt {
width: 100px;
}
.title-cursor-pointer {
cursor: pointer;
}
</style>
</block>
<block name="body">
@ -52,7 +66,7 @@
</div>
<div class="form-group normal_space fr">
<label>创建时间:</label>
<input type="text" class="txt range-date" name="create_time" placeholder="创建时间" value="{:I('create_time')}" >
<input type="text" class="txt range-date" name="create_time" placeholder="创建时间" value="{$createTime}" >
</div>
<div class="form-group normal_space fr">
<label>玩家等级:</label>
@ -61,6 +75,9 @@
<input type="text" class="txt integer-input" name="role_level_end" style="width: 50px" value="{:I('role_level_end')}" >
</div>
<div class="form-group normal_space">
<input type="hidden" name="last_sort_name" id="last_sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort_name" id="sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort" id="sort" value="{$sort}">
<input type="submit" class="submit" id='submit' url="{:U('Query/userRoles','model='.$model['name'],false)}"
value="查询">
</div>
@ -72,20 +89,70 @@
<table class="table normal_table">
<tr class="odd">
<th>玩家帐号</th>
<th>推广账号</th>
<th class="sort" sort-name="role.promote_account" class="title-cursor-pointer">推广账号
<if condition="'role.promote_account' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th>游戏名称</th>
<th>设备码</th>
<th>注册时间</th>
<th class="sort" sort-name="register_time" class="title-cursor-pointer">注册时间
<if condition="'register_time' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th>注册IP</th>
<th>最近登录时间</th>
<th class="sort" sort-name="login_time" class="title-cursor-pointer">最近登录时间
<if condition="'login_time' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th>最近登录IP</th>
<th>平台</th>
<th>游戏区服</th>
<th>角色名</th>
<th>等级</th>
<th>创建时间</th>
<th class="sort" sort-name="role_level" class="title-cursor-pointer">等级
<if condition="'role_level' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="create_time" class="title-cursor-pointer">创建时间
<if condition="'create_time' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</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>
@ -189,21 +256,32 @@ $(function() {
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
$('#submit').click(function () {
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
$('.sort').click(function () {
var element = $(this);
var sortName = element.attr('sort-name');
var sort = parseInt($('#sort').val());
});
sort = (sort === 1) ? 2 : 1;
$('#sort').val(sort);
$('#sort_name').val(sortName);
$('#submit').trigger('click');
});
$('#submit').click(function () {
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
})
</script>
</block>

@ -0,0 +1,331 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.3" rel="stylesheet">
<style>
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.iconsort {
font-size: 1rem;
}
.normal_table tr .sort {
color: #145ccd;
cursor: pointer;
}
.trunk-search .select-time .txt {
width: 100px;
}
.title-cursor-pointer {
cursor: pointer;
}
</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 jssearch">
<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="baseGames" id="game">
<option value="{$game.id}" <if condition="I('game_id') eq $game['id']">selected</if>>{$game.name}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
<select id="sdk_version" name="device_type" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择设备类型</option>
<option value="1" <if condition="I('device_type') === '1'">selected</if>>Andriod</option>
<option value="2" <if condition="I('device_type') === '2'">selected</if>>IOS</option>
</select>
</div>
<include file="Public/promote_select" />
<div class="form-group normal_space fr">
<label>起止时间:</label>
<input type="text" class="txt range-date" name="time_range" placeholder="创建时间" value="{$start} 至 {$end}" >
</div>
<div class="form-group normal_space">
<input type="hidden" name="last_sort_name" id="last_sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort_name" id="sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort" id="sort" value="{$sort}">
<input type="submit" class="submit" id='submit' url="{:U('Query/userretention','model='.$model['name'],false)}"
value="查询">
</div>
</div>
<div class="trunk-list list_normal">
<table class="table normal_table">
<tr class="odd">
<th class="sort" sort-name="date" class="title-cursor-pointer">日期
<if condition="'date' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th>游戏名称</th>
<th>渠道名称</th>
<th class="sort" sort-name="register_count" class="title-cursor-pointer">新增玩家
<if condition="'register_count' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day1" class="title-cursor-pointer">1日留存
<if condition="'retention_day1' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day2" class="title-cursor-pointer">2日留存
<if condition="'retention_day2' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day3" class="title-cursor-pointer">3日留存
<if condition="'retention_day3' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day4" class="title-cursor-pointer">4日留存
<if condition="'retention_day4' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day5" class="title-cursor-pointer">5日留存
<if condition="'retention_day5' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day6" class="title-cursor-pointer">6日留存
<if condition="'retention_day6' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day7" class="title-cursor-pointer">7日留存
<if condition="'retention_day7' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day15" class="title-cursor-pointer">15日留存
<if condition="'retention_day15' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day30" class="title-cursor-pointer">30日留存
<if condition="'retention_day30' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
</tr>
<empty name="data">
<tr><td colspan="13" class="text-align: center;height: 45vh;"">
<?= $error ? '<span style="color: #ff0000;">' . $error . '</span>': '<img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>' ?></td>
</tr>
<else />
<volist name="data" id="vo">
<tr>
<td>{$vo.date}</td>
<td>{$vo.game_name}</td>
<td>{$vo.promote_name}</td>
<td>{$vo.register_count}</td>
<?php if ($vo['register_count']>0):?>
<td>{$vo['retention_day1']}%</td>
<td>{$vo['retention_day2']}%</td>
<td>{$vo['retention_day3']}%</td>
<td>{$vo['retention_day4']}%</td>
<td>{$vo['retention_day5']}%</td>
<td>{$vo['retention_day6']}%</td>
<td>{$vo['retention_day7']}%</td>
<td>{$vo['retention_day15']}%</td>
<td>{$vo['retention_day30']}%</td>
<?php else:?>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<?php endif;?>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" data-href="{:U('download/userRoles_data_export',array_merge(['xlsname'=>'ceshi'],I('get.')))}" class="ajax-get">导出</a>
<?php endif ;?>
{$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" src="__JS__/common.js"></script>
<script type="text/javascript">
$(function() {
setValue('row', '{:I("get.row",10)}');
var defaultDate = $('.range-date').val()
defaultDate = defaultDate == '' ? [] : defaultDate.split(' 至 ')
$('.range-date').flatpickr({
mode: 'range',
locale: 'zh',
dateFormat: "Y-m-d",
defaultDate: defaultDate,
})
$('.select_gallery').select2()
var gameId = $('#game-select').val();
var sdkVersion = $('#sdk_version').val();
var defaultServerId = $('#server-select').attr('data-server');
getGameServers(gameId, sdkVersion, defaultServerId)
$('#game-select,#sdk_version').on({
change: function name() {
gameId = $('#game-select').val();
sdkVersion = $('#sdk_version').val();
getGameServers(gameId, sdkVersion, 0);
}
});
function getGameServers(gameId, sdkVersion, defaultServerId) {
$.ajax({
url: "{:U('Query/getGameServers')}",
dataType: 'json',
data: {game_id: gameId, sdk_version: sdkVersion},
success: function(response) {
var options = '<option value="0">请选择区服</option>'
for (var i in response.data.servers) {
var server = response.data.servers[i]
var selected = ''
if (defaultServerId > 0 && server.id==defaultServerId) {
selected = 'selected'
}
options += '<option value="' + server.server_id + '"' + selected + '>' + server.server_name + '</option>'
}
$('#server-select').html(options)
$("#server-select").val(defaultServerId).trigger("change")
}
})
}
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
$('.sort').click(function () {
var element = $(this);
var sortName = element.attr('sort-name');
var sort = parseInt($('#sort').val());
sort = (sort === 1) ? 2 : 1;
$('#sort').val(sort);
$('#sort_name').val(sortName);
$('#submit').trigger('click');
});
$('#submit').click(function () {
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
})
</script>
</block>
Loading…
Cancel
Save