diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 0f879b6e4..80f10074a 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -860,7 +860,11 @@ class ExportController extends Controller $map['spend_ip'] = array('like', '%' . trim($_REQUEST['spend_ip']) . '%'); unset($_REQUEST['spend_ip']); } - + if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) { + $map['pay_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1)); + unset($_REQUEST['time-start']); + unset($_REQUEST['time-end']); + } if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) { $map['pay_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1)); unset($_REQUEST['timestart']); @@ -1004,7 +1008,7 @@ class ExportController extends Controller array('pay_amount', "充值平台币"), array('pay_way', "充值方式", 'get_pay_way', '*'), array('pay_ip', "充值ip"), - array('create_time', "充值时间", 'time_format'), + array('create_time', "充值时间"), array('pay_status', L('Order_status'), 'get_info_status', '*', '9'), array('', "共计充值{$total}"), ); @@ -1012,6 +1016,10 @@ class ExportController extends Controller ->where($map) ->order('id DESC') ->select(); + foreach ($xlsData as $key => $value) { + $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); + } +// dd($xlsData); break; case 9: $xlsName = $xlsName?$xlsName:"平台币发放"; @@ -1542,6 +1550,7 @@ class ExportController extends Controller $xlsName = $xlsCell = $xlsData = []; } + //数据处理 foreach ($xlsData as $key => $val) { foreach ($xlsCell as $k => $v) { @@ -3472,6 +3481,10 @@ if ($key == 'model'){ $map['user_account'] = array('like', '%' . trim($_REQUEST['account']) . '%'); } + if (isset($_REQUEST['promote_id'])) { + $map['promote_id'] = $_REQUEST['promote_id']; + } + // $map['login_time'] = array('neq', 0); $page = intval($_REQUEST['p']); diff --git a/Application/Admin/Controller/FileController.class.php b/Application/Admin/Controller/FileController.class.php index 864003999..0e1304463 100644 --- a/Application/Admin/Controller/FileController.class.php +++ b/Application/Admin/Controller/FileController.class.php @@ -209,9 +209,9 @@ class FileController extends AdminController ); //TODO:上传到远程服务器 // 添加水印 - if ($_REQUEST['flag']) { - $this->addWatermarkOnPic($info['download']); - } +// if ($_REQUEST['flag']) { +// $this->addWatermarkOnPic($info['download']); +// } /* 记录图片信息 */ if ($info) { @@ -249,8 +249,6 @@ class FileController extends AdminController C("UPLOAD_{$file_driver}_CONFIG"), $_REQUEST['flag'] ); //TODO:上传到远程服务器 - - /* 记录图片信息 */ if ($info) { $return['status'] = 1; diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index afde5599c..8f064b6a8 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -788,13 +788,20 @@ class MemberController extends ThinkController $map['server_name'] = $_REQUEST['server_name']; unset($_REQUEST['server_name']); } + if (isset($_REQUEST['promote_id'])) { + $map['promote_id'] = $_REQUEST['promote_id']; + unset($_REQUEST['promote_id']); + } // $map['type'] = 1; // $map['login_time'] = ['exp', 'login_time<>0']; $extend = array(); $extend['map'] = $map; - + $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); $this->m_title = '登录记录'; + $this->assign('user_count',$count[0]['count']); $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Member/login_record', 'status' => 1])->find()); parent::lists("UserLoginRecord", $p, $extend['map']); diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php index 16625e9d8..b4a22e062 100644 --- a/Application/Admin/Controller/MendController.class.php +++ b/Application/Admin/Controller/MendController.class.php @@ -132,9 +132,9 @@ class MendController extends ThinkController { $id = I('id'); $status = M('ShiftTask')->where(['id' => $id,'status' => 0])->save(['status' => 2]); if ($status) { - $this->success('取消补链成功', U('lists'), 2); + $this->ajaxReturn(array("status"=>1,"url"=> U('lists'))); } else { - $this->error("取消失败,或补链已生效",U('lists')); + $this->ajaxReturn(array("status"=>0,"url"=> U('lists'))); } } } diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php index 3f3ee2da9..325a530f8 100644 --- a/Application/Admin/Controller/StatController.class.php +++ b/Application/Admin/Controller/StatController.class.php @@ -604,7 +604,11 @@ class StatController extends ThinkController ->where($map) ->group('user_id') ->find(); - $data[$key]['keep_num'] = round($num['num']/$data[$key]['register_num'],4)*100; + if (!empty($data[$key]['register_num'])) { + $data[$key]['keep_num'] = round($num['num']/$data[$key]['register_num'],4)*100; + } else { + $data[$key]['keep_num'] = 0; + } //充值 $map = $map_list; empty($game_name ) || $map['game_name'] = array('like','%'.$game_name.'%'); @@ -638,12 +642,24 @@ class StatController extends ThinkController $data[$key]['new_pop'] = $query[0]['num']; //付费率 - $data[$key]['spend_rate'] = round($data[$key]['spend_people']/$data[$key]['act_user'],4)*100; + if (!empty($data[$key]['act_user'])) { + $data[$key]['spend_rate'] = round($data[$key]['spend_people']/$data[$key]['act_user'],4)*100; + } else { + $data[$key]['spend_rate'] = 0; + } //ARPU - $data[$key]['ARPU'] = round($data[$key]['spend']/$data[$key]['act_user'],2); - //ARPPU - $data[$key]['ARPPU'] = round($data[$key]['spend']/$data[$key]['spend_people'],2); + if (!empty($data[$key]['act_user'])) { + $data[$key]['ARPU'] = round($data[$key]['spend']/$data[$key]['act_user'],2); + } else { + $data[$key]['ARPU'] = 0; + } + //ARPPU + if (!empty($data[$key]['spend_people'])) { + $data[$key]['ARPPU'] = round($data[$key]['spend']/$data[$key]['spend_people'],2); + } else { + $data[$key]['ARPPU'] = 0; + } //累计付费玩家 $map = $map_list; empty($hasbindcoins) || $map['pay_way'] = $hasbindcoins['pay_way']; @@ -1144,7 +1160,11 @@ class StatController extends ThinkController ->join("right join tab_user_login_record as ur on ur.user_id = tab_user.id and FROM_UNIXTIME(ur.login_time,'%Y-%m-%d') = '{$login_time}'") ->where($mapl) ->find(); - $data[$key]['keep_num'] = round($num['num']/$data[$key]['register_num'],4)*100; + if (!empty($data[$key]['register_num'])) { + $data[$key]['keep_num'] = round($num['num']/$data[$key]['register_num'],4)*100; + } else { + $data[$key]['keep_num'] = 0; + } //充值 $mapl = $map_list; empty($game_name ) || $mapl['game_name'] = array('like','%'.$game_name.'%'); @@ -1157,15 +1177,26 @@ class StatController extends ThinkController //付费玩家数 $data[$key]['spend_people'] = $spend['people']; //付费率 - $data[$key]['spend_rate'] = round($data[$key]['spend_people']/$data[$key]['act_user'],4)*100; + if (!empty($data[$key]['act_user'])) { + $data[$key]['spend_rate'] = round($data[$key]['spend_people']/$data[$key]['act_user'],4)*100; + } else { + $data[$key]['spend_rate'] = 0; + } //ARPU - $data[$key]['ARPU'] = round($data[$key]['spend']/$data[$key]['act_user'],2); + if (!empty($data[$key]['act_user'])) { + $data[$key]['ARPU'] = round($data[$key]['spend']/$data[$key]['act_user'],2); + } else { + $data[$key]['ARPU'] = 0; + } //ARPPU - $data[$key]['ARPPU'] = round($data[$key]['spend']/$data[$key]['spend_people'],2); - if($data[$key]['register_num']==0&&$data[$key]['act_user']==0&&$data[$key]['keep_num']==0&&$data[$key]['spend']==0&&$data[$key]['spend_people']==0){ - unset($data[$key]); + if (!empty($data[$key]['spend_people'])) { + $data[$key]['ARPPU'] = round($data[$key]['spend']/$data[$key]['spend_people'],2); + } else { + $data[$key]['ARPPU'] = 0; } - +// if($data[$key]['register_num']==0&&$data[$key]['act_user']==0&&$data[$key]['keep_num']==0&&$data[$key]['spend']==0&&$data[$key]['spend_people']==0){ +// unset($data[$key]); +// } } $count=count($data); if($count > $row){ @@ -1180,6 +1211,7 @@ class StatController extends ThinkController $this->assign('list_data',$data); $this->display(); } + function game_analysis(){ if($_REQUEST['time-start']!=''&&$_REQUEST['time-end']!=''){ $start=$_REQUEST['time-start']; @@ -1375,7 +1407,7 @@ class StatController extends ThinkController $model = M('device_statistics','tab_'); if ($type == 0) { - $return = $model->sum('new_device'); + $return = $model->where(['time'=>['neq',0]])->sum('new_device'); // $return = $device->all_device(); } else if($type == 1) { $return = $model->where(['time'=>array('between',[$todaystart,$todaystart+86399])])->sum('new_device'); diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index b2055cc0b..438a28079 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -142,9 +142,15 @@ class TimingController extends AdminController { //当日新增设备 $newSql = M('device_record','tab_')->field('min(create_time) as create_time,model,unique_code,id')->where(['version'=>1])->group('unique_code')->select(false); $data['new_device'] = M('device_record','tab_')->table('(' . $newSql . ') as a')->where(['create_time'=>array('between',[$startTime,$startTime+86399])])->order('create_time')->count(); + $data['time'] = $startTime; echo $data['new_device'].' '; + $duration = $this->duration(['create_time'=>array('between',[$startTime-86400*7,$startTime-1])]); + $newSqls = M('device_record','tab_')->field('min(create_time) as create_time,model,unique_code,id')->group('unique_code')->select(false); + $data['duration7'] = ($duration/M('device_record','tab_')->table('(' . $newSqls . ') as a')->where(['create_time'=>array('between',[$startTime-86400*7,$startTime-1])])->order('create_time')->count())/7; + $data['version'] = 1; + $getStatistics = M('device_statistics','tab_')->where(['time'=>$startTime,'version'=>1])->find(); echo "\n"; if (!$getStatistics) { @@ -152,13 +158,14 @@ class TimingController extends AdminController { } else { M('device_statistics','tab_')->where(['time'=>$startTime,'version'=>1])->save($data); } - + $data['duration7'] = 0; echo date("Y-m-d",$startTime).' 苹果 '; //当日新增设备 $newSql = M('device_record','tab_')->field('min(create_time) as create_time,model,unique_code,id')->where(['version'=>2])->group('unique_code')->select(false); $data['new_device'] = M('device_record','tab_')->table('(' . $newSql . ') as a')->where(['create_time'=>array('between',[$startTime,$startTime+86399])])->order('create_time')->count(); echo $data['new_device'].' '; + $data['version'] = 2; $getStatistics = M('device_statistics','tab_')->where(['time'=>$startTime,'version'=>2])->find(); echo "\n"; diff --git a/Application/Admin/View/Member/login_record.html b/Application/Admin/View/Member/login_record.html index 93fd046e7..8de70f9e1 100644 --- a/Application/Admin/View/Member/login_record.html +++ b/Application/Admin/View/Member/login_record.html @@ -90,6 +90,21 @@