商家最高补贴统计添加未补满的条件
This commit is contained in:
parent
dd8029844b
commit
127d39bdb1
@ -75,6 +75,10 @@ class IndexLogic extends Logic
|
|||||||
}
|
}
|
||||||
// 热销榜单
|
// 热销榜单
|
||||||
$hots = self::getHots($where);
|
$hots = self::getHots($where);
|
||||||
|
|
||||||
|
// 年货超值购
|
||||||
|
$year_shop = self::getYearShop();
|
||||||
|
|
||||||
$set_price_type = 0;
|
$set_price_type = 0;
|
||||||
if ($set != null&&$settpye!=1) {
|
if ($set != null&&$settpye!=1) {
|
||||||
foreach ($hots as $key => $value) {
|
foreach ($hots as $key => $value) {
|
||||||
@ -1117,4 +1121,70 @@ class IndexLogic extends Logic
|
|||||||
|
|
||||||
return $hot_list;
|
return $hot_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getYearShop($get = [])
|
||||||
|
{
|
||||||
|
$page_no = isset($get['page_no']) ?? 1;
|
||||||
|
$page_size = isset($get['page_size']) ?? 10;
|
||||||
|
|
||||||
|
// 销售中商品:未删除/审核通过/已上架
|
||||||
|
$where = [
|
||||||
|
['del', '=', GoodsEnum::DEL_NORMAL], // 未删除
|
||||||
|
['status', '=', GoodsEnum::STATUS_SHELVES], // 上架中
|
||||||
|
['audit_status', '=', GoodsEnum::AUDIT_STATUS_OK], // 审核通过
|
||||||
|
];
|
||||||
|
$order = [
|
||||||
|
'sort_weight' => 'asc', // 商品权重,数字越小权重越大
|
||||||
|
'sort' => 'asc',
|
||||||
|
'id' => 'desc'
|
||||||
|
];
|
||||||
|
|
||||||
|
// 分类ID
|
||||||
|
$category_id = 290;
|
||||||
|
$wh = "";
|
||||||
|
$category_msg = GoodsCategory::where("id", $category_id)->find();
|
||||||
|
if($category_msg['pid'] == 0){
|
||||||
|
$wh = "find_in_set(". $category_id .", first_cate_id)";
|
||||||
|
}else{
|
||||||
|
$category_second_msg = GoodsCategory::where("pid",$category_msg['id'])->find();
|
||||||
|
if($category_second_msg==null){
|
||||||
|
$wh = "find_in_set(". $category_id .", second_cate_id)";
|
||||||
|
}else{
|
||||||
|
$wh = "find_in_set(". $category_id .", third_cate_id)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$field = 'id,image,name,wholesale_price,min_price,market_price,sales_actual,first_cate_id,
|
||||||
|
second_cate_id,third_cate_id,sort_weight,brand_id,shop_id,sales_virtual,
|
||||||
|
(sales_actual + sales_virtual) as sales_total,purchase_price,issuing_price,subsidy_id,presale';
|
||||||
|
|
||||||
|
$list = Goods::with(['shop'])
|
||||||
|
->field($field)
|
||||||
|
->where($wh)
|
||||||
|
->where($where)
|
||||||
|
->order($order)
|
||||||
|
->page($page_no, $page_size)
|
||||||
|
->select();
|
||||||
|
|
||||||
|
foreach ($list as $k => $item) {
|
||||||
|
// 获取返补比例, subsidy_id为0的就传递一个ID为4的固定ID
|
||||||
|
$list[$k]['subsidy'] = (new GoodsSubsidy())->getSubsidyById($item['subsidy_id'] > 0 ? $item['subsidy_id'] : 4);
|
||||||
|
$list[$k]['subsidy_txt'] = '最高返' . $list[$k]['subsidy']['subsidy'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = Goods::where($where)->where($wh)->count();
|
||||||
|
|
||||||
|
$list = $list ? $list->toArray() : [];
|
||||||
|
|
||||||
|
$more = is_more($count, $page_no, $page_size);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'lists' => $list,
|
||||||
|
'page_no' => $page_no,
|
||||||
|
'page_size' => $page_size,
|
||||||
|
'count' => $count,
|
||||||
|
'more' => $more,
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user