商户平台支持购买普通店铺商品

This commit is contained in:
luofei 2024-02-29 10:41:31 +08:00
parent e68e8f850b
commit 4290a872be
4 changed files with 25 additions and 4 deletions

View File

@ -71,10 +71,16 @@ class StoreCartDao extends BaseDao
*/
public function getAll(int $uid,$product_type,$source=0)
{
if ($product_type == 98) {
$product_type = [98, 0];
}
$where=['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'source'=>$source];
if($source==103){
$where=['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'source'=>$source];
}
if ($source == 12) {
$where['source'] = [0, 12];
}
$query = ($this->getModel())::where($where)
->with([
'product' => function ($query) {
@ -152,10 +158,16 @@ class StoreCartDao extends BaseDao
*/
public function getCartCount(int $uid,$product_type,$source=0)
{
if ($product_type == 98) {
$product_type = [98, 0];
}
$where=['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'is_fail'=>0,'source'=>$source];
if($source==103){
$where=['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'is_fail'=>0,'source'=>$source];
}
if ($source == 12) {
$where['source'] = [0, 12];
}
$count = ($this->getModel()::getDB())->where($where)->count();
$data[0]['count'] = $count;
return $data;

View File

@ -65,7 +65,13 @@ class SpuDao extends BaseDao
$query->where('P.mer_id',$where['mer_id']);
})
->when(isset($where['product_type']) && $where['product_type'] !== '',function($query)use($where){
$query->where('P.product_type',$where['product_type']);
if (is_array($where['product_type'])) {
$query->whereIn('P.product_type',$where['product_type']);
$query->whereIn('S.product_type',$where['product_type']);
} else {
$query->where('P.product_type',$where['product_type']);
$query->where('S.product_type',$where['product_type']);
}
})
->when(isset($where['mer_array_id']),function($query)use($where){
$query->whereIn('P.mer_id',$where['mer_array_id']);
@ -140,9 +146,6 @@ class SpuDao extends BaseDao
->when(isset($where['is_gift_bag']) && $where['is_gift_bag'] !== '',function($query)use($where){
$query->where('P.is_gift_bag',$where['is_gift_bag']);
})
->when(isset($where['product_type']) && $where['product_type'] !== '',function($query)use($where){
$query->where('S.product_type',$where['product_type']);
})
->when(isset($where['action']) && $where['action'] !== '',function($query)use($where){
$query->where('S.product_type','>',0);
})

View File

@ -154,6 +154,9 @@ class SpuRepository extends BaseRepository
if (!empty($this->orderField)) {
$this->dao->orderField = $this->orderField;
}
if ($where['product_type'] == 98) {
$where['product_type'] = [0, 98];
}
$query = $this->dao->search($where);
$query->with([

View File

@ -62,6 +62,9 @@ class Merchant extends BaseController
if (empty($where['type_id'])) {
$where['type_id'] = [10, 17];
}
if (!empty($where['type_id']) && $where['type_id'] == 12) {
$where['type_id'] = [10, 12, 17];
}
if ($where['merchant_category_id'] > 0) {
// $arr= Db::name('store_category')->where(['pid'=>$where['store_category_id'],'mer_id'=>0,'level'=>1,'is_show'=>1])->column('cate_name');
// if($arr){