优化首页折线

master
chenzhi 4 years ago
parent d08691c13a
commit 3fdc14120f

@ -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);
}

@ -117,6 +117,7 @@ return array(
/*分库的表格*/
'SUBSITE_TABLE'=>[
"tab_spend",
"sys_auth_group"
"sys_auth_group",
"tab_index_chart"
]
);

@ -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;

@ -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 = [];

Loading…
Cancel
Save