|
...
|
...
|
@@ -89,29 +89,22 @@ class ProductLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/21 17:11
|
|
|
|
*/
|
|
|
|
public function delete($ids, $map =[]){
|
|
|
|
$ids= array_filter(Arr::splitFilterToArray($ids), 'intval');
|
|
|
|
public function productDelete(){
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
foreach ($ids as $k => $id) {
|
|
|
|
$info = $this->getCacheInfo($id);
|
|
|
|
if(!$info){
|
|
|
|
unset($ids[$k]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
foreach ($this->param['ids'] as $k => $id) {
|
|
|
|
$info = $this->model->read(['id'=>$id]);
|
|
|
|
if($info->status == Product::STATUS_RECYCLE){
|
|
|
|
//删除路由映射
|
|
|
|
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
|
|
|
//删除当前产品模版
|
|
|
|
$this->delProductModule($id);
|
|
|
|
$this->model->del(['id'=>['in',$this->param['ids']]]);
|
|
|
|
}else{
|
|
|
|
//回收站
|
|
|
|
parent::save(['id' => $id, 'status' => Product::STATUS_RECYCLE]);
|
|
|
|
unset($ids[$k]);
|
|
|
|
$this->model->edit(['status'=>2],['id'=>$id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
parent::delete($ids);
|
|
|
|
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
...
|
...
|
|