feat: 增加状态字段搜索功能
This commit is contained in:
parent
a059048407
commit
615067f01e
@ -28,7 +28,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['product_id', 'cate_id','store_id'],
|
'=' => ['product_id', 'cate_id','store_id','status'],
|
||||||
'%pipe_like%' => ['store_name_code'=>'store_name|bar_code'],
|
'%pipe_like%' => ['store_name_code'=>'store_name|bar_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace app\admin\logic\store_branch_product;
|
namespace app\admin\logic\store_branch_product;
|
||||||
|
|
||||||
|
use app\admin\logic\store_product\StoreProductLogic;
|
||||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@ -57,26 +57,26 @@ class StoreBranchProductLogic extends BaseLogic
|
|||||||
'store_name'=>$params['store_name'],
|
'store_name'=>$params['store_name'],
|
||||||
'image'=>$params['image'],
|
'image'=>$params['image'],
|
||||||
'price'=>$params['price'],
|
'price'=>$params['price'],
|
||||||
'bar_code'=>$params['bar_code'],
|
|
||||||
'unit'=>$params['unit'],
|
'unit'=>$params['unit'],
|
||||||
'status'=>$params['status'],
|
'status'=>$params['status'],
|
||||||
];
|
];
|
||||||
|
$StoreProduct=StoreBranchProduct::where('id', $params['id'])->find();
|
||||||
if(isset($params['cate_id'])){
|
if(isset($params['cate_id'])){
|
||||||
$StoreProduct=StoreBranchProduct::where('id', $params['id'])->find();
|
|
||||||
if ($StoreProduct['cate_id'] != $params['cate_id']) {
|
if ($StoreProduct['cate_id'] != $params['cate_id']) {
|
||||||
$find=Db::name('store_product_cate')->where(['cate_id'=>$params['cate_id'],'store_id'=>$StoreProduct['store_id']])->find();
|
self::store_product_cate_update($params['id'], $StoreProduct['cate_id'], $StoreProduct['store_id']);
|
||||||
if($find['pid']>0){
|
|
||||||
$two=Db::name('store_product_cate')->where(['cate_id'=>$find['pid'],'store_id'=>$StoreProduct['store_id']])->find();
|
|
||||||
Db::name('store_product_cate')->where('id',$find['id'])->dec('count',1)->update();
|
|
||||||
Db::name('store_product_cate')->where('id',$two['id'])->dec('count',1)->update();
|
|
||||||
if($two['pid']>0){
|
|
||||||
Db::name('store_product_cate')->where('id',$two['pid'])->dec('count',1)->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Redis::send('store-storage', ['product_arr' => ['id' => $params['id'], 'stock' => 0], 'store_id' =>$StoreProduct['store_id'], 'admin_id' => Request()->adminId]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
$data['cate_id']=$params['cate_id'];
|
$data['cate_id']=$params['cate_id'];
|
||||||
|
}else{
|
||||||
|
if($params['statis']!=$StoreProduct['statis']){
|
||||||
|
if($params['statis']==1){
|
||||||
|
StoreProductLogic::updateGoodsclass($params['cate_id']);
|
||||||
|
}else{
|
||||||
|
self::store_product_cate_update($params['id'], $StoreProduct['cate_id'], $StoreProduct['store_id'],0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::store_product_cate_update($params['id'], $StoreProduct['cate_id'], $StoreProduct['store_id']);
|
||||||
|
|
||||||
}
|
}
|
||||||
StoreBranchProduct::where('id', $params['id'])->update($data);
|
StoreBranchProduct::where('id', $params['id'])->update($data);
|
||||||
|
|
||||||
@ -89,7 +89,21 @@ class StoreBranchProductLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function store_product_cate_update($id,$cate_id,$store_id,$type=1)
|
||||||
|
{
|
||||||
|
$find=Db::name('store_product_cate')->where(['cate_id'=>$cate_id,'store_id'=>$store_id])->find();
|
||||||
|
if($find['pid']>0){
|
||||||
|
$two=Db::name('store_product_cate')->where(['cate_id'=>$find['pid'],'store_id'=>$store_id])->find();
|
||||||
|
Db::name('store_product_cate')->where('id',$find['id'])->dec('count',1)->update();
|
||||||
|
Db::name('store_product_cate')->where('id',$two['id'])->dec('count',1)->update();
|
||||||
|
if($two['pid']>0){
|
||||||
|
Db::name('store_product_cate')->where('id',$two['pid'])->dec('count',1)->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($type==1){
|
||||||
|
StoreProductLogic::updateGoodsclass($cate_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @notes 删除门店商品
|
* @notes 删除门店商品
|
||||||
* @param array $params
|
* @param array $params
|
||||||
|
Loading…
x
Reference in New Issue
Block a user