修改排序
This commit is contained in:
parent
4011075698
commit
4f8f505283
@ -907,23 +907,25 @@ class GoodsLogic extends Logic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$where[] = ['og.create_time', '>=', strtotime("today")];
|
$onSaleWhere = [
|
||||||
$where[] = ['og.create_time', '<=', strtotime("tomorrow") - 1];
|
'del' => GoodsEnum::DEL_NORMAL, // 未删除
|
||||||
|
'status' => GoodsEnum::STATUS_SHELVES, // 上架中
|
||||||
|
'audit_status' => GoodsEnum::AUDIT_STATUS_OK, // 审核通过
|
||||||
|
];
|
||||||
|
|
||||||
$order_goods = Db::name('order_goods')
|
$order_goods = Db::name('order_goods')
|
||||||
->alias('og')
|
->alias('og')
|
||||||
->join('goods g', 'og.goods_id = g.id')
|
->join('goods g', 'og.goods_id = g.id')
|
||||||
->where($where)
|
->where($onSaleWhere)
|
||||||
->field('og.goods_id, count(*) as count, g.id as gid, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price')
|
->field('og.goods_id, og.create_time, count(*) as count, g.id as gid, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price')
|
||||||
->group('og.goods_id')
|
->group('og.goods_id')
|
||||||
->order('count desc, og.create_time desc')
|
->order('og.create_time desc, count desc')
|
||||||
->page($page, $size)
|
->page($page, $size)
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
$count = Db::name('order_goods')
|
$count = Db::name('order_goods')
|
||||||
->alias('og')
|
->alias('og')
|
||||||
->where($where)
|
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
foreach ($order_goods as &$v) {
|
foreach ($order_goods as &$v) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user