Merge branch 'release-1.0.0' into dev

# Conflicts:
#	Application/Admin/Controller/access_data_foldline.txt
#	Data/update.sql
master
zhengchanglong 5 years ago
commit e08a2eb3ce

@ -194,6 +194,7 @@ function get_promote_list($select='') {
}
return $list;
}
/**
* [获取所有一级推广员]
* @return [type] [description]
@ -1541,4 +1542,141 @@ function getGameList($partner_id) {
return $data;
}
function getAdminData ($uid) {
$adminData = M('auth_group_access')
->field('data_empower_type,data_president')
->join('left join sys_auth_group on sys_auth_group_access.group_id=sys_auth_group.id')
->where(array('uid'=>$uid))->find();
$promoteData = M('promote','tab_')->field('id')->where(array('admin_id'=>$uid))->select();
$promoteData = implode(',',array_column($promoteData,'id'));
$adminData['data_president'] = $adminData['data_president'].','.$promoteData;
return $adminData;
}
/**
* 获取当前管理员有权限查看所有推广员id
* @return mixed|string 格式如;all-全部;1,2,3;为空表示都没有权限
*/
function getPowerPromoteIds()
{
//session已存在当前管理员可查看数据的推广员id,则直接返回权限有变化事删除此session
if (!empty(session('user_auth_promote_ids'))) {
return session('user_auth_promote_ids');
}
$userAuth = session('user_auth');
$promoteIds = 'all';
$userAuth['data_president']= trim($userAuth['data_president'], ",");
if (!empty($userAuth['data_empower_type'])) {//数据权限 1 全部 2 部分数据 3 自己底下的会长
//等于1默认全部数据不进行筛选
if (in_array($userAuth['data_empower_type'], [2, 3])) {
$promoteIds = '';
//自己创建的会长
$myPromote_ids = M('promote', 'tab_')
->field('GROUP_CONCAT(id) as promote_ids')
->where(['admin_id' => $userAuth['uid']])
->find();
$myPromote_ids = $myPromote_ids['promote_ids'];
if ($myPromote_ids) {
if ($userAuth['data_empower_type'] == 2) {//部分会长加上自己创建的会长
$userAuth['data_president'] .= "," . $myPromote_ids;
} elseif ($userAuth['data_empower_type'] == 3) {//自己创建的会长和底下推广员
$userAuth['data_president'] = $myPromote_ids;
}
}
if (!empty($userAuth['data_president'])) {//查询有权限查看的会长以及底下的推广员
$map = array();
//查询会长底下的推广员(首个斜杆之间的数字)
$where['SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,"/",2),"/",-1)'] = array('exp',"IN({$userAuth['data_president']})");
$where['id'] = array('in', $userAuth['data_president']);//会长本身
$where['_logic'] = 'or';
$map['_complex'] = $where;
$sqlResult = M('promote', 'tab_')
->field('GROUP_CONCAT(id) as promote_ids')
->where($map)
->find();
$promoteIds = $sqlResult['promote_ids'];
}
}
}
session('user_auth_promote_ids', $promoteIds);
return $promoteIds;
}
function setPowerPromoteIds(&$map, $column = 'promote_id') {
//为数据权限添加
$promoteIds = getPowerPromoteIds();
if (empty($promoteIds)) {
$map[$column] = -1;
} elseif ($promoteIds != 'all') {
if (isset($map[$column])) {
if (isset($map['_string'])) {//查询字段中已存在promote_id不覆盖此条件而处理
$map['_string'] .= " and $column in($promoteIds)";
} else {
$map['_string'] = " $column in($promoteIds)";
}
} else {
$map[$column] = array('in', $promoteIds);
}
}
}
function get_promote_listOther($select='') {
$promoteRoot = getPowerPromoteIds();
if ($promoteRoot) {
$map['id'] =array('in',$promoteRoot);
}
$list = M("Promote","tab_")->field('id,account,balance_coin')->where($map)->select();//where("status=1")->
if (empty($list)){return '';}
if($select==111){
$new['id']=-1;
$new['account']="全站用户";
array_unshift($list,$new);
}
return $list;
}
/**
* 渠道列表
* @param $type
* @return mixed
*/
function promote_listsOther($type){
if($type){
$map['level'] = $type;
} else{
$map = '';
}
$promoteRoot = getPowerPromoteIds();
if ($promoteRoot) {
$map['id'] =array('in',$promoteRoot);
}
$data = M('promote','tab_')->where($map)->select();
$items = M('PromoteBalanceCoin', 'tab_')->where(['game_id' => 0])->select();
$records = [];
foreach ($items as $item) {
$records[$item['promote_id']] = $item['num'];
}
foreach ($data as $key => $item) {
$item['common_coin'] = isset($records[$item['id']]) ? $records[$item['id']] : $item['balance_coin'];
$data[$key] = $item;
}
return $data;
}
function get_admin_listOther()
{
$nickname = session('user_auth')['username'];
$list= M("Member")->field('uid,nickname')->where("status=1 and nickname='{$nickname}'")->select();
if(empty($list)){return false;}
return $list;
}
?>

@ -177,6 +177,15 @@ class AjaxController extends ThinkController{
$this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>(new PromoteModel)->getPromotersByLevel($level)]);
}
public function getPromotersByLevelOther()
{
$level = I('level');
if (!$level) {
return $this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>[]]);
}
$this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>(new PromoteModel)->getPromotersByLevelOther($level)]);
}
public function getGameList($type=0, $sdk_type=0)
{
$game = M("game","tab_");

@ -160,7 +160,9 @@ class ApplyController extends ThinkController
$fields = "tab_apply.*,tab_game.ratio as game_ratio,tab_game.money as game_money";
$join = "LEFT JOIN tab_game ON tab_apply.game_id = tab_game.id";
$order = "id desc";
$data = $applyModel -> joinList($fields, $join, $map, $order);
//为数据权限添加
setPowerPromoteIds($map);
$data = $applyModel->joinList($fields, $join, $map, $order);
$this -> meta_title = '游戏分包列表';
$this -> assign('_page', $data['page']);
$listdata = $data['data'];

@ -438,4 +438,62 @@ class AuthManagerController extends AdminController{
}
}
public function dataempower() {
$auth_group = M('AuthGroup')->where( array('status'=>array('egt','0'),'module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) )
->getfield('id,id,title,rules');
// var_dump($auth_group);die();
$empower_type = M('AuthGroup')->field('data_empower_type')->where(array('id'=>$_GET['group_id']))->find();
// var_dump($empower_type);die();
$this->assign('data_empower_type', $empower_type['data_empower_type']);
$this->assign('auth_group', $auth_group);
$this->display();
}
public function dataEmpowerSave() {
$mid = I('id');
$gid = I('group_id');
$data_empower_type = I('data_empower_type');
$promoteData = I('promote_data');
// dump(json_decode($promoteData,true));
// var_dump($promoteData);die();
// str_replace("'valuie'","'id'");
if( empty($gid)||empty($data_empower_type) ){
$this->error('参数有误');
}
$AuthGroup = D('AuthGroup');
if( !$AuthGroup->find($gid)){
$this->error('用户组不存在');
}
if( $mid && !$AuthGroup->checkModelId($mid)){
$this->error($AuthGroup->error);
}
if ($data_empower_type == 2) {
$promoteData = implode(',',array_column(json_decode($promoteData,true),'value'));
} else {
$promoteData = '';
}
if ($AuthGroup->where("id = {$gid}")->save(array('data_empower_type'=>$data_empower_type,'data_president'=>$promoteData))) {
$this->success('操作成功',U('AuthManager/index'));
} else {
$this->error('操作失败');
}
}
function getRootPromote() {
$promoteData = M('promote','tab_')->field('id as value,account as title')->where(array('level'=>1,'chain'=>'/'))->select();
$data_president = M('AuthGroup')->field('data_president')->where(array('id'=>$_REQUEST['group_id']))->find();
$returnData = array('data_president'=>$data_president['data_president'],'list'=>$promoteData);
$this->ajaxReturn(json_encode($returnData));
}
}

@ -32,6 +32,22 @@ class BindRechargeRecordController extends ThinkController{
}elseif(!empty(I("time_end"))){
$map['create_time'] = ["LT",(strtotime(I("time_end"))+86400-1)];
}
// $promoteRoot = getPowerPromoteIds();
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// }
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
empty(I('pay_order_number')) || $map['pay_order_number'] = I('pay_order_number','');
$data = $model->getLists($map,"create_time desc",$p);
$this->assign("data",$data);

@ -19,6 +19,10 @@ class DeductBindRecordController extends ThinkController {
unset($_REQUEST['account']);
}
$extend['execute_id'] = session('user_auth')['uid'];
$map['execute_id'] = session('user_auth')['uid'];
$map['create_time'] = total(1,false);
$sum['to_day'] = D($model_name)->where($map)->sum('quantity');
$map['create_time'] = total(5,false);

@ -23,6 +23,17 @@ class DepositController extends ThinkController {
$map['pay_ip']=array('like','%'.trim($_REQUEST['pay_ip']).'%');
unset($_REQUEST['pay_ip']);
}
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
if(!isset($_REQUEST['promote_id'])){
}else if(isset($_REQUEST['promote_id']) && $_REQUEST['promote_id']==0){
@ -131,6 +142,7 @@ class DepositController extends ThinkController {
* 后台充值平台币(玩家)
*/
public function lists_sen(){
if(isset($_REQUEST['user_account'])){
$map['user_account']=array('like','%'.trim($_REQUEST['user_account']).'%');
unset($_REQUEST['user_account']);
@ -155,6 +167,9 @@ class DepositController extends ThinkController {
$map['create_time'] = ['LT',strtotime(I('end'))+86399];
unset($_REQUEST['end']);
}
$map['op_account']=session('user_auth')['username'];
if(isset($_REQUEST['op_account'])){
if($_REQUEST['op_account']=='全部'){
unset($_REQUEST['op_account']);

@ -89,6 +89,17 @@ class ExportController extends Controller
$map['role_name'] = array('like','%'.trim($_REQUEST['role_name']).'%');
unset($_REQUEST['role_name']);
}
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
if (isset($_REQUEST['promote_id'])) {
$queryStr = '';
if ($_REQUEST['promote_id'] == 0) {
@ -1818,34 +1829,31 @@ class ExportController extends Controller
$map = [];
if (isset($params['user_account'])) {
$map['tab_pay_info.user_account'] = $params['user_account'];
$map['user_account'] = $params['user_account'];
}
if (isset($params['extend'])) {
$map['tab_pay_info.extend'] = $params['extend'];
$map['extend'] = $params['extend'];
}
if (isset($params['game_name'])) {
$game_id = ['in', array_column(getGameByName($params['game_name'], $params['sdk_version']), 'id')];
$map['tab_pay_info.game_id'] = $game_id;
$game_id = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')];
$map['game_id'] = $game_id;
}
if (isset($params['server_name'])) {
$game_id = M('game', 'tab_')->where(['relation_game_name' => $params['game_name'],'sdk_version' => $params['sdk_version']])->getField('id');
$server_id = M('server', 'tab_')->where(['server_name' => $params['server_name'], 'game_id' => $game_id])->getField('server_num');
$map['tab_pay_info.server_id'] = $server_id;
$map['server_name'] = $params['server_name'];
}
if (isset($params['game_player_name'])) {
$map['tab_pay_info.game_player_name'] = $params['game_player_name'];
if (isset($params['user_nickname'])) {
$map['user_nickname'] = $params['user_nickname'];
}
if (isset($params['game_player_id'])) {
$map['tab_pay_info.game_player_id'] = $params['game_player_id'];
$map['game_player_id'] = $params['game_player_id'];
}
$startDate = empty($params['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $params['timestart'];
$endDate = empty($params['timeend']) ? date('Y-m-d') : $params['timeend'];
$startTime = strtotime($startDate);
$endTime = strtotime($endDate) + 86399;
$map['tab_pay_info.create_time'] = array('BETWEEN', [$startTime, $endTime]);
if (isset($params['promote_id'])) {
$promoteId = $params['promote_id'];
$map['create_time'] = array('BETWEEN', [$startTime, $endTime]);
if ($promoteId = I('promote_id')) {
if ($promoteId == 0) {
$map['promote_id'] = 0;
} else {
@ -1855,14 +1863,10 @@ class ExportController extends Controller
$map['promote_id'] = ['in', $promoteIds];
}
}
$data = M('pay_info', 'tab_')->field('tab_pay_info.id,tab_pay_info.user_account,extend,tab_pay_info.create_time,tab_pay_info.game_name,tab_pay_info.server_name,tab_pay_info.promote_account,tab_pay_info.order_id,tab_pay_info.game_player_id,tab_pay_info.game_player_name,price,tab_server.server_name')->join('tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id')->where($map)->order('tab_pay_info.id DESC')->select();
foreach($data as $k => $v) {
$data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
if(empty($v['extend'])) {
$data[$k]['extend'] = $v['order_id'];
}
$xlsData = M('pay_info', 'tab_')->where($map)->order('id DESC')->select();
foreach($xlsData as $k => $v) {
$xlsData[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
}
$xlsData = $data;
break;
case 22:
$xlsCell = array(

@ -98,7 +98,7 @@ class IndexChartSetController extends AdminController {
$this->ChartModel->where("date = '{$this->beginTime}'")->delete();
$reset = "reset and creat ";
}else{
echo ("{$this->date} 已统计,请勿重复 ".PHP_EOL);
echo ("{$this->date} 已统计,请勿重复提交".PHP_EOL);
return;
}
@ -269,11 +269,17 @@ class IndexChartSetController extends AdminController {
$spend = D('Spend');
$promote = D('Promote');
$allcount = array();
$allcount['user_count'] = $user->old();
$allcount['active_count'] =$user->active(['tab_user_login_record.login_time'=>['between',[mktime(0,0,0,date('m'),date('d')-7,date('Y')),mktime(0,0,0,date('m'),date('d'),date('Y'))-1]]]);
$allcount['player_count'] =$spend->player();
$allcount['money_sum'] =$spend->totalAmount();
$allcount['promote_sum'] =$promote->total();
$allcount['user_count'] = $user->old();//平台累计用户
$allcount['active_count'] =$user->active(['tab_user_login_record.login_time'=>['between',[mktime(0,0,0,date('m'),date('d')-7,date('Y')),mktime(0,0,0,date('m'),date('d'),date('Y'))-1]]]);//七日日活
$allcount['player_count'] =$spend->player();//累计付费用户
$allcount['money_sum'] =$spend->totalAmount();//累计充值
$allcount['promote_sum'] =$promote->total();//推广员总数
$allcount['game_count'] = M("game","tab_")->where("game_status = 1")->field("count(1) game_count")->find()['game_count'];//游戏接入数量
$allcount['android_gamesource_count'] = M("GameSource","tab_")->where("file_type = 1")->field("count(1) game_count")->find()['game_count'];//安卓游戏原包
$allcount['ios_gamesource_count'] = M("GameSource","tab_")->where("file_type = 2")->field("count(1) game_count")->find()['game_count'];//IOS游戏原包
$allcount['promote_user_count'] = $user->where("promote_id > 0 and puid = 0")->field("count(1) user_count")->find()['user_count'];//推广员注册用户
$allcount['promote_spend_sum'] = $spend->where("promote_id > 0 and pay_status = 1")->field("sum(pay_amount) pay_amount")->find()['pay_amount'];//推广员总充值
$this->adddata["all_count"] = json_encode($allcount);
}
public function createDb()

@ -11,7 +11,224 @@ class MemberController extends ThinkController
/**
*玩家列表信息
*/
public function user_info($p = 0)
public function user_info($p=0){
//设定默认时间
if(!array_key_exists("time_start",$_REQUEST) && I('type') != 2){
$this->redirect(ACTION_NAME, array('time_start' => date('Y-m-d',strtotime('-30 day')),"time_end"=>date('Y-m-d')));
}
//基础信息
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
//累计充值,账户平台币排序
$order = '';
if (I('key') == 1) {
if (I('balance_status') == 1) {
$order = 'balance,';
} elseif (I('balance_status') == 2) {
$order = 'balance desc,';
}
} else {
if (I('recharge_status') == 1) {
$order .= 'recharge_total,';
} elseif (I('recharge_status') == 2) {
$order .= 'recharge_total desc,';
}
}
$order .= 'tab_user.id desc';
//1条件筛选
$map = [];
$map['puid'] = array('eq', 0);
$map['is_platform'] = 0;
$havs=false;
//1.1 user表相关
if (isset($_REQUEST['user_id'])) {
$map['tab_user.id'] = $_REQUEST['user_id'];
}
if (isset($_REQUEST['account'])) {
$map['tab_user.account'] = ['like',I('account') . "%"];
}
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$map['tab_user.register_time'] = ['between', [strtotime(I('time_start')), strtotime(I('time_end')) + 86399]];
} elseif (isset($_REQUEST['time_start'])) {
$map['tab_user.register_time'] = ['GT', strtotime(I('time_start'))];
} elseif (isset($_REQUEST['time_end'])) {
$map['tab_user.register_time'] = ['LT', strtotime(I('time_end')) + 86399];
}
if (isset($_GET['register_way'])) {
$map['tab_user.register_type'] = $_GET['register_way'];
}else{
if (I('type', 1) == 1) {
$map['tab_user.register_type'] = ['in', [1, 2, 7]];
}else{
$map['tab_user.register_type'] = ['in', [0, 3, 4, 5, 6]];
}
}
if (isset($_REQUEST['status'])) {
$map['lock_status'] = $_REQUEST['status'];
}
if (isset($_REQUEST['viplevel'])) {
$havs = get_vip_level_limit('recharge_total', $_REQUEST['viplevel']);
}
//1.2 与游戏相关
$game_map = false;
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
$game_map = " and tab_user_play_info.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
}
if (isset($_REQUEST['server_name'])) {
$game_map = " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' ";
}
$promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//// var_dump($promoteRoot);die();
//
// if ($promoteRoot) {
// $map['tab_user.promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['tab_user.id'] = array('lt',1);
// }
setPowerPromoteIds($map,'tab_user.promote_id');
//1.3 与推广员相关
$promoterSelect = false;
if ($_REQUEST['promote_id'] != '') {
$promoterSelect = true;
$spendprom = '';
if ($_REQUEST['promote_id'] == 'UC') {
$map['tab_user.promote_account'] = 'UC用户';
} else if ($_REQUEST['promote_id'] == 0) {
$map['tab_user.promote_id'] = 0;
} else {
if ($promoteRoot) {
$promoteRoot = " and id IN({$promoteRoot})";
}
$promoter_ids = D("Promote")->where("(chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']})".$promoteRoot)->field('id')->select();
if ($promoter_ids) {
$map['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
$spendprom = " AND ss.promote_id IN (" . implode(',', array_column($promoter_ids, 'id')) . ") ";
}
}
}
//计算用户列表
$data = M("user","tab_")
->field("tab_user.id,`device_number`,`age_status`,`account`,`balance`,`gold_coin`,`alipay`,tab_user.promote_id,`register_type`,tab_user.promote_account,`register_time`,`lock_status`,`register_way`,`register_ip`,`login_time`,`check_status`,IFNULL(sum(ss.pay_amount), 0) AS recharge_total")
->where($map)
->group("tab_user.id")
->page($page, $row)
->order($order);
if($havs){
$data->having($havs);
}
if($game_map){
$data->join("
(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id
");
}
if($promoterSelect){
$data->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left");
}else{
$data->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left");
}
$data = $data->select();
if($havs){
//判断是否需要vip等级分类
$user_count = M("user","tab_")
->field("tab_user.id,IFNULL(sum(ss.pay_amount), 0) AS recharge_total")
->where($map)
->group("tab_user.id")
->having($havs);
if($game_map){
$user_count->join("
(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id
");
}
if($promoterSelect){
$user_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left");
}else{
$user_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left");
}
$user_count = $user_count->select(false);
$count = M()->table('(' . $user_count . ') as a ')->field("count(*) user_count,sum(a.recharge_total) recharge_total")->find();
$user_count = $count['user_count'];
$now_count = $count['recharge_total'];
}else{
//计算总人数
$user_count = M("user","tab_")
->field("count(*) user_count")
->where($map);
if($game_map){
$user_count->join("
(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id
");
}
$user_count = $user_count->find()['user_count'];
//计算累计充值总额
$now_count = M("user","tab_")
->field("IFNULL(sum(ss.pay_amount), 0) AS recharge_total")
->where($map);
if($game_map){
$now_count->join("
(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id
");
}
if($promoterSelect){
$now_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left");
}else{
$now_count->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1","left");
}
// dump($now_count->select(false));die();
$now_count = $now_count->find()['recharge_total'];
}
//如果存在推广员只计算所属的推广员充值记录
if($promoterSelect){
$maps = $map;
unset($maps['tab_user.promote_id']);
$history_count = M("user","tab_")
->field("IFNULL(sum(ss.pay_amount), 0) AS recharge_total")
->join("tab_spend AS ss ON ss.user_id = tab_user.id AND ss.pay_status = 1".$spendprom,"left")
->where($maps);
if($havs){
$history_count->having($havs);
}
if($game_map){
$history_count->join("(select user_id from tab_user_play_info where 1 $game_map group by tab_user_play_info.user_id) a ON a.user_id = tab_user.id");
}
$history_count = $history_count->find()['recharge_total'];
$this->assign('history_count', $history_count?:0);
}
$this->assign('user_count',$user_count);
$this->assign('now_count', $now_count?:0);
$page = set_pagination($user_count, $row);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('list_data', $data);
$this->display();
}
/**
* 用户列表旧版
*/
public function user_info2($p = 0)
{
$hav = '';
if ($_REQUEST['promote_id'] != '') {
@ -420,6 +637,7 @@ class MemberController extends ThinkController
public function role_list($p = 1, $user_id = '', $row = 10)
{
$limit = ($p - 1) * $row . ", $row";
$list = M("user_play_info", 'tab_')->where(['user_id' => $user_id])->limit($limit)->order('play_time desc')->select();
$count = M("user_play_info", 'tab_')->where(['user_id' => $user_id])->count();
$page = set_pagination($count, $row);
@ -812,6 +1030,17 @@ class MemberController extends ThinkController
$map['server_name'] = $_REQUEST['server_name'];
unset($_REQUEST['server_name']);
}
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
if (isset($_REQUEST['promote_id'])) {
$map['promote_id'] = $_REQUEST['promote_id'];
unset($_REQUEST['promote_id']);
@ -823,6 +1052,7 @@ class MemberController extends ThinkController
$count = M('UserLoginRecord','tab_')->field('user_id')->where($extend['map'])->group('user_id')->select(false);
$sql = "select count(user_id) as count from ({$count})t";
$count = M('UserLoginRecord','tab_')->query($sql);
// var_dump($sql);die();
$this->m_title = '登录记录';
$this->assign('user_count',$count[0]['count']);

@ -12,18 +12,8 @@ class MendController extends ThinkController {
public function lists($p=1){
$this->m_title = '推广补链';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find());
switch ($_GET['type']) {
case '':
case 1:
$this->mendList();
break;
default:
$this->recordList();
break;
}
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find());
$this->mendList();
}
public function mendList(){
@ -39,22 +29,77 @@ class MendController extends ThinkController {
$map['register_time'] = array('gt', 0);
$p = I('p');
$map['register_type'] = array('in','(0,1,2,3,4,5,6,7)');
//为数据权限添加
setPowerPromoteIds($map);
parent::lists("user",$p,$map);
}
public function recordList()
/**
* 补链记录
* @param integer $p 分页
* @param booble IS_POST post请求时为下一页ajax请求
* @param booble export 是否导出
* @return void
*/
public function recordList($p=1,$export=false)
{
if(isset($_REQUEST['account'])){
if ($_REQUEST['account']=='全部') {
unset($_REQUEST['account']);
}
$map['user_account']=array('like','%'.$_REQUEST['account'].'%');
unset($_REQUEST['account']);
$page = intval($p);
$page = $page ? $page : 1;
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
if(isset($_REQUEST['account'])) $map['user_account']=array('like','%'.$_REQUEST['account'].'%');
if(isset($_REQUEST['promote_account'])) $map['promote_account']=array('like','%'.$_REQUEST['promote_account'].'%');
if(isset($_REQUEST['promote_account_to'])) $map['promote_account_to']=array('like','%'.$_REQUEST['promote_account_to'].'%');
if(isset($_REQUEST['op_account'])) $map['op_account']=array('like','%'.$_REQUEST['op_account'].'%');
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$map['order_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
} elseif (isset($_REQUEST['time_start'])) {
$map['order_time'] = ['GT', strtotime($_REQUEST['time_start'])];
} elseif (isset($_REQUEST['time_end'])) {
$map['order_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
}
$p = I('p');
$this->assign('show_status',1);
parent::lists("Mend",$p,$map);
//为数据权限添加
setPowerPromoteIds($map);
$data = M("Mend","tab_")
->field("user_account,promote_account,pay_amount,promote_account_to,order_time,create_time,op_account,remark")
->where($map)
->order("create_time desc");
if($export){
$data = $data->select();
}else{
$data = $data->page($page, $row)->select();
}
//格式化信息
foreach ($data as $key => $value) {
$data[$key]['create_time'] = date("Y-m-d H:i:s",$value['create_time']);
$data[$key]['order_time'] = date("Y-m-d H:i:s",$value['order_time']);
}
if($export) db2csv($data,"推广员管理_推广补链_补链记录",["玩家账号","补链前渠道","补链前归属金额","补链后渠道","切分时间","补链时间","操作人员","备注"]);
if(IS_POST){
$page = set_pagination($_REQUEST['row_count'],$row);
$this->ajaxReturn(array(
"list_data"=>$data,
"page"=>$page
));
die();
}
$count = M("Mend","tab_")->where($map)->count();
$this->assign('row_count',$count);
$this->assign('list_data', $data);
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->display();
// parent::lists("Mend",$p,$map);
}
public function edit($id = null)
{
@ -73,6 +118,14 @@ class MendController extends ThinkController {
if ($_POST['order_time'] == '') {
$this->error('没有订单日期');
}
//判断是否已经结算
if(self::checkSettlement(strtotime($_POST['order_time']),$_POST['promote_id'])){
$this->error('在订单日期内含有已经结算的订单,无法补链');
}
if(self::checkPromote(strtotime($_POST['order_time']),$_POST['account'])){
$this->error('在订单日期内含有多个推广员,无法补链');
}
$create = $_REQUEST;
$create['order_time'] = date($create['order_time']);
$params = array(
@ -108,6 +161,34 @@ class MendController extends ThinkController {
$this->display();
}
}
private function checkSettlement($order_time,$prmote_id)
{
//判断是否已经结算,后台只会对会长进行结算
//获取会长信息
$Promote = M('promote','tab_');
$prmotedata = $Promote->field('chain')->find($prmote_id);
$chain = trim($prmotedata['chain'], '/');
if ($chain == '') {
$prmote_id = $prmote_id;
} else {
$prmote_id = explode('/', $chain)[0];
}
$jsres = M("Settlement","tab_")->where(array(
"total_money"=>array("GT",0),
"starttime"=>array("ELT",$order_time),
"endtime"=>array("EGT",$order_time),
"promote_id"=>$prmote_id
))->find();
if($jsres) return true;
return false;
}
//判断是否跨推广员进行补链
private function checkPromote($order_time,$account)
{
$res = M("Spend","tab_")->field("promote_id")->where(["pay_time"=>array("EGT",$order_time),"user_account"=>$account])->group("promote_id")->select();
if(count($res)>0) return true;
return false;
}
//补链详情
public function shiftInfo()
{

@ -0,0 +1,91 @@
<?php
namespace Admin\Controller;
/**
* 新功能之后还未来的急跑的脚本初始化数据
* @author chenzhi
*/
class OldCountController extends \Think\Controller
{
//超级签订单新增识别微信或者支付宝2019-12-11
public function gameSupersignPaywayInit()
{
$map = array(
"pay_status"=>1,
"pay_way"=>0
);
$GameSupersign = M("GameSupersign","tab_");
$dbres = $GameSupersign->field("id,trade_id")->where($map)->select();
$countdb = count($dbres);
if($countdb < 1){
die("No initialization required");
}
foreach ($dbres as $key => $value) {
$savedata = array(
"id"=>$value['id']
);
$tmp = (int)substr($value['trade_id'],0,4);
if($tmp > 3000){
$savedata['pay_way'] = 2; //微信
}else{
$savedata['pay_way'] = 1;//支付宝
}
$tres = $GameSupersign->save($savedata);
if($tres === false){
die("DB ERROR");
}
}
die("init ok");
}
/**
* mend表新增paymount字段用于统计补链前归属金额
*/
public function mendPayamountInit()
{
//获取符合条件的
$map = array("pay_amount"=>0);
$Mend = M("mend","tab_");
$Spend = M("Spend","tab_");
$Mend->where($map)->select();
$dbres = $Mend->field("id,user_account,promote_account,order_time,create_time")->where($map)->select();
$countdb = count($dbres);
if($countdb < 1) die("No initialization required");
echo "总需要统计数:{$countdb}".PHP_EOL;
foreach ($dbres as $key => $value) {
$savedata = array("id"=>$value['id']);
$saveflag = false;
//设置订单时间
$order_time = $value['order_time'];
if($value['order_time'] == 0){
$saveflag = true;
$savedata['order_time'] = $value['create_time'];
$order_time = $savedata['create_time'];
}
//获取金额
$smap = array(
"user_account"=>$value['user_account'],
"promote_account"=>$value['promote_account'],
"pay_time"=>array("LT",$order_time),
"pay_status"=>1
);
$pay_amount = $Spend->field("IFNULL(sum(pay_amount),0) pay_amount")->where($smap)->find()["pay_amount"];
if($pay_amount > 0){
$saveflag = true;
$savedata['pay_amount'] = $pay_amount;
}
if($saveflag){
$tres = $Mend->save($savedata);
if($tres === false){
die("DB ERROR");
}
}
if( $key % 20 == 0){
$j = (floor)($key/$countdb*100);
echo "当前进度:{$j}%".PHP_EOL;
}
}
die("init ok");
}
}

@ -44,6 +44,9 @@ class PlatformController extends ThinkController
$map['fgame_name'] = $_REQUEST['game_name'];
unset($_REQUEST['fgame_name']);
}
//为数据权限添加
setPowerPromoteIds($map);
$today = total(1);
$week = total(2);
$mounth = total(3);
@ -120,6 +123,9 @@ class PlatformController extends ThinkController
unset($_REQUEST['timeend']);
}
//为数据权限添加
setPowerPromoteIds($map);
// var_dump($_REQUEST);exit;
if (isset($_REQUEST['game_name']) && $_REQUEST['game_name'] != '') {
$map['game_id'] = $_REQUEST['game_name'];
@ -204,6 +210,12 @@ class PlatformController extends ThinkController
$map['register_way'] = $_REQUEST['register_way'];
unset($_REQUEST['register_way']);
}
$promoteRoot = getPowerPromoteIds();
if ($promoteRoot) {
$map['promote_id'] =array('in',$promoteRoot);
}
$today = total(1);
$week = total(2);
$mounth = total(3);
@ -282,6 +294,12 @@ class PlatformController extends ThinkController
$map['pay_way'] = array('in', $_REQUEST['pay_way']);
unset($_REQUEST['pay_way']);
}
$promoteRoot = getPowerPromoteIds();
if ($promoteRoot) {
$map['promote_id'] =array('in',$promoteRoot);
}
$map['pay_status'] = 1;
$today = total(1);
$week = total(2);
@ -375,8 +393,13 @@ class PlatformController extends ThinkController
$map['tp1.chain'] = '/';
}
//为数据权限添加
setPowerPromoteIds($map);
$data = M('promote', 'tab_')->alias('tp1')->field('tp1.account as promote_account,tp1.id, date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(u.id) as count,
$data = M('promote', 'tab_')->alias('tp1')
->field('tp1.account as promote_account,tp1.id,
date_format(FROM_UNIXTIME(register_time),"% ") AS time,
count(u.id) as count,
count(IF(register_time ' . $today . ',1,null)) as today,
count(IF(register_time ' . $week . ',1,null)) as week,
count(IF(register_time ' . $mounth . ',1,null)) as mounth')
@ -440,7 +463,7 @@ class PlatformController extends ThinkController
$this->display();
}
//TODO:
function promotepay_statistics($p = 0)
public function promotepay_statistics($p = 0)
{
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
@ -479,9 +502,12 @@ class PlatformController extends ThinkController
if (isset($_REQUEST['promote_id'])) {
$promote_map = "`chain` = '%/{$_REQUEST['promote_id']}/%' OR id = {$_REQUEST['promote_id']}";
}
$promote = M("promote","tab_")->field("id,account")->page($page,$row)->where($promote_map)->select();
$pcount = M("promote","tab_")->field("count(*) acount")->where($promote_map)->find()['acount'];
//为数据权限添加
setPowerPromoteIds($map);
$promote_map2 = array();
setPowerPromoteIds($promote_map2, 'id');
$promote = M("promote","tab_")->field("id,account")->page($page,$row)->where($promote_map)->where($promote_map2)->select();
$pcount = M("promote","tab_")->field("count(*) acount")->where($promote_map)->where($promote_map2)->find()['acount'];
// var_dump( $promote);
$data =array();

@ -0,0 +1,372 @@
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
namespace Admin\Controller;
use User\Api\UserApi as UserApi;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class PresidentIndexChartSetController extends AdminController {
public $beginTime;
public $endTime;
public $date;
public $nowdata;
public $UserModel;
public $ChartModel;
public $LoginModel;
public $SpendModel;
public $PromoteModel;
public $President_id;
public $President_data;
public $reset=false;
public function _initialize(){
//初始化
$this->UserModel =M("User","tab_");
$this->ChartModel =M("IndexChart","tab_");
$this->LoginModel =M("user_login_record","tab_");
$this->SpendModel =M("spend","tab_");
$this->PromoteModel =M("promote","tab_");
$this->nowdata =time();
$group_concat_max_len = M()->execute("SET SESSION group_concat_max_len = 4294967295");
echo "set group_concat_max_len ok,beging count".PHP_EOL;
if(I("reset")) $this->reset = true;
echo "<pre>";
}
/**
* 每日更新接口
*/
public function setChartCount()
{
$begin = date("Y-m-d",strtotime("-1 day"));
$this->setDateCount($begin);
}
public function setFreeDateCount($begin,$end='')
{
if($end == '') $end = $begin;
//判断日期格式
$patten = "/^\d{4}[\-](0?[1-9]|1[012])[\-](0?[1-9]|[12][0-9]|3[01])$/";
if (!preg_match($patten, $begin)) {
die("开始时间格式错误");
}
if (!preg_match($patten, $end)) {
die("结束时间格式错误");
}
if(strtotime($end) < strtotime($begin)){
die("结束时间不能比开始时间小");
}
if(strtotime($end)+86399 > time()){
die("结束时间不能包含今日");
}
if($begin == $end){
$this->setDateCount($begin);
}else{
$starttime = $begin?strtotime($begin):mktime(0,0,0,date('m'),date('d')-1,date('Y'));
$endtime = $end?strtotime($end)+86399:$starttime+86399;
$datelist = get_date_list($starttime,$endtime,1);
$countdate = count($datelist);
for($i=0;$i<$countdate;$i++){
$this->setDateCount($datelist[$i]);
}
}
}
//
public function setDateCount($date)
{
$this->date = $date;
$tarry = explode('-',$date);
$this->beginTime=mktime(0,0,0,$tarry[1],$tarry[2],$tarry[0]);
$this->endTime=mktime(0,0,0,$tarry[1],$tarry[2]-0+1,$tarry[0])-1;
set_time_limit(0);
$t1 = microtime(true);
//判断是否存在
$res = $this->ChartModel->where("date = '{$this->beginTime}'")->find();
$reset='';
if(!empty($res)){
if($this->reset){
$this->ChartModel->where("date = '{$this->beginTime}'")->delete();
$reset = "reset and creat ";
}else{
echo ("{$this->date} 已统计,请勿重复提交".PHP_EOL);
return;
}
}
$this->newUser();
$this->activeUser();
$this->payUser();
// $this->payMoney();
// $this->promoteNew();
// $this->allCount();
// $this->createDb();
dump($this->President_data);
$t2 = microtime(true);
echo ("{$this->date} {$reset}success runtime:".round($t2-$t1,3).'s'.PHP_EOL);
# code...
}
//获取每日的增长用户
public function newUser()
{
$newUserdata = [];
$map = ['register_time'=>['between',[$this->beginTime,$this->endTime]],"puid"=>0];//0不是小号
$hoursnews = $this->UserModel->field('FROM_UNIXTIME(register_time, "%H") as time,GROUP_CONCAT(DISTINCT id) AS user_id')
->where($map)
->group("time")
->select();
//按小时统计每个会长的信息
for ($i=0; $i < count($hoursnews); $i++) {
$tempres = self::getPresidentCount($hoursnews[$i]['user_id'],"COUNT(1) AS news,IFNULL(p.account,'官方渠道') account");
for($j=0; $j < count($tempres); $j++){
$newUserdata[$tempres[$j]['p_id']]["hoursnews"][$hoursnews[$i]['time']] = $tempres[$j]['news'];
$newUserdata[$tempres[$j]['p_id']]["president_account"]= $tempres[$j]['account'];
$newUserdata[$tempres[$j]['p_id']]["president_id"]= $tempres[$j]['p_id'];
}
}
//拼凑小时
foreach ($newUserdata as $k=>&$v) {
$h = $v['hoursnews'];
$t = [];
$hours = ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'];
$v['new_user_count'] = 0;
foreach($hours as $ht) {
if(isset($h[$ht])){
$t[] = $h[$ht];
$v['new_user_count'] += (int)$h[$ht];
}else{
$t[] = 0;
}
}
unset($v["hoursnews"]);
$v["new_user_hours"] = json_encode(array_map("intFun",$t));
// print_r($v['p_id']);die();
$this->President_data[$v['president_id']] = $v;
}
unset($newUserdata);
unset($hoursnews);
}
/**
* 活跃用户计算
*/
public function activeUser()
{
$newUserdata = [];
$map = ['login_time'=>['between',[$this->beginTime,$this->endTime]]];//0不是小号
$hoursnews = $this->LoginModel->field('FROM_UNIXTIME(login_time, "%H") as time,GROUP_CONCAT(DISTINCT user_id) AS user_id')
->where($map)
->group("time")
->select();
//按小时统计每个会长的信息
for ($i=0; $i < count($hoursnews); $i++) {
$tempres = self::getPresidentCount($hoursnews[$i]['user_id'],"COUNT(1) AS news,IFNULL(p.account,'官方渠道') account,GROUP_CONCAT(DISTINCT u.id) AS active_user_list");
for($j=0; $j < count($tempres); $j++){
$newUserdata[$tempres[$j]['p_id']]["hoursnews"][$hoursnews[$i]['time']] = $tempres[$j]['news'];
$newUserdata[$tempres[$j]['p_id']]["president_account"]= $tempres[$j]['account'];
$newUserdata[$tempres[$j]['p_id']]["president_id"]= $tempres[$j]['p_id'];
$newUserdata[$tempres[$j]['p_id']]["active_user_list"] .= (",".$tempres[$j]['active_user_list']);
}
}
//拼凑小时
foreach ($newUserdata as $k=>&$v) {
$h = $v['hoursnews'];
$t = [];
$hours = ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'];
foreach($hours as $ht) {
if(isset($h[$ht])){
$t[] = $h[$ht];
}else{
$t[] = 0;
}
}
unset($v["hoursnews"]);
$v["active_user_hours"] = json_encode(array_map("intFun",$t));
$ta = array_values(array_flip(array_flip(explode(",",trim($v["active_user_list"],",")))));
$v["active_user_count"] = count($ta);
$v["active_user_list"] = json_encode($ta);
if(array_key_exists($v['president_id'],$this->President_data)){
$this->President_data[$v['president_id']]['active_user_hours'] = $v["active_user_hours"];
$this->President_data[$v['president_id']]['active_user_count'] = $v["active_user_count"];
$this->President_data[$v['president_id']]['active_user_list'] = $v["active_user_list"];
}else{
$this->President_data[$v['president_id']] = $v;
}
}
unset($newUserdata);
unset($hoursnews);
}
/**
* 计算充值用户
*/
public function payUser()
{
$newUserdata = [];
$map = ['pay_time'=>['between',[$this->beginTime,$this->endTime]],'pay_status'=>1];//1支付成功
$hoursnews = $this->SpendModel->field('FROM_UNIXTIME(pay_time, "%H") as time,GROUP_CONCAT(DISTINCT user_id) AS user_id')
->where($map)
->group("time")
->select();
//按小时统计每个会长的信息
for ($i=0; $i < count($hoursnews); $i++) {
$tempres = self::getPresidentCount($hoursnews[$i]['user_id'],"COUNT(1) AS news,IFNULL(p.account,'官方渠道') account,GROUP_CONCAT(DISTINCT u.id) AS pay_user_list");
for($j=0; $j < count($tempres); $j++){
$newUserdata[$tempres[$j]['p_id']]["hoursnews"][$hoursnews[$i]['time']] = $tempres[$j]['news'];
$newUserdata[$tempres[$j]['p_id']]["president_account"]= $tempres[$j]['account'];
$newUserdata[$tempres[$j]['p_id']]["president_id"]= $tempres[$j]['p_id'];
$newUserdata[$tempres[$j]['p_id']]["pay_user_list"] .= (",".$tempres[$j]['pay_user_list']);
}
}
//拼凑小时
foreach ($newUserdata as $k=>&$v) {
$h = $v['hoursnews'];
$t = [];
$hours = ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'];
foreach($hours as $ht) {
if(isset($h[$ht])){
$t[] = $h[$ht];
}else{
$t[] = 0;
}
}
unset($v["hoursnews"]);
$v["pay_user_hours"] = json_encode(array_map("intFun",$t));
$ta = array_values(array_flip(array_flip(explode(",",trim($v["pay_user_list"],",")))));
$v["pay_user_count"] = count($ta);
$v["pay_user_list"] = json_encode($ta);
if(array_key_exists($v['president_id'],$this->President_data)){
$this->President_data[$v['president_id']]['pay_user_hours'] = $v["pay_user_hours"];
$this->President_data[$v['president_id']]['pay_user_count'] = $v["pay_user_count"];
$this->President_data[$v['president_id']]['pay_user_list'] = $v["pay_user_list"];
}else{
$this->President_data[$v['president_id']] = $v;
}
}
unset($newUserdata);
unset($hoursnews);
}
/**
* 充值金额计算
*/
public function payMoney()
{
$map = ['pay_time'=>['between',[$this->beginTime,$this->endTime]],"pay_status"=>1];//1支付成功
$hoursnews = $this->SpendModel->field('FROM_UNIXTIME(pay_time, "%H") as time,sum(pay_amount) AS money')
->where($map)
->group("time")
->select();
$hours = ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'];
$user_hours = array();
foreach($hours as $v) {
$user_hours[$v] = 0;
}
foreach($hoursnews as $h) {
$user_hours[$h['time']] = (integer)$h['money'];
}
$this->adddata["pay_money_hours"] = json_encode($user_hours);
unset($user_hours);
$activeCount = $this->SpendModel->field('sum(pay_amount) AS money')
->where($map)
->find();
$this->adddata["pay_money_count"] = $activeCount['money']?:0;
}
/**
* 新增推广
*/
public function promoteNew()
{
$map = ['create_time'=>['between',[$this->beginTime,$this->endTime]]];
$hoursnews = $this->PromoteModel->field('FROM_UNIXTIME(create_time, "%H") as time,COUNT(1) AS news')
->where($map)
->group("time")
->select();
$hours = ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'];
$user_hours = array();
foreach($hours as $v) {
$user_hours[$v] = 0;
}
foreach($hoursnews as $h) {
$user_hours[$h['time']] = (integer)$h['news'];
}
$this->adddata["promote_new_hours"] = json_encode($user_hours);//promote_new_hours
unset($user_hours);
$activeCount = $this->PromoteModel->field('COUNT(1) AS news')
->where($map)
->find();
$this->adddata["promote_new_count"] = $activeCount['news'];
}
/**
* 统计其他综合信息
* 1. 7天活跃
* 2. 平台累计用户
* 3. 累计付费用户
*/
public function allCount()
{
$user = D('User');
$spend = D('Spend');
$promote = D('Promote');
$allcount = array();
$allcount['user_count'] = $user->old();//平台累计用户
$allcount['active_count'] =$user->active(['tab_user_login_record.login_time'=>['between',[mktime(0,0,0,date('m'),date('d')-7,date('Y')),mktime(0,0,0,date('m'),date('d'),date('Y'))-1]]]);//七日日活
$allcount['player_count'] =$spend->player();//累计付费用户
$allcount['money_sum'] =$spend->totalAmount();//累计充值
$allcount['promote_sum'] =$promote->total();//推广员总数
$allcount['game_count'] = M("game","tab_")->where("game_status = 1")->field("count(1) game_count")->find()['game_count'];//游戏接入数量
$allcount['android_gamesource_count'] = M("GameSource","tab_")->where("file_type = 1")->field("count(1) game_count")->find()['game_count'];//安卓游戏原包
$allcount['ios_gamesource_count'] = M("GameSource","tab_")->where("file_type = 2")->field("count(1) game_count")->find()['game_count'];//IOS游戏原包
$allcount['promote_user_count'] = $user->where("promote_id > 0 and puid = 0")->field("count(1) user_count")->find()['user_count'];//推广员注册用户
$allcount['promote_spend_sum'] = $spend->where("promote_id > 0 and pay_status = 1")->field("sum(pay_amount) pay_amount")->find()['pay_amount'];//推广员总充值
$this->adddata["all_count"] = json_encode($allcount);
}
public function createDb()
{
$this->adddata['date']=$this->beginTime;
$this->adddata['create_time']=$this->nowdata;
$this->ChartModel->add($this->adddata);
}
//通过用户id串获取会长并统计
private function getPresidentCount($ids,$field=false)
{
if($field){
$fields = "IFNULL(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='',u.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id,{$field}";
}else{
$fields = "IFNULL(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='',u.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id";
}
$userres = M("user u","tab_")
->field($fields)
->join("tab_promote p on u.promote_id = p.id","left")
->where("u.id in ({$ids})")
->group("p_id")
->select();
return $userres;
# code...
}
}

@ -17,6 +17,21 @@ class PromoteCoinController extends ThinkController
public function send_lists($p = 0)
{
// $promoteRoot = getPowerPromoteIds();
// if ($promoteRoot) {
// $extend['promote_id'] =array('in',$promoteRoot);
// }
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $extend['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $extend['id'] = array('lt',1);
// }
setPowerPromoteIds($extend,'promote_id');
if (empty($_GET['promote_id'] && $_GET['promote_type'])) {
$extend['type'] = 1;
$extend['source_id'] = 0;
@ -46,6 +61,7 @@ class PromoteCoinController extends ThinkController
public function deduct_lists($p = 0)
{
// var_dump(session('user_auth')['uid']);die();
if (isset($_GET['type']) && $_GET['type'] == 2) {
$extend['type'] = 2;
$extend['source_id'] = 0;
@ -59,6 +75,24 @@ class PromoteCoinController extends ThinkController
}
}
$extend['op_id'] = session('user_auth')['uid'];
// $promoteRoot = getPowerPromoteIds();
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// }
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
$map['create_time'] = total(1, false);
$sum['to_day'] = D(self::model_name)->where($map)->sum('num');
$map['create_time'] = total(5, false);
@ -179,7 +213,8 @@ class PromoteCoinController extends ThinkController
if (!empty($_REQUEST['grand_id'])) $source_ids[] = $_REQUEST['grand_id'];
if (!empty($_REQUEST['child_id'])) $source_ids[] = $_REQUEST['child_id'];
if (!empty($source_ids)) $extend['source_id'] = ['in', $source_ids];
//为数据权限添加
setPowerPromoteIds($extend);
$map = $extend;
$map['create_time'] = total(1, false);
$sum['to_day'] = D(self::model_name)->where($map)->sum('num');
@ -253,6 +288,17 @@ class PromoteCoinController extends ThinkController
$map['order_status'] = $_REQUEST['order_status'];
unset($_REQUEST['order_status']);
}
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
$data = D("CoinPayOrder")->lists($_GET["p"], $map, $order);
// dump($data);
//执行查询

@ -0,0 +1,199 @@
<?php
namespace Admin\Controller;
use User\Api\UserApi as UserApi;
use OSS\OssClient;
use OSS\Core\OSsException;
use Think\Controller;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class PromoteCompanyController extends ThinkController
{
private $modelName = 'PromoteCompany';
//列表
public function lists()
{
$model = M($this->modelName, 'tab_');
$map = [];
$id = intval(I('id', 0));
$company_name = trim(I('company_name'));
if (!empty($id)) {
$map['tab_promote_company.id'] = $id;
$parameter['id'] = $id;
}
if($company_name)
$map['tab_promote_company.company_name'] = array('like',"%{$company_name}%");
if (isset($_REQUEST['status']) && $_REQUEST['status'] !== '') {
$status = intval($_REQUEST['status']);
$map['tab_promote_company.status'] = $status;
$parameter['status'] = $status;
}
$page = intval(I('get.p', 0));
$page = $page ? $page : 1; //默认显示第一页数据
$row = intval(I('row', 0));
$row = empty($row) ? 10 : $row;//每页条数
$data = $model
->field('tab_promote_company.id,tab_promote_company.company_name,tab_promote_company.status,
tab_promote_company.create_time,sys_member.nickname')
->join('left join sys_member on sys_member.uid = tab_promote_company.uid')
->where($map)
->order('id desc')
->page($page, $row)
->select();
/* 查询记录总数 */
$count = $model
->where($map)
->count();
if (!empty($data)) {
foreach ($data as &$list) {
$list['status'] = ($list['status'] == 0) ? '已关闭' : '已开启';
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
}
}
//分页
$parameter['p'] = $page;
$parameter['row'] = $row;
$page = set_pagination($count, $row, $parameter);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('listData', $data);
$this->assign('count', $count);
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find());
$this->meta_title = '推广公司';
$this->display();
}
//添加
public function add()
{
if ($_POST) {
$company_name = I('post.company_name', '');
$status = intval(I('post.status', 1));
if (empty($company_name)) {
$this->error('请输入推广公司名称');
}
if (!in_array($status, [0, 1])) {
$this->error('参数异常');
}
$model = M($this->modelName, 'tab_');
$map['company_name'] = $company_name;
$res = $model->where($map)->getField('id');
if ($res) {
$this->error('推广公司已存在');
}
$time = time();
$save['company_name'] = $company_name;
$save['status'] = $status;
$save['uid'] = UID;
$save['create_time'] = $time;
$save['last_up_time'] = $time;
$res = $model->add($save);
if ($res) {
\Think\Log::actionLog('PromoteCompany/add', 'partner', $res);
$this->success('保存成功', U('lists'));
} else {
$this->error('保存失败');
}
} else {
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCompany/add'])->find());
$this->meta_title = '新增推广公司';
$this->display();
}
}
//编辑
public function edit()
{
$model = M($this->modelName, 'tab_');
if ($_POST) {
$company_name = I('post.company_name', '');
$status = intval(I('post.status', 1));
$id = intval(I('post.id', 0));
if (empty($company_name)) {
$this->error('请输入推广公司名称');
}
if (!in_array($status, [0, 1]) || $id == 0) {
$this->error('参数异常');
}
$data = $model->field('id,company_name')->find($id);
if (empty($data)) {
$this->error('数据异常');
}
$map['company_name'] = $company_name;
$res = $model->where($map)->getField('id');
if ($res && $res != $id) {
$this->error('推广公司已存在');
}
$time = time();
$save['id'] = $id;
$save['company_name'] = $company_name;
$save['status'] = $status;
$save['last_up_time'] = $time;
$res = $model->save($save);
if ($res === false) {
$this->error('保存失败');
} else {
\Think\Log::actionLog('PromoteCompany/edit', 'PromoteCompany', $id);
$this->success('保存成功', U('lists'));
}
} else {
$id = intval(I('get.id', 0));
$map['id'] = $id;
$data = $model->field('id,company_name,status')->find($id);
if (empty($data)) {
$this->error('数据异常', U('lists'));
}
$this->assign('data', $data);
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCompany/edit'])->find());
$this->meta_title = '编辑推广公司';
$this->display();
}
}
//删除
public function del()
{
if (!empty($_POST['ids'])) {
if (!is_array($_POST['ids'])) {
$this->error('参数异常');
}
$id = implode(',', $_POST['ids']);
} else {
$id = intval(I('get.id', 0));
if ($id == 0) {
$this->error('参数异常');
}
}
$res = M($this->modelName, 'tab_')->delete($id);
if ($res === false) {
$this->error('删除失败');
}
$this->success('删除成功', U('lists'));
}
}

@ -133,7 +133,10 @@ class PromoteController extends ThinkController
}
}
}
// dump($map);die();
//为数据权限添加
setPowerPromoteIds($map, 'id');
$list_data = D(self::model_name)->where($map)->order('id DESC')->page($p, $row)->select();
$oa_data = [];
@ -190,7 +193,8 @@ class PromoteController extends ThinkController
$this->m_title = '混服申请';
$this->assign('commonset', M('Kuaijieicon')->where(['url'=>'Promote/lists/type/2','status'=>1])->find());
//为数据权限添加
setPowerPromoteIds($map);
parent::lists('SiteApply', $p, $map);
}
@ -200,7 +204,7 @@ class PromoteController extends ThinkController
if (C('PROMOTE_AUTO_AUDIT') == 1) {
$status = 1;
}
$data = array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name,'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card,'admin_id'=>$admin,'status'=>$status,'ba_id'=>$ba_id);
$data = array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name,'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card,'admin_id'=>session('user_auth')['uid'],'status'=>$status,'ba_id'=>$ba_id);
if (preg_match('/^[a-zA-Z0-9]{6,15}$/', $account)==false) {
$this->error('账号只能是6-15位字母或数字');
@ -509,6 +513,8 @@ class PromoteController extends ThinkController
unset($_REQUEST['end']);
}
$map['puid'] = 0;
//为数据权限添加
setPowerPromoteIds($map);
$model = array(
'm_name' => 'User',
'join' => 'tab_promote ON tab_user.promote_id = tab_promote.id',
@ -535,9 +541,16 @@ class PromoteController extends ThinkController
'title' => '渠道注册',
'template_list' =>'ch_reg_list',
);
$total=D($model['m_name'])->join('tab_promote ON tab_user.promote_id = tab_promote.id')->where(array('tab_user.promote_id'=>array('neq',0),'puid'=>0))->count();
$ttotal=D($model['m_name'])->join('tab_promote ON tab_user.promote_id = tab_promote.id')->where('register_time'.total(1))->where(array('tab_user.promote_id'=>array('neq',0),'puid'=>0))->count();
$ytotal=D($model['m_name'])->join('tab_promote ON tab_user.promote_id = tab_promote.id')->where('register_time'.total(5))->where(array('tab_user.promote_id'=>array('neq',0),'puid'=>0))->count();
$map1 = array('tab_user.promote_id'=>array('neq',0),'puid'=>0);
$map2['register_time'] = total(1, false);
$map3['register_time'] = total(5, false);
//为数据权限添加
setPowerPromoteIds($map1);
setPowerPromoteIds($map2);
setPowerPromoteIds($map3);
$total = D($model['m_name'])->join('tab_promote ON tab_user.promote_id = tab_promote.id')->where($map1)->count();
$ttotal=D($model['m_name'])->join('tab_promote ON tab_user.promote_id = tab_promote.id')->where($map2)->where(array('tab_user.promote_id'=>array('neq',0),'puid'=>0))->count();
$ytotal=D($model['m_name'])->join('tab_promote ON tab_user.promote_id = tab_promote.id')->where($map3)->where(array('tab_user.promote_id'=>array('neq',0),'puid'=>0))->count();
$this->assign('total', $total);
$this->assign('ttotal', $ttotal);
$this->assign('ytotal', $ytotal);
@ -655,6 +668,10 @@ class PromoteController extends ThinkController
$map['promote_id']=array($map['promote_id'],array('in',implode(',', $all_promote_id)),'and');
}
//为数据权限添加
setPowerPromoteIds($map);
// dd($map);
$model = array(
'm_name' => 'Spend',
'map' => $map,
@ -662,11 +679,19 @@ class PromoteController extends ThinkController
'title' => '渠道充值',
'template_list' =>'spend_list',
);
$map1=$map;
$map1 = $map;
$map1['pay_status']=1;
$total =null_to_0(D('Spend')->where($map1)->sum('pay_amount'));
$ttotal=null_to_0(D('Spend')->where('pay_time'.total(1))->where(array('pay_status'=>1))->where(array('promote_id'=>array("gt",0)))->sum('pay_amount'));
$ytotal=null_to_0(D('Spend')->where('pay_time'.total(5))->where(array('pay_status'=>1))->where(array('promote_id'=>array("gt",0)))->sum('pay_amount'));
$map2 = [
'pay_status' => 1,
'promote_id' => ["gt", 0],
];
//为数据权限添加
setPowerPromoteIds($map2);
$total = null_to_0(D('Spend')->where($map1)->sum('pay_amount'));
$ttotal = null_to_0(D('Spend')->where('pay_time'.total(1))->where($map2)->sum('pay_amount'));
$ytotal = null_to_0(D('Spend')->where('pay_time'.total(5))->where($map2)->sum('pay_amount'));
$this->assign('total', $total);
$this->assign('ttotal', $ttotal);
$this->assign('ytotal', $ytotal);
@ -733,11 +758,17 @@ class PromoteController extends ThinkController
}
empty(I('promote_id')) || $map['promote_id'] = I('promote_id');
$map['pay_status'] = 1;
$map1=$map;
$map1['pay_status']=1;
$total=D('Agent')->field('sum(amount) amount,sum(real_amount) real_amount')->where($map1)->find();
$ttotal=D('Agent')->field('sum(amount) amount,sum(real_amount) real_amount')->where('create_time'.total(1))->where(array('pay_status'=>1))->find();
$ytotal=D('Agent')->field('sum(amount) amount,sum(real_amount) real_amount')->where('create_time'.total(5))->where(array('pay_status'=>1))->find();
//为数据权限添加
setPowerPromoteIds($map);
$map1 = $map;
$map1['pay_status'] = 1;
$map2 = array('pay_status'=>1);
setPowerPromoteIds($map2);
$total = D('Agent')->field('sum(amount) amount,sum(real_amount) real_amount')->where($map1)->find();
$ttotal = D('Agent')->field('sum(amount) amount,sum(real_amount) real_amount')->where('create_time'.total(1))->where($map2)->find();
$ytotal = D('Agent')->field('sum(amount) amount,sum(real_amount) real_amount')->where('create_time'.total(5))->where($map2)->find();
$this->assign('total', $total);
$this->assign('ttotal', $ttotal);
$this->assign('ytotal', $ytotal);
@ -792,6 +823,7 @@ class PromoteController extends ThinkController
$this->meta_title ='代充额度';
$this->display();
}
public function pay_limit_add()
{
$limit=D("Promote");

@ -40,6 +40,9 @@ class ProvideController extends ThinkController {
$map['game_id'] = ['in', $game_ids];
unset($_REQUEST['game_name'], $_REQUEST['sdk_version1']);
}
$map['op_account']=session('user_auth')['username'];
if(isset($_REQUEST['op_account'])){
if($_REQUEST['op_account']=='请选择'){
unset($_REQUEST['op_account']);
@ -48,7 +51,6 @@ class ProvideController extends ThinkController {
unset($_REQUEST['op_account']);
}
}
if(is_numeric($_REQUEST['status']) && ($_REQUEST['status']==0 || $_REQUEST['status']==1)) {
$map['status'] = $_REQUEST['status'];
unset($_REQUEST['status']);

@ -75,6 +75,7 @@ class PublicController extends \Think\Controller
if (is_login()) {
D('Member')->logout();
session('[destroy]');
session('user_auth_promote_ids');
cookie('think_language', Null);
// $this->success('退出成功!', U('login'));
$this->ajaxReturn(array('status' => 1, 'msg' => '退出成功!'));

@ -86,10 +86,15 @@ class QueryController extends ThinkController
$smap['pay_time'] = array('BETWEEN', array(strtotime($start), strtotime($end) + 24 * 60 * 60 - 1));
$smap['is_check'] = 1;
$smap['settle_check'] = 0;
//为数据权限添加
setPowerPromoteIds($umap, 'tab_user.promote_id');
setPowerPromoteIds($smap, 'tab_spend.promote_id');
$map['umap'] = $umap;
$map['smap'] = $smap;
$user = A('Settlement', 'Event');
$user->settlement($model, $p, $map);
} else {
$this->display();
@ -147,7 +152,10 @@ class QueryController extends ThinkController
'title' => '结算账单',
'template_list' => 'settlement',
);
//为数据权限添加
setPowerPromoteIds($map);
$map1 = $map;
$ztotal = null_to_0(D('settlement')->where($map1)->sum('sum_money*10000') / 10000);
$this->assign('ztotal', $ztotal);
$ttotal = null_to_0(D('settlement')->where('create_time' . total(1))->sum('sum_money*10000') / 10000);
@ -155,6 +163,7 @@ class QueryController extends ThinkController
$ytotal = null_to_0(D('settlement')->where('create_time' . total(5))->sum('sum_money*10000') / 10000);
$this->assign('ytotal', $ytotal);
$user = A('Bill', 'Event');
$user->money_list($model, $p, $map);
}
@ -683,6 +692,9 @@ class QueryController extends ThinkController
'template_list' => 'withdraw',
);
$map1 = array('status' => ['neq', -1]);
//为数据权限添加
setPowerPromoteIds($map1);
$total = null_to_0(D('withdraw')->where($map1)->sum('sum_money'));
$ttotal = null_to_0(D('withdraw')->where('create_time' . total(1))->where($map1)->sum('sum_money'));
$ytotal = null_to_0(D('withdraw')->where('create_time' . total(5))->where($map1)->sum('sum_money'));
@ -694,7 +706,8 @@ class QueryController extends ThinkController
$this->m_title = '推广提现';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Query/withdraw', 'status' => 1])->find());
//为数据权限添加
setPowerPromoteIds($map);
$user->money_list($model, $p, $map);
}

@ -13,6 +13,20 @@ class RechargeSumController extends ThinkController
$endTime = strtotime($endDateTime);
$key = 0;
$total = ['current' => 0, 'sum' => 0];
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
//
// $rmap['tab_user.promote_id'] = $map['promote_id'] = array('in',$promoteRoot);
// } else if (!$promoteRoot&&$data_empower_type!=1) {
// $rmap['tab_user.id'] = $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
setPowerPromoteIds($rmap,'tab_user.promote_id');
if (isset($_REQUEST['promote_id'])) {
if ($_REQUEST['promote_id'] > 0) {
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();

@ -71,6 +71,17 @@ class SpendController extends ThinkController
$map['pay_game_status'] = $_REQUEST['pay_game_status'];
unset($_REQUEST['pay_game_status']);
}
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
if (isset($_REQUEST['promote_id'])) {
$promoteId = intval($_REQUEST['promote_id']);
if ($promoteId == 0) {

@ -229,81 +229,95 @@ class StatController extends ThinkController
$this->assign("json_data",json_encode($res));
$this->display();
}
//流失率分析
public function loss_pic($para){
if(isset($para['time_start'])&&isset($para['time_end'])&&$para['time_start']!==null&&$para['time_end']!==null){
$dd=prDates($para['time_start'],$para['time_end']);
$day=$dd;
$this->assign('tt',array_chunk($dd,1));
}else{
$defTimeE=date("Y-m-d",time());
$defTimeS=date("Y-m-d",time()-24*60*60*6);
$day=every_day(7);
$dd=prDates($defTimeS,$defTimeE);
if (!empty($para['time_start']) && !empty($para['time_end'])) {
$days = prDates($para['time_start'],$para['time_end']);
$day = $days;
$this->assign('tt',array_chunk($days,1));
} else {
$defTimeE = date("Y-m-d",time());
$defTimeS = date("Y-m-d",time() - 24*60*60*6);
$day = every_day(7);
$days = prDates($defTimeS,$defTimeE);
}
if(isset($para['game_id'])){
if (isset($para['game_id'])) {
$map['r.fgame_id']=$para['game_id'];
$map1['r.fgame_id']=$para['game_id'];
}
if(isset($para['channel_id'])&&$para['channel_id']!=""){
if($para['channel_id']==2){
$d=7;
}else{
$d=3;
if (!empty($para['channel_id'])) {
if ($para['channel_id'] == 2 ) {
$continueDay = 7;
} else {
$continueDay = 3;
}
}else{
$d=3;
$continueDay = 3;//3天不登录表示玩家已流失
}
$limitI=count($dd);
$usermodel = D('User');
for($i=0;$i<$limitI;$i++){
$start=$this->get_time($dd[$i],$d);
$end=$start+24*60*60-1;
$map['r.register_time']=array('between',array($start,$end));
if(isset($para['promote_id'])&&$para['promote_id']!=""){
$map['r.promote_id']=$para['promote_id'];
}
$logins=$usermodel->getPlayers($map);
if($logins==null){
$loss=null;
}else{
$loss=null;
foreach ($logins as $key => $value) {
$start=date("Y-m-d", $value['register_time']+24*60*60);
$start=$this->get_time($start,0);
$end=$start+24*60*60*$d;
$map1['r.login_time']=array('between',array($start,$end));
$map1['r.user_id']=$value['id'];
if(isset($para['promote_id'])&&$para['promote_id']!=""){
$map1['promote_id']=$para['promote_id'];
}
$result1=$usermodel->findPlayer($map1);
if($result1==null){
$loss[]=$logins[$key];
}
}
}
if($loss!=null){
$loser[]=$loss;
}
$loss_count[]=count($loss);
$loss_rate[]=count($loss)/count($logins)*100?sprintf("%.2f",count($loss)/count($logins)*100):0;
}
foreach ($loser as $key => $value) {
foreach ($value as $k => $v) {
$losers[]=$v['user_id'];
//获取这个时间段内注册的玩家
$start = $this->get_time(current($days), $continueDay);
$end = $this->get_time(end($days), $continueDay) + 86399;;
$map['register_time']=array('between',array($start, $end));
if (isset($para['promote_id']) && $para['promote_id']!="") {
$map['promote_id']=$para['promote_id'];
}
$players = $usermodel->getUserList($map, "GROUP_CONCAT(DISTINCT id) as user_ids,
FROM_UNIXTIME(register_time+{$continueDay}*86400, '%Y-%m-%d') as register_date", "register_date");
$players = array_column($players, 'user_ids', 'register_date');
$map1 = array();
$map1['lpuid'] = 0;
$map1['u.register_time'] = array('between',array($start, $end));
if (isset($para['promote_id'])&&$para['promote_id']!="") {
$map1['u.promote_id']=$para['promote_id'];
}
//获取这段时间内有登录(未流失)的玩家
$map1['r.login_time'] = array('exp', 'BETWEEN UNIX_TIMESTAMP(
FROM_UNIXTIME(
u.register_time + 86400,
"%Y-%m-%d"
)
)
AND UNIX_TIMESTAMP(
FROM_UNIXTIME(
u.register_time + 86400,
"%Y-%m-%d"
)
) + 86400 * ' . $continueDay);
$keepPlayers = $usermodel->getKeepPlayers($map1, $continueDay, count($days) > 7);// 3或7天内有登录的玩家
$keepPlayers = array_column($keepPlayers, 'user_ids', 'register_date');
$loss_count = array();//流失玩家数量
foreach ($days as $key => $date) {
$dateUserCount = isset($players[$date]) ? count(explode(",", $players[$date])) : 0;
$keepUserCount = isset($keepPlayers[$date]) ? count(explode(",", $keepPlayers[$date])) : 0;
$loss_count[$key] = $dateUserCount - $keepUserCount;//流失数量
if ($dateUserCount) {
$loss_rate[] = sprintf("%.2f",($loss_count[$key]/$dateUserCount) * 100);//流失率
} else {
$loss_rate[] = 0;
}
}
$data2=$this->loss_pic2($losers);
$data3=$this->loss_pic3($losers);
$result['day']=$day;
$result['loss_count']=$loss_count;
$result['loss_rate']=$loss_rate;
$result['loss_money']=$data2;
$result['loss_times']=$data3;
$losers = array_filter($players, function ($item) use ($keepPlayers) {
return !in_array($item, $keepPlayers);
});
$losers = array_values($losers);//流失玩家id集合
$data2 = $this->loss_pic2($losers);
$data3 = $this->loss_pic3($losers);
$result['day'] = $day;//日期
$result['loss_count'] = $loss_count;//流失数量
$result['loss_rate'] = $loss_rate;//流失率
$result['loss_money'] = $data2;//流失金额
$result['loss_times'] = $data3;//流失次数
return $result;
}
/**
* 流失用户消费金额分析,包括不同等级的人数和所占比例
* @param [type] $data [description]

@ -8,8 +8,9 @@ use User\Api\UserApi as UserApi;
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class StatisticsController extends ThinkController {
const COUNTLIMIT = 10;
public function overview(){
$shuju = M('Data','tab_')->order('create_time desc')->find();
$shuju = json_decode(M('IndexChart','tab_')->field("all_count")->order('`date` desc')->find()["all_count"],true);
$this->assign('shuju',$shuju);
$this->assign('openegretmain','openegretmain');//模板还样式使用
@ -23,183 +24,237 @@ class StatisticsController extends ThinkController {
$lastweek=$this->total(6);
$lastmounth=$this->total(7);
$lastyear=$this->total(8);
//昨天
$yesterdaydate=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
$promoteyesterdaydate=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
// 游戏排行
$type=$_REQUEST['type'];
if($type==1 || $type==''){
$list_data=$this->data_order($today,$yesterday);
$type=$_REQUEST['type']?:1;
if($type==1){
$list_data=$this->data_order($today,$yesterday,true);
$gamedateinfo = explode(" ",$today);
$yesterdaydate=$gamedateinfo[2];
}elseif($type==2){
$list_data=$this->data_order($thisweek,$lastweek);
$list_data=$this->data_order($thisweek,$lastweek);
$gamedateinfo = explode(" ",$thisweek);
}elseif($type==3){
$list_data=$this->data_order($thismounth,$lastmounth);
$list_data=$this->data_order($thismounth,$lastmounth);
$gamedateinfo = explode(" ",$thismounth);
}elseif($type==4){
$list_data=$this->data_order($thisyear,$lastyear);
$list_data=$this->data_order($thisyear,$lastyear);
$gamedateinfo = explode(" ",$thisyear);
}
// 推广员排行
switch($_REQUEST['category']) {
case 2:{$promote_data = $this->promote_data_order($thisweek,$lastweek);};break;
case 3:{$promote_data = $this->promote_data_order($thismounth,$lastmounth);};break;
case 4:{$promote_data = $this->promote_data_order($thisyear,$lastyear);};break;
default:
$promote_data = $this->promote_data_order($today,$yesterday);
$category = $_REQUEST['category']?:1;
if($category==1){
$promote_data = $this->promote_data_order($today,$yesterday,true);
$promotedateinfo = explode(" ",$today);
$promoteyesterdaydate = $promotedateinfo[2];
}elseif($category==2){
$promote_data = $this->promote_data_order($thisweek,$lastweek);
$promotedateinfo = explode(" ",$thisweek);
}elseif($category==3){
$promote_data = $this->promote_data_order($thismounth,$lastmounth);
$promotedateinfo = explode(" ",$thismounth);
}elseif($category==4){
$promote_data = $this->promote_data_order($thisyear,$lastyear);
$promotedateinfo = explode(" ",$thisyear);
}
$this->assign('zhuce',$list_data['zhuce']);
$this->assign('zhuce',$list_data['reg']);
$this->assign('active',$list_data['active']);
$this->assign('pay',$list_data['pay']);
$this->assign('game_chart',$list_data['chart']);
$this->assign('game_date_info',"统计[ ".date("Y/m/d",$gamedateinfo[2])." -- ".date("Y/m/d",$yesterdaydate)." ]之间数据");
$this->assign('promotereg',array_slice($promote_data['reg'], 0, 10));
$this->assign('promoteactive',array_slice($promote_data['active'], 0, 10));
$this->assign('promotepay',array_slice($promote_data['pay'], 0, 10));
$this->assign('promotereg',$promote_data['reg']);
$this->assign('promoteactive',$promote_data['active']);
$this->assign('promotepay',$promote_data['pay']);
$this->assign('promote_chart', $promote_data['chart']);
$this->assign('promote_date_info',"统计[ ".date("Y/m/d",$promotedateinfo[2])." -- ".date("Y/m/d",$promoteyesterdaydate)." ]之间数据");
// 日历
R('Index/calendar');
// 折线图
$this->foldLineDiagram($_REQUEST['start'],$_REQUEST['end'],$_REQUEST['num']);
if(strtotime($_REQUEST['start']) == mktime(0,0,0,date('m'),date('d'),date('Y'))){
//今日时时
$this->nowday($_REQUEST['num']);
}else{
$this->foldLineDiagram($_REQUEST['start'],$_REQUEST['end'],$_REQUEST['num']);
}
// $this->foldLineDiagram($_REQUEST['start'],$_REQUEST['end'],$_REQUEST['num']);
$this->display();
}
/*
* 折线图
* @param integer $start 开始时间
* @param integer $end 结束时间
* @param boolean $flag 是否ajax返回
* @author 鹿文学
*/
public function foldLineDiagram($start='',$end='',$num='',$flag=false) {
$starttime = $start?strtotime($start):mktime(0,0,0,date('m'),date('d')-1,date('Y'));
}
/*
* 今日折线图
*/
public function nowday($num)
{
$starttime = mktime(0,0,0,date('m'),date('d'),date('Y'));
$endtime = $end?strtotime($end)+86399:$starttime+86399;
$endtime = $starttime+86399;
$start = date('Y-m-d',$starttime);
$end = date('Y-m-d',$endtime);
$user = D('User');
$spend = D('Spend');
$promote = D('Promote');
if ($start == $end) {
if ($start == date('Y-m-d',strtotime('-1 day'))) {$num = 2;}
$hours = ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'];
$data['date'] = [$start];
$data['hours'] = 1;
foreach($hours as $v) {
$data['news'][$v] = 0;
$data['active'][$v] = 0;
$data['player'][$v] = 0;
$data['money'][$v] = 0;
if ($start == date('Y-m-d',strtotime('-1 day'))) {$num = 2;}
$hours = ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'];
$data['date'] = [$start];
$data['hours'] = 1;
foreach($hours as $v) {
$data['news'][$v] = 0;
$data['active'][$v] = 0;
$data['player'][$v] = 0;
$data['money'][$v] = 0;
}
// 新增用户
$hoursnews = $user->newsAdd(['register_time'=>['between',[$starttime,$endtime]]],'news','time',5);
// 活跃用户
$hoursactive = $user->totalPlayerByGroup($hours,['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]],'active','time',5);
// 付费用户
$hoursplayer = $spend->totalPlayerByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'player','time',5);
// 充值金额
$hoursmoney = $spend->totalAmountByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'money','time',5);
foreach($hours as $v) {
foreach($hoursnews as $h) {
$time = explode(' ',$h['time']);
if ($time[1] == $v){
$data['news'][$v] = (integer)$h['news'];break;
}
}
// 新增用户
$hoursnews = $user->newsAdd(['register_time'=>['between',[$starttime,$endtime]]],'news','time',5);
// 活跃用户
$hoursactive = $user->totalPlayerByGroup($hours,['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]],'active','time',5);
// 付费用户
$hoursplayer = $spend->totalPlayerByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'player','time',5);
// 充值金额
$hoursmoney = $spend->totalAmountByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'money','time',5);
foreach($hours as $v) {
foreach($hoursnews as $h) {
$time = explode(' ',$h['time']);
if ($time[1] == $v){
$data['news'][$v] = (integer)$h['news'];break;
}
}
foreach($hoursactive as $h) {
foreach($hoursactive as $h) {
if ($h['time'] == $v){
$data['active'][$v] = (integer)$h['active'];break;
}
}
foreach($hoursplayer as $h) {
$time = explode(' ',$h['time']);
if ($time[1] == $v){
$data['player'][$v] = (integer)$h['player'];break;
}
}
foreach($hoursmoney as $h) {
$time = explode(' ',$h['time']);
if ($time[1] == $v){
$data['money'][$v] = $h['money'];break;
}
if ($h['time'] == $v){
$data['active'][$v] = (integer)$h['active'];break;
}
}
} else {
$datelist = get_date_list($starttime,$endtime,$num==7?4:1);
$data['date'] = $datelist;
$data['hours'] = 0;
foreach($datelist as $k => $v) {
$data['news'][$v] = 0;
$data['active'][$v] = 0;
$data['player'][$v] = 0;
$data['money'][$v] = 0;
foreach($hoursplayer as $h) {
$time = explode(' ',$h['time']);
if ($time[1] == $v){
$data['player'][$v] = (integer)$h['player'];break;
}
}
// 新增用户
$news = $user->newsAdd(['register_time'=>['between',[$starttime,$endtime]]],'news','time',$num==7?2:1);
// 活跃用户
$active = $user->totalPlayerByGroup($datelist,['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]],'active','time',$num==7?2:1);
// 付费用户
//$player = $spend->totalPlayerByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'player','time',$num==7?2:1);
$player = $spend->totalPlayerByTime($starttime,$endtime,'player','time',$num==7?2:1);
// 充值金额
$money = $spend->totalAmountByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'money','time',$num==7?2:1);
foreach($datelist as $v) {
foreach($news as $h) {
if ($v == $h['time']) {
$data['news'][$v] = (integer)$h['news'];break;
}
}
foreach($active as $h) {
if ($v == $h['time']) {
$data['active'][$v] = (integer)$h['active'];break;
}
}
foreach($player as $h) {
if ($v == $h['time']) {
$data['player'][$v] = (integer)$h['player'];break;
}
foreach($hoursmoney as $h) {
$time = explode(' ',$h['time']);
if ($time[1] == $v){
$data['money'][$v] = $h['money'];break;
}
foreach($money as $h) {
if ($v == $h['time']) {
$data['money'][$v] = $h['money'];break;
}
}
foreach($data as $k => $v) {
if (is_array($v)) {
if($data['hours']!=1){$table[$k] = $v;}
if ($k == 'date'){
$data[$k] = '"'.implode('","',$v).'"';
}else{
$sum = 0;$x='';$y=0;$tempexport=[];
foreach($v as $t => $s){
$sum += $s;
if($data['hours']==1){
if ($t%2==1) {$tab[$x.'~'.$t] = $y+$s;$x='';$y=0;}else{$x .= $t;$y += $s;}
$tempexport[]=['time'=>((integer)substr($t,0,2)).':00','count'=>$s];
}else{
$tempexport[]=['time'=>$t,'count'=>$s];
}
}
$table['sum'][$k]=$sum;
if($data['hours']==1)$table[$k]=$tab;
$export[$k]=$tempexport;
$export['sum'][$k]=$sum;
$data[$k] = implode(',',$v);
}
}
}
if ($flag) {
echo json_encode($data);
foreach($data as $k => $v) {
} else {
$this->assign('foldline',$data);
$this->assign('table',$table);
$this->assign('num',$num);
}
# code...
}
/*
* 折线图
* @param integer $start 开始时间
* @param integer $end 结束时间
* @param boolean $flag 是否ajax返回
* @author 鹿文学
*/
public function foldLineDiagram($start='',$end='',$num='',$flag=false)
{
$starttime = $start?strtotime($start):mktime(0,0,0,date('m'),date('d')-1,date('Y'));
$endtime = $end?strtotime($end)+86399:$starttime+86399;
$start = date('Y-m-d',$starttime);
$end = date('Y-m-d',$endtime);
$user = D('User');
$spend = D('Spend');
$promote = D('Promote');
if ($start == $end) { // 单天
if ($start == date('Y-m-d',strtotime('-1 day'))) {$num = 2;}
$data['date'] = [$start];
$data['hours'] = 1;
$tm = strtotime($start);
$dbdata = M("IndexChart","tab_")->field("new_user_count,new_user_hours,active_user_count,active_user_hours,pay_user_count,pay_user_hours,pay_money_count,pay_money_hours,promote_new_count")->where("`date` = '{$tm}'")->find();
$data['news'] = json_decode($dbdata["new_user_hours"],true);
$data['active'] = json_decode($dbdata["active_user_hours"],true);
$data['player']=json_decode($dbdata["pay_user_hours"],true);
$data['money']=json_decode($dbdata["pay_money_hours"],true);
} else {
$datelist = get_date_list($starttime,$endtime,$num==7?4:1);
$data['date'] = $datelist;
$data['hours'] = 0;
$map = array(
"date"=>['between',[$starttime,$endtime]]
);
//获取记录
$count1 = array();
$active_user_list = [];
$pay_user_list = [];
$dbdata = M("IndexChart","tab_")->field("new_user_count,active_user_count,pay_user_count,pay_money_count,promote_new_count")
->where($map)->select();
foreach($dbdata as $k => $v) {
$data['news'][$k] = $v['new_user_count'];
$data['active'][$k] = $v['active_user_count'];
$data['player'][$k] = $v['pay_user_count'];
$data['money'][$k] = $v['pay_money_count'];
}
}
foreach($data as $k => $v) {
// dump($k);
if (is_array($v)) {
if($data['hours']!=1){$table[$k] = $v;}
if ($k == 'date'){
@ -224,300 +279,270 @@ class StatisticsController extends ThinkController {
}
}
file_put_contents(dirname(__FILE__).'/access_data_foldline.txt',json_encode($export));
if ($flag) {
$data['table'] = $table;
echo json_encode($data);
} else {
$this->assign('foldline',$data);
$this->assign('table',$table);
$this->assign('num',$num);
}
}
# code...
}
/**
* 获取推广员排行
* @param [type] $starttime 当前时间
* @param [type] $endtime 比较时间
* @return void
*/
private function promote_data_order($starttime,$endtime,$today =false){
/**
* 排行榜(推广员)
* @param string $nowtime 现在时间段between 开始时间戳 and 结束时间戳)
* @param string $othertime 过去时间段between 开始时间戳 and 结束时间戳)
* @return array 结果集
* @author lwx
*/
private function promote_data_order($nowtime,$othertime){
$user = M("User","tab_");
$spend = M('Spend',"tab_");
$chart1 = [];
$chart2 = [];
$chart3 = [];
//今日注册排行
$ri_ug_order=$user->field('tab_user.promote_id,tab_promote.account as promote_account,count(tab_user.id) as cg')
->join('tab_promote on (tab_promote.id = tab_user.promote_id)','left')
->where(array('register_time'.$nowtime,'promote_id'=>array('gt',0),'puid'=>0))
->group('promote_id')->order('cg desc')->limit(10)->select();
$ri_ug_order=array_order($ri_ug_order);
$regids = array_column($ri_ug_order,'promote_id');
if ($regids) {
$yes_ug_order=$user->field('tab_user.promote_id,tab_promote.account as promote_account,count(tab_user.id) as cg')
->join('tab_promote on (tab_promote.id = tab_user.promote_id)')
->where([array('register_time'.$othertime,'promote_id'=>array('gt',0),'puid'=>0),array('register_time'.$othertime,'promote_id'=>array('in',$regids),'puid'=>0),'_logic'=>'or'])
->group('promote_id')->order('cg desc')->select();
$yes_ug_order=array_order($yes_ug_order);
// dump($ri_ug_order);
// dump($yes_ug_order);exit;
foreach ($ri_ug_order as $key => $value) {
$ri_ug_order[$key]['change'] = $value['rand']-count($ri_ug_order)-1;
$chart1['p'.$value['promote_id']] = $value;
foreach ($yes_ug_order as $k => $v) {
if($value['promote_id']==$v['promote_id']){
$ri_ug_order[$key]['change']=$value['rand']-$v['rand'];break;
}
}
}
$PromoteCount = M("PromoteCount","tab_");
$data = array();
//注册排行
//1.获取注册前十名
if($today){
$map = ["puid"=>0,"fgame_id"=>["gt",0]];//0不是小号
$new_user_count = M("User","tab_")->field('COUNT(1) AS cg,promote_id,promote_account')->where($map)->where("register_time {$starttime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
}else{
$new_user_count = $PromoteCount->field("promote_id,promote_account,sum(new_user_count) cg")->where("`date` {$starttime}")->group("promote_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
}
$old_user_count = $PromoteCount->field("promote_id,promote_account,sum(new_user_count) cg")->where("`date` {$endtime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
//2.设置排名
$data["reg"] = $this->setRand($new_user_count,$old_user_count);
//活跃排行
//1.获取注册前十名
if($today){
$map = ["l.promote_id"=>["gt",0]];//0不是小号
$new_active_count = M()->table("tab_user_login_record l")->field('COUNT(DISTINCT user_id) AS cg,l.promote_id,p.account promote_account')
->where($map)->where("l.login_time {$starttime}")
->group("promote_id")
->join("tab_promote p ON l.promote_id = p.id")
->order("cg desc")
->limit(self::COUNTLIMIT)->select();
}else{
$new_active_count = $PromoteCount->field("promote_id,promote_account,sum(active_user_count) cg")->where("`date` {$starttime}")->group("promote_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
if(count($new_active_count) > 0){
$listarr = array();
$promote_id_str = '';
for ($i=0; $i < count($new_active_count); $i++) {
# code...
$promote_id_str .= ($new_active_count[$i]['promote_id'].",");
$new_active_count[$i]["active_user_list"] = [];
$listarr[$new_active_count[$i]['promote_id']] = $new_active_count[$i];
}
// //今日活跃排行
$duser = D('User');
$ri_active_order = $duser->activeRankOnPromote($nowtime,'cg');
$ri_active_order=array_order($ri_active_order);
$activeids = array_column($ri_active_order,'promote_id');
if ($activeids) {
$yes_active = $duser->activeRankOnPromote($othertime,'cg',$activeids);
$yes_active=array_order($yes_active);
foreach ($ri_active_order as $key => $value) {
$ri_active_order[$key]['change'] = $value['rand']-count($ri_active_order)-1;
$chart2['p'.$value['promote_id']] = $value;
foreach ($yes_active as $k => $v) {
if($value['promote_id']==$v['promote_id']){
$ri_active_order[$key]['change']=$value['rand']-$v['rand'];break;
}
}
}
}
$promote_id_str = \rtrim($promote_id_str,",");
//查询
$active_user_list = $PromoteCount->field("active_user_list,promote_id")->where("`date` {$starttime} AND promote_id in ({$promote_id_str})")->select();
for ($i=0; $i < count($active_user_list); $i++) {
$listarr[$active_user_list[$i]["promote_id"]]["active_user_list"] += json_decode($active_user_list[$i]["active_user_list"],true);
}
foreach ($listarr as $key => $value) {
$value['cg'] = count(array_flip(array_flip($value['active_user_list'])));
unset($value['active_user_list']);
$listarr[$key] = $value;
}
$last_names = array_column($listarr,'cg');
array_multisort($last_names,SORT_DESC,$listarr);
$new_active_count = $listarr;
}
}
//获取活跃总量排行
$old_active_count = $PromoteCount->field("promote_id,promote_account,sum(active_user_count) cg")->where("`date` {$endtime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
//2.设置排名
$data["active"] = $this->setRand($new_active_count,$old_active_count);
// //充值排行
//spend
$ri_spay_sql=$spend->field('tab_spend.promote_id,tab_promote.account as promote_account,sum(pay_amount) as cg')
->join('tab_promote on(tab_spend.promote_id = tab_promote.id)')
->union('select promote_id,tab_promote.account as promote_account,sum(pay_amount) as cg from tab_deposit inner join tab_promote on(tab_promote.id = tab_deposit.promote_id) where pay_status=1 and promote_id>0 and tab_deposit.create_time '.$nowtime.' group by promote_id ')
->where(array('pay_time'.$nowtime,'promote_id'=>array('gt',0),'pay_status'=>1))
->group('promote_id')->select(false);
$ri_spay_order = $spend->field('promote_id,promote_account,sum(cg) as cg')->table('('.$ri_spay_sql.') as a')->group('promote_id')->order('cg desc')->limit(10)->select();
$ri_spay_order=array_order($ri_spay_order);
$payids = array_column($ri_spay_order,'promote_id');
if ($payids) {
$yes_spay_sql=$spend->field('tab_spend.promote_id,tab_promote.account as promote_account,sum(pay_amount) as cg')
->join('tab_promote on(tab_spend.promote_id = tab_promote.id)')
->union('select promote_id,tab_promote.account as promote_account,sum(pay_amount) as cg from tab_deposit inner join tab_promote on(tab_promote.id = tab_deposit.promote_id) where pay_status=1 and promote_id>0 and tab_deposit.create_time '.$othertime.' group by promote_id ')
->where([array('pay_status'=>1,'pay_time'.$othertime,'promote_id'=>array('gt',0)),array('pay_time'.$othertime,'promote_id'=>array('in',$payids)),'_logic'=>'or'])
->group('promote_id')->select(false);
$yes_spay=$spend->field('promote_id,promote_account,sum(cg) as cg')->table('('.$yes_spay_sql.') as a')->group('promote_id')->order('cg desc')->select();
$yes_spay=array_order($yes_spay);
foreach ($ri_spay_order as $key => $value) {
$ri_spay_order[$key]['change'] = $value['rand']-count($ri_spay_order)-1;
$chart3['p'.$value['promote_id']] = $value;
foreach ($yes_spay as $k => $v) {
if($value['promote_id']==$v['promote_id']){
$ri_spay_order[$key]['change']=$value['rand']-$v['rand'];
}
}
}
}
//支付排行
//1.获取注册前十名
if($today){
$map = ["pay_status"=>1,"promote_id"=>["gt",0]];
$new_money_count = M("Spend","tab_")->field('sum(pay_amount) AS cg,promote_id,promote_account')->where($map)->where("pay_time {$starttime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
}else{
$new_money_count = $PromoteCount->field("promote_id,promote_account,sum(pay_money_count) cg")->where("`date` {$starttime}")->group("promote_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
}
$old_money_count = $PromoteCount->field("promote_id,promote_account,sum(pay_money_count) cg")->where("`date` {$endtime}")->group("promote_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
//2.设置排名
$data["pay"] = $this->setRand($new_money_count,$old_money_count);
$data['reg']=$ri_ug_order;
$data['active']=$ri_active_order;
$data['pay']=$ri_spay_order;
$chart4 = array_merge($chart1,$chart2,$chart3);
foreach($chart4 as $k => $v) {
$chart['promote'][$k] = $v['promote_account'];
foreach($chart1 as $c) {
$chart['reg'][$k] = 0;
if ($v['promote_id'] == $c['promote_id']) {
$chart['reg'][$k] = (integer)$c['cg'];break;
}
}
foreach($chart2 as $c) {
$chart['active'][$k] = 0;
if ($v['promote_id'] == $c['promote_id']) {
$chart['active'][$k] = (integer)$c['cg'];break;
}
}
foreach($chart3 as $c) {
$chart['pay'][$k] = 0;
if ($v['promote_id'] == $c['promote_id']) {
$chart['pay'][$k] = $c['cg'];break;
}
}
//设置chart
$char = array();
foreach ($data as $key => $value) {
for ($i=0; $i < count($value); $i++) {
$t = $value[$i];
if(empty($char[$t['promote_id']])){
//不存在
$char[$t['promote_id']] = array(
// "promote_id" =>$t['promote_id'],
"promote_account" =>$t['promote_account'],
"reg" => 0,
"active"=>0,
"pay"=>0
);
}
foreach($chart as $k => $v) {
if ($k == 'promote')
$data['chart'][$k] = '"'.implode('","',$v).'"';
else
$data['chart'][$k] = implode(',',$v);
$char[$t['promote_id']][$key] = $t['cg'];
}
}
foreach ($char as $key => $value) {
$data["chart"]["promote"] .= ("\"".$value['promote_account']."\",");
$data["chart"]["reg"] .= ( $value['reg'].",");
$data["chart"]["active"] .= ( $value['active'].",");
$data["chart"]["pay"] .= ( $value['pay'].",");
}
$data["chart"]["promote"] = \rtrim($data["chart"]["promote"],",");
$data["chart"]["reg"] = \rtrim($data["chart"]["reg"],",");
$data["chart"]["active"] = \rtrim($data["chart"]["active"],",");
$data["chart"]["pay"] = \rtrim($data["chart"]["pay"],",");
return $data;
}
/**
* 获取游戏排行
* @param [type] $starttime 当前时间
* @param [type] $endtime 比较时间
* @return void
*/
private function data_order($starttime,$endtime,$today =false){
$GameCount = M("GameCount","tab_");
$data = array();
//注册排行
//1.获取注册前十名
if($today){
$map = ["puid"=>0,"fgame_id"=>["gt",0]];//0不是小号
$new_user_count = M("User","tab_")->field('COUNT(1) AS cg,fgame_id game_id,fgame_name game_name')->where($map)->where("register_time {$starttime}")->group("fgame_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
}else{
$new_user_count = $GameCount->field("game_id,game_name,sum(new_user_count) cg")->where("`date` {$starttime}")->group("game_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
}
$old_user_count = $GameCount->field("game_id,game_name,sum(new_user_count) cg")->where("`date` {$endtime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
//2.设置排名
$data["reg"] = $this->setRand($new_user_count,$old_user_count,"game_id");
//活跃排行
//1.获取注册前十名
if($today){
$map = ["game_id"=>["gt",0]];
$new_active_count = M("user_login_record","tab_")->field('COUNT(DISTINCT user_id) AS cg,game_id,game_name')->where($map)->where("login_time {$starttime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
}else{
$new_active_count = $GameCount->field("game_id,game_name,sum(active_user_count) cg")->where("`date` {$starttime}")->group("game_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
if(count($new_active_count) > 0){
$listarr = array();
$promote_id_str = '';
for ($i=0; $i < count($new_active_count); $i++) {
# code...
$promote_id_str .= ($new_active_count[$i]['game_id'].",");
$new_active_count[$i]["active_user_list"] = [];
$listarr[$new_active_count[$i]['game_id']] = $new_active_count[$i];
}
return $data;
}
$promote_id_str = \rtrim($promote_id_str,",");
//查询
$active_user_list = $GameCount->field("active_user_list,game_id")->where("`date` {$starttime} AND game_id in ({$promote_id_str})")->select();
for ($i=0; $i < count($active_user_list); $i++) {
$listarr[$active_user_list[$i]["game_id"]]["active_user_list"] += json_decode($active_user_list[$i]["active_user_list"],true);
}
foreach ($listarr as $key => $value) {
$value['cg'] = count(array_flip(array_flip($value['active_user_list'])));
unset($value['active_user_list']);
$listarr[$key] = $value;
}
$last_names = array_column($listarr,'cg');
array_multisort($last_names,SORT_DESC,$listarr);
$new_active_count = $listarr;
}
}
$old_active_count = $GameCount->field("game_id,game_name,sum(active_user_count) cg")->where("`date` {$endtime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
//2.设置排名
$data["active"] = $this->setRand($new_active_count,$old_active_count,"game_id");
//支付排行
//1.获取注册前十名
if($today){
$map = ["pay_status"=>1,"game_id"=>["gt",0]];
$new_money_count = M("Spend","tab_")->field('sum(pay_amount) AS cg,game_id,game_name')->where($map)->where("pay_time {$starttime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
}else{
$new_money_count = $GameCount->field("game_id,game_name,sum(pay_money_count) cg")->where("`date` {$starttime}")->group("game_id")->order("cg desc")->having("cg > 0")->limit(self::COUNTLIMIT)->select();
}
/**
* 排行榜(游戏)
* @param string $nowtime 现在时间段between 开始时间戳 and 结束时间戳)
* @param string $othertime 过去时间段between 开始时间戳 and 结束时间戳)
* @return array 结果集
* @author lwx edit
*/
private function data_order($nowtime,$othertime){
$user = M("User","tab_");
$spend = M('Spend',"tab_");
$chart1 = [];
$chart2 = [];
$chart3 = [];
//今日注册排行
/* $ri_ug_order=$user->field('fgame_id as game_id,fgame_name as game_name,count(tab_user.id) as cg')
->where(array('register_time'.$nowtime,'fgame_id'=>array('gt',0),'puid'=>0))
->group('fgame_id')->order('cg desc')->limit(10)->select(false);
$ri_ug_order=$user->field('a.*,@rank:=@rank+1 as rank_no')->table('(' .$ri_ug_order. ') as a,(SELECT @rank:= 0) b')->select();
$regids = array_column($ri_ug_order,'game_id');
if($regids) {
$yes_ug_order=$user->field('fgame_id as game_id,fgame_name as game_name,count(tab_user.id) as cg')
->where([array('register_time'.$othertime,'fgame_id'=>array('gt',0),'puid'=>0),array('register_time'.$othertime,'fgame_id'=>array('in',$regids),'puid'=>0),'_logic'=>'or'])
->group('fgame_id')->order('cg desc')->select(false);
$yes_ug_order=$user->field('a.*,@rank:=@rank+1 as rank_no')->table('(' .$yes_ug_order. ') as a,(SELECT @rank:= 0) b')->select();
$old_money_count = $GameCount->field("game_id,game_name,sum(pay_money_count) cg")->where("`date` {$endtime}")->group("game_id")->order("cg desc")->limit(self::COUNTLIMIT)->select();
//2.设置排名
$data["pay"] = $this->setRand($new_money_count,$old_money_count,"game_id");
foreach ($ri_ug_order as $key => $value) {
$ri_ug_order[$key]['change']=0;
$chart1['g'.$value['game_id']] = $value;
foreach ($yes_ug_order as $k => $v) {
if($value['game_id']==$v['game_id']){
$ri_ug_order[$key]['change']=$value['rank_no']-$v['rank_no'];break;
}
}
if($ri_ug_order[$key]['change']==0) {
$ri_ug_order[$key]['change'] = $value['rank_no']-count($ri_ug_order)-1;
}
}
} */
$ri_ug_order=$user->field('fgame_id as game_id,fgame_name as game_name,count(tab_user.id) as cg')
->where(array('register_time'.$nowtime,'fgame_id'=>array('gt',0),'puid'=>0))
->group('fgame_id')->order('cg desc')->limit(10)->select();
$ri_ug_order=array_order($ri_ug_order);
$regids = array_column($ri_ug_order,'game_id');
if($regids) {
$yes_ug_order=$user->field('fgame_id as game_id,fgame_name as game_name,count(tab_user.id) as cg')
->where([array('register_time'.$othertime,'fgame_id'=>array('gt',0),'puid'=>0),array('register_time'.$othertime,'fgame_id'=>array('in',$regids),'puid'=>0),'_logic'=>'or'])
->group('fgame_id')->order('cg desc')->select();
$yes_ug_order=array_order($yes_ug_order);
foreach ($ri_ug_order as $key => $value) {
$ri_ug_order[$key]['change'] = $value['rand']-count($ri_ug_order)-1;
$chart1['g'.$value['game_id']] = $value;
foreach ($yes_ug_order as $k => $v) {
if($value['game_id']==$v['game_id']){
$ri_ug_order[$key]['change']=$value['rand']-$v['rand'];break;
}
}
}
//设置chart
$char = array();
foreach ($data as $key => $value) {
for ($i=0; $i < count($value); $i++) {
$t = $value[$i];
if(empty($char[$t['game_id']])){
//不存在
$char[$t['game_id']] = array(
// "promote_id" =>$t['promote_id'],
"game_name" =>$t['game_name'],
"reg" => 0,
"active"=>0,
"pay"=>0
);
}
// //今日活跃排行
$duser = D('User');
$ri_active_order = $duser->activeRankOnGame($nowtime,'cg');
$ri_active_order=array_order($ri_active_order);
$activeids = array_column($ri_active_order,'game_id');
if($activeids) {
$yes_active = $duser->activeRankOnGame($othertime,'cg',$activeids);
$yes_active=array_order($yes_active);
foreach ($ri_active_order as $key => $value) {
$ri_active_order[$key]['change'] = $value['rand']-count($ri_active_order)-1;
$chart2['g'.$value['game_id']] = $value;
foreach ($yes_active as $k => $v) {
if($value['game_id']==$v['game_id']){
$ri_active_order[$key]['change']=$value['rand']-$v['rand'];break;
}
}
}
}
$char[$t['game_id']][$key] = $t['cg'];
}
}
foreach ($char as $key => $value) {
$data["chart"]["game"] .= ("\"".$value['game_name']."\",");
$data["chart"]["reg"] .= ( $value['reg'].",");
$data["chart"]["active"] .= ( $value['active'].",");
$data["chart"]["pay"] .= ( $value['pay'].",");
}
$data["chart"]["game"] = \rtrim($data["chart"]["game"],",");
$data["chart"]["reg"] = \rtrim($data["chart"]["reg"],",");
$data["chart"]["active"] = \rtrim($data["chart"]["active"],",");
$data["chart"]["pay"] = \rtrim($data["chart"]["pay"],",");
return $data;
// //充值排行
//spend
$ri_spay_order=$spend->field('game_id,game_name,sum(pay_amount) as cg')
->where(array('pay_time'.$nowtime,'game_id'=>array('gt',0),'pay_status'=>1))
->group('game_id')->order('cg desc')->limit(10)->select();
$ri_spay_order=array_order($ri_spay_order);
$payids = array_column($ri_spay_order,'game_id');
if ($payids) {
$yes_spay=$spend->field('game_id,game_name,sum(pay_amount) as cg')
->where([array('pay_status'=>1,'pay_time'.$othertime,'game_id'=>array('gt',0)),array('pay_time'.$othertime,'game_id'=>array('in',$payids)),'_logic'=>'or'])
->group('game_id')->order('cg desc')->select();
$yes_spay=array_order($yes_spay);
foreach ($ri_spay_order as $key => $value) {
$ri_spay_order[$key]['change'] = $value['rand']-count($ri_spay_order)-1;
$chart3['g'.$value['game_id']] = $value;
foreach ($yes_spay as $k => $v) {
if($value['game_id']==$v['game_id']){
$ri_spay_order[$key]['change']=$value['rand']-$v['rand'];
}
}
}
}
$data['zhuce']=$ri_ug_order;
$data['active']=$ri_active_order;
$data['pay']=$ri_spay_order;
$chart4 = array_merge($chart1,$chart2,$chart3);
foreach($chart4 as $k => $v) {
$chart['game'][$k] = $v['game_name'];
foreach($chart1 as $c) {
$chart['reg'][$k] = 0;
if ($v['game_id'] == $c['game_id']) {
$chart['reg'][$k] = (integer)$c['cg'];break;
}
}
foreach($chart2 as $c) {
$chart['active'][$k] = 0;
if ($v['game_id'] == $c['game_id']) {
$chart['active'][$k] = (integer)$c['cg'];break;
}
}
foreach($chart3 as $c) {
$chart['pay'][$k] = 0;
if ($v['game_id'] == $c['game_id']) {
$chart['pay'][$k] = $c['cg'];break;
}
}
}
foreach($chart as $k => $v) {
if ($k == 'game')
$data['chart'][$k] = '"'.implode('","',$v).'"';
else
$data['chart'][$k] = implode(',',$v);
}
//设置排名
private function setRand($randdata,$oldrand,$field = "promote_id")
{
//数据是否为空
$rcount = count($randdata);
if($rcount < 1){return [];}
//判断是否有旧排名
$isold = true;
$ocount = count($oldrand);
if($ocount < 1){
$isold = false;
}else{
$oldrand = array_column($oldrand,$field);
$oldrand=array_flip($oldrand);//反转数组
}
for ($i=0; $i <$rcount; $i++) {
$rand = $i+1;
$randdata[$i]['rand'] =$rand;
if($isold){
if(empty($oldrand[$randdata[$i][$field]])){
$randdata[$i]['change'] = 0;
}else{
$randdata[$i]['change'] = $rand - $oldrand[$randdata[$i][$field]];
}
return $data;
}
}else{
$randdata[$i]['change'] = $rand-1 - self::COUNTLIMIT;
}
}
return $randdata;
# code...
}
public function zhexian(){
$day=$this->every_day(7);
$time=$this->total(9);
@ -871,7 +896,8 @@ if ($payids) {
$time[]=date('Y-m-d',mktime(0,0,0,date('m'),date('d')-$i,date('Y')));
}
return $time;
}
}
private function total($type) {
switch ($type) {
case 1: { // 今天
@ -931,6 +957,10 @@ if ($payids) {
case 10: { // 前30天
$start = mktime(0,0,0,date('m'),date('d')-29,date('Y'));
$end=mktime(23,59,59,date('m'),date('d'),date('Y'));
};break;
case 11: { // 前天
$start=mktime(0,0,0,date('m'),date('d')-2,date('Y'));
$end=mktime(0,0,0,date('m'),date('d')-1,date('Y'))-1;
};break;
default:
$start='';$end='';

@ -0,0 +1,273 @@
<?php
namespace Admin\Controller;
use Think\Controller;
/**
* 后台总览聚合
* @author cz
*/
class StatisticsCountSetController extends Controller {
public $beginTime;
public $endTime;
public $date;
public $nowdata;
public $UserModel;
public $ChartModel;
public $LoginModel;
public $SpendModel;
public $PromoteModel;
public $GameCountModel;
public $addid;
public $adddata;
public $gameid;
public $gamedata;
public $reset=false;
public function _initialize(){
//初始化
$this->UserModel =M("User","tab_");
$this->LoginModel =M("user_login_record","tab_");
$this->SpendModel =M("spend","tab_");
$this->PromoteModel =M("promote","tab_");
$this->model =M();
$this->PromoteCountModel =M("PromoteCount","tab_");
$this->GameCountModel =M("GameCount","tab_");
$this->nowdata =time();
$group_concat_max_len = M()->execute("SET SESSION group_concat_max_len = 4294967295");
echo "set group_concat_max_len ok,beging count".PHP_EOL;
if(I("reset")) $this->reset = true;
}
public function setChartCount()
{
$begin = date("Y-m-d",strtotime("-1 day"));
$this->setDateCount($begin);
}
public function setFreeDateCount($begin,$end='')
{
if($end == '') $end = $begin;
//判断日期格式
$patten = "/^\d{4}[\-](0?[1-9]|1[012])[\-](0?[1-9]|[12][0-9]|3[01])$/";
if (!preg_match($patten, $begin)) {
die("开始时间格式错误");
}
if (!preg_match($patten, $end)) {
die("结束时间格式错误");
}
if(strtotime($end) < strtotime($begin)){
die("结束时间不能比开始时间小");
}
if(strtotime($end)+86399 > time()){
die("结束时间不能包含今日");
}
if($begin == $end){
$this->setDateCount($begin);
}else{
$starttime = $begin?strtotime($begin):mktime(0,0,0,date('m'),date('d')-1,date('Y'));
$endtime = $end?strtotime($end)+86399:$starttime+86399;
$datelist = get_date_list($starttime,$endtime,1);
$countdate = count($datelist);
for($i=0;$i<$countdate;$i++){
$this->setDateCount($datelist[$i]);
}
}
}
public function setDateCount($date)
{
$this->date = $date;
$tarry = explode('-',$date);
$this->beginTime=mktime(0,0,0,$tarry[1],$tarry[2],$tarry[0]);
$this->endTime=mktime(0,0,0,$tarry[1],$tarry[2]-0+1,$tarry[0])-1;
set_time_limit(0);
$t1 = microtime(true);
//判断是否存在
$PromoteRes = $this->PromoteCountModel->where("date = '{$this->beginTime}'")->find();
$GameRes = $this->GameCountModel->where("date = '{$this->beginTime}'")->find();
$reset='';
if(!empty($PromoteRes) || !empty($GameRes) ){
if($this->reset){
$this->PromoteCountModel->where("date = '{$this->beginTime}'")->delete();
$this->GameCountModel->where("date = '{$this->beginTime}'")->delete();
$reset = "reset and creat ";
}else{
echo ("{$this->date} 已统计,请勿重复提交".PHP_EOL);
return;
}
}
$this->model->startTrans();
$this->addid = [];
$this->adddata = [];
$this->promoteNew();
$this->promotePayMoeny();
$this->promoteActive();
$this->promoteCreateDb();
// unset($this->addid);
// unset($this->adddata);
$this->gameid = [];
$this->gamedata = [];
$this->gameNew();
$this->gamePayMoeny();
$this->gameActive();
$this->gameCreateDb();
$this->model->commit();
$t2 = microtime(true);
echo ("{$this->date} {$reset}success runtime:".round($t2-$t1,3).'s'.PHP_EOL);
# code...
}
//=======================聚合推广员========================
//1聚合新增
public function promoteNew()
{
$map = ['register_time'=>['between',[$this->beginTime,$this->endTime]],"puid"=>0,"promote_id"=>["gt",0]];
$promoteNew = $this->UserModel->field('COUNT(1) AS new_user_count,promote_id,promote_account')
->where($map)
->group("promote_id")
->select();
$count = count($promoteNew);
for ($i=0; $i < $count; $i++) {
$this->addid[] = $promoteNew[$i]["promote_id"];
$this->adddata[$promoteNew[$i]["promote_id"]] = $promoteNew[$i];
}
unset($promoteNew);
}
//2聚合付费
public function promotePayMoeny()
{
$map = ['pay_time'=>['between',[$this->beginTime,$this->endTime]],"pay_status"=>1,"promote_id"=>["gt",0]];//1支付成功
$promotePayMoeny = $this->SpendModel->field('sum(pay_amount) AS pay_money_count,promote_id,promote_account')
->where($map)
->group("promote_id")
->select();
$count = count($promotePayMoeny);
for ($i=0; $i < $count; $i++) {
if (in_array($promotePayMoeny[$i]["promote_id"],$this->addid)) {
//存在
$this->adddata[$promotePayMoeny[$i]["promote_id"]]["pay_money_count"] = $promotePayMoeny[$i]["pay_money_count"];
}else{
$this->addid[] = $promotePayMoeny[$i]["promote_id"];
$this->adddata[$promotePayMoeny[$i]["promote_id"]] = $promotePayMoeny[$i];
}
}
unset($promotePayMoeny);
}
//3聚合活跃
public function promoteActive()
{
$map = ['login_time'=>['between',[$this->beginTime,$this->endTime]],"promote_id"=>["gt",0]];//0不是小号
$promoteActive = $this->LoginModel->field('COUNT(DISTINCT user_id) AS active_user_count,GROUP_CONCAT(DISTINCT user_id) active_user_list,promote_id')
->where($map)
->group("promote_id")
->select();
$count = count($promoteActive);
for ($i=0; $i < $count; $i++) {
if (in_array($promoteActive[$i]["promote_id"],$this->addid)) {
//存在
$this->adddata[$promoteActive[$i]["promote_id"]]["active_user_count"] = $promoteActive[$i]["active_user_count"];
$this->adddata[$promoteActive[$i]["promote_id"]]["active_user_list"] = $promoteActive[$i]["active_user_list"];
}else{
$this->addid[] = $promoteActive[$i]["promote_id"];
$this->adddata[$promoteActive[$i]["promote_id"]] = $promoteActive[$i];
}
}
unset($promoteActive);
}
//4加入数据库
public function promoteCreateDb()
{
$count = count($this->addid);
if ($count > 0) {
foreach ($this->adddata as $key => $value) {
$value['date']=$this->beginTime;
$value['create_time']=$this->nowdata;
$value['active_user_list'] = @json_encode(array_map("intFun",explode(",",$value['active_user_list'])));
if(empty($value['promote_account']) && $value['promote_id']){
$value['promote_account'] = $this->PromoteModel->field("account")->where("id = {$value['promote_id']}")->find()['account'];
}
$tempdbres = $this->PromoteCountModel->add($value);
if($tempdbres === false){
$this->model->rollback();
die("error");
}
}
}
}
//=======================聚合游戏========================
//1聚合新增
public function gameNew()
{
$map = ['register_time'=>['between',[$this->beginTime,$this->endTime]],"puid"=>0,"fgame_id"=>["gt",0]];//0不是小号
$gameNew = $this->UserModel->field('COUNT(1) AS new_user_count,fgame_id game_id,fgame_name game_name')
->where($map)
->group("fgame_id")
->select();
$count = count($gameNew);
for ($i=0; $i < $count; $i++) {
$this->gameid[] = $gameNew[$i]["game_id"];
$this->gamedata[$gameNew[$i]["game_id"]] = $gameNew[$i];
}
unset($gameNew);
}
//2聚合付费
public function gamePayMoeny()
{
$map = ['pay_time'=>['between',[$this->beginTime,$this->endTime]],"pay_status"=>1,"game_id"=>["gt",0]];//1支付成功
$gamePayMoeny = $this->SpendModel->field('sum(pay_amount) AS pay_money_count,game_id,game_name')
->where($map)
->group("game_id")
->select();
$count = count($gamePayMoeny);
for ($i=0; $i < $count; $i++) {
if (in_array($gamePayMoeny[$i]["game_id"],$this->gameid)) {
//存在
$this->gamedata[$gamePayMoeny[$i]["game_id"]]["pay_money_count"] = $gamePayMoeny[$i]["pay_money_count"];
}else{
$this->gameid[] = $gamePayMoeny[$i]["game_id"];
$this->gamedata[$gamePayMoeny[$i]["game_id"]] = $gamePayMoeny[$i];
}
}
unset($gamePayMoeny);
}
//3聚合活跃
public function gameActive()
{
$map = ['login_time'=>['between',[$this->beginTime,$this->endTime]],"game_id"=>["gt",0]];//0不是小号
$gameActive = $this->LoginModel->field('COUNT(DISTINCT user_id) AS active_user_count,GROUP_CONCAT(DISTINCT user_id) active_user_list,game_id,game_name')
->where($map)
->group("game_id")
->select();
$count = count($gameActive);
for ($i=0; $i < $count; $i++) {
if (in_array($gameActive[$i]["game_id"],$this->gameid)) {
//存在
$this->gamedata[$gameActive[$i]["game_id"]]["active_user_count"] = $gameActive[$i]["active_user_count"];
$this->gamedata[$gameActive[$i]["game_id"]]["active_user_list"] = $gameActive[$i]["active_user_list"];
}else{
$this->gameid[] = $gameActive[$i]["game_id"];
$this->gamedata[$gameActive[$i]["game_id"]] = $gameActive[$i];
}
}
unset($gameActive);
}
//4加入数据库
public function gameCreateDb()
{
$count = count($this->gameid);
if ($count > 0) {
foreach ($this->gamedata as $key => $value) {
$value['date']=$this->beginTime;
$value['create_time']=$this->nowdata;
$value['active_user_list'] = @json_encode(array_map("intFun",explode(",",$value['active_user_list'])));
$tempdbres = $this->GameCountModel->add($value);
if($tempdbres === false){
$this->model->rollback();
die("error");
}
}
}
}
}

@ -0,0 +1,85 @@
<?php
namespace Admin\Controller;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class SuperSignController extends ThinkController
{
public function lists($p = 1) {
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row=10;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$map =[];
if (I('account')) {
$map['tab_user.account'] = I('account');
}
if (I('order_id')) {
$map['order_id'] = I('order_id');
}
if (I('start')&&I('end')) {
$map['pay_time'] = ['between',[strtotime(I('start')),strtotime(I('end'))]];
} else if(I('start')&&!I('end')) {
$map['pay_time'] = ['egt',strtotime(I('start'))];
} else if (!I('start')&&I('end')) {
$map['pay_time'] = ['elt',strtotime(I('end'))];
}
if (I('game_name')) {
$map['game_name'] = ['like',I('game_name').'%'];
}
if (I('promote_id')||I('promote_id')=='0') {
$map['tab_user.promote_id'] = I('promote_id');
}
$map['tab_game_supersign.pay_status'] = 1;
$data = M('game_supersign','tab_')
->field("order_id,ticket,pay_time,tab_user.account,tab_game.game_name,tab_user.promote_account,pay_price,pay_way")
->join("left join tab_user on tab_game_supersign.user_id = tab_user.id")
->join("left join tab_game on tab_game_supersign.game_id = tab_game.id")
->page($p, $row)
->order("pay_time DESC")
->where($map)
->select();
foreach ($data as $key => $Value) {
$data[$key]['pay_time'] = date('Y-m-d H:i:s',$Value['pay_time']);
if ($Value['pay_way']==1) {
$data[$key]['pay_way'] = '支付宝';
} else if ($Value['pay_way']==2) {
$data[$key]['pay_way'] = '微信';
} else if($Value['pay_way']==3){
$data[$key]['pay_way'] = '双乾支付宝';
}else if($Value['pay_way']==4){
$data[$key]['pay_way'] = '双乾微信';
}else {
$data[$key]['pay_way'] = '未知';
}
}
$count = M('game_supersign','tab_')
->field("order_id,ticket,pay_time,tab_user.account,tab_game.game_name,tab_user.promote_account,pay_price")
->join("left join tab_user on tab_game_supersign.user_id = tab_user.id")
->join("left join tab_game on tab_game_supersign.game_id = tab_game.id")->where($map)->count();
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$this->meta_title = '超级签订单';
$this->assign('data',$data);
$this->display();
}
}

@ -0,0 +1,193 @@
<?php
namespace Admin\Controller;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class TestWhiteListController extends ThinkController
{
public function lists($p = 1) {
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row=10;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$map =[];
if (I('account')) {
$map['account'] = array('like',I('account').'%');
}
$data = M('test_white_list','tab_')
->page($p, $row)
->where($map)
->order('create_ime DESC')
->select();
foreach ($data as $key => $Value) {
// $data[$key]['show_status'] = $data[$key]['show_status']?'显示':'锁定';
$data[$key]['create_ime'] = date('Y-m-d H:i:s',$Value['create_ime']);
}
$count = M('test_white_list','tab_')
->where($map)
->count();
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$this->meta_title = '测试白名单';
$this->assign('data',$data);
$this->display();
}
public function add() {
$this->meta_title = '测试白名单添加';
$this->assign('title','新增');
$this->display();
}
public function edit() {
$this->meta_title = '测试白名单编辑';
$this->assign('title','编辑');
$this->display("add");
}
public function edit_user() {
$data = I('');
if (!$data['user_id']) {
$this->error('请填写测试账号');
}
$userData['account'] = $data['account'];
$user = M('user','tab_')->where(array('id'=>$data['user_id']))->find();
if (!$user) {
$this->error('账号不存在');
}
$userData['check_status'] = $data['status']?$data['status']:0;
$userAdd = M('user','tab_')->where(array('id'=>$data['user_id']))->save($userData);
if ($userAdd) {
$whitedata['show_status'] = $data['status']?$data['status']:0;
$whitedata['account'] = $data['account'];
$whiteList = M('test_white_list','tab_')->where(array('user_id'=>$data['user_id']))->save($whitedata);
// echo M('test_white_list','tab_')->_sql();die();
if($whiteList) {
$this->success('修改白名单成功',U('TestWhiteList/lists'));
} else {
$this->error('修改白名单失败');
}
} else {
$this->error('修改用户失败');
}
}
public function edit_user1() {
$data = $_GET;
if (!$data['user_id']) {
$this->ajaxReturn(['status'=>0,'msg'=>"请填写测试账号"]);
}
$userData['account'] = $data['account'];
$user = M('user','tab_')->where(array('id'=>$data['user_id']))->find();
if (!$user) {
$this->ajaxReturn(['status'=>0,'msg'=>"账号不存在"]);
}
$userData['check_status'] = $data['status']?$data['status']:0;
$userAdd = M('user','tab_')->where(array('id'=>$data['user_id']))->save($userData);
if ($userAdd) {
$whitedata['show_status'] = $data['status']?$data['status']:0;
$whitedata['account'] = $data['account'];
$whiteList = M('test_white_list','tab_')->where(array('user_id'=>$data['user_id']))->save($whitedata);
// echo M('test_white_list','tab_')->_sql();die();
if($whiteList) {
$this->ajaxReturn(['status'=>1,'msg'=>"修改白名单成功"]);
} else {
$this->ajaxReturn(['status'=>0,'msg'=>"修改白名单成功"]);
}
} else {
$this->ajaxReturn(['status'=>0,'msg'=>"修改用户失败"]);
}
}
public function add_user() {
$data = I('');
if (!$data['account']) {
$this->error('请填写测试账号');
}
$userData['account'] = $data['account'];
$user = M('user','tab_')->where($userData)->find();
if ($user) {
$this->error('账号已经存在');
}
$userData['password'] = md5(sha1('123456') . UC_AUTH_KEY);
$userData['promote_id'] = 0;
$userData['promote_account'] = '官方渠道';
$userData['register_time'] = time();
$userData['check_status'] = $data['status']?$data['status']:0;
$userAdd = M('user','tab_')->add($userData);
if ($userAdd) {
$data['user_id'] = $userAdd;
$data['show_status'] = $data['status']?$data['status']:0;
$data['add_user'] = $_SESSION['onethink_admin']['user_auth']['username'];
$data['create_ime'] = time();
$whiteList = M('test_white_list','tab_')->add($data);
if($whiteList) {
$this->success('添加白名单成功',U('TestWhiteList/lists'));
} else {
$this->error('添加白名单失败');
}
} else {
$this->error('添加用户失败');
}
}
public function freezeSupport() {
$supportId = I('status');
$data = [
'check_status' => $supportId
];
$isFreeze = M('user','tab_')->where("id=".$supportId)->save($data);
if ($supportId == 1) {
$msg = '启用';
} else if ($supportId == 0) {
$msg = '锁定';
}
if ($isFreeze) {
$this->ajaxReturn(['status'=>1, 'msg'=> $msg.'成功']);
} else {
$this->ajaxReturn(['status'=>0, 'msg'=> $msg.'失败']);
}
}
}

@ -631,6 +631,17 @@ class UserController extends AdminController
$map['role_name'] = trim($_REQUEST['role_name']);
unset($_REQUEST['role_name']);
}
// $promoteRoot = getPowerPromoteIds();
// $data_empower_type = session('user_auth')['data_empower_type'];
//
// if ($promoteRoot) {
// $map['promote_id'] =array('in',$promoteRoot);
// } else if(!$promoteRoot&&$data_empower_type!=1){
// $map['id'] = array('lt',1);
// }
setPowerPromoteIds($map,'promote_id');
if (isset($_REQUEST['promote_id'])) {
$queryStr = '';
if ($_REQUEST['promote_id'] == 0) {
@ -646,6 +657,16 @@ class UserController extends AdminController
$map['sdk_version'] = trim($_REQUEST['game_type']);
unset($_REQUEST['game_type']);
}
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$map['create_time'] = ['between', [strtotime(I('time_start')), strtotime(I('time_end')) + 86399]];
} elseif (isset($_REQUEST['time_start'])) {
$map['create_time'] = ['GT', strtotime(I('time_start'))];
} elseif (isset($_REQUEST['time_end'])) {
$map['create_time'] = ['LT', strtotime(I('time_end')) + 86399];
}
empty(I('user_account')) || $map['user_account'] = ['like', "%" . I('user_account') . "%"];
$list = $this->lists(M('user_play_info', 'tab_'), $map, 'play_time desc');
$this->assign('list', $list);

@ -1 +1 @@
{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":2},{"time":"16:00","count":2},{"time":"17:00","count":1},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":5,"active":17,"player":1,"money":6},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":3},{"time":"10:00","count":1},{"time":"11:00","count":3},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":1},{"time":"15:00","count":3},{"time":"16:00","count":4},{"time":"17:00","count":2},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":1},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":"6.00"},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]}
{"news":[{"time":"0:00","count":6},{"time":"1:00","count":9},{"time":"2:00","count":7},{"time":"3:00","count":11},{"time":"4:00","count":16},{"time":"5:00","count":7},{"time":"6:00","count":9},{"time":"7:00","count":11},{"time":"8:00","count":14},{"time":"9:00","count":40},{"time":"10:00","count":58},{"time":"11:00","count":86},{"time":"12:00","count":41},{"time":"13:00","count":55},{"time":"14:00","count":194},{"time":"15:00","count":180},{"time":"16:00","count":121},{"time":"17:00","count":98},{"time":"18:00","count":120},{"time":"19:00","count":147},{"time":"20:00","count":146},{"time":"21:00","count":124},{"time":"22:00","count":93},{"time":"23:00","count":56}],"sum":{"news":1649,"active":8210,"player":1715,"money":226618},"active":[{"time":"0:00","count":967},{"time":"1:00","count":343},{"time":"2:00","count":176},{"time":"3:00","count":135},{"time":"4:00","count":118},{"time":"5:00","count":177},{"time":"6:00","count":465},{"time":"7:00","count":661},{"time":"8:00","count":622},{"time":"9:00","count":547},{"time":"10:00","count":480},{"time":"11:00","count":414},{"time":"12:00","count":326},{"time":"13:00","count":237},{"time":"14:00","count":354},{"time":"15:00","count":328},{"time":"16:00","count":215},{"time":"17:00","count":219},{"time":"18:00","count":256},{"time":"19:00","count":335},{"time":"20:00","count":274},{"time":"21:00","count":244},{"time":"22:00","count":197},{"time":"23:00","count":120}],"player":[{"time":"0:00","count":211},{"time":"1:00","count":84},{"time":"2:00","count":29},{"time":"3:00","count":25},{"time":"4:00","count":16},{"time":"5:00","count":24},{"time":"6:00","count":32},{"time":"7:00","count":56},{"time":"8:00","count":71},{"time":"9:00","count":66},{"time":"10:00","count":63},{"time":"11:00","count":69},{"time":"12:00","count":58},{"time":"13:00","count":62},{"time":"14:00","count":50},{"time":"15:00","count":99},{"time":"16:00","count":68},{"time":"17:00","count":61},{"time":"18:00","count":77},{"time":"19:00","count":157},{"time":"20:00","count":107},{"time":"21:00","count":101},{"time":"22:00","count":74},{"time":"23:00","count":55}],"money":[{"time":"0:00","count":"31554.00"},{"time":"1:00","count":"4117.00"},{"time":"2:00","count":"1839.00"},{"time":"3:00","count":"4513.00"},{"time":"4:00","count":"1008.00"},{"time":"5:00","count":"1981.00"},{"time":"6:00","count":"1270.00"},{"time":"7:00","count":"1906.00"},{"time":"8:00","count":"6683.00"},{"time":"9:00","count":"6119.00"},{"time":"10:00","count":"8974.00"},{"time":"11:00","count":"14147.00"},{"time":"12:00","count":"9775.00"},{"time":"13:00","count":"11908.00"},{"time":"14:00","count":"6781.00"},{"time":"15:00","count":"12626.00"},{"time":"16:00","count":"6742.00"},{"time":"17:00","count":"8303.00"},{"time":"18:00","count":"8804.00"},{"time":"19:00","count":"23476.00"},{"time":"20:00","count":"17464.00"},{"time":"21:00","count":"16899.00"},{"time":"22:00","count":"13143.00"},{"time":"23:00","count":"6586.00"}]}

File diff suppressed because one or more lines are too long

@ -39,7 +39,9 @@ class SettlementEvent extends ThinkEvent {
$spend = M('Spend','tab_');
$ssql=$spend
->field('tab_spend.pay_order_number,tab_spend.game_id,tab_spend.game_name,t.pid as pid,pay_amount,if(isnull(tab_apply.promote_ratio),tab_game.ratio,tab_apply.promote_ratio) as ratio,if(isnull(tab_apply.promote_money),tab_game.money,tab_apply.promote_money) as money')
->field('tab_spend.pay_order_number,tab_spend.game_id,tab_spend.game_name,t.pid as pid,pay_amount,
if(isnull(tab_apply.promote_ratio),tab_game.ratio,tab_apply.promote_ratio) as ratio,
if(isnull(tab_apply.promote_money),tab_game.money,tab_apply.promote_money) as money')
->join("INNER JOIN (
SELECT
tp2.*, tp1.id AS pid,

@ -71,11 +71,15 @@ class MemberModel extends Model {
);
$this->save($data);
$adminData = getAdminData($user['uid']);
/* 记录登录SESSION和COOKIES */
$auth = array(
'uid' => $user['uid'],
'username' => $user['nickname'],
'last_login_time' => $user['last_login_time'],
'data_empower_type'=>$adminData['data_empower_type'],
'data_president'=>$adminData['data_president']
);
session('user_auth', $auth);
session('user_auth_sign', data_auth_sign($auth));

@ -385,4 +385,15 @@ class PromoteModel extends Model{
}
return $result;
}
public function getPromotersByLevelOther($level=1)
{
$result = [];
$promoteRoot = getPowerPromoteIds();
$result = $this->field("*")->where("level={$level} and id IN({$promoteRoot})")->select();
foreach ($result as &$item) {
$item['nickname'] = $item['account'] . ($item['nickname'] ? "({$item['nickname']})" : "");
}
return $result;
}
}

@ -2073,6 +2073,38 @@ class UserModel extends Model{
return $data;
}
/**
* 获取用户列表
*/
public function getUserList($param, $field = "*", $group = "")
{
$result = $this->where($param)
->field($field)
->group($group)
->select();
return $result;
}
/**
* 获取未流失的玩家
* @param $day int 几天算玩家流失
*/
public function getKeepPlayers($map = '', $day, $falseIndex = false)
{
$join = "right join tab_user as u on r.user_id = u.id";
if ($falseIndex) {//日期范围大于5天使用强制索引
$join = "FORCE INDEX (PRIMARY) " . $join;
}
$data = $this->table("tab_user_login_record")
->alias("r")
->field("GROUP_CONCAT(DISTINCT u.id) as user_ids,FROM_UNIXTIME(u.register_time+{$day}*86400, '%Y-%m-%d') as register_date")
->join($join)
->group("register_date")
->where($map)
->select();
return $data;
}
}

@ -14,6 +14,7 @@
<ul>
<li><a href="{:U('AuthManager/access',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">访问授权</a></li>
<li class="current"><a href="javascript:;">分类授权</a></li>
<li><a href="{:U('AuthManager/dataempower',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">数据授权</a></li>
<li><a href="{:U('AuthManager/user',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">成员授权</a></li>
<li class="fr tab_select">
<select name="group">

@ -0,0 +1,188 @@
<!-- 成员授权编辑页面 -->
<extend name="Public/base" />
<block name="body">
<div class="main-place">
<span class="main-placetitle">位置</span>
<ul class="main-placeul">
<li><a href="{:U('User/index')}">用户</a></li>
<li><a href="{:U('User/index')}">管理组</a></li>
<li><a href="#">{$meta_title}</a></li>
</ul>
</div>
<div class="tab-wrap">
<div class="tab_nav">
<ul>
<li><a href="{:U('AuthManager/access',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">访问授权</a></li>
<li><a href="{:U('AuthManager/category',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">分类授权</a></li>
<!-- <li><a href="{:U('AuthManager/dataempower',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">数据授权</a></li>-->
<li class="current"><a href="javascript:;">数据授权</a></li>
<li><a href="{:U('AuthManager/user',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">成员授权</a></li>
<!-- <li class="current"><a href="javascript:;">成员授权</a></li>-->
<li class="fr tab_select">
<select name="group">
<volist name="auth_group" id="vo">
<option value="{:U('AuthManager/dataempower',array('group_id'=>$vo['id'],'group_name'=>$vo['title']))}" <eq name="vo['id']" value="$_GET['group_id']">selected</eq> >{$vo.title}</option>
</volist>
</select>
</li>
</ul>
</div>
<div class="tab-wrap">
<div class="tab-content tabcon1711" style="margin-top: 20px;">
<span style="font-size: 20px;font-weight: 600;padding-left: 15px;padding-bottom: 30px">数据授权</span>
<!-- 表单 -->
<form id="form" action="{:U('dataEmpowerSave?model='.$model['id'])}" method="post" class="form-horizontal">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1" style="margin-top: 10px;">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l" style="padding-left: 15px;">数据授权类型:</td>
<td class="r table_radio">
<span class="form_radio table_btn" style="width: auto">
<label >
<input type="radio" value="1" name="data_empower_type" <eq name="data_empower_type" value="1">checked="checked"</eq>>可查看全部数据
</label >
<label >
<input type="radio" value="2" name="data_empower_type" <eq name="data_empower_type" value="2">checked="checked"</eq>>可查看部分数据
</label>
<label >
<input type="radio" value="3" name="data_empower_type" <eq name="data_empower_type" value="3">checked="checked"</eq>>只能查看自己创建的会长数据
</label>
</span>
<!-- <span class="notice-text">锁定状态下,推广员账号则无法登录</span>-->
<input type="hidden" name="group_id" id="group_id" value="{$_GET['group_id']}">
<input type="hidden" name="promote_data" id="promote_data" value="[]">
</td>
</tr>
</tbody>
</table>
</div>
<link rel="stylesheet" type="text/css" href="__STATIC__/layui-v2.5.5/css/layui.css">
<if condition="$data_empower_type neq 2">
<div id="test4" class="demo-transfer" style="margin-left: 100px;margin-top: 35px;display: none" ></div>
<else/>
<div id="test4" class="demo-transfer" style="margin-left: 100px;margin-top: 35px"></div>
</if>
<div class="form-item cf">
<button class="submit_btn ajax-post mlspacing" id="submit" type="submit" target-form="form-horizontal" >
确认
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back(-1);" style="color:#000000;background:#ffffff;border: solid 1px #000">
返回
</a>
</div>
</form>
</div>
</div>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="AuthManager/index">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script src="__STATIC__/layui-v2.5.5/layui.all.js"></script>
<script>
var dataTransfer = '';
$.ajax({
url: "{:U('getRootPromote')}",
type: "post",
data: {group_id: $('#group_id').val()},
dataType: 'json',
success: function (data) {
// datas = data;
layui.use(['transfer', 'layer', 'util'], function(){
var $ = layui.$
,transfer = layui.transfer
,layer = layui.layer
,util = layui.util;
var data1 =data;
if (JSON.parse(data1).data_president) {
var data2 = JSON.parse(data1).data_president.split(",");
}
//显示搜索框
transfer.render({
elem: '#test4'
,data: JSON.parse(data1).list
,title: ['全部成员', '选中成员']
,showSearch: true,
value: data2,
id: 'key123',
onchange: function(data, index){
dataTransfer = transfer.getData('key123'); //获取右侧数据
// layer.alert(JSON.stringify(dataTransfer));
$('#promote_data').val(JSON.stringify(dataTransfer));
}
})
transfets = transfer;
//批量办法定事件
util.event('lay-demoTransferActive', {
getData: function(othis){
var getData = transfer.getData('key123'); //获取右侧数据
layer.alert(JSON.stringify(getData));
}
,reload:function(){
//实例重载
transfer.reload('key123', {
title: ['文人', '喜欢的文人']
,value: ['2', '5', '9']
,showSearch: true
})
}
});
});
}
});
$(function () {
var status = $('input:radio[name="data_empower_type"]:checked').val();
$('#status').val(status);
});
$(":radio").click(function () {
var status = $('input:radio[name="data_empower_type"]:checked').val();
$('#status').val(status);
if (status != 2) {
$("#test4").css('display','none');
$('#promote_data').val('[]');
} else {
$("#test4").css('display','block');
$('#promote_data').val(JSON.stringify(dataTransfer));
}
})
</script>
<script type="text/javascript" charset="utf-8">
$('select[name=group]').change(function(){
location.href = this.value;
});
//导航高亮
highlight_subnav('{:U('AuthManager/index')}');
</script>
<style>
.layui-transfer-box{
overflow: hidden;
}
</style>
</block>

@ -46,6 +46,7 @@
<td><a href="{:U('AuthManager/access?group_name='.$vo['title'].'&group_id='.$vo['id'])}" >访问授权</a>
<a href="{:U('AuthManager/category?group_name='.$vo['title'].'&group_id='.$vo['id'])}" >分类授权</a>
<a href="{:U('AuthManager/user?group_name='.$vo['title'].'&group_id='.$vo['id'])}" >成员授权</a>
<a href="{:U('AuthManager/dataempower?group_name='.$vo['title'].'&group_id='.$vo['id'])}" >数据授权</a>
</td>
<td>
<eq name="vo.status" value="1"><span class="enabled_status">{:get_status_title($vo['status'])}</span>

@ -14,6 +14,7 @@
<ul>
<li class="current"><a href="javascript:;">访问授权</a></li>
<li><a href="{:U('AuthManager/category',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">分类授权</a></li>
<li><a href="{:U('AuthManager/dataempower',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">数据授权</a></li>
<li><a href="{:U('AuthManager/user',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">成员授权</a></li>
<li class="fr tab_select">
<select name="group">

@ -14,7 +14,8 @@
<ul>
<li><a href="{:U('AuthManager/access',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">访问授权</a></li>
<li><a href="{:U('AuthManager/category',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">分类授权</a></li>
<li class="current"><a href="javascript:;">成员授权</a></li>
<li><a href="{:U('AuthManager/dataempower',array('group_name'=>I('group_name') ,'group_id'=> I('group_id')))}">数据授权</a></li>
<li class="current"><a href="javascript:;">成员授权</a></li>
<li class="fr tab_select">
<select name="group">
<volist name="auth_group" id="vo">

@ -411,7 +411,7 @@
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevel')}",
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',

@ -66,7 +66,7 @@
<div class="input-list input-list-game search_label_rehab">
<select id="op_id" name="op_id" class="select_gallery" style="width:120px;">
<option value="">发放人员</option>
<volist name=":get_admin_list()" id="vo">
<volist name=":get_admin_listOther()" id="vo">
<option game-id="{$vo.uid}" value="{$vo.uid}">{$vo.nickname}</option>
</volist>
</select>

@ -300,7 +300,7 @@
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevel')}",
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',

@ -451,7 +451,7 @@ $(function(){
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevel')}",
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',

@ -8,8 +8,8 @@
<div class="cf main-place top_nav_list navtab_list">
<div class="fr">
<a <if condition="(I('type') eq 1) or (I('type') eq '') "> class="tabchose" </if> href="{:U('lists',array('type'=>1))}">推广补链</a>
<a <if condition="I('type') eq 2"> class="tabchose" </if> href="{:U('lists',array('type'=>2))}">补链记录</a>
<a class="tabchose" href="{:U('lists')}">推广补链</a>
<a href="{:U('recordList')}">补链记录</a>
</div>
<h3 class="page_title">推广补链</h3>
<if condition="(I('type',1) eq 1) ">
@ -181,7 +181,7 @@
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Mend/lists')}');
highlight_subnav("{:U('Mend/lists')}");
if('{$Think.get.account}'!=''){
$('#select2-user_id-container').text('{$Think.get.account}');
}

@ -0,0 +1,277 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.js-pop,.remarkView{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
<div class="fr">
<a href="{:U('lists')}">推广补链</a>
<a class="tabchose" href="{:U('recordList',array('type'=>2))}">补链记录</a>
</div>
<h3 class="page_title">补链记录</h3>
<p class="description_text">说明:此处功能查看玩家推广补链记录。</p>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list">
<input type="text" name="account" placeholder="玩家账号" value="{:I('account')}">
</div>
<div class="input-list">
<input type="text" name="promote_account" placeholder="补链前渠道" value="{:I('promote_account')}">
</div>
<div class="input-list">
<input type="text" name="promote_account_to" placeholder="补链后渠道" value="{:I('promote_account_to')}">
</div>
<div class="input-list">
<input type="text" name="op_account" placeholder="操作人员" value="{:I('op_account')}">
</div>
<div class="input-list">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="切分开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}" placeholder="切分结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Mend/recordList','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>
<input class="check-all" type="checkbox">
</th>
<th>玩家账号</th>
<th>补链前渠道</th>
<th>补链前归属金额</th>
<th>补链后渠道</th>
<th style="width:400px;">备注</th>
<th>切分时间</th>
<th>补链时间</th>
<th>操作人员</th>
</tr>
</thead>
<!-- 列表 -->
<tbody id="tablebox">
<empty name ="list_data">
<td colspan="9" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="list_data" id="data">
<tr>
<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
<td>{$data['user_account']}</td>
<td>{$data['promote_account']}</td>
<td>{$data['pay_amount']}</td>
<td>{$data['promote_account_to']}</td>
<td class="js-pop" style="max-width: 400px;padding: 0 20px;">
<a href="javascript:" title="点击查看" class="remarkView" info="{$data['remark']}">{$data['remark']}</a>
</td>
<td>{$data.order_time}</td>
<td>{$data.create_time}</td>
<td>{$data.op_account}</td>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Mend/recordList',array_merge(['export'=>1],I('get.')))}">导出</a>
<div id="pagebox">
{$_page|default=''}
</div>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Mend/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script type="text/html" id="tabletpl">
{@each list_data as item,index}
<tr>
<td><input class="ids" type="checkbox" value="${item['id']}" name="ids[]"></td>
<td>${item['user_account']}</td>
<td>${item['promote_account']}</td>
<td>${item['pay_amount']}</td>
<td>${item['promote_account_to']}</td>
<td class="js-pop" style="max-width: 400px;padding: 0 20px;">
<a href="javascript:" title="点击查看" class="remarkView" info="${item['remark']}">${item['remark']}</a>
</td>
<td>${item.order_time}</td>
<td>${item.create_time}</td>
<td>${item.op_account}</td>
</tr>
{@/each}
</script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/layer/extend/layer.ext.js" type="text/javascript"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script type="text/javascript">
$(".select_gallery").select2();
$(".input-list-user").click(function(){
$('#select2-user_id-container').text('请选择玩家账号');
$("#user_account").val('');
});
$("#user_id").change(function() {
$("#user_account").val($("#user_id option:selected").val());
});
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('Mend/lists')}");
if('{$Think.get.account}'!=''){
$('#select2-user_id-container').text('{$Think.get.account}');
}
Think.setValue('row','{:I("row",10)}')
$(function(){
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
var start = $("#time_start").val();
var end = $("#time_end").val();
if(start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
window.location.href = url;
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true,
pickerPosition:'bottom-left'
})
//下拉内容框
$(".drop-down2").on('click',function(event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$('#i_list_id').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function(){
navlist.addClass('hidden');
});
event.stopPropagation();
});
$('#i_list_id').on('keyup',function(event) {
var val = $.trim($(this).val()).toLowerCase();
$('#i_list_idh').val(val);
});
$("#i_list_li").find("a").each(function(){
$(this).click(function(){
var text = $.trim($(this).text()).toLowerCase();
$("#i_list_id").val(text);
$('#i_list_idh').val(text);
})
});
pageAjax();
})
function pageAjax(){
$(".remarkView,.num,.prev,.next,.first,.end").off("click");
$(".remarkView").click(function() {
layer.alert($(this).attr("info"));
})
$(".num,.prev,.next,.first,.end").on("click",function(e){
e.preventDefault();
layer.load(2);
var url = $(this).attr("href");
$.ajax({
url:url,
data:{
row_count:{$row_count},
row:'{:I("row",10)}'
},
type:"post",
dataType:"json",
success:function(data){
layer.closeAll('loading');
$("#pagebox").html(data.page);
var tpl =$("#tabletpl").html();
var html = juicer(tpl, data);
$("#tablebox").html(html);
pageAjax();
}
})
})
}
</script>
</block>

@ -82,6 +82,20 @@
</td>
</tr>
<tr>
<td class="l">所属推广公司</td>
<td class="r">
<select name="company_id" id="company_id">
<option value="0">请选择推广公司</option>
<volist name="companys" id="vo">
<option value="{$vo.id}">{$vo.company_name}</option>
</volist>
</select>
<!-- <span class="notice-text">设置该推广员所属的推广公司</span>-->
</td>
</tr>
</tbody>
</table>
</div>

@ -165,7 +165,7 @@ background-color: #FF9797;
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>2,'xlsname'=>'数据管理_实时注册'),I('get.')))}">导出</a>
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>2,'xlsname'=>'数据管理_实时注册'),I('get.')))}">导出</a>
{$_page|default=''}
</div>

@ -57,7 +57,7 @@
<div class="input-list input-list-game search_label_rehab">
<select name="promote_id" class="select_gallery" style="width:120px;">
<option value="">推广员帐号</option>
<volist name=":get_promote_list()" id="vo">
<volist name=":get_promote_listOther()" id="vo">
<option value="{$vo.id}">{$vo.account}</option>
</volist>
</select>

@ -70,7 +70,7 @@
<tr>
<td class="l">推广员帐号</td>
<td class="r"><select id="promote_id" name="promote_id">
<volist name=":promote_lists(I('promote_type'))" id="vo">
<volist name=":promote_listsOther(I('promote_type'))" id="vo">
<option coin-yue='{$vo.common_coin}' value="{$vo.id}">{$vo.account}</option>
</volist>
</select></td>

@ -53,7 +53,7 @@
<div class="input-list input-list-game search_label_rehab">
<select name="promote_id" class="select_gallery" style="width:120px;">
<option value="">推广员帐号</option>
<volist name=":get_promote_list()" id="vo">
<volist name=":get_promote_listOther()" id="vo">
<option value="{$vo.id}">{$vo.account}</option>
</volist>
</select>

@ -0,0 +1,85 @@
<extend name="Public/base" />
<block name="css">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<style>
#form .txt_area.download_url {width:400px;}
.tabcon1711 .table_radio2 .table_btn {width:215px;}
</style>
</block>
<block name="body">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
<!-- 标签页导航 -->
<div class="tab-wrap">
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
</div>
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="form" action="{:U('add')}" method="post" class="form-horizontal">
<!-- 基础 -->
<div id="tab1" class="tab-pane in tab1 ">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>推广公司名称:</td>
<td class="r" >
<input type="text" class="txt " name="company_name" value="" placeholder="请输入推广公司名称">
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>显示状态:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="status" checked> 开启
</label>
<label>
<input type="radio" class="inp_radio" value="0" name="status"> 关闭
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn ajax-post" id="submit" type="submit" target-form="form-horizontal" style="margin-left:210px;">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:history.back(-1);" >
返回
</a>
</div>
</form>
</div>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$meta_title}">
<input type="hidden" name="url" value="Partner/add">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('PromoteCompany/lists')}");
$('#submit').click(function(){
$('#form').submit();
});
</script>
</block>

@ -0,0 +1,88 @@
<extend name="Public/base" />
<block name="css">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<style>
#form .txt_area.download_url {width:400px;}
.tabcon1711 .table_radio2 .table_btn {width:215px;}
</style>
</block>
<block name="body">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
<!-- 标签页导航 -->
<div class="tab-wrap">
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
</div>
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="form" action="{:U('edit')}" method="post" class="form-horizontal">
<!-- 基础 -->
<div id="tab1" class="tab-pane in tab1 ">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>推广公司名称:</td>
<td class="r" >
<input type="text" class="txt " name="company_name" value="{$data.company_name}" placeholder="请输入推广公司名称">
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>显示状态:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="status"
<eq name="data.status" value="1"> checked </eq>> 开启
</label>
<label>
<input type="radio" class="inp_radio" value="0" name="status"
<eq name="data.status" value="0"> checked </eq>> 关闭
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<input type="hidden" name="id" value="{$data.id}">
<button class="submit_btn ajax-post" id="submit" type="submit" target-form="form-horizontal" style="margin-left:210px;">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="{:U('Partner/lists')}" >
返回
</a>
</div>
</form>
</div>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$meta_title}">
<input type="hidden" name="url" value="Partner/edit">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('Partner/lists')}");
$('#submit').click(function(){
$('#form').submit();
});
</script>
</block>

@ -0,0 +1,163 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.data_list table td{
text-indent:0;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
<p class="description_text">说明:该功能是用于录入工会所属的推广公司名称</p>
</div>
<div class="cf top_nav_list">
<div class="fl button_list">
<div class="tools">
<a class="" href="{:U('add')}"><span class="button_icon button_icon1"></span>新增</a>
<a class="ajax-post confirm " target-form="ids" url="{:U('del')}"><span class="button_icon button_icon2"></span>删除</a>
</div>
</div>
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="sleft">
<input type="text" name="company_name" class="search-input" value="{:I('company_name')}" placeholder="请输入公司名称搜索">
<a class="sch-btn" href="javascript:;" id="search" url="__SELF__">搜索</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list data_game_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>
<input class="check-all" type="checkbox">
</th>
<th>推广公司</th>
<th>显示状态</th>
<th>添加人</th>
<th>添加时间</th>
<th style="width:10%;min-width:150px;">操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="listData">
<td colspan="6" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="listData" id="data">
<tr>
<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
<td>{$data.company_name}</td>
<td>{$data.status}</td>
<td>{$data.nickname}</td>
<td>{$data.create_time}</td>
<td>
<a href="{:U('edit',array('id'=>$data['id']))}">编辑</a>
<a href="{:U('del',array('id'=>$data['id']))}" class="confirm ajax-get">删除</a>
</td>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
</div>
<div class="page">
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$meta_title}">
<input type="hidden" name="url" value="Partner/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script src="__STATIC__/layer/layer.js"></script>
<script src="__STATIC__/layer/extend/layer.ext.js"></script>
<style>
.layui-layer-demo .layui-layer-title {background:#F0F5F7;font-weight:bold;}
.layui-layer-demo .layui-layer-content {}
.layui-layer-demo .layui-layer-content table{width:100%;border:0;border-spacing:0;padding:0;}
.layui-layer-demo .layui-layer-content td {height:42px;padding-left:20px;}
.layui-layer-demo .layui-layer-content tr:hover {background:#F0F5F7;}
.layui-layer-demo .layui-layer-content tr~tr {border-top:1px solid #ccc;}
.layui-layer-demo .layui-layer-content td~td {border-left:1px solid #ccc;}
.layui-layer-demo .layui-layer-content tr:last-child td {}
</style>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
$(function(){
//搜索功能
$("#search").click(function(){
var url = $(this).attr('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;
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
});
</script>
</block>

@ -77,7 +77,7 @@
<div class="input-list input-list-admin search_label_rehab">
<select id="op_account" name="op_account" class="select_gallery" style="width:120px;">
<option value="">操作人员</option>
<volist name=":get_admin_list()" id="vo">
<volist name=":get_admin_listOther()" id="vo">
<option value="{$vo.nickname}">{$vo.nickname}</option>
</volist>
</select>

@ -295,7 +295,7 @@ $(function(){
console.log(promote_id);
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevel')}",
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',

@ -243,7 +243,7 @@
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>7,'xlsname'=>'游戏订单_游戏充值'),I('get.')))}">导出</a>
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>7,'xlsname'=>'游戏订单_游戏充值','timestart'=>$startDate,'timeend'=>$endDate),I('get.')))}">导出</a>
{$_page|default=''}
</div>
@ -486,7 +486,7 @@
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevel')}",
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',

@ -55,17 +55,17 @@
<div class="main_content_main m-channel-data main_content_platform">
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$shuju.player_regist_all|default=0}</strong> 平台累计用户
<strong class="s-c-orange">{:set_number_short($shuju['user_count'])}</strong> 平台累计用户
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$shuju.payer_all|default=0}</strong> 累计付费用户
<strong class="s-c-orange">{:set_number_short($shuju['player_count'])}</strong> 累计付费用户
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$shuju.pay_all|default=0}</strong> 累计充值
<strong class="s-c-orange">{:set_number_short($shuju['money_sum'])}</strong> 累计充值
</div>
</div>
<div class="main_content_main_item">
@ -75,32 +75,32 @@
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$shuju.pro_complete|default=0}</strong> 开通推广员数
<strong class="s-c-orange">{:set_number_short($shuju['promote_sum'])}</strong> 开通推广员数
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$shuju.game_add_all|default=0}</strong> 游戏接入数量
<strong class="s-c-orange">{$shuju.game_count|default=0}</strong> 游戏接入数量
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$shuju.game_and_all|default=0}</strong> 安卓游戏原包
<strong class="s-c-orange">{$shuju.android_gamesource_count|default=0}</strong> 安卓游戏原包
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$shuju.game_ios_all|default=0}</strong> IOS游戏原包
<strong class="s-c-orange">{$shuju.ios_gamesource_count|default=0}</strong> IOS游戏原包
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$shuju.pro_player_all|default=0}</strong> 推广员注册用户
<strong class="s-c-orange">{:set_number_short($shuju['promote_user_count'])}</strong> 推广员注册用户
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$shuju.pro_pay_all|default=0}</strong> 推广员总充值
<strong class="s-c-orange">{:set_number_short($shuju['promote_spend_sum'])}</strong> 推广员总充值
</div>
</div>
</div>
@ -123,7 +123,7 @@
<li class="<eq name='num' value='4'>datapick_active</eq>"><a href="{:U('overview',array('tb'=>I('tb'),'gtc'=>I('gtc'),'ptc'=>I('ptc'),'type'=>I('type'),'category'=>I('category'),'start'=>date('Y-m-d',mktime(0,0,0,date('m')-1,1,date('Y'))),'end'=>date('Y-m-d',mktime(0,0,0,date('m'),1,date('Y'))-1),'num'=>4))}">过去整月</a></li>
<li class="<eq name='num' value='5'>datapick_active</eq>"><a href="{:U('overview',array('tb'=>I('tb'),'gtc'=>I('gtc'),'ptc'=>I('ptc'),'type'=>I('type'),'category'=>I('category'),'start'=>date('Y-m-d',strtotime('-7 day')),'end'=>date('Y-m-d',strtotime('-1 day')),'num'=>5))}">过去7天</a></li>
<li class="<eq name='num' value='6'>datapick_active</eq>"><a href="{:U('overview',array('tb'=>I('tb'),'gtc'=>I('gtc'),'ptc'=>I('ptc'),'type'=>I('type'),'category'=>I('category'),'start'=>date('Y-m-d',strtotime('-30 day')),'end'=>date('Y-m-d',strtotime('-1 day')),'num'=>6))}">过去30天</a></li>
<li class="<eq name='num' value='7'>datapick_active</eq>"><a href="{:U('overview',array('tb'=>I('tb'),'gtc'=>I('gtc'),'ptc'=>I('ptc'),'type'=>I('type'),'category'=>I('category'),'start'=>date('Y-m-d',strtotime('-365 day')),'end'=>date('Y-m-d',strtotime('-1 day')),'num'=>7))}">过去一年</a></li>
<!-- <li class="<eq name='num' value='7'>datapick_active</eq>"><a href="{:U('overview',array('tb'=>I('tb'),'gtc'=>I('gtc'),'ptc'=>I('ptc'),'type'=>I('type'),'category'=>I('category'),'start'=>date('Y-m-d',strtotime('-365 day')),'end'=>date('Y-m-d',strtotime('-1 day')),'num'=>7))}">过去一年</a></li> -->
</ul>
<div class="range_inputs">
<button class="applyBtn pt-btn btn-success js_determine" type="button">确定</button>
@ -382,7 +382,7 @@
),false)}"><i></i><span>导出</span></a></div>
</div>
<div class="m-box m-chart pad_no each_box gamerank" style="height: 500px;">
<div class="m-box m-chart pad_no each_box gamerank" style="min-height: 500px;">
<div class="tab_btn">
<span class="table_box fl <neq name='Think.get.gtc' value='1'>current</neq>" data-flag="gtc_0"><i></i></span>
<span class="chart_box fr <eq name='Think.get.gtc' value='1'>current</eq>" data-flag="gtc_1"><i></i></span>
@ -403,6 +403,9 @@
<li role="presentation" <if condition="$Think.get.type eq 4"> class="active" </if>>
<a href="{:U('Statistics/overview',array('tb'=>I('tb'),'gtc'=>I('gtc'),'ptc'=>I('ptc'),'type'=>4,'category'=>I('category'),'start'=>I('start'),'end'=>I('end'),'num'=>I('num')))}" id="gy" aria-controls="yearRank" role="tab" data-toggle="tab">年排行</a>
</li>
<li style="margin-left: 30px;color: #777;font-size: 12px;line-height: 28px;">
{$game_date_info}
</li>
</ul>
</div>
@ -496,7 +499,7 @@
</div>
</div>
</div>
<div class="m-box m-chart pad_no each_box promoterank" style="height: 500px;">
<div class="m-box m-chart pad_no each_box promoterank" style="min-height: 500px;">
<div class="tab_btn">
<span class="table_box fl <neq name='Think.get.ptc' value='1'>current</neq>" data-flag="ptc_0"><i></i></span>
<span class="chart_box fr <eq name='Think.get.ptc' value='1'>current</eq>" data-flag="ptc_1"><i></i></span>
@ -517,6 +520,9 @@
<li role="presentation" <if condition="$Think.get.category eq 4"> class="active" </if>>
<a href="{:U('Statistics/overview',array('tb'=>I('tb'),'gtc'=>I('gtc'),'ptc'=>I('ptc'),'category'=>4,'type'=>I('type'),'start'=>I('start'),'end'=>I('end'),'num'=>I('num')))}#py" id="py" aria-controls="yearRank" role="tab" data-toggle="tab">年排行</a>
</li>
<li style="margin-left: 30px;color: #777;font-size: 12px;line-height: 28px;">
{$promote_date_info}
</li>
</ul>
</div>
<!-- Tab panes -->
@ -625,6 +631,7 @@
<script src="__JS__/zwmjs/highcharts.js"></script>
<script>
var datelist;
var ydata = {$foldline|json_encode};
$(function() {
$('.data-box').each(function() {
var that = $(this);
@ -647,12 +654,46 @@
//end 点击确定关闭日历
$('.jsexport').on('click',function() {
var that=$(this),url = $.trim(that.attr('url')).replace(/((\.htm(l?))?)$/g,'');
var but = $('.tab_head a.current').attr('data-key');
var times = [];
if(ydata.hours ==1){
times = ["0:00","2:00","4:00","6:00","8:00","10:00","12:00","14:00","16:00","18:00","20:00","22:00"];
}else{
times = ydata["date"].split(",");
}
var value = ydata[but].split(",");
var but = $('.tab_head a.current');
url += '/name/'+$.trim(but.text())+'/key/'+but.attr('data-key');
window.location.href = url;
if(but == 'news'){
var str = `时间,新增用户\n`;
var title = "新增用户";
}
if(but == 'active'){
var str = `时间,活跃用户\n`;
var title = "活跃用户";
}
if(but == 'player'){
var str = `时间,付费用户\n`;
var title = "付费用户";
}
for (var i = 0, len = times.length; i < len; ++i) {
str += times[i]+"\t,"+value[i]+"\t\n";
}
var url = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str);
downloadCSV(url, title+'.csv');
});
//导出csv
function downloadCSV(url, name) {
// 利用a标签的download属性进行下载
var link = document.createElement("a");
// 设置a标签的属性
link.href = url;
link.download = name || 'work.csv';
// 加入dom树中模拟用户点击并下载
document.body.appendChild(link);
link.click();
// 移除该元素,防泄漏
document.body.removeChild(link);
}
if({$foldline.hours|default=1}==1) {
Highcharts.setOptions({
@ -762,6 +803,30 @@
}
function chartdata(start,end,parent) {
var starttime = new Date(start).getTime();
if(end){
var endtime = new Date(end).getTime();
}else{
var endtime = new Date(start).getTime();
}
if(starttime > endtime){
var temp = start;
start = end;
end = temp;
}
if(end && (start != end)){
var endtime = (new Date(end).getTime()) + 86399000;
var now = new Date().getTime();
if(endtime > now){
layer.msg('历史时间选择不能包含今日');
return false;
}
};
var index = layer.load(1, {
shade: [0.3,'#000'] //0.1透明度的白色背景
});
var href = '{:U("overview",array("type"=>I("type"),"category"=>I("category")))}';
end = end?end:start;
@ -1164,7 +1229,7 @@
<!-- ECharts单文件引入 -->
<script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript">
$('.jsnav li a').on('click', function() {
var that = $(this),

@ -0,0 +1,438 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css"/>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">超级签订单</h3>
<p class="description_text">说明:超级签购买订单</p>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list">
<input type="text" name="{$model['search_key']|default='user_account'}" placeholder="玩家账号" class=""
value="{:I('user_account')}">
</div>
<div class="input-list">
<input type="text" name="order_id" class="" value="{:I('order_id')}" placeholder="支付订单号">
</div>
<div class="input-list">
<input type="text" readonly id="time-start" name="start" class="" value="{$_GET['start']}"
placeholder="开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time-end" name="end" class="" value="{$_GET['end']}"
placeholder="结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_name" name="game_name" class="select_gallery" >
<option value="">游戏名称</option>
<volist name=":getAllGame()" id="vo">
<option value="{$vo.game_name}" <?php echo $vo.relation_game_name == I('game_name') ? 'selected':''; ?> >{$vo.game_name}</option>
</volist>
</select>
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_level" style="color:#444" class="select_gallery" id="promote_level">
<option value="">请选择推广员等级</option>
<option value="1" <?php if ($_POST['promote_level'] == 1):?>selected<?php endif;?>>会长</option>
<option value="2" <?php if ($_POST['promote_level'] == 2):?>selected<?php endif;?>>部门长</option>
<option value="3" <?php if ($_POST['promote_level'] == 3):?>selected<?php endif;?>>组长</option>
<option value="4" <?php if ($_POST['promote_level'] == 4):?>selected<?php endif;?>>组员</option>
</select>
-
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_id" style="color:#444" class="select_gallery" id="promote_id">
<option value="">请选择推广员</option>
</select>
</div>
<input type="hidden" name="" value="" class="sortBy">
<div class="input-list search_item">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('SuperSign/lists','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list zdata_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>支付订单号</th>
<th>超级签授权码</th>
<th>购买时间</th>
<th>玩家账号</th>
<th>游戏名称</th>
<th>所属推广员</th>
<th>实付金额</th>
<th>购买方式</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name="data">
<td colspan="15" class="text-center">aOh! 暂时还没有内容!</td>
<else/>
<volist name="data" id="data">
<tr>
<td>{$data.order_id}</td>
<td>{$data.ticket}</td>
<td>{$data.pay_time}</td>
<td>{$data.account}</td>
<td>{$data.game_name}</td>
<td>
<if condition="$data.promote_account == '自然注册'">
官方渠道
<else />
{$data.promote_account}
</if>
</td>
<td>{$data.pay_price}</td>
<td>{$data.pay_way}</td>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
</div>
<div class="page">
<!-- <a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>7,'xlsname'=>'游戏订单_游戏充值'),I('get.')))}">导出</a>-->
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Spend/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script>
<volist name = ":I('get.')" id = "vo">
Think.setValue('{$key}', "{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('SuperSign/lists')}');
$(function () {
//搜索功能
$("#search").click(function () {
var sdate = Date.parse($('#time-start').val()) / 1000;
var edate = Date.parse($('#time-end').val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
return false;
}
var url = $(this).attr('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;
});
$(".paixu").click(function () {
var that = $(this);
$data_order = that.attr('data-order');
$order_type = '{$userarpu_order}';
if ($order_type == '' || $order_type == '4') {
$(".sortBy").attr('name', 'data_order');
val = '3,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
} else if ($order_type == '3') {
$(".sortBy").attr('name', 'data_order');
val = '4,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
}
});
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
$("#search").click();
}
});
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var end = new Date($.trim($('#time-end').val())).getTime();
if (val>end) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
$("#time-end").datetimepicker({
format:"yyyy-mm-dd",
language: "zh-CN",
showMeridian:true,
minView:2,
autoclose:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var start = new Date($.trim($('#time-start').val())).getTime();
if (val<start) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
$(".budan").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
$.ajax({
type: 'post',
url: url,
data: {orderNo: data},
success: function (e) {
if (e.status == 1) {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
} else {
layer.msg(e.msg, {icon: 2});
}
},
});
});
$(".budan2").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
$.ajax({
type: 'post',
url: url,
data: {orderNo: data},
success: function (e) {
if (e.status == 1) {
if (e.msg.length > 30) {
window.open(e.msg);
} else {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
}
} else {
layer.msg(e.msg, {icon: 2});
}
},
});
});
$(".d_list").find(".drop-down11").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down11 .nav-list li").find("a").each(function () {
var that = $(".drop-down11");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
$(".d_list").find(".drop-down12").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down12 .nav-list li").find("a").each(function () {
var that = $(".drop-down12");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
$(".d_list").find(".drop-down13").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down13 .nav-list li").find("a").each(function () {
var that = $(".drop-down13");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
//下拉内容框
$(".drop-down2").on('click', function (event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$('#i_list_id').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function () {
navlist.addClass('hidden');
});
event.stopPropagation();
});
$('#i_list_id').on('keyup', function (event) {
var val = $.trim($(this).val()).toLowerCase();
$('#i_list_idh').val(val);
});
$("#i_list_li").find("a").each(function () {
$(this).click(function () {
var text = $.trim($(this).text()).toLowerCase();
$("#i_list_id").val(text);
$('#i_list_idh').val(text);
})
});
})
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevel')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',
success:function(response){
str = '<option value="">请选择推广员</option><option value="0"'+(promote_id && 0 == promote_id?'selected':'')+'>官方渠道</option>';
data = response.data;
for (var i in data){
str += "<option value='"+data[i].id+"' "+(promote_id && data[i].id == promote_id?'selected':'')+">"+data[i].nickname+"</option>"
}
$("#promote_id").empty();
$("#promote_id").append(str);
$("#promote_id").select2();
}
})
});
$("#promote_level").change();
var game_server = "{:I('server_name')}";
$("#game_type").change(function(){
$.ajax({
url:"{:U('Ajax/getGmeServer')}",
type:"post",
data:{sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()},
dataType:'json',
success:function(data){
str = "<option value=''>请选择区服</option>";
for (var i in data){
str += "<option value='"+data[i].server_name+"' "+(game_server && data[i].server_name == game_server?'selected':'')+">"+data[i].server_name+"</option>"
}
$("#server_name").empty();
$("#server_name").append(str);
$("#server_name").select2();
}
})
});
$("#game_name").change(function(){
$("#game_type").change();
});
$("#game_name").change();
/**
* 初始化select2单选默认带搜索功能。
*/
//初始化页面加载
$(document).ready(function () {
});
</script>
</block>

@ -0,0 +1,115 @@
<extend name="Public/base" />
<block name="body">
<!-- <link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all"> -->
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/area1.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/jquery-1.7.min.js"></script>
<script type="text/javascript" src="__JS__/jquery.mousewheel.js"></script>
<div class="cf main-place top_nav_list navtab_list">
<ul class="tabnav1711 fr jstabnav">
<li data-tab="tab1" class="current"><a href="javascript:void(0);">基本信息</a></li></li>
<li data-tab="tab2" ><a href="javascript:void(0);">结算信息</a></li>
</ul>
<h3 class="page_title">{$title}测试账号</h3>
</div>
<!-- 标签页导航 -->
<div class="tab-wrap">
<div class="tab-content tabcon1711">
<!-- 表单 -->
<if condition="$title eq '编辑'" >
<form id="form" action="{:U('edit_user?model='.$model['id'])}" method="post" class="form-horizontal">
<else />
<form id="form" action="{:U('add_user?model='.$model['id'])}" method="post" class="form-horizontal">
</if>
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">测试账号:</td>
<td class="r">
<input type="text" class="txt" name="account" value="{$_REQUEST['account']}" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
<input type="hidden" name="user_id" value="{$_REQUEST['user_id']}">
</td>
</tr>
<td class="l">显示状态:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="1" name="status" <if condition="$_REQUEST['status'] eq 1">checked="checked"</if>>开启
</label >
<label >
<input type="radio" value="0" name="status" <if condition="$_REQUEST['status'] eq 0">checked="checked"</if>>{:L('Lock')}
</label>
</span>
<input type="hidden" name="status" id="status" value="{$data['status']}">
<script>
$(function () {
var status = $('input:radio[name="status"]:checked').val();
$('#status').val(status);
});
$(":radio").click(function () {
var status = $('input:radio[name="status"]:checked').val();
$('#status').val(status);
})
</script>
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn ajax-post mlspacing" id="submit" type="submit" target-form="form-horizontal">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back(-1);" >
返回
</a>
</div>
</form>
</div>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Promote/lists/type/1">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('TestWhiteList/lists')}');
Think.setValue("game_type_id", {$data.game_type_id|default = 0});
Think.setValue("category", {$data.category|default = 0});
Think.setValue("ba_id", {$data.ba_id|default = 0});
$(function(){
// var pro="{:$data['bank_area']['0']}";
// alert (pro);
showTab();
prov="{:substr($data['bank_area'],0,2)}";
city="{:substr($data['bank_area'],2,2)}";
ciarea="{:substr($data['bank_area'],4,2)}";
//initComplexArea('seachprov', 'seachcity', 'seachdistrict', area_array, sub_array, prov, city, ciarea);
});
</script>
</block>

@ -0,0 +1,250 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">测试白名单</h3>
<p class="description_text">说明:测试白名单内的所有测试账号产生的流水须导入正式环境的月结统计功能内</p>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list">
<input type="text" id="search-input" name="account" class="" value="{:I('account')}"
placeholder="玩家账号"/>
</div>
<input type="hidden" name="" value="" class="sortBy">
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('TestWhiteList/lists','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
<a class="sch-btn" style="background: #ffffff;border: #000000 solid 1px;color: #000000;width:120px" href="{:U('TestWhiteList/add',array('status'=>1))}" >添加测试账号</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div>
<table>
<!-- 表头 -->
<thead>
<tr>
<th>测试账号</th>
<th>显示状态</th>
<th>添加人</th>
<th>添加时间</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="data">
<td colspan="11" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="data" id="data">
<tr>
<td>{$data['account']}</td>
<td><if condition="$data['show_status'] eq 0"> 锁定 <else /> 开启 </if></td>
<td>{$data.add_user}</td>
<td>{$data.create_ime}</td>
<td>
<a href="{:U('TestWhiteList/edit',array('user_id'=>$data['user_id'],'account'=>$data['account'],'status'=>$data['show_status']))}" style="width:100%;">编辑</a>
<if condition="$data['show_status'] eq 1">
<a class="froze-btn" href-hhh="{:U('TestWhiteList/edit_user1',array('user_id'=>$data['user_id'],'status'=>0,'account'=>$data['account']))}" style="width:100%;">锁定</a>
<else />
<a class="froze-btn" href-hhh="{:U('TestWhiteList/edit_user1',array('user_id'=>$data['user_id'],'status'=>1,'account'=>$data['account']))}" style="width:100%;">开启</a>
</if>
</td>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
</div>
<div class="page">
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Deposit/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('TestWhiteList/lists')}');
$(function () {
$('.froze-btn').on({
click: function() {
var url = $(this).attr('href-hhh');
console.log(url);
layer.confirm('是否确认修改测试账号状态?', {icon: 3, title:'提示',skin:'textColor'}, function(index){
$.ajax({
url: url,
type: 'post',
dataType: 'json',
success: function(response) {
layer.msg(response.msg, {time: 1000,skin:'msgClolor'}, function() {
window.location.href = window.location.href
})
}
})
})
}
})
//搜索功能
$("#search").click(function () {
var url = $(this).attr('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;
}
var start = $("#time-start").val();
var end = $("#time-end").val();
if (start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
window.location.href = url;
});
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
$("#search").click();
}
});
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
$(".drop-down2").on('click', function (event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$('#promoteid').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function () {
navlist.addClass('hidden');
});
event.stopPropagation();
});
var a = $('.i_list_li li a');
$('#promoteid').on('keyup', function (event) {
var val = $.trim($(this).val()).toLowerCase();
$('#promoteid').val(val);
$('#promoteidh').val(-1);
});
})
/**
* 初始化select2单选默认带搜索功能。
*/
//初始化页面加载
$(document).ready(function () {
//初始化select2单选
initSelect2WithSearch();
});
function initSelect2WithSearch() {
// $("#sel_order").select2({
// tags: true,
// placeholder: '订单状态',
// allowClear: false, //清空
// minimumResultsForSearch: Infinity, // 永久隐藏搜索框
// });
}
</script>
<style>
.textColor .layui-layer-content{color: #000000;}
.msgClolor .layui-layer-content{color: #ffffff;background:#000; opacity: 0.8;text-align: center}
</style>
</block>

@ -4,6 +4,7 @@
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
@ -95,6 +96,14 @@
<option value="0" <?php if ($_POST['promote_id'] == 0):?>selected<?php endif;?>>官方渠道</option>
<option value="UC" <?php if ($_POST['promote_id'] == 'UC'):?>selected<?php endif;?>>UC用户</option>
</select>
</div>
<div class="input-list">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="创角开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}" placeholder="创角结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('rolelist',array('row'=>I('row')))}">搜索</a>
@ -180,7 +189,13 @@
</volist>
$(".select_gallery").select2();
</script>
<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
//搜索功能
$("#search").click(function(){
@ -193,6 +208,14 @@ $(".select_gallery").select2();
url += '&' + query;
}else{
url += '?' + query;
}
var start = $("#time_start").val();
var end = $("#time_end").val();
if(start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
window.location.href = url;
});
@ -224,7 +247,22 @@ $(".select_gallery").select2();
$("#game_id").change(function(){
get_sever($(this).find("option:selected").attr('game-id'));
})
//时间
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true,
pickerPosition:'bottom-left'
})
function get_sever(game_id){
//var game_id = game_id;//$("this").find("option:selected").attr('game-id');
if(!game_id) {return;}
@ -258,7 +296,7 @@ $(".select_gallery").select2();
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevel')}",
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',

@ -949,10 +949,11 @@ class PromoteService {
'mobile_phone' => $params['mobile_phone'],
'bank_name' => $params['bank_name'] ?? '',
'bank_card' => $params['bank_card'],
'status' => 1,
// 'status' => 1,
'parent_id' => $parent ? $parent['id'] : 0,
'parent_name' => $parent ? $parent['account'] : '官方渠道',
'admin_id' => $params['admin_id'] ?? 0,
'company_id' => $params['company_id'] ?? 0,
'invite_code' => $params['invite_code'] ?? '',
'create_time' => time(),
];

@ -246,7 +246,8 @@ class BaseController extends Controller {
'pay_status' => 0,
))->save(array(
'trade_id' => $data['trade_id'],
'pay_status' => 1,
'pay_status' => 1,
'pay_way'=>$data['pay_way'],
'pay_time' => time()
));
if (!$r) return -1;

@ -69,7 +69,8 @@ class Notify2Controller extends BaseController
case 'SS': // 超级签
$this->supersign_pay_notify(array(
'trade_id' => $order_info['trade_no'],
'order_id' => $order_info['out_trade_no']
'order_id' => $order_info['out_trade_no'],
'pay_way'=>1
));
break;
default:

@ -221,7 +221,8 @@ class NotifyController extends BaseController
$out_trade_no = $Swiftpass->resHandler->getParameter('out_trade_no');
$this->supersign_pay_notify(array(
'trade_id' => $trade_no,
'order_id' => $out_trade_no
'order_id' => $out_trade_no,
'pay_way'=>2
));
echo 'success';
}else{

@ -375,8 +375,29 @@ function get_custom_category_title($id=0,$title=0) {
*/
function set_pagination($count, $row,$request='') {
$aside = '<script>function pagechange(that){url = location.href.replace(".html","").replace(/(&|\/)row(=|\/)\d*/gi,"").replace(/\/p\/\d*/gi,"");if(url.indexOf("?")>0){url += "&row="+that.value;}else{url += "?row="+that.value;} window.location.href = url;}</script><select id="pagechange" name="row" onchange="pagechange(this)"><option value="10">每页10条</option><option value="25">每页25条</option><option value="50">每页50条</option><option value="100">每页100条</option></select>';
$count=$count?$count:0;
$aside = '<script>function pagechange(that){url = location.href.replace(".html","").replace(/(&|\/)row(=|\/)\d*/gi,"").replace(/\/p\/\d*/gi,"");if(url.indexOf("?")>0){url += "&row="+that.value;}else{url += "?row="+that.value;} window.location.href = url;}</script><select id="pagechange" name="row" onchange="pagechange(this)">';
if($row == 10){
$aside .= '<option value="10" selected>每页10条</option>';
}else{
$aside .= '<option value="10">每页10条</option>';
}
if($row == 25){
$aside .= '<option value="25" selected>每页25条</option>';
}else{
$aside .= '<option value="25">每页25条</option>';
}
if($row == 50){
$aside .= '<option value="50" selected>每页50条</option>';
}else{
$aside .= '<option value="50">每页50条</option>';
}
if($row == 100){
$aside .= '<option value="100" selected>每页100条</option></select>';
}else{
$aside .= '<option value="100">每页100条</option></select>';
}
$count=$count?$count:0;
$row=$row?$row:10;
if ($count > $row) {
$page = new \Think\Page($count, $row,$request);
@ -2890,3 +2911,24 @@ function encryption($string) {
return substr($string, 0, $strLen) . $hideChar . substr($string, $orderLen-$strLen);
}
//导出csv
function db2csv(&$data,$title,$header=false){
set_time_limit(0);
$filename = $title .'.csv';
$fp = fopen($filename, 'w'); //生成临时文件
fwrite($fp, chr(0xEF).chr(0xBB).chr(0xBF));//转码,防止乱码
if($header) fputcsv($fp, $header);
foreach ($data as $a) {
fputcsv($fp, $a);
}
fclose($fp); //每生成一个文件关闭
//下载
header('Content-Type: application/vnd.ms-excel;charset=utf-8');
header('Content-Disposition: attachment;filename="' . $title . '.csv"');
header('Cache-Control: max-age=0');
header('Content-Length: ' . filesize($filename));
readfile($filename);
unlink($filename);
die();
}

@ -1913,6 +1913,9 @@ class DownloadController extends BaseController {
$gameId = $v['game_id'];
$serverInfo = M('server','tab_')->field('server_name')->where(['server_num'=>$serverId,'game_id'=>$gameId])->find();
$v['promote_id']= $promoteInfo['account'];
if(empty($v['extend'])) {
$v['extend'] = $v['order_id'];
}
$csvData['extend'] = $this->encryption($v['extend']);
$csvData['create_time'] = $v['create_time'];
$csvData['user_account'] = $v['user_account'];

@ -74,6 +74,9 @@ class PlayersController extends BaseController {
$rs = M('pay_info','tab_')->where($map)->order('tab_pay_info.create_time desc')
->page($page, $row)->select();
foreach($rs as $key => $v) {
if(empty($v['extend'])) {
$v['extend'] = $v['order_id'];
}
$rs[$key]['extend'] = encryption($v['extend']);
$rs[$key]['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
$promoteInfo = M('promote','tab_')->field("account")->where(['id' => intval($v['promote_id'])])->find();
@ -82,6 +85,7 @@ class PlayersController extends BaseController {
$serverInfo = M('server','tab_')->field('server_name')->where(['server_num'=>$serverId1,'game_id'=>$gameId])->find();
$rs[$key]['server_name'] = $serverInfo['server_name'];
$rs[$key]['promote_id']= $promoteInfo['account'];
}
$count = M('pay_info', 'tab_')
->field('tab_pay_info.id')

@ -60,7 +60,6 @@
<link rel="stylesheet" type="text/css" href="__CSS__/heard.css" />
<link rel="stylesheet" type="text/css" href="__CSS__/foot.css" />
<link rel="stylesheet" type="text/css" href="__CSS__/supervise.css" />
<div class="service_swiper">
<img src="__IMG__/lunbo3.png" alt="">
</div>

@ -721,10 +721,60 @@ MODIFY COLUMN `extend` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci
-- 菜单(游戏充值预下单)
INSERT INTO `sys_menu`(`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) VALUES ('游戏充值预下单', 16, 0, 'BehaviorLog/game', 0, '', '行为日志', 0, 1);
--model zyx 2019-12-11
UPDATE `sys_model` SET `list_grid` = 'id:编号\r\npay_order_number:订单号\r\nuser_account:用户账号\r\npromote_account:所属推广员\r\npay_amount:支付金额\r\npay_way:充值方式\r\ncreate_time|set_show_time:支付时间\r\npay_status|get_info_status*12:支付状态\r\npay_ip:支付IP\r\nsdk_status:游戏SDK状态\r\n' WHERE `id` = 9
CREATE TABLE `tab_test_white_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL COMMENT '用户id',
`account` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '白名单账号',
`show_status` tinyint(2) NULL DEFAULT 1 COMMENT '显示状态',
`add_user` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '后台添加账号',
`create_ime` int(11) NULL DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
--2019-12-13
--
ALTER TABLE `tab_game`
ADD COLUMN `flooring_page_video_cover` int(11) NOT NULL DEFAULT 0 COMMENT '落地页视频封面';
--2019-12-11 chenzhi
ALTER TABLE `tab_game_supersign` ADD COLUMN `pay_way` tinyint(2) DEFAULT '0' COMMENT '充值方式(0:未知,1:支付宝,2:微信)' AFTER `pay_time`;
-- 2019-12-16 chenzhi
CREATE TABLE `tab_game_count` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键自增',
`date` int(11) NOT NULL DEFAULT '0' COMMENT '日期时间戳',
`game_id` int(11) NOT NULL DEFAULT '0' COMMENT '游戏id',
`game_name` varchar(50) NOT NULL DEFAULT '' COMMENT '游戏名称',
`new_user_count` int(11) NOT NULL DEFAULT '0' COMMENT '新增总计',
`active_user_count` int(11) NOT NULL DEFAULT '0' COMMENT '活跃总计',
`active_user_list` longtext COMMENT '活跃用户的id序列',
`pay_money_count` decimal(10,2) DEFAULT '0.00' COMMENT '付费金额总计',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '统计日期',
PRIMARY KEY (`id`),
KEY `date` (`date`) USING BTREE,
KEY `new_user_count` (`new_user_count`) USING BTREE,
KEY `active_user_count` (`active_user_count`) USING BTREE,
KEY `pay_money_count` (`pay_money_count`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='总览游戏统计聚合';
CREATE TABLE `tab_promote_count` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键自增',
`date` int(11) NOT NULL DEFAULT '0' COMMENT '日期时间戳',
`promote_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广账号',
`promote_account` varchar(30) NOT NULL DEFAULT '' COMMENT '账号',
`new_user_count` int(11) NOT NULL DEFAULT '0' COMMENT '新增总计',
`active_user_count` int(11) NOT NULL DEFAULT '0' COMMENT '活跃总计',
`active_user_list` longtext COMMENT '活跃用户的id序列',
`pay_money_count` decimal(10,2) DEFAULT '0.00' COMMENT '付费金额总计',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '统计日期',
PRIMARY KEY (`id`),
KEY `date` (`date`) USING BTREE,
KEY `new_user_count` (`new_user_count`) USING BTREE,
KEY `active_user_count` (`active_user_count`) USING BTREE,
KEY `pay_money_count` (`pay_money_count`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='总览推广员统计聚合';
--2019-12-16
--

@ -176,4 +176,7 @@
.service_download>div>span{
color: #00A3E1;
font-size: 0.14rem;
}
.list>li {
cursor: pointer;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,2 @@
/** layui-v2.5.5 MIT License By https://www.layui.com */
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save