|
...
|
...
|
@@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\News; |
|
|
|
|
|
|
|
use App\Helper\Translate;
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Com\NoticeLog;
|
|
|
|
use App\Models\News\News;
|
|
|
|
use App\Models\News\News as NewsModel;
|
|
|
|
use App\Models\News\NewsCategory as NewsCategoryModel;
|
|
...
|
...
|
@@ -83,22 +84,27 @@ class NewsCategoryLogic extends BaseLogic |
|
|
|
$this->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :删除新闻分类
|
|
|
|
* @return array
|
|
|
|
* @throws \App\Exceptions\BsideGlobalException
|
|
|
|
* @author :liyuhang
|
|
|
|
* @method
|
|
|
|
* @remark :删除分类
|
|
|
|
* @name :del_news_category
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/5/16 14:58
|
|
|
|
*/
|
|
|
|
public function del_news_category(){
|
|
|
|
foreach ($this->param['id'] as $id){
|
|
|
|
$this->delRoute($id);
|
|
|
|
$this->model->del(['id'=>$id]);
|
|
|
|
//同步删除产品字段category_id
|
|
|
|
$newsModel = new NewsModel();
|
|
|
|
$newsModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]);
|
|
|
|
$newsModel->edit(['category_id'=>null],['category_id'=>',']);
|
|
|
|
$ids = $this->param['id'];
|
|
|
|
foreach ($ids as $id){
|
|
|
|
$str = [];
|
|
|
|
$this->getAllSub($id,$str);
|
|
|
|
$str[] = $id;
|
|
|
|
foreach ($str as $value){
|
|
|
|
//删除路由
|
|
|
|
$this->delRoute($value);
|
|
|
|
$this->model->del(['id'=>$value]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NoticeLog::createLog(NoticeLog::DELETE_NEWS_CATEGORY, ['project_id' => $this->user['project_id']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|