• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getSystemWeekArr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getSystemWeekArr函数的典型用法代码示例。如果您正苦于以下问题:PHP getSystemWeekArr函数的具体用法?PHP getSystemWeekArr怎么用?PHP getSystemWeekArr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getSystemWeekArr函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: refundOp

 /**
  * 退款统计
  */
 public function refundOp()
 {
     $where = array();
     if (!$this->search_arr['search_type']) {
         $this->search_arr['search_type'] = 'day';
     }
     $model = Model('stat');
     //获得搜索的开始时间和结束时间
     $searchtime_arr = $model->getStarttimeAndEndtime($this->search_arr);
     $field = ' SUM(refund_amount) as amount ';
     if ($this->search_arr['search_type'] == 'day') {
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             $stat_arr['xAxis']['categories'][] = "{$i}";
             $statlist[$i] = 0;
         }
         $field .= ' ,HOUR(FROM_UNIXTIME(add_time)) as timeval ';
     }
     if ($this->search_arr['search_type'] == 'week') {
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             $tmp_weekarr = getSystemWeekArr();
             //横轴
             $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
             unset($tmp_weekarr);
             $statlist[$i] = 0;
         }
         $field .= ' ,WEEKDAY(FROM_UNIXTIME(add_time))+1 as timeval ';
     }
     if ($this->search_arr['search_type'] == 'month') {
         //计算横轴的最大量(由于每个月的天数不同)
         $dayofmonth = date('t', $searchtime_arr[0]);
         //构造横轴数据
         for ($i = 1; $i <= $dayofmonth; $i++) {
             //横轴
             $stat_arr['xAxis']['categories'][] = $i;
             $statlist[$i] = 0;
         }
         $field .= ' ,day(FROM_UNIXTIME(add_time)) as timeval ';
     }
     $where = array();
     $where['add_time'] = array('between', $searchtime_arr);
     $statlist_tmp = $model->statByRefundreturn($where, $field, 0, 0, 'timeval asc', 'timeval');
     if ($statlist_tmp) {
         foreach ((array) $statlist_tmp as $k => $v) {
             $statlist[$v['timeval']] = floatval($v['amount']);
         }
     }
     //得到统计图数据
     $stat_arr['legend']['enabled'] = false;
     $stat_arr['series'][0]['name'] = '退款金额';
     $stat_arr['series'][0]['data'] = array_values($statlist);
     $stat_arr['title'] = '退款金额统计';
     $stat_arr['yAxis'] = '金额';
     $stat_json = getStatData_LineLabels($stat_arr);
     Tpl::output('stat_json', $stat_json);
     Tpl::output('searchtime', implode('|', $searchtime_arr));
     Tpl::output('top_link', $this->sublink($this->links, 'refund'));
     Tpl::showpage('stat.aftersale.refund');
 }
开发者ID:noikiy,项目名称:shopnc-minion,代码行数:63,代码来源:stat_aftersale.php


示例2: storeflowOp

 /**
  * 店铺流量统计
  */
 public function storeflowOp()
 {
     $store_id = intval($_SESSION['store_id']);
     //确定统计分表名称
     $last_num = $store_id % 10;
     //获取店铺ID的末位数字
     $tablenum = ($t = intval(C('flowstat_tablenum'))) > 1 ? $t : 1;
     //处理流量统计记录表数量
     $flow_tablename = ($t = $last_num % $tablenum) > 0 ? "flowstat_{$t}" : 'flowstat';
     if (!$this->search_arr['search_type']) {
         $this->search_arr['search_type'] = 'week';
     }
     $model = Model('stat');
     //获得搜索的开始时间和结束时间
     $searchtime_arr = $model->getStarttimeAndEndtime($this->search_arr);
     $where = array();
     $where['store_id'] = $store_id;
     $where['stattime'] = array('between', $searchtime_arr);
     $where['type'] = 'sum';
     $field = ' SUM(clicknum) as amount';
     if ($this->search_arr['search_type'] == 'week') {
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             $tmp_weekarr = getSystemWeekArr();
             //横轴
             $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
             unset($tmp_weekarr);
             $statlist[$i] = 0;
         }
         $field .= ' ,WEEKDAY(FROM_UNIXTIME(stattime))+1 as timeval ';
     }
     if ($this->search_arr['search_type'] == 'month') {
         //计算横轴的最大量(由于每个月的天数不同)
         $dayofmonth = date('t', $searchtime_arr[0]);
         //构造横轴数据
         for ($i = 1; $i <= $dayofmonth; $i++) {
             //横轴
             $stat_arr['xAxis']['categories'][] = $i;
             $statlist[$i] = 0;
         }
         $field .= ' ,day(FROM_UNIXTIME(stattime)) as timeval ';
     }
     $statlist_tmp = $model->statByFlowstat($flow_tablename, $where, $field, 0, 0, 'timeval asc', 'timeval');
     if ($statlist_tmp) {
         foreach ((array) $statlist_tmp as $k => $v) {
             $statlist[$v['timeval']] = floatval($v['amount']);
         }
     }
     //得到统计图数据
     $stat_arr['legend']['enabled'] = false;
     $stat_arr['series'][0]['name'] = '访问量';
     $stat_arr['series'][0]['data'] = array_values($statlist);
     $stat_arr['title'] = '店铺访问量统计';
     $stat_arr['yAxis'] = '访问次数';
     $stat_json = getStatData_LineLabels($stat_arr);
     Tpl::output('stat_json', $stat_json);
     self::profile_menu('storeflow');
     Tpl::showpage('stat.flow.store');
 }
开发者ID:mengtaolin,项目名称:shopping,代码行数:62,代码来源:statistics_flow.php


示例3: promotiontrendOp

 /**
  * 促销销售趋势分析
  */
 public function promotiontrendOp()
 {
     //优惠类型数组
     $goodstype_arr = array(2 => '团购', 3 => '限时折扣', 4 => '优惠套装');
     $model = Model('stat');
     $where = array();
     $searchtime_arr = explode('|', $_GET['t']);
     $where['add_time'] = array('between', $searchtime_arr);
     //$where['order_state'] = array(array('neq',ORDER_STATE_CANCEL),array('neq',ORDER_STATE_NEW),'and');
     $where['order_state'] = array('neq', ORDER_STATE_NEW);
     //去除未支付订单
     $where['refund_state'] = array('exp', "!(order_state = '" . ORDER_STATE_CANCEL . "' and refund_state = 0)");
     //没有参与退款的取消订单,不记录到统计中
     $where['payment_code'] = array('exp', "!(order.payment_code='offline' and order_state <> '" . ORDER_STATE_SUCCESS . "')");
     //货到付款订单,订单成功之后才计入统计
     $where['goods_type'] = array('in', array(2, 3, 4));
     $field = ' goods_type';
     switch ($this->search_arr['stattype']) {
         case 'orderamount':
             $field .= " ,SUM(goods_pay_price) as orderamount";
             $caption = '下单金额';
             break;
         case 'goodsnum':
             $field .= " ,SUM(goods_num) as goodsnum";
             $caption = '下单商品数';
             break;
         default:
             $field .= " ,count(DISTINCT order.order_id) as ordernum";
             $caption = '下单量';
             break;
     }
     if ($this->search_arr['search_type'] == 'day') {
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             //横轴
             $stat_arr['xAxis']['categories'][] = "{$i}";
             foreach ($goodstype_arr as $k => $v) {
                 $statlist[$k][$i] = 0;
             }
         }
         $field .= ' ,HOUR(FROM_UNIXTIME(add_time)) as timeval ';
     }
     if ($this->search_arr['search_type'] == 'week') {
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             $tmp_weekarr = getSystemWeekArr();
             //横轴
             $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
             unset($tmp_weekarr);
             foreach ($goodstype_arr as $k => $v) {
                 $statlist[$k][$i] = 0;
             }
         }
         $field .= ' ,WEEKDAY(FROM_UNIXTIME(add_time))+1 as timeval ';
     }
     if ($this->search_arr['search_type'] == 'month') {
         //计算横轴的最大量(由于每个月的天数不同)
         $dayofmonth = date('t', $searchtime_arr[0]);
         //构造横轴数据
         for ($i = 1; $i <= $dayofmonth; $i++) {
             //横轴
             $stat_arr['xAxis']['categories'][] = $i;
             foreach ($goodstype_arr as $k => $v) {
                 $statlist[$k][$i] = 0;
             }
         }
         $field .= ' ,day(FROM_UNIXTIME(add_time)) as timeval ';
     }
     //查询数据
     $statlist_tmp = $model->statByOrderGoods($where, $field, 0, '', 'timeval', 'goods_type,timeval');
     //整理统计数组
     if ($statlist_tmp) {
         foreach ($statlist_tmp as $k => $v) {
             //将数据按照不同的促销方式分组
             foreach ($goodstype_arr as $t_k => $t_v) {
                 if ($t_k == $v['goods_type']) {
                     switch ($this->search_arr['stattype']) {
                         case 'orderamount':
                             $statlist[$t_k][$v['timeval']] = round($v[$this->search_arr['stattype']], 2);
                             break;
                         case 'goodsnum':
                             $statlist[$t_k][$v['timeval']] = intval($v[$this->search_arr['stattype']]);
                             break;
                         default:
                             $statlist[$t_k][$v['timeval']] = intval($v[$this->search_arr['stattype']]);
                             break;
                     }
                 }
             }
         }
     }
     foreach ($goodstype_arr as $k => $v) {
         $tmp = array();
         $tmp['name'] = $v;
         $tmp['data'] = array_values($statlist[$k]);
         $stat_arr['series'][] = $tmp;
     }
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:haifenbao,代码行数:101,代码来源:stat_marketing.php


示例4: newmemberOp

 /**
  * 新增会员
  */
 public function newmemberOp()
 {
     if (!$this->search_arr['search_type']) {
         $this->search_arr['search_type'] = 'day';
     }
     $model = Model('stat');
     $statlist = array();
     //统计数据列表
     //新增总数数组
     $count_arr = array('up' => 0, 'curr' => 0);
     $where = array();
     $field = ' count(*) as allnum ';
     if ($this->search_arr['search_type'] == 'day') {
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             //统计图数据
             $curr_arr[$i] = 0;
             //今天
             $up_arr[$i] = 0;
             //昨天
             //统计表数据
             $currlist_arr[$i]['timetext'] = $i;
             //方便搜索会员列表,计算开始时间和结束时间
             $currlist_arr[$i]['stime'] = $this->search_arr['day']['search_time'] + $i * 3600;
             $currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 3600;
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             //横轴
             $stat_arr['xAxis']['categories'][] = "{$i}";
         }
         $stime = $this->search_arr['day']['search_time'] - 86400;
         //昨天0点
         $etime = $this->search_arr['day']['search_time'] + 86400 - 1;
         //今天24点
         //总计的查询时间
         $count_arr['seartime'] = $stime + 86400 . '|' . $etime;
         $today_day = @date('d', $this->search_arr['day']['search_time']);
         //今天日期
         $yesterday_day = @date('d', $stime);
         //昨天日期
         $where['member_time'] = array('between', array($stime, $etime));
         $field .= ' ,DAY(FROM_UNIXTIME(member_time)) as dayval,HOUR(FROM_UNIXTIME(member_time)) as hourval ';
         $memberlist = $model->statByMember($where, $field, 0, '', 'DAY(FROM_UNIXTIME(member_time)),HOUR(FROM_UNIXTIME(member_time))');
         if ($memberlist) {
             foreach ($memberlist as $k => $v) {
                 if ($today_day == $v['dayval']) {
                     $curr_arr[$v['hourval']] = intval($v['allnum']);
                     $currlist_arr[$v['hourval']]['val'] = intval($v['allnum']);
                     $count_arr['curr'] += intval($v['allnum']);
                 }
                 if ($yesterday_day == $v['dayval']) {
                     $up_arr[$v['hourval']] = intval($v['allnum']);
                     $uplist_arr[$v['hourval']]['val'] = intval($v['allnum']);
                     $count_arr['up'] += intval($v['allnum']);
                 }
             }
         }
         $stat_arr['series'][0]['name'] = '昨天';
         $stat_arr['series'][0]['data'] = array_values($up_arr);
         $stat_arr['series'][1]['name'] = '今天';
         $stat_arr['series'][1]['data'] = array_values($curr_arr);
         //统计数据标题
         $statlist['headertitle'] = array('小时', '昨天', '今天', '同比');
         Tpl::output('actionurl', 'index.php?act=stat_member&op=newmember&search_type=day&search_time=' . date('Y-m-d', $this->search_arr['day']['search_time']));
     }
     if ($this->search_arr['search_type'] == 'week') {
         $current_weekarr = explode('|', $this->search_arr['week']['current_week']);
         $stime = strtotime($current_weekarr[0]) - 86400 * 7;
         $etime = strtotime($current_weekarr[1]) + 86400 - 1;
         //总计的查询时间
         $count_arr['seartime'] = $stime + 86400 * 7 . '|' . $etime;
         $up_week = @date('W', $stime);
         //上周
         $curr_week = @date('W', $etime);
         //本周
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             //统计图数据
             $up_arr[$i] = 0;
             $curr_arr[$i] = 0;
             $tmp_weekarr = getSystemWeekArr();
             //统计表数据
             $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
             //方便搜索会员列表,计算开始时间和结束时间
             $currlist_arr[$i]['stime'] = strtotime($current_weekarr[0]) + ($i - 1) * 86400;
             $currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 86400 - 1;
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             //横轴
             $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
             unset($tmp_weekarr);
         }
         $where['member_time'] = array('between', array($stime, $etime));
         $field .= ',WEEKOFYEAR(FROM_UNIXTIME(member_time)) as weekval,WEEKDAY(FROM_UNIXTIME(member_time))+1 as dayofweekval ';
         $memberlist = $model->statByMember($where, $field, 0, '', 'weekval,dayofweekval');
         if ($memberlist) {
             foreach ($memberlist as $k => $v) {
//.........这里部分代码省略.........
开发者ID:norain2050,项目名称:xingkang,代码行数:101,代码来源:stat_member.php


示例5: promotiontrendOp

 /**
  * 促销销售趋势分析
  */
 public function promotiontrendOp()
 {
     //优惠类型数组
     $goodstype_arr = array(2 => '抢购', 3 => '限时折扣', 4 => '优惠套装');
     $model = Model('stat');
     $where = array();
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', $searchtime_arr);
     $where['goods_type'] = array('in', array(2, 3, 4));
     $field = ' goods_type';
     switch ($this->search_arr['stattype']) {
         case 'orderamount':
             $field .= " ,SUM(goods_pay_price) as orderamount";
             $caption = '下单金额';
             break;
         case 'goodsnum':
             $field .= " ,SUM(goods_num) as goodsnum";
             $caption = '下单商品数';
             break;
         default:
             $field .= " ,count(DISTINCT order_id) as ordernum";
             $caption = '下单量';
             break;
     }
     if ($this->search_arr['search_type'] == 'day') {
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             //横轴
             $stat_arr['xAxis']['categories'][] = "{$i}";
             foreach ($goodstype_arr as $k => $v) {
                 $statlist[$k][$i] = 0;
             }
         }
         $field .= ' ,HOUR(FROM_UNIXTIME(order_add_time)) as timeval ';
     }
     if ($this->search_arr['search_type'] == 'week') {
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             $tmp_weekarr = getSystemWeekArr();
             //横轴
             $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
             unset($tmp_weekarr);
             foreach ($goodstype_arr as $k => $v) {
                 $statlist[$k][$i] = 0;
             }
         }
         $field .= ' ,WEEKDAY(FROM_UNIXTIME(order_add_time))+1 as timeval ';
     }
     if ($this->search_arr['search_type'] == 'month') {
         //计算横轴的最大量(由于每个月的天数不同)
         $dayofmonth = date('t', $searchtime_arr[0]);
         //构造横轴数据
         for ($i = 1; $i <= $dayofmonth; $i++) {
             //横轴
             $stat_arr['xAxis']['categories'][] = $i;
             foreach ($goodstype_arr as $k => $v) {
                 $statlist[$k][$i] = 0;
             }
         }
         $field .= ' ,day(FROM_UNIXTIME(order_add_time)) as timeval ';
     }
     //查询数据
     $statlist_tmp = $model->statByStatordergoods($where, $field, 0, 0, 'timeval', 'goods_type,timeval');
     //整理统计数组
     if ($statlist_tmp) {
         foreach ($statlist_tmp as $k => $v) {
             //将数据按照不同的促销方式分组
             foreach ($goodstype_arr as $t_k => $t_v) {
                 if ($t_k == $v['goods_type']) {
                     switch ($this->search_arr['stattype']) {
                         case 'orderamount':
                             $statlist[$t_k][$v['timeval']] = round($v[$this->search_arr['stattype']], 2);
                             break;
                         case 'goodsnum':
                             $statlist[$t_k][$v['timeval']] = intval($v[$this->search_arr['stattype']]);
                             break;
                         default:
                             $statlist[$t_k][$v['timeval']] = intval($v[$this->search_arr['stattype']]);
                             break;
                     }
                 }
             }
         }
     }
     foreach ($goodstype_arr as $k => $v) {
         $tmp = array();
         $tmp['name'] = $v;
         $tmp['data'] = array_values($statlist[$k]);
         $stat_arr['series'][] = $tmp;
     }
     //得到统计图数据
     $stat_arr['title'] = $caption . '统计';
//.........这里部分代码省略.........
开发者ID:ff00x0,项目名称:shopnc,代码行数:101,代码来源:stat_marketing.php


示例6: saleOp


//.........这里部分代码省略.........
         if ($memberlist) {
             foreach ($memberlist as $k => $v) {
                 if ($today_day == $v['dayval']) {
                     $curr_arr[$v['hourval']] = intval($v['allnum']);
                     $currlist_arr[$v['hourval']]['val'] = intval($v['allnum']);
                 }
                 if ($yesterday_day == $v['dayval']) {
                     $up_arr[$v['hourval']] = intval($v['allnum']);
                     $uplist_arr[$v['hourval']]['val'] = intval($v['allnum']);
                 }
             }
         } elseif (trim($_GET['store_name']) != '') {
             Tpl::output('data_null', 'yes');
         }
         $stat_arr['series'][0]['name'] = '昨天';
         $stat_arr['series'][0]['data'] = array_values($up_arr);
         $stat_arr['series'][1]['name'] = '今天';
         $stat_arr['series'][1]['data'] = array_values($curr_arr);
         Tpl::output('actionurl', 'index.php?act=stat_trade&op=sale&search_type=day&search_time=' . date('Y-m-d', $search_time));
     }
     if ($_REQUEST['search_type'] == 'week') {
         $current_weekarr = explode('|', $current_week);
         $stime = strtotime($current_weekarr[0]) - 86400 * 7;
         $etime = strtotime($current_weekarr[1]) + 86400 - 1;
         $up_week = @date('W', $stime);
         //上周
         $curr_week = @date('W', $etime);
         //本周
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             //统计图数据
             $up_arr[$i] = 0;
             $curr_arr[$i] = 0;
             $tmp_weekarr = getSystemWeekArr();
             //统计表数据
             $uplist_arr[$i]['timetext'] = $tmp_weekarr[$i];
             $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             //横轴
             $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
             unset($tmp_weekarr);
         }
         $where['add_time'] = array('between', array($stime, $etime));
         $field .= ',WEEKOFYEAR(FROM_UNIXTIME(add_time)) as weekval,DAYOFWEEK(FROM_UNIXTIME(add_time)) as dayofweekval ';
         $memberlist = $model->getStoreSaleStatList($where, $field, 0, '', 0, 'weekval,dayofweekval');
         if ($memberlist) {
             foreach ($memberlist as $k => $v) {
                 if ($up_week == $v['weekval']) {
                     $up_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
                 }
                 if ($curr_week == $v['weekval']) {
                     $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
                     $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
                 }
             }
         } elseif (trim($_GET['store_name']) != '') {
             Tpl::output('data_null', 'yes');
         }
         $stat_arr['series'][0]['name'] = '上周';
         $stat_arr['series'][0]['data'] = array_values($up_arr);
         $stat_arr['series'][1]['name'] = '本周';
         $stat_arr['series'][1]['data'] = array_values($curr_arr);
         Tpl::output('actionurl', 'index.php?act=stat_trade&op=sale&search_type=week&search_time_year=' . $current_year . '&search_time_month=' . $current_month . '&search_time_week=' . $current_week);
     }
开发者ID:Maplecms,项目名称:shopnc-yhmall,代码行数:67,代码来源:stat_trade.php


示例7: storesales_trendsOp

 /**
  * 销售走势
  */
 public function storesales_trendsOp()
 {
     $storeid = intval($_GET['storeid']);
     if ($storeid <= 0) {
         Tpl::output('stat_error', '走势图加载错误');
         Tpl::showpage('stat.store.salestrends');
         exit;
     }
     if (!$_GET['search_type']) {
         $_GET['search_type'] = 'day';
     }
     $model = Model('stat');
     $where = array();
     $where['store_id'] = $storeid;
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $where['order_add_time'] = array('between', $searchtime_arr);
     $field = " store_id,store_name,SUM(order_amount) as orderamount, COUNT(*) as ordernum, COUNT(DISTINCT buyer_id) as membernum";
     $stat_arr = array('orderamount' => array(), 'ordernum' => array(), 'membernum' => array());
     $statlist = array();
     if ($_GET['search_type'] == 'day') {
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             //横轴
             foreach ($stat_arr as $k => $v) {
                 $stat_arr[$k]['xAxis']['categories'][] = "{$i}";
                 $statlist[$k][$i] = 0;
             }
         }
         $field .= ' ,HOUR(FROM_UNIXTIME(order_add_time)) as timeval ';
     }
     if ($_GET['search_type'] == 'week') {
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             $tmp_weekarr = getSystemWeekArr();
             //横轴
             foreach ($stat_arr as $k => $v) {
                 $stat_arr[$k]['xAxis']['categories'][] = $tmp_weekarr[$i];
                 $statlist[$k][$i] = 0;
             }
             unset($tmp_weekarr);
         }
         $field .= ' ,WEEKDAY(FROM_UNIXTIME(order_add_time))+1 as timeval ';
     }
     if ($_GET['search_type'] == 'month') {
         //计算横轴的最大量(由于每个月的天数不同)
         $dayofmonth = date('t', $searchtime_arr[0]);
         //构造横轴数据
         for ($i = 1; $i <= $dayofmonth; $i++) {
             //横轴
             foreach ($stat_arr as $k => $v) {
                 $stat_arr[$k]['xAxis']['categories'][] = $i;
                 $statlist[$k][$i] = 0;
             }
         }
         $field .= ' ,day(FROM_UNIXTIME(order_add_time)) as timeval ';
     }
     //查询数据
     $statlist_tmp = $model->statByStatorder($where, $field, 0, '', 'timeval', 'timeval');
     //整理统计数组
     $storename = '';
     if ($statlist_tmp) {
         foreach ($statlist_tmp as $k => $v) {
             $storename = $v['store_name'];
             foreach ($stat_arr as $t_k => $t_v) {
                 if ($k == 'orderamount') {
                     $statlist[$t_k][$v['timeval']] = round($v[$t_k], 2);
                 } else {
                     $statlist[$t_k][$v['timeval']] = intval($v[$t_k]);
                 }
             }
         }
     }
     foreach ($stat_arr as $k => $v) {
         $stat_arr[$k]['legend']['enabled'] = false;
         switch ($k) {
             case 'orderamount':
                 $caption = '下单金额';
                 break;
             case 'ordernum':
                 $caption = '下单量';
                 break;
             default:
                 $caption = '下单会员数';
                 break;
         }
         $stat_arr[$k]['series'][0]['name'] = $caption;
         $stat_arr[$k]['series'][0]['data'] = array_values($statlist[$k]);
         $stat_arr[$k]['title'] = $caption . '走势';
         $stat_arr[$k]['yAxis'] = $caption;
         //得到统计图数据
         $stat_json[$k] = getStatData_LineLabels($stat_arr[$k]);
     }
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:ejia,代码行数:101,代码来源:stat_store.php


示例8: sale_trendOp

 /**
  * 订单走势
  */
 public function sale_trendOp()
 {
     $model = Model('stat');
     //存储参数
     $this->search_arr = $_REQUEST;
     //默认统计当前数据
     if (!$this->search_arr['search_type']) {
         $this->search_arr['search_type'] = 'day';
     }
     $where = array();
     if (trim($_GET['order_state']) != '') {
         $where['order_state'] = trim($_GET['order_state']);
     }
     if (trim($_GET['store_name']) != '') {
         $where['store_name'] = array('like', '%' . trim($_GET['store_name']) . '%');
     }
     $stattype = trim($_GET['type']);
     if ($stattype == 'ordernum') {
         $field = ' COUNT(*) as ordernum ';
         $stat_arr['title'] = '订单量统计';
         $stat_arr['yAxis'] = '订单量';
     } else {
         $stattype = 'orderamount';
         $field = ' SUM(order_amount) as orderamount ';
         $stat_arr['title'] = '订单销售额统计';
         $stat_arr['yAxis'] = '订单销售额';
     }
     $searchtime_arr_tmp = explode('|', $this->search_arr['t']);
     foreach ((array) $searchtime_arr_tmp as $k => $v) {
         $searchtime_arr[] = intval($v);
     }
     if ($this->search_arr['search_type'] == 'day') {
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             //统计图数据
             $curr_arr[$i] = 0;
             //今天
             $up_arr[$i] = 0;
             //昨天
             //统计表数据
             $currlist_arr[$i]['timetext'] = $i;
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             //横轴
             $stat_arr['xAxis']['categories'][] = "{$i}";
         }
         $today_day = @date('d', $searchtime_arr[1]);
         //今天日期
         $yesterday_day = @date('d', $searchtime_arr[0]);
         //昨天日期
         $where['order_add_time'] = array('between', $searchtime_arr);
         $field .= ' ,DAY(FROM_UNIXTIME(order_add_time)) as dayval,HOUR(FROM_UNIXTIME(order_add_time)) as hourval ';
         $orderlist = $model->statByStatorder($where, $field, 0, 0, '', 'dayval,hourval');
         foreach ((array) $orderlist as $k => $v) {
             if ($today_day == $v['dayval']) {
                 $curr_arr[$v['hourval']] = intval($v[$stattype]);
                 $currlist_arr[$v['hourval']]['val'] = $v[$stattype];
             }
             if ($yesterday_day == $v['dayval']) {
                 $up_arr[$v['hourval']] = intval($v[$stattype]);
                 $uplist_arr[$v['hourval']]['val'] = $v[$stattype];
             }
         }
         $stat_arr['series'][0]['name'] = '昨天';
         $stat_arr['series'][0]['data'] = array_values($up_arr);
         $stat_arr['series'][1]['name'] = '今天';
         $stat_arr['series'][1]['data'] = array_values($curr_arr);
     }
     if ($this->search_arr['search_type'] == 'week') {
         $up_week = @date('W', $searchtime_arr[0]);
         //上周
         $curr_week = @date('W', $searchtime_arr[1]);
         //本周
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             //统计图数据
             $up_arr[$i] = 0;
             $curr_arr[$i] = 0;
             $tmp_weekarr = getSystemWeekArr();
             //统计表数据
             $uplist_arr[$i]['timetext'] = $tmp_weekarr[$i];
             $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
             $uplist_arr[$i]['val'] = 0;
             $currlist_arr[$i]['val'] = 0;
             //横轴
             $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
             unset($tmp_weekarr);
         }
         $where['order_add_time'] = array('between', $searchtime_arr);
         $field .= ',WEEKOFYEAR(FROM_UNIXTIME(order_add_time)) as weekval,WEEKDAY(FROM_UNIXTIME(order_add_time))+1 as dayofweekval ';
         $orderlist = $model->statByStatorder($where, $field, 0, 0, '', 'weekval,dayofweekval');
         foreach ((array) $orderlist as $k => $v) {
             if ($up_week == $v['weekval']) {
                 $up_arr[$v['dayofweekval']] = intval($v[$stattype]);
                 $uplist_arr[$v['dayofweekval']]['val'] = intval($v[$stattype]);
             }
             if ($curr_week == $v['weekval']) {
//.........这里部分代码省略.........
开发者ID:ff00x0,项目名称:shopnc,代码行数:101,代码来源:stat_trade.php


示例9: saleOp

	/**
	 * 销售统计
	 */
	public function saleOp(){
	    $model = Model('stat');
        //默认统计当前数据
		if(!$this->search_arr['search_type']){
			$this->search_arr['search_type'] = 'day';
		}
		//计算昨天和今天时间
    	if($this->search_arr['search_type'] == 'day'){
    	    $stime = $this->search_arr['day']['search_time'] - 86400;//昨天0点
    	    $etime = $this->search_arr['day']['search_time'] + 86400 - 1;//今天24点
    	    $curr_stime = $this->search_arr['day']['search_time'];//今天0点
    	} elseif ($this->search_arr['search_type'] == 'week'){
			$current_weekarr = explode('|', $this->search_arr['week']['current_week']);
			$stime = strtotime($current_weekarr[0])-86400*7;
			$etime = strtotime($current_weekarr[1])+86400-1;
			$curr_stime = strtotime($current_weekarr[0]);//本周0点
    	} elseif ($this->search_arr['search_type'] == 'month'){
			$stime = strtotime($this->search_arr['month']['current_year'].'-'.$this->search_arr['month']['current_month']."-01 -1 month");
			$etime = getMonthLastDay($this->search_arr['month']['current_year'],$this->search_arr['month']['current_month'])+86400-1;
			$curr_stime = strtotime($this->search_arr['month']['current_year'].'-'.$this->search_arr['month']['current_month']."-01");;//本月0点
    	}

        $where = array();
        $where['store_id'] = $_SESSION['store_id'];
        $where['order_add_time'] = array('between',array($stime,$etime));
		if(trim($_GET['order_type']) != ''){
    		$where['order_state'] = trim($_GET['order_type']);
    	}
	    //走势图
	    $field = ' COUNT(*) as ordernum,SUM(order_amount) as orderamount ';
	    $stat_arr = array();
    	//$searchtime_arr = array($stime,$etime);
		if($this->search_arr['search_type'] == 'day'){
			//构造横轴数据
			for($i=0; $i<24; $i++){
				//统计图数据
				$curr_arr['orderamount'][$i] = 0;//今天
				$up_arr['orderamount'][$i] = 0;//昨天
				$curr_arr['ordernum'][$i] = 0;//今天
				$up_arr['ordernum'][$i] = 0;//昨天

				//统计表数据
				$currlist_arr[$i]['timetext'] = $i;

				$uplist_arr[$i]['val'] = 0;
				$currlist_arr[$i]['val'] = 0;
				//横轴
				$stat_arr['orderamount']['xAxis']['categories'][] = "$i";
				$stat_arr['ordernum']['xAxis']['categories'][] = "$i";
			}

			$today_day = @date('d', $etime);//今天日期
			$yesterday_day = @date('d', $stime);//昨天日期

			$field .= ' ,DAY(FROM_UNIXTIME(order_add_time)) as dayval,HOUR(FROM_UNIXTIME(order_add_time)) as hourval ';
			$orderlist = $model->statByStatorder($where, $field, 0, 0, '', 'dayval,hourval');
			foreach((array)$orderlist as $k => $v){
				if($today_day == $v['dayval']){
					$curr_arr['ordernum'][$v['hourval']] = intval($v['ordernum']);
					$curr_arr['orderamount'][$v['hourval']] = floatval($v['orderamount']);

					$currlist_arr[$v['hourval']]['val'] = $v[$search_type];
				}
				if($yesterday_day == $v['dayval']){
					$up_arr['ordernum'][$v['hourval']] = intval($v['ordernum']);
					$up_arr['orderamount'][$v['hourval']] = floatval($v['orderamount']);

					$uplist_arr[$v['hourval']]['val'] = $v[$search_type];
				}
			}
			$stat_arr['ordernum']['series'][0]['name'] = '昨天';
			$stat_arr['ordernum']['series'][0]['data'] = array_values($up_arr['ordernum']);
			$stat_arr['ordernum']['series'][1]['name'] = '今天';
			$stat_arr['ordernum']['series'][1]['data'] = array_values($curr_arr['ordernum']);

			$stat_arr['orderamount']['series'][0]['name'] = '昨天';
			$stat_arr['orderamount']['series'][0]['data'] = array_values($up_arr['orderamount']);
			$stat_arr['orderamount']['series'][1]['name'] = '今天';
			$stat_arr['orderamount']['series'][1]['data'] = array_values($curr_arr['orderamount']);
		}

		if($this->search_arr['search_type'] == 'week'){
			$up_week = @date('W', $stime);//上周
			$curr_week = @date('W', $etime);//本周
			//构造横轴数据
			for($i=1; $i<=7; $i++){
			    $tmp_weekarr = getSystemWeekArr();
				//统计图数据
				$up_arr['ordernum'][$i] = 0;
				$curr_arr['ordernum'][$i] = 0;

				$up_arr['orderamount'][$i] = 0;
				$curr_arr['orderamount'][$i] = 0;

				//横轴
				$stat_arr['ordernum']['xAxis']['categories'][] = $tmp_weekarr[$i];
				$stat_arr['orderamount']['xAxis']['categories'][] = $tmp_weekarr[$i];
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:ejia,代码行数:101,代码来源:statistics_sale.php


示例10: ordersstat

 /**
  * 统计订单下单金额及下单量
  * @param $data_type 统计数据类型'ordersamount'为下单金额'ordersnum'为下单量
  */
 private function ordersstat($data_type)
 {
     $model_stat = Model('stat');
     $where = array();
     $where['store_id'] = $this->store_info['store_id'];
     $where['order_add_time'] = array('between', array($this->search_arr['stime'], $this->search_arr['etime']));
     $where['order_isvalid'] = 1;
     //计入统计的有效订单
     $field = ' COUNT(*) as ordersnum,SUM(order_amount) as ordersamount ';
     if ($this->search_arr['show_type'] == 'hour') {
         //构造横轴数据
         for ($i = 0; $i < 24; $i++) {
             //横轴坐标
             $x_data[] = $i;
             //统计表数据
             $y_data[$i] = 0;
         }
         $field .= ' ,HOUR(FROM_UNIXTIME(order_add_time)) as hourval ';
         if (C('dbdriver') == 'mysql') {
             $_group = 'hourval';
         } else {
             $_group = 'HOUR(FROM_UNIXTIME(order_add_time))';
         }
         $orderlist = $model_stat->statByStatorder($where, $field, 0, 0, '', $_group);
         foreach ((array) $orderlist as $k => $v) {
             if ($data_type == 'ordersnum') {
                 //下单量
                 $y_data[$v['hourval']] = intval($v['ordersnum']);
             }
             if ($data_type == 'ordersamount') {
                 //下单金额
                 $y_data[$v['hourval']] = floatval($v['ordersamount']);
             }
         }
     }
     if ($this->search_arr['show_type'] == 'day') {
         //构造横轴数据
         for ($i = $this->search_arr['stime']; $i < $this->search_arr['etime']; $i = $i + 86400) {
             //横轴坐标
             $x_data[] = date('d', $i);
             //统计表数据
             $y_data[date('j', $i)] = 0;
         }
         $field .= ',day(FROM_UNIXTIME(order_add_time)) as dayval ';
         if (C('dbdriver') == 'mysql') {
             $_group = 'dayval';
         } else {
             $_group = 'DAY(FROM_UNIXTIME(order_add_time))';
         }
         $orderlist = $model_stat->statByStatorder($where, $field, 0, 0, '', $_group);
         foreach ($orderlist as $k => $v) {
             if ($data_type == 'ordersnum') {
                 //下单量
                 $y_data[$v['dayval']] = intval($v['ordersnum']);
             }
             if ($data_type == 'ordersamount') {
                 //下单金额
                 $y_data[$v['dayval']] = floatval($v['ordersamount']);
             }
         }
     }
     if ($this->search_arr['show_type'] == 'week') {
         //构造横轴数据
         for ($i = 1; $i <= 7; $i++) {
             $tmp_weekarr = getSystemWeekArr();
             //横轴坐标
             $x_data[] = $tmp_weekarr[$i];
             //统计表数据
             $y_data[$i] = 0;
             unset($tmp_weekarr);
         }
         $field .= ',WEEKDAY(FROM_UNIXTIME(order_add_time))+1 as dayofweekval ';
         if (C('dbdriver') == 'mysql') {
             $_group = 'dayofweekval';
         } else {
             $_group = 'WEEKDAY(FROM_UNIXTIME(order_add_time))+1';
         }
         $orderlist = $model_stat->statByStatorder($where, $field, 0, 0, '', $_group);
         foreach ((array) $orderlist as $k => $v) {
             if ($data_type == 'ordersnum') {
                 //下单量
                 $y_data[$v['dayofweekval']] = intval($v['ordersnum']);
             }
             if ($data_type == 'ordersamount') {
                 //下单金额
                 $y_data[$v['dayofweekval']] = floatval($v['ordersamount']);
             }
         }
     }
     if ($this->search_arr['show_type'] == 'month') {
         //构造横轴数据
         for ($i = 1; $i <= 12; $i++) {
             //横轴坐标
             $x_data[] = $i;
             //统计表数据
             $y_data[$i] = 0;
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:meizhan,代码行数:101,代码来源:seller_stat.php



注:本文中的getSystemWeekArr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getSystemYearArr函数代码示例发布时间:2022-05-15
下一篇:
PHP getSystemMonthArr函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap