作者 lyh

gx

... ... @@ -442,16 +442,11 @@ class NewsLogic extends BaseLogic
foreach ($this->param['id'] as $id){
//获取当前产品的分类
$newsInfo = $this->model->read(['id'=>$id],['id','category_id']);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($newsInfo, true) . PHP_EOL, FILE_APPEND);
$category_ids = explode(',',trim($newsInfo['category_id'],','));
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($category_ids, true) . PHP_EOL, FILE_APPEND);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($this->param['category_id'], true) . PHP_EOL, FILE_APPEND);
$category_ids_arr = array_values(array_unique(array_merge($category_ids,$this->param['category_id'])));
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($category_ids_arr, true) . PHP_EOL, FILE_APPEND);
$category_ids = ','.implode(',',$category_ids_arr).',';
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($category_ids, true) . PHP_EOL, FILE_APPEND);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($id, true) . PHP_EOL, FILE_APPEND);
$this->model->edit(['category_id'=>$category_ids],['id'=>$id]);
$rs = $this->model->edit(['category_id'=>$category_ids],['id'=>$id]);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($rs, true) . PHP_EOL, FILE_APPEND);
}
}
}catch (\Exception $e){
... ...