正在显示
1 个修改的文件
包含
2 行增加
和
7 行删除
| @@ -56,6 +56,8 @@ class UpdateProductCategory extends Command | @@ -56,6 +56,8 @@ class UpdateProductCategory extends Command | ||
| 56 | foreach ($list as $v) { | 56 | foreach ($list as $v) { |
| 57 | echo date('Y-m-d H:i:s') . ' start: ' . $v['id'] . PHP_EOL; | 57 | echo date('Y-m-d H:i:s') . ' start: ' . $v['id'] . PHP_EOL; |
| 58 | ProjectServer::useProject($v['id']); | 58 | ProjectServer::useProject($v['id']); |
| 59 | + $cateRelatedModel = new CategoryRelated(); | ||
| 60 | + $cateRelatedModel->truncate(); | ||
| 59 | $this->getUpdateProductCategory(); | 61 | $this->getUpdateProductCategory(); |
| 60 | DB::disconnect('custom_mysql'); | 62 | DB::disconnect('custom_mysql'); |
| 61 | } | 63 | } |
| @@ -91,13 +93,6 @@ class UpdateProductCategory extends Command | @@ -91,13 +93,6 @@ class UpdateProductCategory extends Command | ||
| 91 | * @time :2023/12/6 16:20 | 93 | * @time :2023/12/6 16:20 |
| 92 | */ | 94 | */ |
| 93 | public function handleCategory($id,$cate_arr){ | 95 | public function handleCategory($id,$cate_arr){ |
| 94 | - $productModel = new Product(); | ||
| 95 | - $productInfo = $productModel->read(['id'=>$id]); | ||
| 96 | - if($productInfo == false){ | ||
| 97 | - $cateRelatedModel = new CategoryRelated(); | ||
| 98 | - $cateRelatedModel->del(['product_id'=>$id]); | ||
| 99 | - return true; | ||
| 100 | - } | ||
| 101 | if(!empty($cate_arr) && is_array($cate_arr)){ | 96 | if(!empty($cate_arr) && is_array($cate_arr)){ |
| 102 | foreach ($cate_arr as $v){ | 97 | foreach ($cate_arr as $v){ |
| 103 | $categoryModel = new Category(); | 98 | $categoryModel = new Category(); |
-
请 注册 或 登录 后发表评论