mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-11-01 23:40:38 +00:00
商品可以添加一级分类
This commit is contained in:
parent
01990a29d5
commit
7f2cf94e88
@ -122,7 +122,7 @@ class StoreProductDao extends BaseDao
|
||||
})->when(isset($where['cid']) && $where['cid'], function ($query) use ($where) {
|
||||
$query->whereIn('id', function ($query) use ($where) {
|
||||
$query->name('store_product_cate')->whereIn('cate_id', function ($query) use ($where) {
|
||||
$query->name('store_category')->where('pid', $where['cid'])->field('id')->select();
|
||||
$query->name('store_category')->where('pid', $where['cid'])->whereOr('id', $where['cid'])->field('id')->select();
|
||||
})->field('product_id')->select();
|
||||
});
|
||||
})->when(isset($where['coupon_category_id']) && $where['coupon_category_id'] != '', function ($query) use ($where) {
|
||||
|
||||
@ -97,11 +97,11 @@ class StoreCategoryServices extends BaseServices
|
||||
if ($show !== '') $where['is_show'] = $show;
|
||||
if (!$type) $where['pid'] = 0;
|
||||
$data = get_tree_children($this->dao->getTierList($where, ['id', 'id as value', 'cate_name as label', 'cate_name as title', 'pid']), 'children', 'id');
|
||||
foreach ($data as &$item) {
|
||||
if (!isset($item['children'])) {
|
||||
$item['disabled'] = true;
|
||||
}
|
||||
}
|
||||
// foreach ($data as &$item) {
|
||||
// if (!isset($item['children'])) {
|
||||
// $item['disabled'] = true;
|
||||
// }
|
||||
// }
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@ -620,7 +620,7 @@ class StoreProductServices extends BaseServices
|
||||
$cateGory = $storeCategoryServices->getColumn([['id', 'IN', $cate_id]], 'id,pid', 'id');
|
||||
foreach ($cate_id as $cid) {
|
||||
if ($cid && isset($cateGory[$cid]['pid'])) {
|
||||
$cateData[] = ['product_id' => $id, 'cate_id' => $cid, 'cate_pid' => $cateGory[$cid]['pid'], 'status' => $data['is_show'], 'add_time' => $time];
|
||||
$cateData[] = ['product_id' => $id, 'cate_id' => $cid, 'cate_pid' => $cateGory[$cid]['pid'] ?: $cid, 'status' => $data['is_show'], 'add_time' => $time];
|
||||
}
|
||||
}
|
||||
$storeProductCateServices->change($id, $cateData);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user