update 平台商品/店铺销量排行
This commit is contained in:
parent
bc548f2afa
commit
1f57416251
@ -456,6 +456,14 @@ class Order extends BaseController
|
||||
->field('p.product_id, p.store_name, p.image, COUNT(o.`order_id`) AS total_sales')
|
||||
->join('store_order_product op', 'p.product_id = op.product_id')
|
||||
->join('store_order o', 'op.order_id = o.order_id')
|
||||
->join('product_order_log og', 'o.order_id = og.order_id')
|
||||
->where(function($query) {
|
||||
if ($this->streetCode != '') {
|
||||
$query->where('og.street_code', $this->streetCode);
|
||||
} else {
|
||||
$query->where('og.district_code', $this->areaCode);
|
||||
}
|
||||
})
|
||||
->group('p.product_id')
|
||||
->order('total_sales DESC')
|
||||
->limit(10)
|
||||
@ -470,6 +478,13 @@ class Order extends BaseController
|
||||
$merchantRankingList = Db::name('store_order')->alias('o')
|
||||
->field('m.`mer_id`, m.`mer_name`, m.mini_banner, COUNT(o.`order_id`) AS total_sales')
|
||||
->join('merchant m', 'o.`mer_id` = m.`mer_id`')
|
||||
->where(function($query) {
|
||||
if ($this->streetCode != '') {
|
||||
$query->where('m.street_id', $this->streetCode);
|
||||
} else {
|
||||
$query->where('m.area_id', $this->areaCode);
|
||||
}
|
||||
})
|
||||
->group('m.mer_id')
|
||||
->order('total_sales DESC')
|
||||
->limit(10)
|
||||
|
Loading…
x
Reference in New Issue
Block a user