|
@@ -86,15 +86,29 @@ class ProductLogic extends BaseLogic |
|
@@ -86,15 +86,29 @@ class ProductLogic extends BaseLogic |
|
86
|
|
86
|
|
|
87
|
DB::beginTransaction();
|
87
|
DB::beginTransaction();
|
|
88
|
try {
|
88
|
try {
|
|
89
|
- foreach ($ids as $id){
|
|
|
|
90
|
- //删除路由映射
|
|
|
|
91
|
- RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
89
|
+ foreach ($ids as $k => $id) {
|
|
92
|
|
90
|
|
|
93
|
- //删除分类关联
|
|
|
|
94
|
- CategoryRelated::where('product_id', $id)->delete();
|
91
|
+ $info = $this->getCacheInfo($id);
|
|
|
|
92
|
+ if(!$info){
|
|
|
|
93
|
+ unset($ids[$k]);
|
|
|
|
94
|
+ continue;
|
|
|
|
95
|
+ }
|
|
95
|
|
96
|
|
|
96
|
- //删除关键词关联
|
|
|
|
97
|
- KeywordRelated::where('product_id', $id)->delete();
|
97
|
+ if($info->status == Product::STATUS_RECYCLE){
|
|
|
|
98
|
+ //删除路由映射
|
|
|
|
99
|
+ RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
|
|
|
|
100
|
+
|
|
|
|
101
|
+ //删除分类关联
|
|
|
|
102
|
+ CategoryRelated::where('product_id', $id)->delete();
|
|
|
|
103
|
+
|
|
|
|
104
|
+ //删除关键词关联
|
|
|
|
105
|
+ KeywordRelated::where('product_id', $id)->delete();
|
|
|
|
106
|
+ }else{
|
|
|
|
107
|
+ //回收站
|
|
|
|
108
|
+ $info->status = Product::STATUS_RECYCLE;
|
|
|
|
109
|
+ $info->save();
|
|
|
|
110
|
+ unset($ids[$k]);
|
|
|
|
111
|
+ }
|
|
98
|
}
|
112
|
}
|
|
99
|
parent::delete($ids);
|
113
|
parent::delete($ids);
|
|
100
|
|
114
|
|