作者 lyh

gx

... ... @@ -56,6 +56,8 @@ class UpdateProductCategory extends Command
foreach ($list as $v) {
echo date('Y-m-d H:i:s') . ' start: ' . $v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$cateRelatedModel = new CategoryRelated();
$cateRelatedModel->truncate();
$this->getUpdateProductCategory();
DB::disconnect('custom_mysql');
}
... ... @@ -91,13 +93,6 @@ class UpdateProductCategory extends Command
* @time :2023/12/6 16:20
*/
public function handleCategory($id,$cate_arr){
$productModel = new Product();
$productInfo = $productModel->read(['id'=>$id]);
if($productInfo == false){
$cateRelatedModel = new CategoryRelated();
$cateRelatedModel->del(['product_id'=>$id]);
return true;
}
if(!empty($cate_arr) && is_array($cate_arr)){
foreach ($cate_arr as $v){
$categoryModel = new Category();
... ...