diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index 7719c610f..48d585020 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -1060,7 +1060,7 @@ function showNumPercent($num) //优化子站点实例化方法 function SM($name='', $tablePrefix='tab_') { - $tableName = strtolower($tablePrefix.$name); + $tableName = strtolower($tablePrefix.unCamelize($name)); if(is_subsiteTable($tableName)){ return M($name, $tablePrefix,SUBSITE_DB); } diff --git a/Application/Admin/Conf/config.php b/Application/Admin/Conf/config.php index 4a5cdab53..e90a461e2 100644 --- a/Application/Admin/Conf/config.php +++ b/Application/Admin/Conf/config.php @@ -117,6 +117,7 @@ return array( /*分库的表格*/ 'SUBSITE_TABLE'=>[ "tab_spend", - "sys_auth_group" + "sys_auth_group", + "tab_index_chart" ] ); \ No newline at end of file diff --git a/Application/Admin/Controller/IndexChartSetController.class.php b/Application/Admin/Controller/IndexChartSetController.class.php index d5582be59..fa437b3e0 100644 --- a/Application/Admin/Controller/IndexChartSetController.class.php +++ b/Application/Admin/Controller/IndexChartSetController.class.php @@ -33,9 +33,9 @@ class IndexChartSetController extends AdminController { //初始化 $this->UserModel =M("User","tab_"); - $this->ChartModel =M("IndexChart","tab_"); + $this->ChartModel =SM("IndexChart","tab_"); $this->LoginModel =M("user_login_record","tab_"); - $this->SpendModel =M("spend","tab_"); + $this->SpendModel =SM("spend","tab_"); $this->PromoteModel =M("promote","tab_"); $this->nowdata =time(); if(I("reset")) $this->reset = true; diff --git a/Application/Admin/Controller/IndexController.class.php b/Application/Admin/Controller/IndexController.class.php index 8a47b995f..d15cd55f1 100644 --- a/Application/Admin/Controller/IndexController.class.php +++ b/Application/Admin/Controller/IndexController.class.php @@ -49,7 +49,7 @@ class IndexController extends AdminController { $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 = SM("IndexChart","tab_")->field("all_count")->order("date desc")->find(); $allcount = json_decode($allcount['all_count'],true); $this->assign('user_count',$allcount['user_count']); @@ -223,7 +223,7 @@ class IndexController extends AdminController { $data['date'] = [$start]; $data['hours'] = 1; $tm = strtotime($start); - $dbdata = M("IndexChart","tab_")->field("new_user_count,new_user_hours,active_user_count,active_user_hours,pay_user_count,pay_user_hours,pay_money_count,pay_money_hours,promote_new_count")->where("`date` = '{$tm}'")->find(); + $dbdata = SM("IndexChart","tab_")->field("new_user_count,new_user_hours,active_user_count,active_user_hours,pay_user_count,pay_user_hours,pay_money_count,pay_money_hours,promote_new_count")->where("`date` = '{$tm}'")->find(); $data['news'] = json_decode($dbdata["new_user_hours"],true); $data['active'] = json_decode($dbdata["active_user_hours"],true); $data['player']=json_decode($dbdata["pay_user_hours"],true); @@ -231,7 +231,7 @@ class IndexController extends AdminController { //获取昨天 $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(); + $ydbdata = SM("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']); @@ -260,7 +260,7 @@ class IndexController extends AdminController { $count1 = array(); $active_user_list = []; $pay_user_list = []; - $dbdata = M("IndexChart","tab_")->field("FROM_UNIXTIME(`date`, '%Y-%m-%d') as time,new_user_count,active_user_count,active_user_list,pay_user_count,pay_user_list,pay_money_count,promote_new_count") + $dbdata = SM("IndexChart","tab_")->field("FROM_UNIXTIME(`date`, '%Y-%m-%d') as time,new_user_count,active_user_count,active_user_list,pay_user_count,pay_user_list,pay_money_count,promote_new_count") ->where($map) ->group("time") ->select(); @@ -330,7 +330,7 @@ class IndexController extends AdminController { $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") + $ydbdata = SM("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 = [];