$time = time(); $endtime = strtotime(date('Y-m', strtotime('-6 month'))); $store_id = $_SESSION['admin_user']['store_id']; $where['pay_state'] = 2; //支付成功 $where['print_state'] = 4; //打印状态: 打印完成 $where['store_id'] = $store_id; $where['create_time'] = ['between', [$endtime, $time]]; $model = D('Order'); $list = $model->field("sum(pay_price) as price, count(1) as cnt,FROM_UNIXTIME(create_time, '%Y-%m') as create_time")->where($where)->group("FROM_UNIXTIME(create_time, '%Y-%m')")->order("create_time asc")->select(); var_dump($list);

本文介绍了一段PHP代码,用于统计过去六个月内支付成功的订单数量及总金额,并按月份进行分组。

3734

被折叠的 条评论
为什么被折叠?



