Merge branch 'dev' of 47.111.118.107:/srv/git/platform into dev

master
ELF 5 years ago
commit 51d1d730e1

@ -0,0 +1,22 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}

@ -0,0 +1,286 @@
<?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 IndexChartSetController extends AdminController {
public $beginTime;
public $endTime;
public $date;
public $nowdata;
public $UserModel;
public $ChartModel;
public $LoginModel;
public $SpendModel;
public $PromoteModel;
public $addid;
public $adddata;
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();
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);
//判断是否存在
$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();
$t2 = microtime(true);
echo ("{$this->date} {$reset}success runtime:".round($t2-$t1,3).'s'.PHP_EOL);
# code...
}
//获取每日的增长用户
public function newUser()
{
$map = ['register_time'=>['between',[$this->beginTime,$this->endTime]],"puid"=>0];//0不是小号
$hoursnews = $this->UserModel->field('FROM_UNIXTIME(register_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["new_user_hours"] = serialize($user_hours);
unset($user_hours);
//获取当日所有的注册用户
$userList = $this->UserModel->field('count(1) count')
->where($map)
->find();
$this->adddata["new_user_count"] = $userList['count'];
}
/**
* 活跃用户计算
*/
public function activeUser()
{
$map = ['login_time'=>['between',[$this->beginTime,$this->endTime]]];//0不是小号
$hoursnews = $this->LoginModel->field('FROM_UNIXTIME(login_time, "%H") as time,COUNT(DISTINCT user_id) AS active')
->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['active'];
}
$this->adddata["active_user_hours"] = serialize($user_hours);
unset($user_hours);
//获取活跃用户列表
$activeCount = $this->LoginModel->field('user_id')
->where($map)
->group('user_id')
->select();
$this->adddata["active_user_count"] = count($activeCount);
$this->adddata["active_user_list"] = serialize(array_column($activeCount,'user_id'));
unset($activeCount);
}
/**
* 计算充值用户
*/
public function payUser()
{
$map = ['pay_time'=>['between',[$this->beginTime,$this->endTime]],'pay_status'=>1];//1支付成功
$hoursnews = $this->SpendModel->field('FROM_UNIXTIME(pay_time, "%H") as time,COUNT(DISTINCT user_id) AS payuser')
->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['payuser'];
}
$this->adddata["pay_user_hours"] = serialize($user_hours);
unset($user_hours);
$activeCount = $this->SpendModel->field('user_id')
->where($map)
->group('user_id')
->select();
$this->adddata["pay_user_count"] = count($activeCount);
$this->adddata["pay_user_list"] = serialize(array_column($activeCount,'user_id'));
unset($activeCount);
}
/**
* 充值金额计算
*/
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"] = serialize($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"] = serialize($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();
$this->adddata["all_count"] = serialize($allcount);
}
public function createDb()
{
$this->adddata['date']=$this->beginTime;
$this->adddata['create_time']=$this->nowdata;
$this->ChartModel->add($this->adddata);
}
}

@ -16,20 +16,13 @@ use Base\Repository\UserRepository;
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class IndexController extends AdminController {
public function test()
{
$content = 'MDAwMDAwMDAwMJndsKKZZYuXeqCgy324cpebidDdi6mplZy2vKCFdqeagKewp5CKas6JaJ3Nec6fnYWvzM59qK2im5OfZZGrq2d9zqeig3aD0IqNYs6IlnarmnzR0HrP0puGt7B2hqysdoLe0n-FeIKUfnqCl33edZ2DeK_VlJacnJvPvJycebiXlpewpJGLg9eVjWLOk815aoCfqs59qK2skrqwZpKKrJeW0aytkYaCmHqfetV50oaukY2vy5K8tJuHy69nhXWrpH3StKSYZHKUi4573JG7aamAn9TOfs6spYHQuKScedqdfc7VopBlctZ9pJnSipeGrpF82NqVrbmlmpSbopGfqKeOq6yvj2Sxk3-NhtqKqqhlha-ymYrR22OG3L9ohnjaYoKWvKKFZLGTf32Gln-3mJebiczei8_PlZy2v2eHibCUmLjJsoV3oNJ6n6jLiZZpn5GIrpt6z6ibhKWwq5ufzpuOt69vhHZt2X6JqMuJ0oKpkGee2JOYrJuHy6-thYmrqY67r6KDdoPcimiZzpK7hZ2Gnq-Zi5ilpZG6uKGaZayll5a4q4CcsMuLaHfWirppq5l8q5qLva2Yms-sqJKFq2d9za-sgKBqzX-MatyRu5SpgJ_Uzn-svZyRz79phpyknI64p2mRnZyXio2G3H2onKGRn8nQgLy8qYXPv6uGrKeagKewpZx7i86To4LLf816rpGNr5eLva18kqaWrp56uKuOvLCDkXdp2n56dtqT3n6rhZ-mmYC5vWqbqrCqknq4m5ip0qSHh37bfoqGlH7ehWiFr77dgKispYHPrJ6RZJtiltK3ooacg5KLjn-Sfbh5roV5upd6ztqbkpSsqJKIm6aNu5elgJ2oy4l-hpOKuHafj326mH7fy5uQqrtnhpzJYYysu2yRioKViX6Gkoq4l2mCe92WgKmtn4e43mWGnMVmjZXeaoWtgpKAeZzLfKd6pJlos8uV0rmrm5TSqpqbq2d9zquuhHZt2XqfqMuTq3Zpj2ee3ousuauQlJtlmomsnZfNr2-An4ezibB62X24m6uGiaaVfrnGqYWmq2iPnLB3jt2vrIChe8qWjGrclKt2ZJuNss6Az6SlgdConJ2Im2SNvNGihp2c1Xqkf9mKu2Wfj2fR3HrP0puGttGphoa7poG4p66FrYrLl4dunw';
$request=json_decode(think_decrypt($content),true);
var_dump($request);
}
/**
/**
* 后台首页
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
* @author cz
*/
public function index(){
if(session('user_auth.uid')){
public function index()
{
if(session('user_auth.uid')){
$data=M('Member')
->field('uid,nickname,username,us.last_login_time,us.last_login_ip,login')
->join('sys_ucenter_member as us on sys_member.uid = us.id')
@ -49,122 +42,171 @@ class IndexController extends AdminController {
// 日历
$this->calendar();
// 折线图
$this->foldLineDiagram($_REQUEST['start'],$_REQUEST['end'],$_REQUEST['num']);
$userRepository = new UserRepository();
$activeCount = $userRepository->getActiveUserCountRecently(7);
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']);
}
$tm =strtotime(date("Y-m-d",strtotime("-1 day")));
$allcount = M("IndexChart","tab_")->field("all_count")->where("`date` = '{$tm}'")->find();
$allcount = unserialize($allcount['all_count']);
// 累计数据
$user = D('User');
$spend = D('Spend');
$promote = D('Promote');
$this->assign('user_count', $user->old());
// $this->assign('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]]]));
$this->assign('active_count', $activeCount);
$this->assign('player_count', $spend->player());
$this->assign('money_sum', $spend->totalAmount());
$this->assign('promote_sum', $promote->total());
$this->display();
}
/*
* 日历
* @param integer $start 开始时间(2018-04)
* @param integer $end 结束时间(2018-05)
* @param boolean $flag 是否ajax返回
* @author 鹿文学
*/
public function calendar($start='',$end='',$flag=false) {
$start = $start?$start:date('Y-m',strtotime('-1 month'));
$end = $end?$end:date('Y-m');
$this->assign('user_count',$allcount['user_count']);
$this->assign('active_count', $allcount['active_count']);
$this->assign('player_count', $allcount['player_count']);
$this->assign('money_sum', $allcount['money_sum']);
$this->assign('promote_sum',$allcount['promote_sum']);
//累计统计
$this->display();
}
/*
* 今日折线图
*/
public function nowday($num)
{
$starttime = mktime(0,0,0,date('m'),date('d'),date('Y'));
if ($start == $end) {$start = date('Y-m',strtotime('-1 month',$end));}
if (strtotime($start)>strtotime($end)) {$temp = $end;$end = $start;$start = $temp;}
if (strtotime($end) > strtotime(date('Y-m'))) {$end = date('Y-m');$start = date('Y-m',strtotime('-1 month'));}
$endtime = $starttime+86399;
$iscurrent = $end != date('Y-m')?1:0; // 默认是当前月,不可进入下一个月
$start = date('Y-m-d',$starttime);
$end = date('Y-m-d',$endtime);
$stime = strtotime($start);
$etime = strtotime($end);
$user = D('User');
$spend = D('Spend');
$promote = D('Promote');
$sw = date('w',$stime); // 周几
$ew = date('w',$etime);
$sw = $sw == 0? 6:(integer)$sw-1;
$ew = $ew == 0? 6:(integer)$ew-1;
if ($start == date('Y-m-d',strtotime('-1 day'))) {$num = 2;}
$st = date('t',$stime); // 天数
$et = date('t',$etime);
$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'];
$sf = $ef = $sr = $er = 1; // 行数 ,日期起始值
$data['date'] = [$start];
for($i=0;$i<7;$i++) {
if ($i<$sw)
$first[$sr][$i] = ['value'=>''];
else {
$first[$sr][$i] = ['value'=>set_date_day_format($sf),'full'=>$start.'-'.set_date_day_format($sf)];$sf++;
}
}
for($i=0;$i<7;$i++) {
if ($i<$ew)
$last[$er][$i] = ['value'=>''];
else {
$eday = set_date_day_format($ef);
if (strtotime($end.'-'.$eday)>strtotime(date('Y-m-d'))){
$last[$er][$i] = ['value'=>$eday,'full'=>$end.'-'.$eday,'no'=>1];$ef++;
}else{
$last[$er][$i] = ['value'=>$eday,'full'=>$end.'-'.$eday];$ef++;
}
}
}
$data['hours'] = 1;
$sn = $en = 0; // 列数
for ($i=$sf;$i<=$st;$i++) {
if (count($first[$sr])==7){$sr++;$sn=0;}
$sday = set_date_day_format($i);
$first[$sr][$sn] = ['value'=>$sday,'full'=>$start.'-'.$sday];
$sn++;
}
for ($i=$ef;$i<=$et;$i++) {
if (count($last[$er])==7){$er++;$en=0;}
$eday = set_date_day_format($i);
if (strtotime($end.'-'.$eday)>strtotime(date('Y-m-d'))){$last[$er][$en] = ['value'=>$eday,'full'=>$end.'-'.$eday,'no'=>1];} else{$last[$er][$en] = ['value'=>$eday,'full'=>$end.'-'.$eday];}
$en++;
foreach($hours as $v) {
$data['news'][$v] = 0;
$data['active'][$v] = 0;
$data['player'][$v] = 0;
$data['money'][$v] = 0;
}
$prev = date('Y-m',strtotime('-1 month',$stime)).','.$start;
$next = $end.','.date('Y-m',strtotime('+1 month',$etime));
// 新增用户
$hoursnews = $user->newsAdd(['register_time'=>['between',[$starttime,$endtime]]],'news','time',5);
$calendar = ['first'=>$first,'last'=>$last,'prev'=>$prev,'next'=>$next,'iscurrent'=>$iscurrent,'ftitle'=>date('Y年m月',$stime),'ltitle'=>date('Y年m月',$etime),'today'=>date('Y-m-d')];
// 活跃用户
$hoursactive = $user->totalPlayerByGroup($hours,['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]],'active','time',5);
if ($flag) {
// 付费用户
$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;
}
}
echo json_encode($calendar);
foreach($hoursactive as $h) {
if ($h['time'] == $v){
$data['active'][$v] = (integer)$h['active'];break;
}
}
} else {
foreach($hoursplayer as $h) {
$time = explode(' ',$h['time']);
if ($time[1] == $v){
$data['player'][$v] = (integer)$h['player'];break;
}
}
$this->assign('calendar',$calendar);
foreach($hoursmoney as $h) {
$time = explode(' ',$h['time']);
if ($time[1] == $v){
$data['money'][$v] = $h['money'];break;
}
}
}
// 新
$between = ['between',[$starttime-86400,$endtime]];
$cnewslist = $user->newsAdd(['register_time'=>$between],'count','time',1,'time desc');
$cnews['count'] = $cnewslist[0]['count']?$cnewslist[0]['count']:0;
$cnews['rate'] = $cnewslist[0] && $cnewslist[1]? round(($cnewslist[0]['count']/$cnewslist[1]['count']-1)*100,2):($cnewslist[0]&&!$cnewslist[1]?(100):(!$cnewslist[0]&&$cnewslist[1]?(-100):0));
// 活
$cactivelist = $user->totalPlayerByGroup([date('Y-m-d',$starttime-86400),$end],['tab_user_login_record.login_time'=>$between],'count','time',1,'time desc');
$cactive['count'] = $cactivelist[0]['count']?$cactivelist[0]['count']:0;
$cactive['rate'] = $cactivelist[0] && $cactivelist[1]? round(($cactivelist[0]['count']/$cactivelist[1]['count']-1)*100,2):($cactivelist[0]&&!$cactivelist[1]?(100):(!$cactivelist[0]&&$cactivelist[1]?(-100):0));
// 付
$cplayerlist = $spend->totalPlayerByGroup(['pay_time'=>$between],'count','time',1,'time desc');
$cplayer['count'] = $cplayerlist[0]['count']?$cplayerlist[0]['count']:0;
$cplayer['rate'] = $cplayerlist[0] && $cplayerlist[1]? round(($cplayerlist[0]['count']/$cplayerlist[1]['count']-1)*100,2):($cplayerlist[0]&&!$cplayerlist[1]?(100):(!$cplayerlist[0]&&$cplayerlist[1]?(-100):0));
// 充
$cmoneylist = $spend->totalAmountByGroup(['pay_time'=>$between],'count','time',1,'time desc');
$cmoney['count'] = $cmoneylist[0]['count']?$cmoneylist[0]['count']:0;
$cmoney['rate'] = $cmoneylist[0] && $cmoneylist[1]? round(($cmoneylist[0]['count']/$cmoneylist[1]['count']-1)*100,2):($cmoneylist[0]&&!$cmoneylist[1]?(100):(!$cmoneylist[0]&&$cmoneylist[1]?(-100):0));
// 渠
$cpromotelist = $promote->newsAdd(['create_time'=>$between],'count','time',1,'time desc');
$cpromote['count'] = $cpromotelist[0]['count']?$cpromotelist[0]['count']:0;
$cpromote['rate'] = $cpromotelist[0] && $cpromotelist[1]? round(($cpromotelist[0]['count']/$cpromotelist[1]['count']-1)*100,2):($cpromotelist[0]&&!$cpromotelist[1]?(100):(!$cpromotelist[0]&&$cpromotelist[1]?(-100):0));
foreach($data as $k => $v) {
if (is_array($v)) {
if ($k == 'date')
$data[$k] = '"'.implode('","',$v).'"';
else
$data[$k] = implode(',',$v);
}
}
$data['compare']['news'] = $cnews;
$data['compare']['active'] = $cactive;
$data['compare']['player'] = $cplayer;
$data['compare']['money'] = $cmoney;
$data['compare']['promote'] = $cpromote;
/*
* 折线图
* @param integer $start 开始时间
* @param integer $end 结束时间
* @param boolean $flag 是否ajax返回
* @author 鹿文学
*/
public function foldLineDiagram($start='',$end='',$num='',$flag=false) {
if ($flag) {
$starttime = $start?strtotime($start):mktime(0,0,0,date('m'),date('d')-1,date('Y'));
echo json_encode($data);
} else {
$this->assign('foldline',$data);
$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;
@ -175,238 +217,144 @@ class IndexController extends AdminController {
$spend = D('Spend');
$promote = D('Promote');
if ($start == $end) {
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;
}
// 新增用户
$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) {
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;
}
}
}
// 新
$between = ['between',[$starttime-86400,$endtime]];
$cnewslist = $user->newsAdd(['register_time'=>$between],'count','time',1,'time desc');
$cnews['count'] = $cnewslist[0]['count']?$cnewslist[0]['count']:0;
$cnews['rate'] = $cnewslist[0] && $cnewslist[1]? round(($cnewslist[0]['count']/$cnewslist[1]['count']-1)*100,2):($cnewslist[0]&&!$cnewslist[1]?(100):(!$cnewslist[0]&&$cnewslist[1]?(-100):0));
// 活
$cactivelist = $user->totalPlayerByGroup([date('Y-m-d',$starttime-86400),$end],['tab_user_login_record.login_time'=>$between],'count','time',1,'time desc');
$cactive['count'] = $cactivelist[0]['count']?$cactivelist[0]['count']:0;
$cactive['rate'] = $cactivelist[0] && $cactivelist[1]? round(($cactivelist[0]['count']/$cactivelist[1]['count']-1)*100,2):($cactivelist[0]&&!$cactivelist[1]?(100):(!$cactivelist[0]&&$cactivelist[1]?(-100):0));
// 付
$cplayerlist = $spend->totalPlayerByGroup(['pay_time'=>$between],'count','time',1,'time desc');
$cplayer['count'] = $cplayerlist[0]['count']?$cplayerlist[0]['count']:0;
$cplayer['rate'] = $cplayerlist[0] && $cplayerlist[1]? round(($cplayerlist[0]['count']/$cplayerlist[1]['count']-1)*100,2):($cplayerlist[0]&&!$cplayerlist[1]?(100):(!$cplayerlist[0]&&$cplayerlist[1]?(-100):0));
// 充
$cmoneylist = $spend->totalAmountByGroup(['pay_time'=>$between],'count','time',1,'time desc');
$cmoney['count'] = $cmoneylist[0]['count']?$cmoneylist[0]['count']:0;
$cmoney['rate'] = $cmoneylist[0] && $cmoneylist[1]? round(($cmoneylist[0]['count']/$cmoneylist[1]['count']-1)*100,2):($cmoneylist[0]&&!$cmoneylist[1]?(100):(!$cmoneylist[0]&&$cmoneylist[1]?(-100):0));
// 渠
$cpromotelist = $promote->newsAdd(['create_time'=>$between],'count','time',1,'time desc');
$cpromote['count'] = $cpromotelist[0]['count']?$cpromotelist[0]['count']:0;
$cpromote['rate'] = $cpromotelist[0] && $cpromotelist[1]? round(($cpromotelist[0]['count']/$cpromotelist[1]['count']-1)*100,2):($cpromotelist[0]&&!$cpromotelist[1]?(100):(!$cpromotelist[0]&&$cpromotelist[1]?(-100):0));
$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'] = unserialize($dbdata["new_user_hours"]);
$data['active'] = unserialize($dbdata["active_user_hours"]);
$data['player']=unserialize($dbdata["pay_user_hours"]);
$data['money']=unserialize($dbdata["pay_money_hours"]);
//获取昨天
$ytm = $starttime-86400;
$ydbdata = M("IndexChart","tab_")->field("new_user_count,active_user_count,pay_user_count,pay_money_count,promote_new_count")->where("`date` = '{$ytm}'")->find();
//计算
$cnews['count'] = $dbdata['new_user_count'];
$cnews['rate'] = $this->setRate($dbdata['new_user_count'],$ydbdata['new_user_count']);
$cactive['count'] = $dbdata['active_user_count'];
$cactive['rate'] = $this->setRate($dbdata['active_user_count'],$ydbdata['active_user_count']);
$cplayer['count'] = $dbdata['pay_user_count'];
$cplayer['rate'] = $this->setRate($dbdata['pay_user_count'],$ydbdata['pay_user_count']);
$cmoney['count'] = $dbdata['pay_money_count'];
$cmoney['rate'] = $this->setRate($dbdata['pay_money_count'],$ydbdata['pay_money_count']);
$cpromote['count'] = $dbdata['promote_new_count'];
$cpromote['rate'] = $this->setRate($dbdata['promote_new_count'],$ydbdata['promote_new_count']);
} 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;
}
// 新增用户
$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);
// 充值金额
$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($money as $h) {
if ($v == $h['time']) {
$data['money'][$v] = $h['money'];break;
}
}
$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,active_user_list,pay_user_count,pay_user_list,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'];
$active_user_list += unserialize($v['active_user_list']);
unset($v['active_user_list']);
unset($dbdata[$k]['active_user_list']);
$pay_user_list += unserialize($v['pay_user_list']);
unset($v['pay_user_list']);
unset($dbdata[$k]['pay_user_list']);
$count1['new_user_count'] += $v['new_user_count'];
$count1['pay_money_count'] += $v['pay_money_count'];
$count1['promote_new_count'] += $v['promote_new_count'];
}
// 新
$cnewslist1 = $user->old(['register_time'=>['between',[$starttime,$endtime]]]);
// 活
$cactivelist1 = $user->active(['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]]);
// 付
$cplayerlist1 = $spend->player(['pay_time'=>['between',[$starttime,$endtime]]]);
// 充
$cmoneylist1 = $spend->totalAmount(['pay_time'=>['between',[$starttime,$endtime]]]);
// 渠
$cpromotelist1 = $promote->total(['create_time'=>['between',[$starttime,$endtime]]]);
unset($dbdata);
$count1['active_user_count'] = count(array_flip(array_flip($active_user_list)));
unset($active_user_list);
$count1['pay_user_count'] = count(array_flip(array_flip($pay_user_list)));
unset($active_user_list);
//获取前num的日志
switch($num) {
case 3:{
$between = ['between',[strtotime('-7 day',$starttime),strtotime('-7 day',$endtime)]];
$cnewslist2 = $user->old(['register_time'=>$between]);
$cactivelist2 = $user->active(['tab_user_login_record.login_time'=>$between]);
$cplayerlist2 = $spend->player(['pay_time'=>$between]);
$cmoneylist2 = $spend->totalAmount(['pay_time'=>$between]);
$cpromotelist2 = $promote->total(['create_time'=>$between]);
};break;
case 4:{
$temp = strtotime('-1 month',$starttime);
$between = ['between',[$temp,mktime(0,0,0,date('m',$temp)+1,1,date('Y',$temp))-1]];
$cnewslist2 = $user->old(['register_time'=>$between]);
$cactivelist2 = $user->active(['tab_user_login_record.login_time'=>$between]);
$cplayerlist2 = $spend->player(['pay_time'=>$between]);
$cmoneylist2 = $spend->totalAmount(['pay_time'=>$between]);
$cpromotelist2 = $promote->total(['create_time'=>$between]);
};break;
case 5:{
$between = ['between',[strtotime('-7 day',$starttime),strtotime('-7 day',$endtime)]];
$cnewslist2 = $user->old(['register_time'=>$between]);
$cactivelist2 = $user->active(['tab_user_login_record.login_time'=>$between]);
$cplayerlist2 = $spend->player(['pay_time'=>$between]);
$cmoneylist2 = $spend->totalAmount(['pay_time'=>$between]);
$cpromotelist2 = $promote->total(['create_time'=>$between]);
};break;
case 6:{
$between = ['between',[strtotime('-30 day',$starttime),strtotime('-30 day',$endtime)]];
$cnewslist2 = $user->old(['register_time'=>$between]);
$cactivelist2 = $user->active(['tab_user_login_record.login_time'=>$between]);
$cplayerlist2 = $spend->player(['pay_time'=>$between]);
$cmoneylist2 = $spend->totalAmount(['pay_time'=>$between]);
$cpromotelist2 = $promote->total(['create_time'=>$between]);
};break;
case 7:{
$between = ['between',[strtotime('-365 day',$starttime),strtotime('-365 day',$endtime)]];
$cnewslist2 = $user->old(['register_time'=>$between]);
$cactivelist2 = $user->active(['tab_user_login_record.login_time'=>$between]);
$cplayerlist2 = $spend->player(['pay_time'=>$between]);
$cmoneylist2 = $spend->totalAmount(['pay_time'=>$between]);
$cpromotelist2 = $promote->total(['create_time'=>$between]);
};break;
default:{
$day_num = count($datelist);
$between = ['between',[strtotime('-'.$day_num.' day',$starttime),strtotime('-'.$day_num.' day',$endtime)]];
$cnewslist2 = $user->old(['register_time'=>$between]);
$cactivelist2 = $user->active(['tab_user_login_record.login_time'=>$between]);
$cplayerlist2 = $spend->player(['pay_time'=>$between]);
$cmoneylist2 = $spend->totalAmount(['pay_time'=>$between]);
$cpromotelist2 = $promote->total(['create_time'=>$between]);
};
}
//获取前几天记录
$map1 = array(
"date"=>$between
);
$ydbdata = M("IndexChart","tab_")->field("new_user_count,active_user_count,active_user_list,pay_user_count,pay_user_list,pay_money_count,promote_new_count")
->where($map1)->select();
$active_user_list = [];
$pay_user_list = [];
$count2 = array();
foreach($ydbdata as $k => $v) {
$active_user_list += unserialize($v['active_user_list']);
unset($v['active_user_list']);
unset($ydbdata[$k]['active_user_list']);
$pay_user_list += unserialize($v['pay_user_list']);
unset($v['pay_user_list']);
unset($ydbdata[$k]['pay_user_list']);
$count2['new_user_count'] += $v['new_user_count'];
$count2['pay_money_count'] += $v['pay_money_count'];
$count2['promote_new_count'] += $v['promote_new_count'];
}
unset($ydbdata);
$count2['active_user_count'] = count(array_flip(array_flip($active_user_list)));
unset($active_user_list);
$count2['pay_user_count'] = count(array_flip(array_flip($pay_user_list)));
unset($active_user_list);
//比较
$cnews['count'] = $count1['new_user_count'];
$cnews['rate'] = $this->setRate($count1['new_user_count'],$count2['new_user_count']);
$cnews['count'] = $cnewslist1?$cnewslist1:0;
$cnews['rate'] = $cnewslist1 && $cnewslist2? round(($cnewslist1/$cnewslist2-1)*100,2):($cnewslist1&&!$cnewslist2?(100):(!$cnewslist1&&$cnewslist2?(-100):0));
$cactive['count'] = $cactivelist1?$cactivelist1:0;
$cactive['rate'] = $cactivelist1 && $cactivelist2? round(($cactivelist1/$cactivelist2-1)*100,2):($cactivelist1&&!$cactivelist2?(100):(!$cactivelist1&&$cactivelist2?(-100):0));
$cactive['count'] =$count1['active_user_count'];
$cactive['rate'] = $this->setRate($count1['active_user_count'],$count2['active_user_count']);
$cplayer['count'] = $cplayerlist1?$cplayerlist1:0;
$cplayer['rate'] = $cplayerlist1 && $cplayerlist2? round(($cplayerlist1/$cplayerlist2-1)*100,2):($cplayerlist1&&!$cplayerlist2?(100):(!$cplayerlist1&&$cplayerlist2?(-100):0));
$cplayer['count'] =$count1['pay_user_count'];
$cplayer['rate'] = $this->setRate($count1['pay_user_count'],$count2['pay_user_count']);
$cmoney['count'] = $cmoneylist1?$cmoneylist1:0;
$cmoney['rate'] = $cmoneylist1 && $cmoneylist2? round(($cmoneylist1/$cmoneylist2-1)*100,2):($cmoneylist1&&!$cmoneylist2?(100):(!$cmoneylist1&&$cmoneylist2?(-100):0));
$cmoney['count'] = $count1['pay_money_count'];
$cmoney['rate'] = $this->setRate($count1['pay_money_count'],$count2['pay_money_count']);
$cpromote['count'] = $cpromotelist1?$cpromotelist1:0;
$cpromote['rate'] = $cpromotelist1 && $cpromotelist2? round(($cpromotelist1/$cpromotelist2-1)*100,2):($cpromotelist1&&!$cpromotelist2?(100):(!$cpromotelist1&&$cpromotelist2?(-100):0));
$cpromote['count'] = $count1['promote_new_count'];
$cpromote['rate'] = $this->setRate($count1['promote_new_count'],$count2['promote_new_count']);
}
foreach($data as $k => $v) {
// dump($k);
if (is_array($v)) {
if ($k == 'date')
$data[$k] = '"'.implode('","',$v).'"';
@ -421,7 +369,6 @@ class IndexController extends AdminController {
$data['compare']['player'] = $cplayer;
$data['compare']['money'] = $cmoney;
$data['compare']['promote'] = $cpromote;
if ($flag) {
echo json_encode($data);
@ -433,9 +380,108 @@ class IndexController extends AdminController {
$this->assign('num',$num);
}
# code...
}
public function setRate($d1,$d2)
{
$rate = 0;
if($d1>0){
if($d2 > 0){
$rate = round(($d1/$d2-1)*100,2);
}else{
$rate = 100;
}
}else if($d1 == 0 && $d2 == 0){
$rate = 0;
}else{
$rate = -100;
}
return $rate;
}
/*
* 日历
* @param integer $start 开始时间(2018-04)
* @param integer $end 结束时间(2018-05)
* @param boolean $flag 是否ajax返回
* @author 鹿文学
*/
public function calendar($start='',$end='',$flag=false) {
$start = $start?$start:date('Y-m',strtotime('-1 month'));
$end = $end?$end:date('Y-m');
if ($start == $end) {$start = date('Y-m',strtotime('-1 month',$end));}
if (strtotime($start)>strtotime($end)) {$temp = $end;$end = $start;$start = $temp;}
if (strtotime($end) > strtotime(date('Y-m'))) {$end = date('Y-m');$start = date('Y-m',strtotime('-1 month'));}
$iscurrent = $end != date('Y-m')?1:0; // 默认是当前月,不可进入下一个月
$stime = strtotime($start);
$etime = strtotime($end);
$sw = date('w',$stime); // 周几
$ew = date('w',$etime);
$sw = $sw == 0? 6:(integer)$sw-1;
$ew = $ew == 0? 6:(integer)$ew-1;
$st = date('t',$stime); // 天数
$et = date('t',$etime);
$sf = $ef = $sr = $er = 1; // 行数 ,日期起始值
for($i=0;$i<7;$i++) {
if ($i<$sw)
$first[$sr][$i] = ['value'=>''];
else {
$first[$sr][$i] = ['value'=>set_date_day_format($sf),'full'=>$start.'-'.set_date_day_format($sf)];$sf++;
}
}
for($i=0;$i<7;$i++) {
if ($i<$ew)
$last[$er][$i] = ['value'=>''];
else {
$eday = set_date_day_format($ef);
if (strtotime($end.'-'.$eday)>strtotime(date('Y-m-d'))){
$last[$er][$i] = ['value'=>$eday,'full'=>$end.'-'.$eday,'no'=>1];$ef++;
}else{
$last[$er][$i] = ['value'=>$eday,'full'=>$end.'-'.$eday];$ef++;
}
}
}
$sn = $en = 0; // 列数
for ($i=$sf;$i<=$st;$i++) {
if (count($first[$sr])==7){$sr++;$sn=0;}
$sday = set_date_day_format($i);
$first[$sr][$sn] = ['value'=>$sday,'full'=>$start.'-'.$sday];
$sn++;
}
for ($i=$ef;$i<=$et;$i++) {
if (count($last[$er])==7){$er++;$en=0;}
$eday = set_date_day_format($i);
if (strtotime($end.'-'.$eday)>strtotime(date('Y-m-d'))){$last[$er][$en] = ['value'=>$eday,'full'=>$end.'-'.$eday,'no'=>1];} else{$last[$er][$en] = ['value'=>$eday,'full'=>$end.'-'.$eday];}
$en++;
}
$prev = date('Y-m',strtotime('-1 month',$stime)).','.$start;
$next = $end.','.date('Y-m',strtotime('+1 month',$etime));
$calendar = ['first'=>$first,'last'=>$last,'prev'=>$prev,'next'=>$next,'iscurrent'=>$iscurrent,'ftitle'=>date('Y年m月',$stime),'ltitle'=>date('Y年m月',$etime),'today'=>date('Y-m-d')];
if ($flag) {
echo json_encode($calendar);
} else {
$this->assign('calendar',$calendar);
}
}
public function indextt(){
$user = M("User","tab_");

@ -792,7 +792,7 @@ class MemberController extends ThinkController
*/
public function lock_status($id, $lock_status)
{
$map['id'] = ['in', explode(',', $id)];
$map['id'] = ['in', array_unique(explode(',', $id))];
$res = M('user', 'tab_')->where($map)->setField(['lock_status' => $lock_status]);
if ($res) {
\Think\Log::actionLog('Member/lock_status', 'Member', $id);

@ -380,14 +380,13 @@ class PlatformController extends ThinkController
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')
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%')", 'left')
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
->join("tab_user as u on tp2.id = u.promote_id", 'left')
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->where($map)
->group('tp1.id')
->order('count desc, register_time')
->select();
$count = count($data);
foreach ($data as $key => $value) {
static $i = 0;
@ -507,7 +506,7 @@ class PlatformController extends ThinkController
unset($_REQUEST['promote_id']);
}
$data = $spend->field('t.pid as promote_id,t.promote_account,sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth')
->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') where $promote_map ) AS t ON promote_id = t.id")
->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') where $promote_map ) AS t ON promote_id = t.id or promote_id = t.pid")
->where($condition)->table('(' . $data . ') as a')->group('t.pid')->order('count desc,a.ordertime')->select();
$count = count($data);
// dump($condition);die;

@ -237,5 +237,4 @@ class PublicController extends \Think\Controller
cookie('think_language', 'en-us');
$this->ajaxReturn(['status' => 1]);
}
}

@ -1331,26 +1331,28 @@ class StatController extends ThinkController
* @author 鹿文学
*/
public function device_survey() {
$device = D('DeviceRecord');
set_time_limit(0);
// $device = D('DeviceRecord');
// 统计
$total = $device->all_device();
$todaystart = mktime(0,0,0,date('m'),date('d'),date('Y'));
$today = $device->total_device(['create_time'=>array('between',[$todaystart,$todaystart+86399])]);
$yesterday = $device->total_device(['create_time'=>array('between',[$todaystart-86400,$todaystart-1])]);
$day7 = $device->total_device(['create_time'=>array('between',[$todaystart-86400*7,$todaystart-1])],1);
$day30 = $device->total_device(['create_time'=>array('between',[$todaystart-86400*30,$todaystart-1])],1);
$duration = $device->single_duration(['create_time'=>array('between',[$todaystart-86400*7,$todaystart-1])]);
$this->assign('total',$total);
$this->assign('today',$today);
$this->assign('yesterday',$yesterday);
$this->assign('day7',$day7);
$this->assign('day30',$day30);
$this->assign('duration7',second_to_duration($duration/7));
// $total = $device->all_device();
// $todaystart = mktime(0,0,0,date('m'),date('d'),date('Y'));
// $today = $device->total_device(['create_time'=>array('between',[$todaystart,$todaystart+86399])]);
// $yesterday = $device->total_device(['create_time'=>array('between',[$todaystart-86400,$todaystart-1])]);
//
// $day7 = $device->total_device(['create_time'=>array('between',[$todaystart-86400*7,$todaystart-1])],1);
//
//
// $day30 = $device->total_device(['create_time'=>array('between',[$todaystart-86400*30,$todaystart-1])],1);
// $duration = $device->single_duration(['create_time'=>array('between',[$todaystart-86400*7,$todaystart-1])]);
// $this->assign('total',$total);
// $this->assign('today',$today);
// $this->assign('yesterday',$yesterday);
// $this->assign('day7',$day7);
// $this->assign('day30',$day30);
// $this->assign('duration7',second_to_duration($duration/7));
// 日历
R('Index/calendar');
@ -1362,6 +1364,39 @@ class StatController extends ThinkController
}
public function getDevice() {
set_time_limit(0);
$type = I("type",0);
$device = D('DeviceRecord');
$todaystart = mktime(0,0,0,date('m'),date('d'),date('Y'));
$model = M('device_statistics','tab_');
if ($type == 0) {
$return = $model->sum('new_device');
// $return = $device->all_device();
} else if($type == 1) {
$return = $model->where(['time'=>array('between',[$todaystart,$todaystart+86399])])->sum('new_device');
// $return = $device->total_device(['create_time'=>array('between',[$todaystart,$todaystart+86399])]);
} else if($type == 2) {
$return = $model->where(['time'=>array('between',[$todaystart-86400,$todaystart-1])])->sum('new_device');
// $return = $device->total_device(['create_time'=>array('between',[$todaystart-86400,$todaystart-1])]);
} else if($type == 3) {
$return = $model->where(['time'=>array('between',[$todaystart-86400*7,$todaystart-1])])->sum('active_device');
// $return = $device->total_device(['create_time'=>array('between',[$todaystart-86400*7,$todaystart-1])],1);
} else if($type == 4) {
$return = $model->where(['time'=>array('between',[$todaystart-86400*30,$todaystart-1])])->sum('active_device');
// $return = $device->total_device(['create_time'=>array('between',[$todaystart-86400*30,$todaystart-1])],1);
} else if ($type == 5) {
$return = second_to_duration(($model->where(['time'=>$todaystart])->sum('duration7')));
// $return = second_to_duration($device->single_duration(['create_time'=>array('between',[$todaystart-86400*7,$todaystart-1])])/7);
}
$this->ajaxReturn($return?$return:0) ;
}
/*
* 折线图
@ -1399,14 +1434,19 @@ class StatController extends ThinkController
$data['active']['and'][$v] = 0;
}
$deviceDataAnd = M("device_statistics","tab_")->where(['time'=>strtotime($start),'version'=>1])->find();
$deviceDataIos = M("device_statistics","tab_")->where(['time'=>strtotime($start),'version'=>2])->find();
// 新增设备
$hoursnews = $device->news_on_time(['create_time'=>['between',[$starttime,$endtime]]],'news',5,'time,version');
// $hoursnews = $device->news_on_time(['create_time'=>['between',[$starttime,$endtime]]],'news',5,'time,version');
$hoursnews = array_merge(json_decode($deviceDataAnd['today_new_device'],true),json_decode($deviceDataIos['today_new_device'],true));
// 活跃设备
$hoursactive = $device->active_on_time(['create_time'=>['between',[$starttime,$endtime]]],'active',5,'time,version');
// $hoursactive = $device->active_on_time(['create_time'=>['between',[$starttime,$endtime]]],'active',5,'time,version');
$hoursactive = array_merge(json_decode($deviceDataAnd['today_active_device'],true),json_decode($deviceDataIos['today_active_device'],true));
// 启动机型
$hoursmodel = $device->model(['create_time'=>['between',[$starttime,$endtime]]]);
// $hoursmodel = $device->model(['create_time'=>['between',[$starttime,$endtime]]]);
$hoursmodel = array_merge(json_decode($deviceDataAnd['today_model_device'],true),json_decode($deviceDataIos['today_model_device'],true));
foreach($hours as $v) {
foreach($hoursnews as $h) {
@ -1445,15 +1485,68 @@ class StatController extends ThinkController
$data['active']['ios'][$v] = 0;
$data['active']['and'][$v] = 0;
}
$newData = M('device_statistics','tab_')
->field("new_device as news,version,FROM_UNIXTIME(time,'%Y-%m-%d') as time")
->where(['time'=>['between',[$starttime,$endtime]],'new_device'=>['neq','0']])
->group('time,version')
->select();
// 新增设备
$news = $device->news_on_time(['create_time'=>['between',[$starttime,$endtime]]],'news',$num==7?2:1,'time,version');
// $news = $device->news_on_time(['create_time'=>['between',[$starttime,$endtime]]],'news',$num==7?2:1,'time,version');
$news = $newData;
$activeData = M('device_statistics','tab_')
->field("active_device as active,version,FROM_UNIXTIME(time,'%Y-%m-%d') as time")
->where(['time'=>['between',[$starttime,$endtime]],'active_device'=>['neq','0']])
->group('time,version')
->select();
// 活跃设备
$active = $device->active_on_time(['create_time'=>['between',[$starttime,$endtime]]],'active',$num==7?2:1,'time,version');
// $active = $device->active_on_time(['create_time'=>['between',[$starttime,$endtime]]],'active',$num==7?2:1,'time,version');
$active = $activeData;
// 启动机型
$model = $device->model(['create_time'=>['between',[$starttime,$endtime]]]);
$modelData = M('device_statistics','tab_')
->field("model")
->where(['time'=>['between',[$starttime,$endtime]]])
->select();
$modelNew = [];
$unique_code = [];
foreach($modelData as $key => $value) {
$resolveData = json_decode($value['model'],true);
// dump($resolveData);
foreach($resolveData as $k => $v) {
if (!isset($modelNew[$v['model']][$v['version']])) {
$modelNew[$v['model']][$v['version']] = 1;
$unique_code[$v['unique_code']] = 1;
} else if(!$unique_code[$v['unique_code']]){
$modelNew[$v['model']][$v['version']]++;
$unique_code[$v['unique_code']] = 1;
// array_push($unique_code,$v['unique_code']);
}
}
}
$unique_code = [];
$modelNewData = [];
$modelKey = 0;
foreach($modelNew as $key => $value) {
$modelNewData[$modelKey]['model'] = $key;
foreach($value as $k => $v) {
$modelNewData[$modelKey]['version'] = $k;
$modelNewData[$modelKey]['count'] = $v;
}
$modelKey++;
}
$last_names = array_column($modelNewData,'count');
array_multisort($last_names,SORT_DESC,$modelNewData);
// dump($modelNewData);
// die();
// $model = $device->model(['create_time'=>['between',[$starttime,$endtime]]]);
// dump($model);die();
$model = $modelNewData;
foreach($datelist as $v) {
foreach($news as $h) {

@ -0,0 +1,194 @@
<?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 TimingController extends AdminController {
public function _initialize(){
}
public function caculateDeviceInfo() {
$start = 1569686400;
$end = time();
if (I('time')) {
$start = strtotime(I('time'));
$end = $start+1;
}
if (I('start')) {
$start = strtotime(I('start'));
}
ini_set('memory_limit','1024M');
// $device = D('DeviceRecord');
// echo 1;
for($startTime = $start;$startTime<$end;$startTime=$startTime+86400) {
echo date("Y-m-d",$startTime).' 安卓 ';
//当日新增设备
$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();
echo $data['new_device'].' ';
//当日活跃设备
$data['active_device'] = $this->active(['create_time'=>array('between',[$startTime,$startTime+86399]),'version'=>1]);
echo $data['active_device'].' ';
$data['time'] = $startTime;
$data['version'] = 1;
$data['today_new_device'] =json_encode($this->news_on_time(['create_time'=>['between',[$startTime,$startTime+86399]]],'news',5,'time,version','time',1));
// echo M('device_record','tab_')->_sql()."\n";
$data['today_active_device'] =json_encode($this->active_on_time(['create_time'=>['between',[$startTime,$startTime+86399]],'version'=>1],'active',5,'time,version'));
// echo M('device_record','tab_')->_sql()."\n";
$data['today_model_device'] = json_encode($this->model(['create_time'=>['between',[$startTime,$startTime+86399]],'version'=>1]));
$data['model'] = json_encode($this->modelDevice(['create_time'=>['between',[$startTime,$startTime+86399]],'version'=>1]));
$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;
$getStatistics = M('device_statistics','tab_')->where(['time'=>$startTime,'version'=>1])->find();
echo "\n";
if (!$getStatistics) {
M('device_statistics','tab_')->add($data);
} else {
M('device_statistics','tab_')->where(['time'=>$startTime,'version'=>1])->save($data);
}
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['active_device'] = $this->active(['create_time'=>array('between',[$startTime,$startTime+86399]),'version'=>2]);
echo $data['active_device'].' ';
$data['time'] = $startTime;
$data['version'] = 2;
echo 0;
$data['today_new_device'] =json_encode($this->news_on_time(['create_time'=>['between',[$startTime,$startTime+86399]]],'news',5,'time,version','time',2));
// echo M('device_record','tab_')->_sql();die();
echo 1;
$data['today_active_device'] =json_encode($this->active_on_time(['create_time'=>['between',[$startTime,$startTime+86399]],'version'=>2],'active',5,'time,version'));
echo 2;
$data['today_model_device'] = json_encode($this->model(['create_time'=>['between',[$startTime,$startTime+86399]],'version'=>2]));
echo 3;
$data['model'] = json_encode($this->modelDevice(['create_time'=>['between',[$startTime,$startTime+86399]],'version'=>2]));
// $duration = $this->duration(['create_time'=>array('between',[$startTime-86400*7,$startTime-1]),'version'=>2]);
// $data['duration7'] = ($duration/M('device_record','tab_')->table('(' . $newSql . ') as a')->where(['create_time'=>array('between',[$startTime-86400*7,$startTime-1])])->order('create_time')->count())/7;
$data['duration7'] = 0;
echo 4;
$getStatistics = M('device_statistics','tab_')->where(['time'=>$startTime,'version'=>2])->find();
echo "\n";
if (!$getStatistics) {
M('device_statistics','tab_')->add($data);
} else {
M('device_statistics','tab_')->where(['time'=>$startTime,'version'=>2])->save($data);
}
}
}
public function duration($map=array()) {
return M('device_record','tab_')->where($map)->sum('duration');
}
public function active($map=array()) {
$sql = M('device_record','tab_')->field('create_time,model,unique_code')->where($map)->select(false);
$sql = M('device_record','tab_')->table('(' . $sql . ') as a')->group('unique_code')->order('create_time')->select(false);
$sql = "select count(*) as count from ({$sql})t";
$count = M('device_record','tab_')->query($sql);
return $count[0]['count'];
}
public function news_on_time($map=array(),$field='news',$flag=1,$group='time',$order='time',$version = 1) {
switch($flag) {
case 2:{$dateform = '%Y-%m';};break;
case 3:{$dateform = '%Y-%u';};break;
case 4:{$dateform = '%Y';};break;
case 5:{$dateform = '%Y-%m-%d %H';};break;
default:$dateform = '%Y-%m-%d';
}
$sql = M('device_record','tab_')->field('min(create_time) as create_time,version,unique_code,id')->where(['version'=>$version])->group('unique_code')->select(false);
$news = M('device_record','tab_')->table('(' . $sql . ') as a')
->field('FROM_UNIXTIME(a.create_time, "'.$dateform.'") as '.$group.',group_concat(a.id) as id,group_concat(a.unique_code) as unique_code ,COUNT(a.unique_code) AS '.$field)
->where($map)->group($group)->order($order)->select();
// echo M('device_record','tab_')->_sql();die();
return $news;
}
public function active_on_time($map=array(),$field='active',$flag=1,$group='time',$order='time') {
switch($flag) {
case 2:{$dateform = '%Y-%m';};break;
case 3:{$dateform = '%Y-%u';};break;
case 4:{$dateform = '%Y';};break;
case 5:{$dateform = '%Y-%m-%d %H';};break;
default:$dateform = '%Y-%m-%d';
}
$sql = M('device_record','tab_')->field('create_time,version,unique_code,id')->where($map)->select(false);
$mid = M('device_record','tab_')->table('(' . $sql . ') as m')->group('unique_code')->select(false);
$active = M('device_record','tab_')->table('(' . $mid . ') as a')
->field('FROM_UNIXTIME(a.create_time, "'.$dateform.'") as '.$group.',group_concat(a.id) as id,group_concat(a.unique_code) as unique_code ,COUNT(a.unique_code) AS '.$field)
->group($group)->order($order)->select();
// echo $this->_sql();die();
return $active;
}
public function model($map=array()) {
$sql = M('device_record','tab_')->field('create_time,model,version,unique_code')->where($map)->select(false);
$mid = M('device_record','tab_')->table('(' .$sql. ') as m')->group('unique_code')->select(false);
return M('device_record','tab_')->table('(' .$mid. ') as a')->field('a.model,version,count(a.unique_code) as count')->group('model,version')->order('count desc')->select();
}
public function modelDevice($map=array()) {
$sql = M('device_record','tab_')->field('model,version,unique_code')->where($map)->select(false);
$mid = M('device_record','tab_')->table('(' .$sql. ') as m')->group('unique_code')->select();
return $mid;
}
}

@ -589,12 +589,9 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){
$this->assign('list', $list);
$this->meta_title = '角色数据';
$this->m_title = '角色查询';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/rolelist','status'=>1])->find());
$this->m_title = '角色查询';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'User/rolelist','status'=>1])->find());
$this->display();
}

@ -1 +1 @@
{"news":[{"time":"0:00","count":16},{"time":"1:00","count":11},{"time":"2:00","count":12},{"time":"3:00","count":8},{"time":"4:00","count":9},{"time":"5:00","count":5},{"time":"6:00","count":6},{"time":"7:00","count":15},{"time":"8:00","count":18},{"time":"9:00","count":28},{"time":"10:00","count":82},{"time":"11:00","count":77},{"time":"12:00","count":33},{"time":"13:00","count":36},{"time":"14:00","count":156},{"time":"15:00","count":136},{"time":"16:00","count":108},{"time":"17:00","count":71},{"time":"18:00","count":75},{"time":"19:00","count":99},{"time":"20:00","count":104},{"time":"21:00","count":82},{"time":"22:00","count":84},{"time":"23:00","count":45}],"sum":{"news":1316,"active":6633,"player":1359,"money":132537.03},"active":[{"time":"0:00","count":833},{"time":"1:00","count":294},{"time":"2:00","count":144},{"time":"3:00","count":101},{"time":"4:00","count":84},{"time":"5:00","count":150},{"time":"6:00","count":410},{"time":"7:00","count":590},{"time":"8:00","count":452},{"time":"9:00","count":438},{"time":"10:00","count":399},{"time":"11:00","count":299},{"time":"12:00","count":250},{"time":"13:00","count":174},{"time":"14:00","count":309},{"time":"15:00","count":269},{"time":"16:00","count":204},{"time":"17:00","count":174},{"time":"18:00","count":175},{"time":"19:00","count":222},{"time":"20:00","count":206},{"time":"21:00","count":161},{"time":"22:00","count":181},{"time":"23:00","count":114}],"player":[{"time":"0:00","count":174},{"time":"1:00","count":54},{"time":"2:00","count":34},{"time":"3:00","count":19},{"time":"4:00","count":17},{"time":"5:00","count":18},{"time":"6:00","count":31},{"time":"7:00","count":54},{"time":"8:00","count":54},{"time":"9:00","count":48},{"time":"10:00","count":53},{"time":"11:00","count":63},{"time":"12:00","count":45},{"time":"13:00","count":52},{"time":"14:00","count":40},{"time":"15:00","count":107},{"time":"16:00","count":90},{"time":"17:00","count":56},{"time":"18:00","count":47},{"time":"19:00","count":66},{"time":"20:00","count":62},{"time":"21:00","count":66},{"time":"22:00","count":66},{"time":"23:00","count":43}],"money":[{"time":"0:00","count":"21663.00"},{"time":"1:00","count":"3664.00"},{"time":"2:00","count":"2245.00"},{"time":"3:00","count":"734.00"},{"time":"4:00","count":"1526.00"},{"time":"5:00","count":"1506.00"},{"time":"6:00","count":"3141.00"},{"time":"7:00","count":"3900.00"},{"time":"8:00","count":"5225.00"},{"time":"9:00","count":"5350.02"},{"time":"10:00","count":"3657.00"},{"time":"11:00","count":"5008.00"},{"time":"12:00","count":"2899.00"},{"time":"13:00","count":"7167.00"},{"time":"14:00","count":"13457.00"},{"time":"15:00","count":"6680.00"},{"time":"16:00","count":"4772.00"},{"time":"17:00","count":"4365.01"},{"time":"18:00","count":"3683.00"},{"time":"19:00","count":"3187.00"},{"time":"20:00","count":"5599.00"},{"time":"21:00","count":"10597.00"},{"time":"22:00","count":"7201.00"},{"time":"23:00","count":"5311.00"}]}
{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":1},{"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":1},{"time":"10:00","count":0},{"time":"11:00","count":2},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":3},{"time":"15:00","count":1},{"time":"16:00","count":1},{"time":"17:00","count":1},{"time":"18:00","count":3},{"time":"19:00","count":0},{"time":"20:00","count":2},{"time":"21:00","count":0},{"time":"22:00","count":3},{"time":"23:00","count":2}],"sum":{"news":20,"active":43,"player":10,"money":50.059999999999995},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":2},{"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":2},{"time":"10:00","count":3},{"time":"11:00","count":7},{"time":"12:00","count":1},{"time":"13:00","count":1},{"time":"14:00","count":4},{"time":"15:00","count":1},{"time":"16:00","count":1},{"time":"17:00","count":3},{"time":"18:00","count":5},{"time":"19:00","count":0},{"time":"20:00","count":2},{"time":"21:00","count":1},{"time":"22:00","count":8},{"time":"23:00","count":2}],"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":1},{"time":"11:00","count":1},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":1},{"time":"15:00","count":3},{"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":1}],"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":"1.01"},{"time":"11:00","count":"9.00"},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":"0.01"},{"time":"15:00","count":"10.01"},{"time":"16:00","count":"11.02"},{"time":"17:00","count":"14.00"},{"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":"5.01"}]}

@ -46,10 +46,13 @@ class DeviceRecordModel extends Model{
* @author 鹿文学
*/
public function all_device() {
$list = $this->field('min(create_time) as create_time,unique_code')->group('unique_code')->select();
return count($list);
// $list = $this->field('unique_code')->group('unique_code')->count();
$sql = "SELECT count(1) as count from (select unique_code from tab_device_record group by unique_code)t;";
$list = $this->query($sql);
return $list[0]['count'];
}
@ -60,7 +63,7 @@ class DeviceRecordModel extends Model{
public function total_device($map=array(),$flag=0) {
if($flag) {
$list = $this->active($map);
$list = $this->active($map);
} else {
$list = $this->news($map);
}
@ -76,7 +79,7 @@ class DeviceRecordModel extends Model{
public function news($map=array()) {
$sql = $this->field('min(create_time) as create_time,model,unique_code,id')->group('unique_code')->select(false);
return $this->table('(' . $sql . ') as a')->where($map)->order('create_time')->select();
}
@ -89,7 +92,7 @@ class DeviceRecordModel extends Model{
* @author 鹿文学
*/
public function news_on_time($map=array(),$field='news',$flag=1,$group='time',$order='time') {
switch($flag) {
case 2:{$dateform = '%Y-%m';};break;
case 3:{$dateform = '%Y-%u';};break;
@ -97,13 +100,13 @@ class DeviceRecordModel extends Model{
case 5:{$dateform = '%Y-%m-%d %H';};break;
default:$dateform = '%Y-%m-%d';
}
$sql = $this->field('min(create_time) as create_time,version,unique_code,id')->group('unique_code')->select(false);
$news = $this->table('(' . $sql . ') as a')
->field('FROM_UNIXTIME(a.create_time, "'.$dateform.'") as '.$group.',group_concat(a.id) as id,group_concat(a.unique_code) as unique_code ,COUNT(a.unique_code) AS '.$field)
->where($map)->group($group)->order($order)->select();
return $news;
}
@ -145,7 +148,7 @@ class DeviceRecordModel extends Model{
$active = $this->table('(' . $mid . ') as a')
->field('FROM_UNIXTIME(a.create_time, "'.$dateform.'") as '.$group.',group_concat(a.id) as id,group_concat(a.unique_code) as unique_code ,COUNT(a.unique_code) AS '.$field)
->group($group)->order($order)->select();
// echo $this->_sql();die();
return $active;
}
@ -160,6 +163,7 @@ class DeviceRecordModel extends Model{
$mid = $this->table('(' .$sql. ') as m')->group('unique_code')->select(false);
// echo $this->_sql();die();
return $this->table('(' .$mid. ') as a')->field('a.model,version,count(a.unique_code) as count')->group('model,version')->order('count desc')->select();

@ -45,7 +45,7 @@
<li class="<eq name='num' value='4'>datapick_active</eq>"><a href="{:U('index',array('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('index',array('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('index',array('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('index',array('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('index',array('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>
@ -386,8 +386,32 @@
});
}
}
//执行日期的选择
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("index")}';
end = end?end:start;

@ -4,7 +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__/layer/layer.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<style>
.select2-container--default .select2-selection--single {
@ -479,24 +479,43 @@ $(function(){
function shenhe(status){
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get().join(',');
console.log(text);
$.ajax({
cache: true,
type: "POST",
url:"{:U('Member/lock_status')}",
data:{id:text, lock_status:status},// 你的formid
async: false,
error: function(data) {
layer.alert("服务器故障,请稍后重试!",{icon: 2});
},
success: function(data) {
// var obj = JSON.parse(data);
// layer.alert(obj.info,{icon:obj.status})
layer.alert(data.info,{icon:data.status})
window.location.reload()
return $(elem).val();
}).get().join(',');
var desc = '';
if (status == 0) {
desc = '锁定';
} else {
desc = '开启';
}
layer.prompt({
formType: 2,
value: text,
placeholder : '账户ID英文逗号隔开',
title: '请输入要'+desc+'的账户ID(英文逗号隔开)',
area: ['800px', '350px'] //自定义文本域宽高
}, function(value, index, elem){
if(value=='') {
layer.msg("请输入账户ID");
return;
}
$.ajax({
cache: true,
type: "POST",
url:"{:U('Member/lock_status')}",
data:{id:value, lock_status:status},// 你的formid
async: false,
error: function(data) {
layer.alert("服务器故障,请稍后重试!",{icon: 2});
},
success: function(data) {
// var obj = JSON.parse(data);
// layer.alert(obj.info,{icon:obj.status})
layer.alert(data.info,{icon:data.status})
window.location.reload()
}
});
layer.close(index);
});
}
</script>

@ -81,33 +81,33 @@
<div class="main_content_main m-channel-data main_content_platform" style="border-bottom:1px solid #ddd;margin-bottom:15px;padding:17px 0;">
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$today|default=0}</strong> <span class="s-c-title">今日新增设备</span>
<div class="col-md-2" onclick="gettotal(1,'#today');">
<strong class="s-c-orange" id = "today">加载中...</strong> <span class="s-c-title">今日新增设备</span>
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$yesterday|default=0}</strong> <span class="s-c-title">昨日新增设备</span>
<div class="col-md-2" onclick="gettotal(2,'#yesterday')">
<strong class="s-c-orange" id = "yesterday">加载中...</strong> <span class="s-c-title">昨日新增设备</span>
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$total|default=0}</strong> <span class="s-c-title">累计设备</span>
<div class="col-md-2" onclick="gettotal(0,'#total')">
<strong class="s-c-orange" id = "total">加载中...</strong> <span class="s-c-title">累计设备</span>
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$day7|default=0}</strong> <span class="s-c-title">近7日活跃设备</span>
<div class="col-md-2" onclick="gettotal(3,'#day7')">
<strong class="s-c-orange" id = "day7">加载中...</strong> <span class="s-c-title">近7日活跃设备</span>
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$day30|default=0}</strong> <span class="s-c-title">近30日活跃设备</span>
<div class="col-md-2" onclick="gettotal(4,'#day30')">
<strong class="s-c-orange"id = "day30">加载中...</strong> <span class="s-c-title">近30日活跃设备</span>
</div>
</div>
<div class="main_content_main_item">
<div class="col-md-2">
<strong class="s-c-orange">{$duration7|default='00:00:00'}</strong> <span class="s-c-title">近7日单设备日均使用时长</span>
<div class="col-md-2" onclick="gettotal(5,'#duration7')">
<strong class="s-c-orange" id = "duration7">加载中...</strong> <span class="s-c-title">近7日单设备日均使用时长</span>
</div>
</div>
@ -131,7 +131,7 @@
<li class="<eq name='num' value='4'>datapick_active</eq>"><a href="{:U('device_survey',array('tb'=>I('tb'),'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('device_survey',array('tb'=>I('tb'),'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('device_survey',array('tb'=>I('tb'),'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('device_survey',array('tb'=>I('tb'),'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('device_survey',array('tb'=>I('tb'),'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>
@ -457,7 +457,37 @@
<script src="__JS__/zwmjs/highcharts.js"></script>
<script>
var datelist;
function gettotal(types,ids) {
$(ids).text("加载中...");
$(ids).css('color','#FBA10D');
$.ajax({
type:'post',
dataType:'json',
url:'{:U("stat/getDevice")}',
data:{type:types},
success:function(data) {
$(ids).text(data)
},error:function() {
$(ids).text("加载失败");
$(ids).css('color','red');
layer.msg('服务器错误,请稍候再试');that.removeClass('disabled');
}
});
}
$(function() {
gettotal(0,'#total');
gettotal(1,'#today');
gettotal(2,'#yesterday');
gettotal(3,'#day7');
gettotal(4,'#day30');
gettotal(5,'#duration7');
$('.data-box').each(function() {
var that = $(this);
if (that.width()>that.find('.data-wrap').width()) {

@ -106,13 +106,13 @@
<table class="">
<thead>
<tr>
<th class="">查询时间</th>
<th class="">玩家账号</th>
<th class="">创角时间</th>
<th class="">玩家账号</th>
<th class="">游戏名称</th>
<th class="">游戏区服ID</th>
<th class="">游戏区服</th>
<th class="">角色ID</th>
<th class="">角色名</th>
<th class="">角色名</th>
<th class="">游戏等级</th>
<th class="">所属推广员</th>
<th class="">最后登录时间</th>

@ -16,6 +16,7 @@ use Think\Controller;
*/
class AddonsController extends Controller{
public function _initialize(){
/* 读取数据库中的配置 */
$config = S('DB_CONFIG_DATA');

@ -72,6 +72,12 @@ class DownloadController extends BaseController {
}
public function listsIndex($p = 0) {
$nowTime = date('Y-m-d');
$initBegTime = empty(I('begtime')) ? '' : I('begtime');
$initEndTime = $nowTime;
$initEndTime = empty(I('endtime')) ? '' : I('endtime');
$this->assign('begtime',$initBegTime);
$this->assign('endtime',$initEndTime);
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
$res = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
$childPromoteIds = '';
@ -114,9 +120,10 @@ class DownloadController extends BaseController {
$endtime = strtotime($_REQUEST['endtime']);
}
$map['addtime'] = array('BETWEEN',array(strtotime($_REQUEST['begtime']),$endtime));
}
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$page = intval(I('get.p', 1));
$page = $page ? $page : 1; //默认显示第一页数据arraypage
$row=10;
$rs = M('downloadlog','tab_')->where($map)->order('tab_downloadlog.addtime desc')
->page($page, $row)->select();
@ -142,11 +149,19 @@ class DownloadController extends BaseController {
//分页
$parameter['p'] = I('get.p', 1);
$parameter['row'] = I('get.row');
$parameter['dataname'] = $_REQUEST['dataname'];
$parameter['logid'] = $_REQUEST['logid'];
$parameter['begtime'] = I('begtime');
$parameter['endtime'] = I('endtime');
$parameter['level_promote_2'] = $levelPromote[0];
$parameter['level_promote_3'] = $levelPromote[1];
$parameter['level_promote_4'] = $levelPromote[2];
$page = set_pagination($count, $row, $parameter);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('data',$rs);
$this->assign('promoteNameArr',$promoteNameArr);
return $this->display();
}
@ -1710,7 +1725,6 @@ class DownloadController extends BaseController {
$this->orderlistExcelInfo($id,$map);
break;
default:
var_dump('ss');die();
break;
}

@ -24,7 +24,7 @@ class FinanceController extends BaseController
//权限过滤
private function purview()
{
$this->loginPromote = $this->getLoginPromote();
$this->getLoginPromote();
if ($this->loginPromote['level'] != 1) {
$this->error('权限异常');
}
@ -80,7 +80,7 @@ class FinanceController extends BaseController
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '结算明细';
$metaTitle = '结算中心';
$modelList = ['财务管理', $metaTitle];
$this->verifyPasswordView($modelList);

@ -151,7 +151,7 @@ class PromoteController extends BaseController
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')
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%')", 'left')
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp1.id=tp2.id", 'left')
->join("tab_user as u on tp2.id = u.promote_id", 'left')
->join(false)
->where($map)
@ -319,7 +319,7 @@ class PromoteController extends BaseController
$promote_map = "tp1.`id` = {$promote_id}";
$data = $spend->field('sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth')
->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') where $promote_map ) AS t ON promote_id = t.id")
->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp1.id = tp2.id where $promote_map ) AS t ON promote_id = t.id")
->where($condition)->table('(' . $spendData . ') as a')->group()->order('count desc,a.ordertime')->find();
$spendData1 = $spend->field('sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth')

@ -1,10 +1,35 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/manager.css" rel="stylesheet">
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.2" rel="stylesheet">
</block>
<block name="body">
<style>
@media screen and (max-width: 1500px) {
.normal_form {
padding-top: 45px;
}
.trunk-search .normal_txt {
width: 100px
}
.select2-container--default .select2-selection--single {
width: 125px;
}
.trunk-search .select-time .txt {
width: 100px;
}
.form-group .submit {
width: 55px;
}
}
.selected-color {
color: #2bd8ed;
}
@ -20,18 +45,22 @@
float: right;
right: 10px;
}
.current {
display: inline-block;
margin-right: 10px;
padding-left: 10px;
padding-right: 10px;
height: 34px;
border: 1px solid #E5E5E5;
color: red;
border-radius: 4px;
line-height: 34px;
text-align: center;
.th-hide {
display: none;
}
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.form-group .txt {
width: 180px;
height: 34px;
}
.chakan {
display: inline-block;
@ -47,40 +76,33 @@
}
</style>
</block>
<block name="body">
<div class="page-search normal_list query-register-search">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>下载管理></span><span>控制台</span></div>
</div>
<img src="__IMG__/20180207/icon_zhuce.png">
<span class="title_main">下载日志</span>
<span class="details">记录数据管理中导出数据事件</span>
</div>
<div class="page-search normal_list query-recharge-search jssearch">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>下载管理></span><span>控制台</span></div>
</div>
<img src="__IMG__/20180207/icon_zhuce.png">
<span class="title_main">下载日志</span>
<span class="details">记录数据管理中导出数据事件</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<form action="{:U('download/listsIndex')}" method="post" enctype="multipart/form-data">
<div class="tab normal_tab">
</div>
<!-- <form action="{:U('Finance/settlementDtl')}" method="get" enctype="multipart/form-data" class="normal_form"> -->
<div class="form-group fl">
<div class="form-group normal_space">
<input type="text" name="dataname" class="txt normal_txt" id="uid" placeholder="请输入数据名称"
value="{:I('dataname')}">
</div>
<div class="form-group fl" style='margin-left:10px'>
<div class="form-group normal_space" style='margin-left:10px'>
<input type="text" name="logid" class="txt normal_txt" id="lid" placeholder="输入日志编号"
value="{:I('logid')}">
</div>
<!-- <div class="form-group fl" style="margin-left:10px">
<select id="pid" name="pid" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="0">请选择推广员</option>
<volist name="promoteNameArr" id="vo">
<option value="{$vo.promote_id}" title="{$vo.name}">{$vo.name}</option>
</volist>
</select>
</div>-->
<input type="hidden" id="top-promote-id" value="{$loginer.id}">
<input type="hidden" id="top-promote-id" value="{$loginer.id}">
<if condition="$loginer.level elt 1">
<div class="form-group fl" style="margin-left:10px">
<select name="level_promote_2" class="level-promote reselect select_gallery" style="width: 220px;" data-level="2" data-val="{:I('level_promote_2', 0)}">
@ -103,81 +125,82 @@
</div>
</if>
<div class="form-group normal_space fl">
<label class="form-title select-title" style="position: relative;">申请时间:</label>
<div class="select-time">
<input type="text" id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{:I('begtime')}" autocomplete="off">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" id="edate" class="txt" name="endtime" placeholder="结束时间" value="{:I('endtime')}" autocomplete="off">
</div>
</div>
<div class="form-group normal_space fl">
<input type="submit" class="submit" id='submit' value="查询">
<div class="form-group normal_space">
<label class="form-title select-title" style="position: relative;">下载时间:</label>
<div class="select-time">
<input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{:I('begtime')}">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="结束时间" value="{:I('endtime')}">
</div>
</div>
</form>
<div class="form-group normal_space">
<input type="submit" class="submit" id='submit' url="{:U('download/listsindex','model='.$model['name'],false)}"
value="查询">
</div>
<!-- </form> -->
</div>
</div>
<div class="page-list query-register-list">
<div class="trunk-content article">
<div class="trunk-list list_normal" style="">
<table class="table normal_table">
<tr class="odd">
<th>ID</th>
<th>报表类型</th>
<th>操作人</th>
<th>申请时间</th>
<th>下载时间</th>
<th>状态</th>
</tr>
<empty name="data">
<tr class="num2">
<td colspan="8" style="text-align: center;height: 45vh;">
<img src="__IMG__/20180207/icon_wushujv2.png"/>
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</td>
</tr>
<else/>
<volist name="data" id="vo">
<tr class="num2">
<td>{$vo.logid}</td>
<td>{$vo.dataname}</td>
<td>{$vo.actor}</td>
<td>{$vo.addtime|date='Y-m-d H:i:s',###}</td>
<td>
<if condition="$vo['begintime'] neq 0">
{$vo.begintime|date='Y-m-d H:i:s',###}
<else />
暂无下载时间
</if>
<div class="page-list apply-app_apply-list query-recharge-list">
<div class="trunk-content article" style="margin-left: 0;margin-right: 0;">
<div class="tabcon trunk-list">
<table class="table normal_table">
<tr class="odd">
<th>ID</th>
<th>报表类型</th>
<th>操作人</th>
<th>申请时间</th>
<th>下载时间</th>
<th>状态</th>
</tr>
<empty name="data">
<tr class="num2">
<td colspan="8" style="text-align: center;height: 45vh;">
<img src="__IMG__/20180207/icon_wushujv2.png"/>
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</td>
<td>
<if condition="$vo['status'] eq 0">
<form action="{:U('download/export',array('conditions'=>$vo['conditions'],'id'=>$vo['id'],'dataname'=>$vo['dataname']))}" method="post" id="downloadForm">
<a style="cursor: pointer" onclick="reload()" target="_blank"
class="chakan"><span>可下载</span></a>
</form>
<else /> <a href="javascript:;" class="current"><span style="color:#9D9D9D">已下载</span></a>
</if>
</td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$_page}
</tr>
<else/>
<volist name="data" id="vo">
<tr class="num2">
<td>{$vo.logid}</td>
<td>{$vo.dataname}</td>
<td>{$vo.actor}</td>
<td>{$vo.addtime|date='Y-m-d H:i:s',###}</td>
<td>
<if condition="$vo['begintime'] neq 0">
{$vo.begintime|date='Y-m-d H:i:s',###}
<else />
暂无下载时间
</if>
</td>
<td>
<if condition="$vo['status'] eq 0">
<form action="{:U('download/export',array('conditions'=>$vo['conditions'],'id'=>$vo['id'],'dataname'=>$vo['dataname']))}" method="post" id="downloadForm">
<a style="cursor: pointer" onclick="reload()" target="_blank" class="chakan"><span>可下载</span></a>
</form>
<else /> <a href="javascript:;" class="current"><span style="color:#9D9D9D">已下载</span></a>
</if>
</td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
{$_page}
</div>
</div>
</div>
</div>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
@ -186,15 +209,21 @@
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript">
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
$().ready(function () {
setValue('team_leader_id', {$Think.request.team_leader_id |default = '""'});
setValue('promote_id', {$Think.request.promote_id |default = 0});
setValue('row', '{:I("get.row",10)}');
$("#pagehtml a").on("click", function (event) {
event.preventDefault();//使a自带的方法失效即无法调整到href中的URL(http://www.baidu.com)
var geturl = $(this).attr('href');
$('#data_form').attr('action', geturl);
$('#data_form').submit();
});
var date = "{$setdate}";
$('#sdate').datetimepicker({
format: 'yyyy-mm-dd',
@ -219,49 +248,40 @@
endDate: date
});
$('#own').on('click',function () {
var ownId = $('#own_id').val();
var checkBox = $(this).children('i');
$('#submit').click(function () {
var sdate = Date.parse($('#sdate').val()) / 1000;
var edate = Date.parse($('#edate').val()) / 1000;
if (ownId > 0) {
checkBox.removeClass('iconfangxingxuanzhongfill');
checkBox.removeClass('selected-color');
checkBox.addClass('iconfangxingweixuanzhong');
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间', {icon: 5});
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期', {icon: 5});
return false;
}
$('#own_id').val(0);
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
checkBox.removeClass('iconfangxingweixuanzhong');
checkBox.addClass('iconfangxingxuanzhongfill');
checkBox.addClass('selected-color');
$('#own_id').val({$pID});
url += '?' + query;
}
});
console.log(url)
window.location.href = url;
$("#pagehtml a").on("click", function (event) {
event.preventDefault();//使a自带的方法失效即无法调整到href中的URL(http://www.baidu.com)
var geturl = $(this).attr('href');
$('#data_form').attr('action', geturl);
$('#data_form').submit();
});
$(".select_gallery").select2();
$('.submit').click(function () {
var sdate = $('#sdate').val();
var edate = $('#edate').val();
if (Date.parse(sdate) > Date.parse(edate)) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
});
});
</script>
<script>
setValue('pid', {$Think.request.pid |default = '""'});
</script>
<script>
function reload() {
function reload() {
document.getElementById('downloadForm').submit()
setTimeout(function(){ window.location.reload(); }, 7000);
}

@ -79,10 +79,10 @@
<div class="page-search normal_list query-recharge-search jssearch">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>数据管理></span><span>数据汇总</span></div>
<div class="location-container">当前位置:<span>数据管理></span><span>{$meta_title}</span></div>
</div>
<img src="__IMG__/20180207/icon_chongzhi.png">
<span class="title_main">数据汇总</span>
<span class="title_main">{$meta_title}</span>
<span class="details">说明:默认展示旗下各子渠道的全部数据</span>
</div>
<div class="trunk-content article">

@ -19,7 +19,7 @@ class SsgController extends BaseController {
const CODE_ERROR = -97; //验证码错误
const RETURN_SUCCESS = 1;
const RETURN_FALSE = 2;
const signprice = 0.01; //充值金额
const signprice = 0.1; //充值金额
public function login()
@ -566,13 +566,12 @@ class SsgController extends BaseController {
$param['body'] = $price;
//$param['callback'] = "https://m.wmtxkj.com/mobile.php/Ssg/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}";
//$param['notifyurl'] = "https://m.wmtxkj.com/callback.php/Notify/notify/apitype/alipay";
if(stripos($_SERVER['HTTP_HOST'], '.wmtxkj.cn') || $_SERVER['HTTP_HOST']=='127.0.0.1' || stripos($_SERVER['HTTP_HOST'], '.free.idcfengye.com')){
$param['callback'] = "http://".$_SERVER['HTTP_HOST']."/mobile.php/Ssg/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}";
// $param['notifyurl'] = "http://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay";
$param['notifyurl'] = "http://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay";
}else{
$param['callback'] = "https://".$_SERVER['HTTP_HOST']."/mobile.php/Ssg/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}";
// $param['notifyurl'] = "https://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay";
$param['notifyurl'] = "https://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay";
}
$ali_pay = $this->alipay($param);
@ -604,7 +603,7 @@ class SsgController extends BaseController {
->setTable("supersign")
->setPayWay($param['payway'])
->setCallback($param['callback'])
// ->setNotifyUrl($param['notifyurl'])
->setNotifyUrl($param['notifyurl'])
->setGameName(get_game_name($param['game_id']))
->setServerId(0)
->setUserId($param['user_id'])

@ -429,7 +429,7 @@ ALTER TABLE `tab_user_play_info` ADD INDEX `search`(`promote_id`, `game_id`, `se
ALTER TABLE `tab_user_login_record` ADD INDEX `search`(`promote_id`, `game_id`, `server_id`, `login_time`);
ALTER TABLE `tab_spend` ADD INDEX `search`(`promote_id`, `game_id`, `server_id`, `pay_way`, `pay_status`, `pay_time`);
<<<<<<< HEAD
-- 添加登录日统计表
CREATE TABLE `tab_login_daily_record` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
@ -441,7 +441,6 @@ CREATE TABLE `tab_login_daily_record` (
KEY `search` (`promote_id`,`game_id`,`create_time`) USING BTREE,
KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=284597 DEFAULT CHARSET=utf8;
=======
--sdk
ALTER TABLE `tab_pay_info`
MODIFY COLUMN `order_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '平台订单ID' AFTER `game_id`,
@ -453,4 +452,57 @@ ADD COLUMN `extend` varchar(255) NOT NULL DEFAULT '' COMMENT 'cp订单ID' AFTER
ALTER TABLE `tab_promote`
CHANGE COLUMN `ver_status` `ver_status` INT(11) NULL DEFAULT '0' COMMENT '资质认证审核状态(1是审核成功2审核失败3未审核,4修改认证)' AFTER `child_game_permission`,
ADD COLUMN `anothpic` CHAR(254) NULL DEFAULT NULL AFTER `account_type`;
>>>>>>> 05bb9b4aa3ba712199e5489f684bc7a8cfeb59c8
--2019-11-19 chenzhi
CREATE TABLE `tab_index_chart` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键自增',
`date` int(11) NOT NULL DEFAULT '0' COMMENT '日期时间戳',
`new_user_hours` varchar(500) NOT NULL DEFAULT '' COMMENT '新增用户聚合',
`new_user_count` int(11) NOT NULL DEFAULT '0' COMMENT '单日新增总计',
`active_user_hours` varchar(500) NOT NULL DEFAULT '' COMMENT '活跃用户聚合',
`active_user_count` int(11) NOT NULL DEFAULT '0' COMMENT '单日活跃总计',
`active_user_list` longtext COMMENT '单日活跃用户的id序列',
`pay_user_hours` varchar(500) NOT NULL DEFAULT '' COMMENT '付费用户聚合',
`pay_user_count` int(11) NOT NULL DEFAULT '0' COMMENT '单日付费用户总计',
`pay_user_list` longtext COMMENT '单日付费用户的id序列',
`pay_money_hours` varchar(500) NOT NULL DEFAULT '' COMMENT '付费金额聚合',
`pay_money_count` decimal(10,2) DEFAULT '0.00' COMMENT '单日付费金额总计',
`promote_new_hours` varchar(500) NOT NULL DEFAULT '' COMMENT '小时新增渠道',
`promote_new_count` int(11) NOT NULL DEFAULT '0' COMMENT '新增合作渠道总计',
`all_count` varchar(500) NOT NULL DEFAULT '' COMMENT '累计的统计数据',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '统计日期',
PRIMARY KEY (`id`),
KEY `date` (`date`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='首页折线图静态数据';
-- 2019-11-20 zyx
DROP TABLE IF EXISTS `tab_device_statistics`;
CREATE TABLE `tab_device_statistics` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` int(11) NOT NULL DEFAULT 0 COMMENT '日期时间戳',
`new_device` int(11) NOT NULL DEFAULT 0 COMMENT '当日新增设备',
`active_device` int(11) NOT NULL DEFAULT 0 COMMENT '当日活跃设备',
`today_new_device` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL COMMENT '当日新增设备按小时划分的json字符串',
`today_active_device` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL COMMENT '当日活跃设备按小时划分的json字符串',
`today_model_device` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL COMMENT '当日启动机型(机型,系统,数量)',
`model` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL COMMENT '当日启动设备',
`version` int(11) NOT NULL DEFAULT 1 COMMENT '机型',
`duration7` int(255) NOT NULL DEFAULT 0 COMMENT '七天的平均使用时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `time`(`time`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 163 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE `platform`.`tab_device_record`
ADD INDEX `create_time`(`create_time`) USING BTREE,
ADD INDEX `unique_code`(`unique_code`) USING BTREE,
ADD INDEX `idx_unique_version`(`version`, `unique_code`) USING BTREE,
ADD INDEX `version`(`version`) USING BTREE;
UPDATE `platform_new`.`tab_quick_menu` SET `url` = '/index.php?s=/Home/TestResource/index.html' WHERE `id` = 11
UPDATE `platform_new`.`tab_quick_menu` SET `url` = '/index.php?s=/Home/TestResource/lists.html' WHERE `id` = 12
--
ALTER TABLE `tab_withdraw`
ADD INDEX `widthdraw_number`(`widthdraw_number`);

@ -13,8 +13,8 @@
docEl.style.fontSize = Math.max(Math.min(20 * (clientWidth / 1536), 22.5), 17.5) * 5 + 'px';
}else{
/* 8.55小于320px不再缩小11.2大于420px不再放大 */
docEl.style.fontSize = Math.max(Math.min(20 * (clientWidth / docWidth), 11.2), 8.55) * 5 + 'px';
/* 8.55小于320px不再缩小11.2大于420px不再放大 17.2 大于667不再放大*/
docEl.style.fontSize = Math.max(Math.min(20 * (clientWidth / docWidth), 17.2), 8.55) * 5 + 'px';
}
return refreshRem;
})();

@ -0,0 +1,2 @@
/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */
;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window);

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

@ -0,0 +1,2 @@
/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */
;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window);

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

Loading…
Cancel
Save