后台中的会员统计数据,在首页中使用ECHARS图表展示,该如何修改class.php中文件。

146次浏览 更新日期:2025-04-04 20:57:57 分类:程序交流 评论:1

/ * 会员统计

*/

public function member_count(){ 

$data1 = D('member')->total();

$data2 = D('member')->where(array('status'=>1))->total();

$data3 = D('member')->where(array('status'=>2))->total();

$data4 = D('member')->where(array('vip'=>1))->total();

$data5 = D('member')->where(array('lastdate>'=>strtotime(date('Y-m-d', strtotime('-1 week')))))->total();

$data6 = D('member')->where(array('email_status'=>1))->total();

//近一周统计开始时间

$starttime = strtotime(date('Y-m-d'))-7*24*3600;

//近一周统计结束时间

$endtime = strtotime(date('Y-m-d'));

$where = "regdate > $starttime";  //无需加结束条件,否则统计不到今日数据

$data = D('member')->field("COUNT(*) AS num,FROM_UNIXTIME(regdate, '%m/%d') AS gap")->where($where)->group('gap')->select();

$arr = array();

foreach ($data as $val){

$arr[$val['gap']] = intval($val['num']);

}

$result1 = array();

for($i=$starttime; $i<=$endtime; $i = $i+24*3600){

$num = isset($arr[date('m/d',$i)]) ? $arr[date('m/d',$i)] : 0;

$result1['day'][] = date('m/d',$i);

$result1['num'][] = $num;

}

$result1 = json_encode($result1);

// 会员组人员统计

$result2 = array();

foreach(get_groupinfo() as $val){

$result2[] = array(

'name' => $val['name'],

'value' => D('member')->where(array('groupid'=>$val['groupid']))->total()

);

}

$result2 = json_encode($result2);

include template('index', $template);

}

以上内容需要在首页中读取显示数据里该如何修改,谢谢


后台中的会员统计数据,在首页中使用ECHARS图表展示,该如何修改class.php中文件。

这个首页里的该如何写???


我来说两句
  • sxsmlj
    sxsmlj 3天前
    有知道的指点下,谢谢
    0
    回复
作者信息
发布见解
发内容 回顶部