更新
This commit is contained in:
parent
f181fd1dac
commit
cc57379223
@ -413,6 +413,24 @@ class ProductDao extends BaseDao
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO api展示的商品条件
|
||||||
|
* @return array
|
||||||
|
* @author Qinii
|
||||||
|
* @day 2020-08-18
|
||||||
|
*/
|
||||||
|
public function productTypeShow($type=98)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'is_show' => 1,
|
||||||
|
'status' => 1,
|
||||||
|
'is_used' => 1,
|
||||||
|
'product_type' => $type,
|
||||||
|
'mer_status' => 1,
|
||||||
|
'is_gift_bag' => 0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO api展示的礼包商品条件
|
* TODO api展示的礼包商品条件
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -82,7 +82,7 @@ class Merchant extends BaseModel
|
|||||||
{
|
{
|
||||||
$list = Product::where('mer_id', $this['mer_id'])
|
$list = Product::where('mer_id', $this['mer_id'])
|
||||||
->where((new ProductDao())->productShow())
|
->where((new ProductDao())->productShow())
|
||||||
->field('mer_id,product_id,store_name,image,price,is_show,status,is_gift_bag,is_good,cate_id')
|
->field('mer_id,product_id,product_type,store_name,image,price,is_show,status,is_gift_bag,is_good,cate_id')
|
||||||
->order('sort DESC, create_time DESC')
|
->order('sort DESC, create_time DESC')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
->select()->append(['show_svip_info']);
|
->select()->append(['show_svip_info']);
|
||||||
@ -90,7 +90,30 @@ class Merchant extends BaseModel
|
|||||||
$data = [];
|
$data = [];
|
||||||
$make = app()->make(StoreActivityRepository::class);
|
$make = app()->make(StoreActivityRepository::class);
|
||||||
foreach ($list as $item) {
|
foreach ($list as $item) {
|
||||||
$spu_id = Spu::where('product_id',$item->product_id)->where('product_type' ,0)->value('spu_id');
|
halt(1);
|
||||||
|
$spu_id = Spu::where('product_id',$item->product_id)->where('product_type' ,$item->product_type)->value('spu_id');
|
||||||
|
$act = $make->getActivityBySpu(StoreActivityRepository::ACTIVITY_TYPE_BORDER,$spu_id,$item['cate_id'],$item['mer_id']);
|
||||||
|
$item['border_pic'] = $act['pic'] ?? '';
|
||||||
|
$data[] = $item;
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllRecommendTypeAttr()
|
||||||
|
{
|
||||||
|
$list = Product::where('mer_id', $this['mer_id'])
|
||||||
|
->where((new ProductDao())->productTypeShow(98))
|
||||||
|
->field('mer_id,product_id,product_type,store_name,image,price,is_show,status,is_gift_bag,is_good,cate_id')
|
||||||
|
->order('sort DESC, create_time DESC')
|
||||||
|
->limit(10)
|
||||||
|
->select()->append(['show_svip_info']);
|
||||||
|
if ($list) {
|
||||||
|
$data = [];
|
||||||
|
$make = app()->make(StoreActivityRepository::class);
|
||||||
|
foreach ($list as $item) {
|
||||||
|
$spu_id = Spu::where('product_id',$item->product_id)->where('product_type' ,$item->product_type)->value('spu_id');
|
||||||
$act = $make->getActivityBySpu(StoreActivityRepository::ACTIVITY_TYPE_BORDER,$spu_id,$item['cate_id'],$item['mer_id']);
|
$act = $make->getActivityBySpu(StoreActivityRepository::ACTIVITY_TYPE_BORDER,$spu_id,$item['cate_id'],$item['mer_id']);
|
||||||
$item['border_pic'] = $act['pic'] ?? '';
|
$item['border_pic'] = $act['pic'] ?? '';
|
||||||
$data[] = $item;
|
$data[] = $item;
|
||||||
|
@ -311,7 +311,9 @@ class MerchantRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
$item['distance'] = $distance;
|
$item['distance'] = $distance;
|
||||||
}
|
}
|
||||||
$item['recommend'] = isset($where['delivery_way']) ? $item['CityRecommend'] : $item['AllRecommend'];
|
if(isset($where['type_id'])){
|
||||||
|
$item['recommend'] = $item['AllRecommendType'];
|
||||||
|
}
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user