人人商城

summary.ctrl.php 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. $acid = intval($_GPC['acid']);
  8. $uniacid = intval($_GPC['uniacid']);
  9. $account = account_fetch($acid);
  10. if(empty($account)) {
  11. message('公众号不存在或已被删除', '', 'error');
  12. }
  13. $_W['page']['title'] = $account['name'] . ' - 公众号详细信息';
  14. $starttime = $_GPC['datelimit']['start'] ? strtotime($_GPC['datelimit']['start']) : strtotime('-7day');
  15. $endtime = $_GPC['datelimit']['end'] ? strtotime($_GPC['datelimit']['end']) : strtotime(date('Ymd'));
  16. $yesterday = date('Ymd', strtotime('-1 days'));
  17. $today = date('Ymd');
  18. $type = intval($_GPC['type']) ? intval($_GPC['type']) : 1;
  19. if($_W['isajax']) {
  20. $days = array();
  21. $datasets = array();
  22. $starttime = $_GPC['starttime'] ? date('Ymd', $_GPC['starttime']) : date('Ymd', strtotime('-7day'));
  23. $endtime = $_GPC['endtime'] ? date('Ymd', $_GPC['endtime']) : date('Ymd');
  24. $starttime = $starttime == $endtime ? date('Ymd', strtotime('-1 day', strtotime($starttime))): $starttime;
  25. $stat = pdo_fetchall("SELECT * FROM ".tablename('stat_fans')." WHERE date >= '$starttime' AND date <= '$endtime' AND uniacid = '{$_W['uniacid']}' ORDER BY date ASC", array(), 'date');
  26. for ($i = strtotime($starttime); $i <= strtotime($endtime); $i+=86400) {
  27. $day = date('Ymd', $i);
  28. if ($day == $today) {
  29. $stat[$day]['cumulate'] = intval($stat[$day]['cumulate']) + intval($stat[$yesterday]['cumulate']);
  30. }
  31. $shuju['label'][] = date('m-d', strtotime($day));
  32. $shuju['datasets']['new'][] = intval($stat[$day]['new']);
  33. $shuju['datasets']['cancel'][] = intval($stat[$day]['cancel']);
  34. $shuju['datasets']['increase'][] = intval($stat[$day]['new']) - intval($stat[$day]['cancel']);
  35. $shuju['datasets']['cumulate'][] = intval($stat[$day]['cumulate']);
  36. }
  37. exit(json_encode($shuju));
  38. }
  39. $scroll = intval($_GPC['scroll']);
  40. $yesterday_stat = pdo_get('stat_fans', array('date' => $yesterday, 'uniacid' => $_W['uniacid']));
  41. $today_stat = pdo_get('stat_fans', array('date' => date('Ymd'), 'uniacid' => $_W['uniacid']));
  42. $today_stat['cumulate'] = intval($yesterday_stat['cumulate']) + intval($today_stat['new']) - intval($today_stat['cancel']);
  43. if($today_stat['cumulate'] < 0) {
  44. $today_stat['cumulate'] = 0;
  45. }
  46. template('account/summary');