//获取今天开始、结束时间
$where_day['createtime'] = [
['egt',strtotime(date('Y-m-d',time()))],
['lt',strtotime(date('Y-m-d',time())).'+1 day']
];
//获取本周开始、结束时间
$where_week['createtime'] = [
['egt',strtotime(date('Y-m-d',time())).'-'.date('w',time()).' day'],
['lt',strtotime(date('Y-m-d',time())).'+1 week -'.date('w',time()).' day']
];
//获取本月开始、结束时间
$where_month['createtime'] = [
['egt',strtotime(date('Y-m',time()))],
['lt',strtotime(date('Y-m',time()).'+1 month')]
];
$order_goods = new Order();
$order_goods_sum = $order_goods->where($where_day)
->field('goods_id,goods_name,sum(number) as sales')
->group('goods_id')
->order('sales','desc')
->limit(10)
->select(),
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END