Merge branch 'feature/version_1028' of wmtx/platform into release

修改评级等功能
master
廖金灵 4 years ago committed by Gogs
commit 001b390afc

@ -6,6 +6,8 @@ use Base\Tool\GameCatClient;
class PromoteGradeService
{
const FOREVER_TIME = 300001;
public static $symbols = [
1 => '>=',
2 => '>',
@ -22,6 +24,14 @@ class PromoteGradeService
{
$id = $params['id'] ?? 0;
if (empty($params['base_game_id'])) {
throw new \Exception('请选择游戏');
}
$monthBegin = isset($params['month_begin']) && $params['month_begin'] ?
date('Ym', strtotime($params['month_begin'])) : 0;
$monthEnd = isset($params['month_end']) && $params['month_end'] ?
date('Ym', strtotime($params['month_end'])) : self::FOREVER_TIME;
$setting = null;
if ($id > 0) {
$setting = M('promote_grade_setting', 'tab_')->where(['id' => $id])->find();
@ -32,12 +42,16 @@ class PromoteGradeService
throw new \Exception('不允许修改其他公司的配置');
}
} else {
$setting = M('promote_grade_setting', 'tab_')->where(['company_id' => $promote['company_id']])->find();
if ($setting) {
throw new \Exception('您已经设置过了');
$count = $this->getRepeatRuleCount($promote['company_id'], $params['base_game_id'], $monthBegin, $monthEnd);
if ($count > 0) {
throw new \Exception('该游戏在相同时间段内已经设置规则');
}
}
if ($monthBegin > 0 && $monthEnd > 0 && $monthBegin > $monthEnd) {
throw new \Exception('规则截止时间不能大于规则开始时间');
}
$config = [];
$config['reach_level'] = $params['level'];
$config['grades'] = $this->sortGrades($params['grades']);
@ -45,6 +59,9 @@ class PromoteGradeService
$data = [];
$data['status'] = 1;
$data['base_game_id'] = $params['base_game_id'];
$data['month_begin'] = $monthBegin;
$data['month_end'] = $monthEnd;
$data['name'] = $params['name'];
$data['config'] = json_encode($config);
@ -75,9 +92,35 @@ class PromoteGradeService
return $grades;
}
public function getCurrentSetting($promote)
public function getTimeRepeatCondition($monthBegin, $monthEnd)
{
return ' ((month_begin >= ' . $monthBegin . ' AND month_begin <= ' . $monthEnd . ') OR (month_begin <= ' . $monthBegin . ' AND month_end >= ' . $monthEnd
. ') OR (month_end >= ' . $monthBegin . ' AND month_end <= ' . $monthEnd . '))';
}
public function getRepeatRuleCount($companyId, $baseGameId, $monthBegin, $monthEnd)
{
$conditions = [
'compnay_id' => $companyId,
'base_game_id' => $baseGameId,
];
$conditions['_string'] = $this->getTimeRepeatCondition($monthBegin, $monthEnd);
$count = M('promote_grade_setting', 'tab_')->where($conditions)->count();
return intval($count);
}
public function getCurrentSetting($promote, $baseGameId, $month)
{
return M('promote_grade_setting', 'tab_')->where(['status' => 1, 'company_id' => $promote['company_id']])->find();
$timeCondition = 'month_end >= ' . $month . ' and month_begin <= ' . $month;
return M('promote_grade_setting', 'tab_')
->where([
'status' => 1,
'company_id' => $promote['company_id'],
'base_game_id' => $baseGameId,
'_string' => $timeCondition
])
->find();
}
public function searchGradeByPromotes($promotes, $params, $setting)
@ -85,6 +128,7 @@ class PromoteGradeService
$config = json_decode($setting['config'], true);
$settingLevel = $config['reach_level'];
$month = $params['month'] ?? date('Y-m');
$baseGameId = $params['base_game_id'] ?? 0;
$promoteIds = array_column($promotes, 'id');
$beginTime = strtotime($month . '-01 00:00:00');
$endDate = date('Y-m-01 00:00:00', strtotime($month . '-01' . ' +1 month'));
@ -97,26 +141,44 @@ class PromoteGradeService
->where(['register_time' => ['between', $betweenTime], 'promote_id' => ['in', $promoteIds]])
->group('promote_id')
->select(false);
$baseGame = null;
if ($baseGameId > 0) {
$baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find();
}
$roleMap = [
'role_level' => ['egt', $settingLevel],
'create_time' => ['between', $betweenTime],
'promote_id' => ['in', $promoteIds],
'_string' => 'user_id in (' . $userSubSql . ')'
];
$spendMap = [
'pay_time' => ['between', $betweenTime],
'pay_status' => 1,
'promote_id' => ['in', $promoteIds],
'_string' => 'user_id in (' . $userSubSql . ')'
];
if ($baseGame) {
$roleMap['game_id'] = ['in', [$baseGame['android_game_id'], $baseGame['ios_game_id']]];
$spendMap['game_id'] = ['in', [$baseGame['android_game_id'], $baseGame['ios_game_id']]];
} else {
$roleMap['_string'] .= ' and 1=0';
$spendMap['_string'] .= ' and 1=0';
}
$accountItems = M('user_play_info', 'tab_')
->field(['promote_id', 'count(DISTINCT user_id) num'])
->where([
'role_level' => ['egt', $settingLevel],
'create_time' => ['between', $betweenTime],
'promote_id' => ['in', $promoteIds],
'_string' => 'user_id in (' . $userSubSql . ')'
])
->where($roleMap)
->group('promote_id')
->select();
$accountItems = index_by_column('promote_id', $accountItems);
$amountItems = M('spend', 'tab_')
->field(['promote_id', 'sum(pay_amount) amount'])
->where([
'pay_time' => ['between', $betweenTime],
'pay_status' => 1, 'promote_id' => ['in', $promoteIds],
'_string' => 'user_id in (' . $userSubSql . ')'
])
->where($spendMap)
->group('promote_id')
->select();
$amountItems = index_by_column('promote_id', $amountItems);

@ -1194,6 +1194,19 @@ class PromoteService {
return $groupName;
}
public function getVisibleBaseGames($promote)
{
$gameIds = $this->getVisibleGameIds($promote);
if (count($gameIds) == 0) {
return [];
}
return M('base_game', 'tab_')->where([
'_logic' => 'or',
'android_game_id' => ['in', $gameIds],
'ios_game_id' => ['in', $gameIds],
])->select();
}
public function getVisibleGameIds($promote)
{
/* $gameIds = M('game', 'tab_')->getField('id', true);

@ -13,6 +13,7 @@ use Base\Facade\Request;
use Base\Service\ApplyService;
use Base\Service\PromoteCoinRecordService;
use Base\Service\PromoteCoinTransferLogService;
use GuzzleHttp\Client;
/**
* @author elf<360197197@qq.com>
@ -1893,12 +1894,18 @@ class DownloadController extends BaseController {
public function promote_grade_export()
{
$month = I('month', date('Y-m'));
$month = $month ? $month : date('Y-m');
$baseGameId = I('base_game_id', 0);
$loginPromote = $this->getLoginPromote();
if ($baseGameId == 0) {
return $this->error('未选择游戏');
}
$promoteGradeService = new PromoteGradeService();
$setting = $promoteGradeService->getCurrentSetting($loginPromote);
$monthNumber = date('Ym', strtotime($month . '-01'));
$setting = $promoteGradeService->getCurrentSetting($loginPromote, $baseGameId, $monthNumber);
if (is_null($setting)) {
return $this->error('未设置评级规则');
return $this->error('该游戏在此月份未设置评级规则');
}
$parentId = I('parent_id', 0);
@ -1930,7 +1937,7 @@ class DownloadController extends BaseController {
$promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map)->select();
array_unshift($promotes, $parent);
$conditions = json_encode(['promotes' => $promotes, 'setting' => $setting, 'month' => $month], true);
$conditions = json_encode(['promotes' => $promotes, 'setting' => $setting, 'month' => $month, 'base_game_id' => $baseGameId], true);
$addtime = time();
$data1 = [
'logid' => 'pg_'.time(),
@ -1950,8 +1957,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 +1969,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 +2000,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 +2007,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,17 +2055,191 @@ 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('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
'conditions' => $conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
$this->error('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
}
public function userretention_data_export()
{
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$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);
$orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc';
if (!empty($sortName)) {
$orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc';
}
$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) {
$this->error($error);
}
}
$conditions = json_encode([
'base_game_id' => $baseGameId,
'start' => $start,
'end' => $end,
'promote_id' => $queryPromote['id'],
'device_type' => $deviceType,
'orderColumn' => $orderColumn,
'orderType' => $orderType,
], true);
$addtime = time();
$data = [
'logid' => 'ur_'.time(),
'promote_id' => PID,
'type' => '/Home/Query/userretention',
'dataname' => '用户留存率',
'status' => 0,
'addtime' => $addtime,
'begintime' => 0,
'content' => '',
'conditions' => $conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
$this->error('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
}
public function gameData_data_export()
{
$gameId = I('game_id', 0);
$serverId = I('server_id', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$start = '';
$end = '';
$timeRangeRow = explode(' 至 ', $timeRange);
if (count($timeRangeRow) == 2) {
$start = $timeRangeRow[0];
$end = $timeRangeRow[1];
} else {
$start = $timeRangeRow[0];
$end = $timeRangeRow[0];
}
$spendMap = ['pay_status' => 1, '_string' => '1=1'];
$roleMap = ['_string' => '1=1'];
$map = [];
$betweenTime = [strtotime($start . ' 00:00:00'), strtotime($start . ' 23:59:59')];
$spendMap['pay_time'] = ['between', $betweenTime];
$roleMap['create_time'] = ['between', $betweenTime];
$promoteService = new PromoteService();
$subInSql = $promoteService->subInSql($queryPromote);
$spendMap['_string'] .= ' and promote_id in (' . $subInSql . ')';
$roleMap['_string'] .= ' and promote_id in (' . $subInSql . ')';
if ($gameId > 0) {
$spendMap['game_id'] = $gameId;
$roleMap['game_id'] = $gameId;
$map['a.game_id'] = $gameId;
}
if ($serverId != '') {
$spendMap['server_id'] = $serverId;
$roleMap['server_id'] = $serverId;
$map['a.server_id'] = $serverId;
}
$orderBy = '';
$sortNameData = ['amount', 'count'];
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;
}
}
$spendSubSql = M('spend', 'tab_')->field(['game_id', 'server_id', 'sum(pay_amount) amount'])->where($spendMap)->group('game_id, server_id')->select(false);
$roleSubSql = M('user_play_info', 'tab_')->field(['game_id', 'server_id', 'count(*) count'])->where($roleMap)->group('game_id, server_id')->select(false);
$conditions = json_encode([
'spendSubSql' => $spendSubSql,
'roleSubSql' => $roleSubSql,
'map' => $map,
'orderBy' => $orderBy,
], true);
$addtime = time();
$data = [
'logid' => 'gd_'.time(),
'promote_id' => PID,
'type' => '/Home/Query/gameData',
'dataname' => '游戏分区数据汇总',
'status' => 0,
'addtime' => $addtime,
'begintime' => 0,
'content' => '',
'conditions' => $conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
$this->error('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
}
/**
* 数据汇总添加下载
* @author sunke
@ -2195,7 +2348,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;
}
@ -2291,6 +2444,12 @@ class DownloadController extends BaseController {
case "结算单明细":
$this->WithdrawOrderExcelInfo($id,$map);
break;
case "用户留存率":
$this->userretentionExcelInfo($id,$map);
break;
case "游戏分区数据汇总":
$this->gameDataExcelInfo($id,$map);
break;
default:
break;
}
@ -2938,7 +3097,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 +3116,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 +3153,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);
@ -4057,6 +4223,7 @@ public function iosDetailExcelInfo($id,$map) {
$promoteGradeService = new PromoteGradeService();
$records = $promoteGradeService->searchGradeByPromotes($map['promotes'], [
'month' => $map['month'],
'base_game_id' => $map['base_game_id']
], $map['setting']);
$xlsData = [];
@ -5060,5 +5227,154 @@ public function iosDetailExcelInfo($id,$map) {
$this->backSuccessExport($id);
}
public function multisort($records, $column, $type = 'asc')
{
$length = count($records);
for ($i = 0; $i < $length; $i ++) {
for ($j = $i + 1; $j < $length; $j ++) {
if ($type == 'asc') {
if ($records[$i][$column] > $records[$j][$column]) {
$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 $records;
}
public function userretentionExcelInfo($id,$map)
{
$xlsName = "用户留存率";
$xlsCell = array(
array('date','日期'),
array('game_name','游戏名称'),
array('promote_name','渠道名称'),
array('register_count','新增玩家'),
array('retention_day1', '1日留存'),
array('retention_day2', '2日留存'),
array('retention_day3', '3日留存'),
array('retention_day4', '4日留存'),
array('retention_day5', '5日留存'),
array('retention_day6', '6日留存'),
array('retention_day7', '7日留存'),
array('retention_day15', '15日留存'),
array('retention_day30', '30日留存'),
);
$records = recordPromoteLogs('数据管理', '用户留存率导出');
$map = json_decode(json_encode($map), true);
$baseGameId = $map['base_game_id'];
$start = $map['start'];
$end = $map['end'];
$queryPromoteId = $map['promote_id'];
$deviceType = $map['device_type'];
$orderColumn = $map['orderColumn'];
$orderType = $map['orderType'];
$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' => $queryPromoteId,
'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 ($orderColumn) {
$data = $this->multisort($data, $orderColumn, $orderType);
}
foreach ($data as $key => $item) {
foreach ($dayList as $day) {
if ($item['retention_day' . $day] === '--') {
} else {
$item['retention_day' . $day] .= '%';
}
}
$data[$key] = $item;
}
$this->exportExcel($xlsName, $xlsCell, $data, $id);
}
public function gameDataExcelInfo($id,$map)
{
$xlsName = "游戏分区数据汇总";
$xlsCell = array(
array('game_name','游戏名称'),
array('server_name','区服名称'),
array('count','创角数'),
array('amount', '消费金额'),
);
$records = recordPromoteLogs('数据管理', '游戏分区数据汇总');
$map = json_decode(json_encode($map), true);
$spendSubSql = $map['spendSubSql'];
$roleSubSql = $map['roleSubSql'];
$queryMap = $map['map'];
$orderBy = $map['orderBy'];
$query = M('server', 'tab_')->alias('a')
->field(['a.game_id', 'a.game_name', 'a.server_id', 'a.server_name', 'b.amount', 'c.count'])
->join('left join (' . $spendSubSql . ') b on a.game_id = b.game_id and a.server_id = b.server_id')
->join('left join (' . $roleSubSql . ') c on a.game_id = c.game_id and a.server_id = c.server_id')
->where($queryMap);
if ($orderBy) {
$query->order($orderBy);
}
$data = $query->select();
foreach ($data as $key => $item) {
$item['amount'] = floatval($item['amount']);
$item['count'] = intval($item['count']);
$data[$key] = $item;
}
$this->exportExcel($xlsName, $xlsCell, $data, $id);
}
}

@ -24,14 +24,9 @@ class PromoteGradeController extends BaseController
public function index($p = 1)
{
$month = I('month', date('Y-m'));
$month = $month ? $month : date('Y-m');
$baseGameId = I('base_game_id', 0);
$loginPromote = $this->getLoginPromote();
$promoteGradeService = new PromoteGradeService();
$setting = $promoteGradeService->getCurrentSetting($loginPromote);
if (is_null($setting)) {
return $this->error('未设置评级规则');
}
$parentId = I('parent_id', 0);
$promoteId = I('promote_id', 0);
$searchLevel = 0;
@ -51,6 +46,9 @@ class PromoteGradeController extends BaseController
$currentDisplay = '自己';
}
$searchLevel = $parent['level'] + 1;
$searchLevelName = $promoteService->getLevelName($searchLevel);
$subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'group_remark'])->where(['parent_id' => $parent['id']])->select();
$map = ['parent_id' => $parent['id']];
@ -58,34 +56,72 @@ class PromoteGradeController extends BaseController
$map['id'] = $promoteId;
}
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map);
list($promotes, $pagination, $count) = $this->paginate($query);
$promoteGradeService = new PromoteGradeService();
if (I('p', 1) == 1) {
array_unshift($promotes, $parent);
$error = '';
$status = true;
$setting = null;
$pagination = null;
if ($baseGameId == 0) {
$status = false;
$error = '请选择游戏';
} else {
$monthNumber = date('Ym', strtotime($month . '-01'));
$setting = $promoteGradeService->getCurrentSetting($loginPromote, $baseGameId, $monthNumber);
if (is_null($setting)) {
$status = false;
$error = '该游戏在此月份未设置评级规则';
}
}
$records = $promoteGradeService->searchGradeByPromotes($promotes, [
'month' => $month,
], $setting);
$records = [];
if ($status) {
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map);
list($promotes, $pagination, $count) = $this->paginate($query);
if (I('p', 1) == 1) {
array_unshift($promotes, $parent);
}
$records = $promoteGradeService->searchGradeByPromotes($promotes, [
'month' => $month,
'base_game_id' => $baseGameId
], $setting);
if (I('p', 1) == 1) {
$records[0]['current_display'] = $currentDisplay;
if (I('p', 1) == 1) {
$records[0]['current_display'] = $currentDisplay;
}
}
$this->meta_title = '团队评级';
$this->assign('month', $month);
$baseGames = $promoteService->getVisibleBaseGames($loginPromote);
$this->assign('baseGames', $baseGames);
$this->assign('error', $error);
$this->assign('prevParentId', $prevParentId);
$this->assign('searchLevelName', $searchLevelName);
$this->assign('subPromotes', $subPromotes);
$this->assign('parentId', $parentId);
$this->assign('records', $records);
$this->assign('month', $month);
$this->assign('pagination', $pagination);
$this->display();
}
private function getMonthRangeDisplay($monthBegin, $monthEnd)
{
if ($monthBegin == 0 && $monthEnd == 0) {
return '永久';
} elseif ($monthBegin == 0 && $monthEnd > 0) {
return '从前 至 ' . date('Y-m', strtotime($monthEnd . '01'));
} elseif ($monthBegin > 0 && $monthEnd == 0) {
return date('Y-m', strtotime($monthBegin . '01')) . ' 至 永久';
} else {
return date('Y-m', strtotime($monthBegin . '01')) . ' 至 ' . date('Y-m', strtotime($monthEnd . '01'));
}
}
public function settings()
{
$this->checkSettingPermission();
@ -93,6 +129,13 @@ class PromoteGradeController extends BaseController
$loginPromote = $this->getLoginPromote();
$items = M('promote_grade_setting', 'tab_')->where(['company_id' => $loginPromote['company_id']])->select();
$baseGameIds = array_column($items, 'base_game_id');
$itemBaseGames = [];
if (count($baseGameIds) > 0) {
$itemBaseGames = M('base_game', 'tab_')->where(['id' => ['in', $baseGameIds]])->select();
$itemBaseGames = index_by_column('id', $itemBaseGames);
}
$symbols = PromoteGradeService::$symbols;
$records = [];
@ -100,11 +143,16 @@ class PromoteGradeController extends BaseController
$i = 0;
$config = json_decode($item['config'], true);
$gradeCount = count($config['grades']) + 1;
$baseGame = $itemBaseGames[$item['base_game_id']] ?? null;
$baseGameName = $baseGame ? $baseGame['name'] : '--';
$monthRangeDisplay = $this->getMonthRangeDisplay($item['month_begin'], $item['month_end']);
if ($gradeCount == 1) {
$records[] = [
'id' => $item['id'],
'name' => $item['name'],
'game_name' => $baseGameName,
'grade_count' => $gradeCount,
'month_range' => $monthRangeDisplay,
'reach_level' => $config['reach_level'],
'grade_name' => $config['default_grade_name'],
'grade_value' => '全部'
@ -114,7 +162,9 @@ class PromoteGradeController extends BaseController
$records[] = [
'id' => $item['id'],
'name' => $item['name'],
'game_name' => $baseGameName,
'grade_count' => $gradeCount,
'month_range' => $monthRangeDisplay,
'reach_level' => $config['reach_level'],
'grade_name' => $config['default_grade_name'],
'grade_value' => ($firstGrade['symbol'] == 1 ? '<' : '<=') . $firstGrade['value']
@ -123,7 +173,9 @@ class PromoteGradeController extends BaseController
$records[] = [
'id' => $item['id'],
'name' => $item['name'],
'game_name' => $baseGameName,
'grade_count' => 0,
'month_range' => $monthRangeDisplay,
'reach_level' => $config['reach_level'],
'grade_name' => $grade['name'],
'grade_value' => $symbols[$grade['symbol']] . $grade['value']
@ -131,6 +183,10 @@ class PromoteGradeController extends BaseController
}
}
}
$promoteService = new PromoteService();
$baseGames = $promoteService->getVisibleBaseGames($loginPromote);
$this->assign('baseGames', $baseGames);
$this->assign('records', $records);
$this->display();
}
@ -138,6 +194,8 @@ class PromoteGradeController extends BaseController
public function setting()
{
$this->checkSettingPermission();
$loginPromote = $this->getLoginPromote();
$id = I('id', 0);
$setting = null;
if ($id > 0) {
@ -148,6 +206,10 @@ class PromoteGradeController extends BaseController
$setting['config'] = json_decode($setting['config'], true);
}
}
$promoteService = new PromoteService();
$baseGames = $promoteService->getVisibleBaseGames($loginPromote);
$this->assign('baseGames', $baseGames);
$this->assign('setting', $setting);
$this->display();
}

@ -8,6 +8,8 @@ use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository;
use Base\Repository\UserRepository;
use Base\Service\PromoteService;
use GuzzleHttp\Client;
use Base\Repository\GameRepository;
/**
* 前台首页控制器
@ -1681,7 +1683,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 +1697,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 +1735,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 +1815,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 +1831,7 @@ class QueryController extends BaseController
$records[$key]['register_ip'] = '--';
$records[$key]['login_ip'] = '--';
$records[$key]['device_number'] = '--';
}
} */
}
$games = get_promote_serach_game();
@ -1801,11 +1839,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 +2812,241 @@ class QueryController extends BaseController
$this->assign('initEndTime', $initEndTime);
$this->display();
}
public function multisort($records, $column, $type = 'asc')
{
$length = count($records);
for ($i = 0; $i < $length; $i ++) {
for ($j = $i + 1; $j < $length; $j ++) {
if ($type == 'asc') {
if ($records[$i][$column] > $records[$j][$column]) {
$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 $records;
}
public function userretention()
{
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$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);
$orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc';
if (!empty($sortName)) {
$orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc';
}
$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 ($orderColumn) {
$data = $this->multisort($data, $orderColumn, $orderType);
}
} else {
$this->assign('error', $error);
}
$baseGames = M('base_game', 'tab_')->select();
$this->assign('baseGames', $baseGames);
$this->assign('sortName', $sortName);
$this->assign('sort', $sort);
$this->assign('data', $data);
$this->assign('start', $start);
$this->assign('end', $end);
$this->display();
}
public function gameData()
{
$gameId = I('game_id', 0);
$serverId = I('server_id', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$start = '';
$end = '';
$timeRangeRow = explode(' 至 ', $timeRange);
if (count($timeRangeRow) == 2) {
$start = $timeRangeRow[0];
$end = $timeRangeRow[1];
} else {
$start = $timeRangeRow[0];
$end = $timeRangeRow[0];
}
$spendMap = ['pay_status' => 1, '_string' => '1=1'];
$roleMap = ['_string' => '1=1'];
$map = [];
$betweenTime = [strtotime($start . ' 00:00:00'), strtotime($start . ' 23:59:59')];
$spendMap['pay_time'] = ['between', $betweenTime];
$roleMap['create_time'] = ['between', $betweenTime];
$promoteService = new PromoteService();
$subInSql = $promoteService->subInSql($queryPromote);
$spendMap['_string'] .= ' and promote_id in (' . $subInSql . ')';
$roleMap['_string'] .= ' and promote_id in (' . $subInSql . ')';
if ($gameId > 0) {
$spendMap['game_id'] = $gameId;
$roleMap['game_id'] = $gameId;
$map['a.game_id'] = $gameId;
}
if ($serverId != '') {
$spendMap['server_id'] = $serverId;
$roleMap['server_id'] = $serverId;
$map['a.server_id'] = $serverId;
}
$spendSubSql = M('spend', 'tab_')->field(['game_id', 'server_id', 'sum(pay_amount) amount'])->where($spendMap)->group('game_id, server_id')->select(false);
$roleSubSql = M('user_play_info', 'tab_')->field(['game_id', 'server_id', 'count(*) count'])->where($roleMap)->group('game_id, server_id')->select(false);
$orderBy = '';
$sortNameData = ['amount', 'count'];
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;
}
}
$query = M('server', 'tab_')->alias('a')
->field(['a.game_id', 'a.game_name', 'a.server_id', 'a.server_name', 'b.amount', 'c.count'])
->join('left join (' . $spendSubSql . ') b on a.game_id = b.game_id and a.server_id = b.server_id')
->join('left join (' . $roleSubSql . ') c on a.game_id = c.game_id and a.server_id = c.server_id')
->where($map);
if ($orderBy) {
$query->order($orderBy);
}
list($records, $pagination, $count) = $this->paginate($query);
$gameRepository = new GameRepository();
$this->assign('games', $gameRepository->getChoiceGames());
$this->assign('servers', $gameRepository->getServersByGameId($gameId));
$this->assign('sort', $sort);
$this->assign('sortName', $sortName);
$this->assign('records', $records);
$this->assign('start', $start);
$this->assign('end', $end);
$this->assign('pagination', $pagination);
$this->display();
}
public function getServers()
{
$gameId = I('game_id', 0);
$gameRepository = new GameRepository();
$servers = $gameRepository->getServersByGameId($gameId);
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['servers' => $servers]]);
}
}

@ -39,6 +39,16 @@
</volist>
</select>
</div>
<div class="form-group normal_space">
<select name="base_game_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option>
<volist name="baseGames" id="baseGame">
<option ba-id="{$baseGame.id}" value="{$baseGame.id}" <if condition="I('base_game_id') == $baseGame['id']">selected</if>>
{$baseGame.name}
</option>
</volist>
</select>
</div>
<div class="form-group normal_space fr">
<input type="text" class="txt month-date" name="month" placeholder="月份" value="{$month}" >
</div>
@ -63,7 +73,9 @@
<th>操作</th>
</tr>
<empty name="records">
<tr><td colspan="14" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
<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="records" id="record" mod="2">
<tr data-id="{$record.id}" class="<eq name='mod' value='1'>odd</eq>">
@ -82,7 +94,7 @@
<td>{$record.amount}</td>
<td>
<?php if($record['current_display'] == '' && $record['level'] < 4):?>
<a href="{:U('PromoteGrade/index', ['parent_id' => $record['id'], 'month' => I('month', '')])}">查看下级</a>
<a href="{:U('PromoteGrade/index', ['parent_id' => $record['id'], 'base_game_id' => I('base_game_id', 0), 'month' => I('month', '')])}">查看下级</a>
<?php endif;?>
</td>
</tr>
@ -93,7 +105,7 @@
</div>
<div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" href="{:U('download/promote_grade_export',array_merge(['parent_id'=>$parentId,'month'=>$month],I('post.')))}" class="ajax-get">导出</a>
<a id="sch-btn" href="{:U('download/promote_grade_export',array_merge(['parent_id'=>$parentId,'month'=>$month, 'base_game_id' => I('base_game_id', 0)],I('post.')))}" class="ajax-get">导出</a>
<?php endif ;?>
{$pagination}
</div>

@ -61,6 +61,33 @@
<input type="text" class="name input-txt txt" name="name" value="<?= $setting['name'] ?? '' ?>" placeholder="请输入评级规则名称">
</td>
</tr>
<tr>
<td class="l">* 对应游戏:</td>
<td class="r">
<select id="baseGameId" name="base_game_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option>
<?php foreach($baseGames as $baseGame):?>
<option value="<?= $baseGame['id'] ?>" <?php if($baseGame['id'] == $setting['base_game_id']):?>selected<?php endif;?>>
<?= $baseGame['name'] ?>
</option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="l">规则开始月份:</td>
<td class="r">
<input type="text" class="txt month-date" name="month_begin" placeholder="规则开始月份" value="<?= $setting['month_begin'] == 0 ? '' : date('Y-m', strtotime($setting['month_begin'] . '01')) ?>" >
<span style="font-size: 12px; color: #F8AC59">仅可选月份</span>
</td>
</tr>
<tr>
<td class="l">规则截止月份:</td>
<td class="r">
<input type="text" class="txt month-date" name="month_end" placeholder="规则截止月份" value="<?= $setting['month_end'] == 0 ? '' : date('Y-m', strtotime($setting['month_end'] . '01')) ?>" >
<span style="font-size: 12px; color: #F8AC59">仅可选月份,不选则表示截止时间为永久</span>
</td>
</tr>
<?php $settingConfig = $setting ? $setting['config'] : null ?>
<tr>
<td class="l">* 玩家角色达标等级:</td>
@ -109,10 +136,18 @@
</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">
$(".select_gallery").select2();
var defaultDate = $('.month-date').val()
$('.month-date').flatpickr({
locale: 'zh',
dateFormat: "Y-m",
defaultDate: defaultDate,
})
$('#add-rule').on({
click: function () {
var html = '<div class="rule-item">'
@ -140,6 +175,9 @@
var id = form.find('input[name=id]').val()
var name = form.find('input[name=name]').val()
var level = form.find('input[name=level]').val()
var baseGameId = $('#baseGameId').val()
var monthBegin = form.find('input[name=month_begin]').val()
var monthEnd = form.find('input[name=month_end]').val()
var defaultGradeName = form.find('input[name=default_grade_name]').val()
$.ajax({
@ -150,7 +188,10 @@
name: name,
level: level,
default_grade_name: defaultGradeName,
grades: getGrades()
grades: getGrades(),
month_begin: monthBegin,
month_end: monthEnd,
base_game_id: baseGameId
},
success:function(res){
if(res.status == 1){

@ -35,6 +35,8 @@
<tr class="odd">
<th>ID</th>
<th style="width: 200px;">规则名称</th>
<th style="width: 200px;">规则所属游戏</th>
<th style="width: 200px;">规则有效期</th>
<th style="width: 200px;">当月注册玩家角色达标等级</th>
<th>系数值</th>
<th>等级名称</th>
@ -48,6 +50,8 @@
<?php if($record['grade_count'] > 0):?>
<td rowspan="<?=$record['grade_count']?>"><?=$record['id']?></td>
<td rowspan="<?=$record['grade_count']?>"><?=$record['name']?></td>
<td rowspan="<?=$record['grade_count']?>"><?=$record['game_name']?></td>
<td rowspan="<?=$record['grade_count']?>"><?=$record['month_range']?></td>
<td rowspan="<?=$record['grade_count']?>"><?=$record['reach_level']?></td>
<?php endif;?>
<td><?=$record['grade_value']?></td>

@ -75,6 +75,8 @@
<a href="{:U('Query/achievement')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq achievement '>active</if> ">团队/推广员业绩</a>
<!-- <a href="{:U('Query/promoteQuota')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq promoteQuota or ACTION_NAME eq quotaDtl) '>active</if> ">推广员指标</a> -->
<a href="{:U('Query/iosDownLoadData')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq iosDownLoadData or ACTION_NAME eq iosDownLoadData) '>active</if> ">IOS下载数统计</a>
<a href="{:U('Query/userretention')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq userretention) '>active</if> ">用户留存率</a>
<a href="{:U('Query/gameData')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq gameData) '>active</if> ">游戏分区数据汇总</a>
</div>
<?php endif;?>
<?php if ($canViewUserRecharge && $loginer['level'] == 1) :?>

@ -0,0 +1,218 @@
<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_id" name="game_id" class="reselect select_gallery">
<option game-id="0" value="">请选择游戏</option>
<?php foreach($games as $game):?>
<option game-id="<?=$game['id']?>" value="<?=$game['id']?>" <?php if($game['id'] == I('game_id')):?>selected="selected"<?php endif;?>>
<?=$game['game_name']?>
</option>
<?php endforeach;?>
</select>
</div>
<div class="form-group normal_space">
<span id="server_js">
<select id="server_id" name="server_id" class="reselect select_gallery" data-default="<?=I('server_id', '')?>">
<option server-id="0" value="">请选择区服</option>
<?php foreach($servers as $server):?>
<option server-id="<?=$server['server_id']?>" value="<?=$server['server_id']?>" <?php if($server['server_id'] == I('server_id')):?>selected="selected"<?php endif;?>>
<?=$server['server_name']?>
</option>
<?php endforeach;?>
</select>
</span>
</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/gameData','model='.$model['name'],false)}"
value="查询">
</div>
</div>
<div class="trunk-list list_normal">
<table class="table normal_table">
<tr class="odd">
<th>游戏名称</th>
<th>区服名称</th>
<th class="sort" sort-name="count" class="title-cursor-pointer">创角数
<if condition="'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="amount" class="title-cursor-pointer">消费金额
<if condition="'amount' == 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="13" class="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="vo">
<tr>
<td>{$vo.game_name}</td>
<td>{$vo.server_name}</td>
<td><?=intval($vo['count'])?></td>
<td><?=floatval($vo['amount'])?></td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" data-href="{:U('download/gameData_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()
$("#game_id").change(function () {
$.ajax({
url: "{:U('getServers')}",
type: "post",
data: { game_id: $("#game_id option:selected").attr('game-id') },
dataType: 'json',
success: function (result ) {
if (result.status == 1) {
var servers = result.data.servers
var str = "<option value=''>请选择区服</option>"
for (var i in servers){
str += "<option value='"+servers[i].server_id+"'>"+servers[i].server_name+"</option>"
}
$("#server_id").empty()
$("#server_id").append(str)
$("#server_id").select2()
}
}
})
})
$("#server_js").click(function (event) {
var game_id = $("#game_id").val();
if (game_id == 0) {
layer.msg('请先选择游戏');
}
});
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 () {
console.log('ssb')
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>

@ -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,295 @@
<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="">请选择设备类型</option>
<option value="android" <if condition="I('device_type') === 'android'">selected</if>>Andriod</option>
<option value="ios" <if condition="I('device_type') === 'ios'">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/userretention_data_export',array_merge(['xlsname'=>'ceshi'],I('get.')))}" class="ajax-get">导出</a>
<?php endif ;?>
</div>
</div>
<div class="page-explain promote-mychlid-explain">
<div class="trunk-content article border_normal">
</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 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>

@ -2674,4 +2674,10 @@ CREATE TABLE `tab_testing_game_setting` (
`create_time` int(11) NOT NULL DEFAULT '0',
`update_time` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='测试资源游戏设置';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='测试资源游戏设置';
ALTER TABLE `tab_promote_grade_setting`
ADD COLUMN `base_game_id` int(11) not NULL DEFAULT 0 COMMENT '游戏ID' AFTER `name`,
ADD COLUMN `month_begin` int(11) not NULL DEFAULT 0 COMMENT '规则截止月份' AFTER `base_game_id`,
ADD COLUMN `month_end` int(11) not NULL DEFAULT 0 COMMENT '规则开始月份' AFTER `month_begin`;
Loading…
Cancel
Save