作者 lyh

gx

... ... @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command
public function handle(){
//获取所有项目
$projectModel = new Project();
$list = $projectModel->list(['id'=>['in',[475]]],'id',['id']);
$list = $projectModel->list(['id'=>['in',[302]]],'id',['id']);
echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL;
try {
foreach ($list as $v) {
... ...
... ... @@ -199,7 +199,7 @@ class BlogLogic extends BaseLogic
foreach ($category as $v){
$str .= $v.',';
}
return !empty($str) ? ','.$str : '';
return !empty(trim($str,',')) ? ','.$str.',' : '';
}
/**
... ...
... ... @@ -217,7 +217,7 @@ class NewsLogic extends BaseLogic
foreach ($category as $v){
$str .= $v.',';
}
return !empty($str) ? ','.$str : '';
return !empty(trim($str,',')) ? ','.$str.',' : '';
}
/**
... ...
... ... @@ -248,7 +248,7 @@ class CategoryLogic extends BaseLogic
$str .= $v.',';
}
}
return !empty($str) ? ','.$str : '';
return !empty(trim($str,',')) ? ','.$str.',' : '';
}
/**
... ...
... ... @@ -197,6 +197,7 @@ class ProductLogic extends BaseLogic
* @time :2023/10/26 9:49
*/
public function editList(){
$category_ids = $this->param['category_id'];
$this->param['category_id'] = $this->handleListCategory($this->param['category_id']);
$this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']);
if(isset($this->param['gallery']) && !empty($this->param['gallery'])){
... ... @@ -215,6 +216,8 @@ class ProductLogic extends BaseLogic
$this->editProductRoute($this->param['id'],$this->param['route']);
}
$this->model->edit($this->param,['id'=>$this->param['id']]);
//产品分类关联
CategoryRelated::saveRelated($this->param['id'], $category_ids);
}catch (\Exception $e){
$this->fail('系统错误,请连续管理员');
}
... ... @@ -317,7 +320,7 @@ class ProductLogic extends BaseLogic
$str .= $v.',';
}
}
return !empty($str) ? ','.$str : '';
return !empty(trim($str,',')) ? ','.$str.',' : '';
}
/**
... ...