修改分类同步小程序分类相关
This commit is contained in:
parent
28c94be5c9
commit
a944e9936f
@ -127,6 +127,33 @@ class StoreProductLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 传入三级或者二级分类返还上级分类 一级那全是相同
|
||||||
|
*/
|
||||||
|
public static function dealChangeCate($cate_id)
|
||||||
|
{
|
||||||
|
$value =[];
|
||||||
|
$last_cate = Db::name('store_category')->where('id',$cate_id)->value('pid');
|
||||||
|
if(!empty($last_cate)){
|
||||||
|
//2
|
||||||
|
$value['two_cate_id'] = $last_cate;
|
||||||
|
//1
|
||||||
|
$first_cate = Db::name('store_category')->where('id',$value['two_cate_id'])->value('pid');
|
||||||
|
if(empty($first_cate)){//顶级了
|
||||||
|
$value['two_cate_id'] = $cate_id;
|
||||||
|
$value['top_cate_id'] = $last_cate;
|
||||||
|
}else{
|
||||||
|
$value['top_cate_id'] = $first_cate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//1-2 选的1级目录
|
||||||
|
$value['two_cate_id'] = $cate_id;
|
||||||
|
$value['top_cate_id'] = $cate_id;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 编辑商品列表
|
* @notes 编辑商品列表
|
||||||
* @param array $params
|
* @param array $params
|
||||||
@ -175,15 +202,15 @@ class StoreProductLogic extends BaseLogic
|
|||||||
self::updateGoodsclass($params['cate_id'], $value['store_id']);
|
self::updateGoodsclass($params['cate_id'], $value['store_id']);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
$dealCate = self::dealChangeCate($params['cate_id']);
|
||||||
|
|
||||||
//修改
|
//修改
|
||||||
StoreBranchProduct::where('product_id', $params['id'])->update([
|
StoreBranchProduct::where('product_id', $params['id'])->update([
|
||||||
'price' => $params['price'], 'vip_price' => $params['vip_price'],
|
'price' => $params['price'], 'vip_price' => $params['vip_price'],
|
||||||
'cost' => $params['cost'],'unit'=>$params['unit'],
|
'cost' => $params['cost'],'unit'=>$params['unit'],
|
||||||
'batch'=>$params['batch'],'store_name'=>$params['store_name'],
|
'batch'=>$params['batch'],'store_name'=>$params['store_name'],
|
||||||
'manufacturer_information' => $params['manufacturer_information']??'',
|
'manufacturer_information' => $params['manufacturer_information']??'',
|
||||||
'store_info' => $params['store_info']??'',
|
'store_info' => $params['store_info']??'','cate_id'=>$params['cate_id'],
|
||||||
|
'top_cate_id'=>$dealCate['top_cate_id'],'two_cate_id'=>$dealCate['two_cate_id']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user