|
@@ -89,29 +89,22 @@ class ProductLogic extends BaseLogic |
|
@@ -89,29 +89,22 @@ class ProductLogic extends BaseLogic |
|
89
|
* @method :post
|
89
|
* @method :post
|
|
90
|
* @time :2023/8/21 17:11
|
90
|
* @time :2023/8/21 17:11
|
|
91
|
*/
|
91
|
*/
|
|
92
|
- public function delete($ids, $map =[]){
|
|
|
|
93
|
- $ids= array_filter(Arr::splitFilterToArray($ids), 'intval');
|
92
|
+ public function productDelete(){
|
|
94
|
DB::beginTransaction();
|
93
|
DB::beginTransaction();
|
|
95
|
try {
|
94
|
try {
|
|
96
|
- foreach ($ids as $k => $id) {
|
|
|
|
97
|
- $info = $this->getCacheInfo($id);
|
|
|
|
98
|
- if(!$info){
|
|
|
|
99
|
- unset($ids[$k]);
|
|
|
|
100
|
- continue;
|
|
|
|
101
|
- }
|
95
|
+ foreach ($this->param['ids'] as $k => $id) {
|
|
|
|
96
|
+ $info = $this->model->read(['id'=>$id]);
|
|
102
|
if($info->status == Product::STATUS_RECYCLE){
|
97
|
if($info->status == Product::STATUS_RECYCLE){
|
|
103
|
//删除路由映射
|
98
|
//删除路由映射
|
|
104
|
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
99
|
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
|
105
|
//删除当前产品模版
|
100
|
//删除当前产品模版
|
|
106
|
$this->delProductModule($id);
|
101
|
$this->delProductModule($id);
|
|
|
|
102
|
+ $this->model->del(['id'=>['in',$this->param['ids']]]);
|
|
107
|
}else{
|
103
|
}else{
|
|
108
|
//回收站
|
104
|
//回收站
|
|
109
|
- parent::save(['id' => $id, 'status' => Product::STATUS_RECYCLE]);
|
|
|
|
110
|
- unset($ids[$k]);
|
105
|
+ $this->model->edit(['status'=>2],['id'=>$id]);
|
|
111
|
}
|
106
|
}
|
|
112
|
}
|
107
|
}
|
|
113
|
- parent::delete($ids);
|
|
|
|
114
|
-
|
|
|
|
115
|
DB::commit();
|
108
|
DB::commit();
|
|
116
|
}catch (\Exception $e){
|
109
|
}catch (\Exception $e){
|
|
117
|
DB::rollBack();
|
110
|
DB::rollBack();
|