调整品类商家不存在则不显示商品
This commit is contained in:
parent
cd775fc7aa
commit
c8801c23ea
@ -16,6 +16,7 @@ use app\common\model\goods\GoodsCategory;
|
|||||||
use app\common\server\ConfigServer;
|
use app\common\server\ConfigServer;
|
||||||
use app\common\server\UrlServer;
|
use app\common\server\UrlServer;
|
||||||
use app\api\logic\SeckillGoodsLogic;
|
use app\api\logic\SeckillGoodsLogic;
|
||||||
|
use app\api\logic\GoodsLogic;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use app\common\model\activity_area\ActivityArea;
|
use app\common\model\activity_area\ActivityArea;
|
||||||
use think\facade\Event;
|
use think\facade\Event;
|
||||||
@ -674,6 +675,12 @@ class IndexLogic extends Logic
|
|||||||
|
|
||||||
public static function categoryRecommend($platform_category_id,$p_id,$set_id)
|
public static function categoryRecommend($platform_category_id,$p_id,$set_id)
|
||||||
{
|
{
|
||||||
|
$shop_id = GoodsLogic::filterShopsIds();
|
||||||
|
$shopWhere = [];
|
||||||
|
if (!empty($shop_id)) {
|
||||||
|
$shopWhere[] = ['shop_id', 'not in', $shop_id];
|
||||||
|
}
|
||||||
|
|
||||||
// 销售中商品:未删除/审核通过/已上架
|
// 销售中商品:未删除/审核通过/已上架
|
||||||
$where = [
|
$where = [
|
||||||
['del', '=', GoodsEnum::DEL_NORMAL], // 未删除
|
['del', '=', GoodsEnum::DEL_NORMAL], // 未删除
|
||||||
@ -682,6 +689,7 @@ class IndexLogic extends Logic
|
|||||||
['first_cate_id|second_cate_id|third_cate_id', '=', $platform_category_id], // 分类id
|
['first_cate_id|second_cate_id|third_cate_id', '=', $platform_category_id], // 分类id
|
||||||
['is_recommend', '=', 1] // 推荐商品
|
['is_recommend', '=', 1] // 推荐商品
|
||||||
];
|
];
|
||||||
|
|
||||||
$order = [
|
$order = [
|
||||||
'min_price' => 'asc', // 价格排序
|
'min_price' => 'asc', // 价格排序
|
||||||
];
|
];
|
||||||
@ -710,10 +718,12 @@ class IndexLogic extends Logic
|
|||||||
$lists = Goods::field('id,name,image,min_price,market_price,wholesale_price,purchase_price,issuing_price,sales_actual,(sales_actual + sales_virtual) as sales_total')
|
$lists = Goods::field('id,name,image,min_price,market_price,wholesale_price,purchase_price,issuing_price,sales_actual,(sales_actual + sales_virtual) as sales_total')
|
||||||
->where($where1)
|
->where($where1)
|
||||||
->where($where)
|
->where($where)
|
||||||
|
->where($shopWhere)
|
||||||
->order($order)
|
->order($order)
|
||||||
->limit(4)
|
->limit(4)
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
$set_price_type = 0;
|
$set_price_type = 0;
|
||||||
if ($set != null&&$settpye!=1) {
|
if ($set != null&&$settpye!=1) {
|
||||||
foreach ($lists as $key => $value) {
|
foreach ($lists as $key => $value) {
|
||||||
@ -758,6 +768,7 @@ class IndexLogic extends Logic
|
|||||||
return $lists;
|
return $lists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function config()
|
public static function config()
|
||||||
{
|
{
|
||||||
$navigation = Db::name('dev_navigation')
|
$navigation = Db::name('dev_navigation')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user