更新复制和推送数据
This commit is contained in:
parent
a944e9936f
commit
abd9e2cb82
@ -310,6 +310,7 @@ class StoreProductLogic extends BaseLogic
|
|||||||
$attr_value = StoreProductAttrValue::where('product_id', $id)->findOrEmpty();
|
$attr_value = StoreProductAttrValue::where('product_id', $id)->findOrEmpty();
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
|
$dealCate = self::dealChangeCate($find['cate_id']);
|
||||||
$product = [
|
$product = [
|
||||||
'product_id' => $find['id'],
|
'product_id' => $find['id'],
|
||||||
'image' => $find['image'],
|
'image' => $find['image'],
|
||||||
@ -318,6 +319,8 @@ class StoreProductLogic extends BaseLogic
|
|||||||
'keyword' => $find['keyword'],
|
'keyword' => $find['keyword'],
|
||||||
'bar_code' => $find['bar_code'],
|
'bar_code' => $find['bar_code'],
|
||||||
'cate_id' => $find['cate_id'],
|
'cate_id' => $find['cate_id'],
|
||||||
|
'top_cate_id' => $dealCate['top_cate_id'],
|
||||||
|
'two_cate_id' => $dealCate['two_cate_id'],
|
||||||
'price' => $find['price'],
|
'price' => $find['price'],
|
||||||
'unit' => $find['unit'],
|
'unit' => $find['unit'],
|
||||||
'store_id' => $store_id,
|
'store_id' => $store_id,
|
||||||
|
@ -46,6 +46,7 @@ class StoreStorageSend implements Consumer
|
|||||||
$attr_value = StoreProductAttrValue::where('product_id', $product_arr['id'])->findOrEmpty();
|
$attr_value = StoreProductAttrValue::where('product_id', $product_arr['id'])->findOrEmpty();
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
|
$dealCate = self::dealChangeCate($find['cate_id']);
|
||||||
$product = [
|
$product = [
|
||||||
'product_id' => $find['id'],
|
'product_id' => $find['id'],
|
||||||
'image' => $find['image'],
|
'image' => $find['image'],
|
||||||
@ -54,6 +55,8 @@ class StoreStorageSend implements Consumer
|
|||||||
'keyword' => $find['keyword'],
|
'keyword' => $find['keyword'],
|
||||||
'bar_code' => $find['bar_code'],
|
'bar_code' => $find['bar_code'],
|
||||||
'cate_id' => $find['cate_id'],
|
'cate_id' => $find['cate_id'],
|
||||||
|
'top_cate_id' => $dealCate['top_cate_id'],
|
||||||
|
'two_cate_id' => $dealCate['two_cate_id'],
|
||||||
'price' => $find['price'],
|
'price' => $find['price'],
|
||||||
// 'cost' => $find['cost'], //v1.0
|
// 'cost' => $find['cost'], //v1.0
|
||||||
'cost' => $find['cost'],
|
'cost' => $find['cost'],
|
||||||
@ -179,4 +182,31 @@ class StoreStorageSend implements Consumer
|
|||||||
Log::error('store-storage队列消费失败: ' . $e->getMessage() . ',line:' . $e->getLine() . ',file:' . $e->getFile());
|
Log::error('store-storage队列消费失败: ' . $e->getMessage() . ',line:' . $e->getLine() . ',file:' . $e->getFile());
|
||||||
return $package;
|
return $package;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 传入三级或者二级分类返还上级分类 一级那全是相同
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user