|
...
|
...
|
@@ -948,8 +948,18 @@ class ProductLogic extends BaseLogic |
|
|
|
* @time :2024/9/20 16:48
|
|
|
|
*/
|
|
|
|
public function batchSetKeyword(){
|
|
|
|
$this->param['keyword_id'] = ','.implode(',',$this->param['keyword_id']).',';
|
|
|
|
$this->edit(['keyword_id'=>$this->param['keyword_id']],['id'=>['in',$this->param['id']]]);
|
|
|
|
if(isset($this->param['is_cover']) && $this->param['is_cover'] == 1){//覆盖
|
|
|
|
$this->param['keyword_id'] = ','.implode(',',$this->param['keyword_id']).',';
|
|
|
|
$this->edit(['keyword_id'=>$this->param['keyword_id']],['id'=>['in',$this->param['id']]]);
|
|
|
|
}else{
|
|
|
|
foreach ($this->param['id'] as $id){
|
|
|
|
//获取当前产品的分类
|
|
|
|
$productInfo = $this->model->read(['id'=>$id],['id','keyword_id']);
|
|
|
|
$keyword_ids_arr = array_values(array_unique(array_merge($productInfo['keyword_id'],$this->param['keyword_id'])));
|
|
|
|
$keyword_ids = ','.implode(',',$keyword_ids_arr).',';
|
|
|
|
$this->model->edit(['keyword_id'=>$keyword_ids],['id'=>$id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|