diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 93520cd73..1d6b3fb72 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -1044,6 +1044,11 @@ function get_promote_coin($promote_id){ $promote = M('promote','tab_')->field('balance_coin')->find($promote_id); return $promote['balance_coin']; } +function intFun($v) + { + $v=(int)$v; + return $v; + } /** * 获取渠道父类 diff --git a/Application/Admin/Controller/IndexChartSetController.class.php b/Application/Admin/Controller/IndexChartSetController.class.php index 691eff18f..c87426ea4 100644 --- a/Application/Admin/Controller/IndexChartSetController.class.php +++ b/Application/Admin/Controller/IndexChartSetController.class.php @@ -132,7 +132,7 @@ class IndexChartSetController extends AdminController { foreach($hoursnews as $h) { $user_hours[$h['time']] = (integer)$h['news']; } - $this->adddata["new_user_hours"] = serialize($user_hours); + $this->adddata["new_user_hours"] = json_encode($user_hours); unset($user_hours); //获取当日所有的注册用户 $userList = $this->UserModel->field('count(1) count') @@ -159,7 +159,7 @@ class IndexChartSetController extends AdminController { foreach($hoursnews as $h) { $user_hours[$h['time']] = (integer)$h['active']; } - $this->adddata["active_user_hours"] = serialize($user_hours); + $this->adddata["active_user_hours"] = json_encode($user_hours); unset($user_hours); //获取活跃用户列表 $activeCount = $this->LoginModel->field('user_id') @@ -168,7 +168,7 @@ class IndexChartSetController extends AdminController { ->select(); $this->adddata["active_user_count"] = count($activeCount); - $this->adddata["active_user_list"] = serialize(array_column($activeCount,'user_id')); + $this->adddata["active_user_list"] =json_encode(array_map("intFun",array_column($activeCount,'user_id'))); unset($activeCount); } /** @@ -189,7 +189,7 @@ class IndexChartSetController extends AdminController { foreach($hoursnews as $h) { $user_hours[$h['time']] = (integer)$h['payuser']; } - $this->adddata["pay_user_hours"] = serialize($user_hours); + $this->adddata["pay_user_hours"] = json_encode($user_hours); unset($user_hours); $activeCount = $this->SpendModel->field('user_id') ->where($map) @@ -197,7 +197,7 @@ class IndexChartSetController extends AdminController { ->select(); $this->adddata["pay_user_count"] = count($activeCount); - $this->adddata["pay_user_list"] = serialize(array_column($activeCount,'user_id')); + $this->adddata["pay_user_list"] = json_encode(array_map("intFun",array_column($activeCount,'user_id'))); unset($activeCount); } /** @@ -220,7 +220,7 @@ class IndexChartSetController extends AdminController { foreach($hoursnews as $h) { $user_hours[$h['time']] = (integer)$h['money']; } - $this->adddata["pay_money_hours"] = serialize($user_hours); + $this->adddata["pay_money_hours"] = json_encode($user_hours); unset($user_hours); $activeCount = $this->SpendModel->field('sum(pay_amount) AS money') @@ -248,7 +248,7 @@ class IndexChartSetController extends AdminController { foreach($hoursnews as $h) { $user_hours[$h['time']] = (integer)$h['news']; } - $this->adddata["promote_new_hours"] = serialize($user_hours);//promote_new_hours + $this->adddata["promote_new_hours"] = json_encode($user_hours);//promote_new_hours unset($user_hours); $activeCount = $this->PromoteModel->field('COUNT(1) AS news') @@ -274,7 +274,7 @@ class IndexChartSetController extends AdminController { $allcount['player_count'] =$spend->player(); $allcount['money_sum'] =$spend->totalAmount(); $allcount['promote_sum'] =$promote->total(); - $this->adddata["all_count"] = serialize($allcount); + $this->adddata["all_count"] = json_encode($allcount); } public function createDb() { @@ -282,5 +282,5 @@ class IndexChartSetController extends AdminController { $this->adddata['create_time']=$this->nowdata; $this->ChartModel->add($this->adddata); } - + } diff --git a/Application/Admin/Controller/IndexController.class.php b/Application/Admin/Controller/IndexController.class.php index 1cbe5477d..f779e3c5f 100644 --- a/Application/Admin/Controller/IndexController.class.php +++ b/Application/Admin/Controller/IndexController.class.php @@ -50,7 +50,7 @@ class IndexController extends AdminController { } $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']); + $allcount = json_decode($allcount['all_count'],true); $this->assign('user_count',$allcount['user_count']); $this->assign('active_count', $allcount['active_count']); @@ -224,10 +224,10 @@ class IndexController extends AdminController { $data['hours'] = 1; $tm = strtotime($start); $dbdata = M("IndexChart","tab_")->field("new_user_count,new_user_hours,active_user_count,active_user_hours,pay_user_count,pay_user_hours,pay_money_count,pay_money_hours,promote_new_count")->where("`date` = '{$tm}'")->find(); - $data['news'] = 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"]); + $data['news'] = json_decode($dbdata["new_user_hours"],true); + $data['active'] = json_decode($dbdata["active_user_hours"],true); + $data['player']=json_decode($dbdata["pay_user_hours"],true); + $data['money']=json_decode($dbdata["pay_money_hours"],true); //获取昨天 $ytm = $starttime-86400; @@ -268,10 +268,10 @@ class IndexController extends AdminController { $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']); + $active_user_list += json_decode($v['active_user_list'],true); unset($v['active_user_list']); unset($dbdata[$k]['active_user_list']); - $pay_user_list += unserialize($v['pay_user_list']); + $pay_user_list += json_decode($v['pay_user_list'],true); unset($v['pay_user_list']); unset($dbdata[$k]['pay_user_list']); $count1['new_user_count'] += $v['new_user_count']; @@ -318,10 +318,10 @@ class IndexController extends AdminController { $pay_user_list = []; $count2 = array(); foreach($ydbdata as $k => $v) { - $active_user_list += unserialize($v['active_user_list']); + $active_user_list += json_decode($v['active_user_list'],true); unset($v['active_user_list']); unset($ydbdata[$k]['active_user_list']); - $pay_user_list += unserialize($v['pay_user_list']); + $pay_user_list += json_decode($v['pay_user_list'],true); unset($v['pay_user_list']); unset($ydbdata[$k]['pay_user_list']); $count2['new_user_count'] += $v['new_user_count'];