|
@@ -442,14 +442,13 @@ class NewsLogic extends BaseLogic |
|
@@ -442,14 +442,13 @@ class NewsLogic extends BaseLogic |
|
442
|
foreach ($this->param['id'] as $id){
|
442
|
foreach ($this->param['id'] as $id){
|
|
443
|
//获取当前产品的分类
|
443
|
//获取当前产品的分类
|
|
444
|
$newsInfo = $this->model->read(['id'=>$id],['id','category_id']);
|
444
|
$newsInfo = $this->model->read(['id'=>$id],['id','category_id']);
|
|
445
|
- @file_put_contents(storage_path('logs/lyh_error.log'), var_export($newsInfo, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
446
|
$category_ids = explode(',',trim($newsInfo['category_id'],','));
|
445
|
$category_ids = explode(',',trim($newsInfo['category_id'],','));
|
|
447
|
$category_ids_arr = array_values(array_unique(array_merge($category_ids,$this->param['category_id'])));
|
446
|
$category_ids_arr = array_values(array_unique(array_merge($category_ids,$this->param['category_id'])));
|
|
448
|
$category_ids_str = ','.implode(',',$category_ids_arr).',';
|
447
|
$category_ids_str = ','.implode(',',$category_ids_arr).',';
|
|
449
|
- $newsModel = new News();
|
|
|
|
450
|
- $newsModel->edit(['category_id'=>$category_ids_str],['id'=>$id]);
|
448
|
+ $this->model->edit(['category_id'=>$category_ids_str],['id'=>$id]);
|
|
451
|
}
|
449
|
}
|
|
452
|
}
|
450
|
}
|
|
|
|
451
|
+ DB::connection('custom_mysql')->commit();
|
|
453
|
}catch (\Exception $e){
|
452
|
}catch (\Exception $e){
|
|
454
|
DB::connection('custom_mysql')->rollBack();
|
453
|
DB::connection('custom_mysql')->rollBack();
|
|
455
|
$this->fail('系统错误,请联系管理员');
|
454
|
$this->fail('系统错误,请联系管理员');
|