博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
php 获取半年内每个月的订单数量, 总价, 月份
阅读量:7004 次
发布时间:2019-06-27

本文共 577 字,大约阅读时间需要 1 分钟。

$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);

 

转载于:https://www.cnblogs.com/zjj1990/p/8745288.html

你可能感兴趣的文章