正在显示
11 个修改的文件
包含
129 行增加
和
146 行删除
| @@ -103,7 +103,7 @@ class BlogCategoryController extends BaseController | @@ -103,7 +103,7 @@ class BlogCategoryController extends BaseController | ||
| 103 | 'id.required' => 'ID不能为空', | 103 | 'id.required' => 'ID不能为空', |
| 104 | 'id.array' => 'ID为数组', | 104 | 'id.array' => 'ID为数组', |
| 105 | ]); | 105 | ]); |
| 106 | - $blogCategoryLogic->del_blog_category(); | 106 | + $blogCategoryLogic->delBlogCategory(); |
| 107 | //TODO::写入操作日志 | 107 | //TODO::写入操作日志 |
| 108 | $this->response('success'); | 108 | $this->response('success'); |
| 109 | } | 109 | } |
| @@ -126,7 +126,7 @@ class BlogController extends BaseController | @@ -126,7 +126,7 @@ class BlogController extends BaseController | ||
| 126 | 'id.required' => 'ID不能为空', | 126 | 'id.required' => 'ID不能为空', |
| 127 | 'id.array' => 'ID为数组', | 127 | 'id.array' => 'ID为数组', |
| 128 | ]); | 128 | ]); |
| 129 | - $blogLogic->blog_status(); | 129 | + $blogLogic->blogStatus(); |
| 130 | //TODO::写入日志 | 130 | //TODO::写入日志 |
| 131 | $this->response('success'); | 131 | $this->response('success'); |
| 132 | } | 132 | } |
| @@ -143,7 +143,7 @@ class BlogController extends BaseController | @@ -143,7 +143,7 @@ class BlogController extends BaseController | ||
| 143 | 'id.required' => 'ID不能为空', | 143 | 'id.required' => 'ID不能为空', |
| 144 | 'id.array' => 'ID为数组', | 144 | 'id.array' => 'ID为数组', |
| 145 | ]); | 145 | ]); |
| 146 | - $blogLogic->blog_del(); | 146 | + $blogLogic->blogDel(); |
| 147 | $this->response('success'); | 147 | $this->response('success'); |
| 148 | } | 148 | } |
| 149 | 149 |
| @@ -82,28 +82,14 @@ class NavController extends BaseController | @@ -82,28 +82,14 @@ class NavController extends BaseController | ||
| 82 | */ | 82 | */ |
| 83 | public function urls(){ | 83 | public function urls(){ |
| 84 | // todo::需要配合 c端来 | 84 | // todo::需要配合 c端来 |
| 85 | - return $this->success([ | ||
| 86 | - [ | ||
| 87 | - 'url' => 'index', | ||
| 88 | - 'name' => '首页' | ||
| 89 | - ], | ||
| 90 | - [ | ||
| 91 | - 'url' => 'news', | ||
| 92 | - 'name' => '新闻' | ||
| 93 | - ], | ||
| 94 | - [ | ||
| 95 | - 'url' => 'products', | ||
| 96 | - 'name' => '产品' | ||
| 97 | - ], | ||
| 98 | - [ | ||
| 99 | - 'url' => 'search', | ||
| 100 | - 'name' => '搜索页' | ||
| 101 | - ], | ||
| 102 | - [ | ||
| 103 | - 'url' => 'blog', | ||
| 104 | - 'name' => '博客' | ||
| 105 | - ] | 85 | + $data = $this->success([ |
| 86 | + ['url'=>'index', 'name'=>'首页'], | ||
| 87 | + ['url'=>'news', 'name'=>'新闻'], | ||
| 88 | + ['url'=>'products', 'name'=>'产品'], | ||
| 89 | + ['url'=>'search', 'name'=>'搜索页'], | ||
| 90 | + ['url'=>'blog', 'name'=>'博客'] | ||
| 106 | ]); | 91 | ]); |
| 92 | + $this->response('success',Code::SUCCESS,$data); | ||
| 107 | } | 93 | } |
| 108 | 94 | ||
| 109 | /** | 95 | /** |
| @@ -61,30 +61,17 @@ class NewsCategoryController extends BaseController | @@ -61,30 +61,17 @@ class NewsCategoryController extends BaseController | ||
| 61 | $info['url'] = $this->user['domain'] . $info['alias']; | 61 | $info['url'] = $this->user['domain'] . $info['alias']; |
| 62 | $this->response('success',Code::SUCCESS,$info); | 62 | $this->response('success',Code::SUCCESS,$info); |
| 63 | } | 63 | } |
| 64 | - /** | ||
| 65 | - * @name :添加分类 | ||
| 66 | - * @author :liyuhang | ||
| 67 | - * @method | ||
| 68 | - */ | ||
| 69 | - public function add(NewsCategoryRequest $request,NewsCategoryLogic $newsCategoryLogic){ | ||
| 70 | - $request->validated(); | ||
| 71 | - //添加时,验证分类上级分类是否有,有则更新到当前分类中,没有时直接添加 | ||
| 72 | - $newsCategoryLogic->add_news_category(); | ||
| 73 | - $this->response('success'); | ||
| 74 | - } | ||
| 75 | 64 | ||
| 76 | /** | 65 | /** |
| 77 | - * @name :编辑分类 | ||
| 78 | - * @author :liyuhang | ||
| 79 | - * @method | 66 | + * @remark :保存数据 |
| 67 | + * @name :save | ||
| 68 | + * @author :lyh | ||
| 69 | + * @method :post | ||
| 70 | + * @time :2023/9/7 14:51 | ||
| 80 | */ | 71 | */ |
| 81 | - public function edit(NewsCategoryRequest $request,NewsCategoryLogic $newsCategoryLogic){ | ||
| 82 | - $request->validate([ | ||
| 83 | - 'id'=>['required'] | ||
| 84 | - ],[ | ||
| 85 | - 'id.required' => 'ID不能为空' | ||
| 86 | - ]); | ||
| 87 | - $newsCategoryLogic->edit_news_category(); | 72 | + public function save(NewsCategoryRequest $request,NewsCategoryLogic $newsCategoryLogic){ |
| 73 | + $request->validated(); | ||
| 74 | + $newsCategoryLogic->newsCategorySave(); | ||
| 88 | $this->response('success'); | 75 | $this->response('success'); |
| 89 | } | 76 | } |
| 90 | 77 |
| @@ -153,25 +153,35 @@ class BlogCategoryLogic extends BaseLogic | @@ -153,25 +153,35 @@ class BlogCategoryLogic extends BaseLogic | ||
| 153 | * @author :liyuhang | 153 | * @author :liyuhang |
| 154 | * @method | 154 | * @method |
| 155 | */ | 155 | */ |
| 156 | - public function del_blog_category(){ | ||
| 157 | - $ids = $this->param['id']; | ||
| 158 | - foreach ($ids as $v){ | ||
| 159 | - //查询是否有子分类 | ||
| 160 | - $rs = $this->model->read(['pid'=>$v],['id']); | ||
| 161 | - if($rs !== false){ | ||
| 162 | - $this->response('当前分类拥有子分类不允许删除'); | ||
| 163 | - } | ||
| 164 | - //查看当前分内下是否有博客 | ||
| 165 | - $blogModel = new BlogModel(); | ||
| 166 | - $rs = $blogModel->read(['category_id'=>$v],['id']); | ||
| 167 | - if($rs !== false){ | ||
| 168 | - $this->response('当前分类拥有博客,不允许删除'); | ||
| 169 | - } | 156 | + public function delBlogCategory(){ |
| 157 | + foreach ($this->param['id'] as $id){ | ||
| 158 | + $this->verifyIsDelete($id); | ||
| 170 | //删除路由 | 159 | //删除路由 |
| 171 | - $this->delRoute($v); | 160 | + $this->delRoute($id); |
| 161 | + $this->model->del(['id'=>$id]); | ||
| 162 | + } | ||
| 163 | + return $this->success(); | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + /** | ||
| 167 | + * @remark :验证是否可删除 | ||
| 168 | + * @name :VerifyIsDelete | ||
| 169 | + * @author :lyh | ||
| 170 | + * @method :post | ||
| 171 | + * @time :2023/9/7 14:40 | ||
| 172 | + */ | ||
| 173 | + public function verifyIsDelete($id){ | ||
| 174 | + //查询是否有子分类 | ||
| 175 | + $rs = $this->model->read(['pid'=>$id],['id']); | ||
| 176 | + if($rs !== false){ | ||
| 177 | + $this->response('当前分类拥有子分类不允许删除'); | ||
| 178 | + } | ||
| 179 | + //查看当前分内下是否有博客 | ||
| 180 | + $blogModel = new BlogModel(); | ||
| 181 | + $rs = $blogModel->read(['category_id'=>$id],['id']); | ||
| 182 | + if($rs !== false){ | ||
| 183 | + $this->response('当前分类拥有博客,不允许删除'); | ||
| 172 | } | 184 | } |
| 173 | - $this->param['id'] = ['in',$this->param['id']]; | ||
| 174 | - $this->model->del($this->param); | ||
| 175 | return $this->success(); | 185 | return $this->success(); |
| 176 | } | 186 | } |
| 177 | 187 |
| @@ -150,7 +150,7 @@ class BlogLogic extends BaseLogic | @@ -150,7 +150,7 @@ class BlogLogic extends BaseLogic | ||
| 150 | * @author :liyuhang | 150 | * @author :liyuhang |
| 151 | * @method | 151 | * @method |
| 152 | */ | 152 | */ |
| 153 | - public function blog_status(){ | 153 | + public function blogStatus(){ |
| 154 | $this->param['operator_id'] = $this->user['id']; | 154 | $this->param['operator_id'] = $this->user['id']; |
| 155 | $rs = $this->model->edit($this->param,['id'=>['in',$this->param['id']]]); | 155 | $rs = $this->model->edit($this->param,['id'=>['in',$this->param['id']]]); |
| 156 | if($rs === false){ | 156 | if($rs === false){ |
| @@ -165,14 +165,12 @@ class BlogLogic extends BaseLogic | @@ -165,14 +165,12 @@ class BlogLogic extends BaseLogic | ||
| 165 | * @author :liyuhang | 165 | * @author :liyuhang |
| 166 | * @method | 166 | * @method |
| 167 | */ | 167 | */ |
| 168 | - public function blog_del(){ | ||
| 169 | - $ids = $this->param['id']; | 168 | + public function blogDel(){ |
| 170 | DB::beginTransaction(); | 169 | DB::beginTransaction(); |
| 171 | try { | 170 | try { |
| 172 | - $this->param['id'] = ['in',$this->param['id']]; | ||
| 173 | - $this->del($this->param,$ids); | ||
| 174 | - foreach ($ids as $id){ | 171 | + foreach ($this->param['id'] as $id){ |
| 175 | $this->delRoute($id); | 172 | $this->delRoute($id); |
| 173 | + $this->model->del(['id'=>$id]); | ||
| 176 | } | 174 | } |
| 177 | DB::commit(); | 175 | DB::commit(); |
| 178 | }catch (Exception $e){ | 176 | }catch (Exception $e){ |
| @@ -5,6 +5,8 @@ namespace App\Http\Logic\Bside\Nav; | @@ -5,6 +5,8 @@ namespace App\Http\Logic\Bside\Nav; | ||
| 5 | 5 | ||
| 6 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | use App\Models\Nav\BNav; | 7 | use App\Models\Nav\BNav; |
| 8 | +use App\Models\RouteMap\RouteMap; | ||
| 9 | +use Illuminate\Support\Facades\DB; | ||
| 8 | 10 | ||
| 9 | 11 | ||
| 10 | /** | 12 | /** |
| @@ -32,23 +34,41 @@ class NavLogic extends BaseLogic | @@ -32,23 +34,41 @@ class NavLogic extends BaseLogic | ||
| 32 | */ | 34 | */ |
| 33 | public function navSave() | 35 | public function navSave() |
| 34 | { | 36 | { |
| 35 | - if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 36 | - $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 37 | - if($this->param['pid'] == $info['id']){ | ||
| 38 | - $this->fail('不允许成为自己的上级'); | 37 | + DB::beginTransaction(); |
| 38 | + try { | ||
| 39 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 40 | + $this->handleEditParam();//验证是否可编辑分类 | ||
| 41 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 42 | + }else{ | ||
| 43 | + $this->param['project_id'] = $this->user['project_id']; | ||
| 44 | + $this->model->add($this->param); | ||
| 39 | } | 45 | } |
| 40 | - $pid_info = $this->model->read(['pid'=>$this->param['id']]); | ||
| 41 | - if(($pid_info !== false) && $this->param['pid'] != $info['pid']){ | ||
| 42 | - $this->fail('当前菜单拥有子集不允许修改上级'); | ||
| 43 | - } | ||
| 44 | - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 45 | - }else{ | ||
| 46 | - $this->param['project_id'] = $this->user['project_id']; | ||
| 47 | - $rs = $this->model->add($this->param); | ||
| 48 | - } | ||
| 49 | - if($rs === false){ | 46 | + DB::commit(); |
| 47 | + }catch (\Exception $e){ | ||
| 48 | + DB::rollBack(); | ||
| 50 | $this->fail('error'); | 49 | $this->fail('error'); |
| 51 | } | 50 | } |
| 51 | + //编辑菜单后,通知更新 | ||
| 52 | + $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']); | ||
| 53 | + return $this->success(); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * @remark :验证是否可编辑 | ||
| 58 | + * @name :handleEditParam | ||
| 59 | + * @author :lyh | ||
| 60 | + * @method :post | ||
| 61 | + * @time :2023/9/7 14:36 | ||
| 62 | + */ | ||
| 63 | + public function handleEditParam(){ | ||
| 64 | + $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 65 | + if($this->param['pid'] == $info['id']){ | ||
| 66 | + $this->fail('不允许成为自己的上级'); | ||
| 67 | + } | ||
| 68 | + $pid_info = $this->model->read(['pid'=>$this->param['id']]); | ||
| 69 | + if(($pid_info !== false) && $this->param['pid'] != $info['pid']){ | ||
| 70 | + $this->fail('当前菜单拥有子集不允许修改上级'); | ||
| 71 | + } | ||
| 52 | return $this->success(); | 72 | return $this->success(); |
| 53 | } | 73 | } |
| 54 | 74 | ||
| @@ -70,6 +90,8 @@ class NavLogic extends BaseLogic | @@ -70,6 +90,8 @@ class NavLogic extends BaseLogic | ||
| 70 | if($rs === false){ | 90 | if($rs === false){ |
| 71 | $this->fail('error'); | 91 | $this->fail('error'); |
| 72 | } | 92 | } |
| 93 | + //编辑菜单后,通知更新 | ||
| 94 | + $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']); | ||
| 73 | return $this->success(); | 95 | return $this->success(); |
| 74 | } | 96 | } |
| 75 | 97 |
| @@ -44,59 +44,46 @@ class NewsCategoryLogic extends BaseLogic | @@ -44,59 +44,46 @@ class NewsCategoryLogic extends BaseLogic | ||
| 44 | * @method | 44 | * @method |
| 45 | */ | 45 | */ |
| 46 | public function info_news_category(){ | 46 | public function info_news_category(){ |
| 47 | - $info = $this->info($this->param); | 47 | + $info = $this->model->read($this->param); |
| 48 | return $this->success($info); | 48 | return $this->success($info); |
| 49 | } | 49 | } |
| 50 | + | ||
| 50 | /** | 51 | /** |
| 51 | - * @name :添加时验证上级分类是否有商品,有则替换带当前分类下 | ||
| 52 | - * @return void | ||
| 53 | - * @author :liyuhang | ||
| 54 | - * @method | 52 | + * @remark :保存数据 |
| 53 | + * @name :newsCategorySave | ||
| 54 | + * @author :lyh | ||
| 55 | + * @method :post | ||
| 56 | + * @time :2023/9/7 14:53 | ||
| 55 | */ | 57 | */ |
| 56 | - public function add_news_category(){ | 58 | + public function newsCategorySave(){ |
| 57 | //验证名称是否存在 | 59 | //验证名称是否存在 |
| 58 | $this->verifyParamName($this->param['name']); | 60 | $this->verifyParamName($this->param['name']); |
| 59 | - //参数处理 | ||
| 60 | - $this->param = $this->addParamProcessing($this->param); | ||
| 61 | DB::beginTransaction(); | 61 | DB::beginTransaction(); |
| 62 | try { | 62 | try { |
| 63 | - $cate_id = $this->model->insertGetId($this->param); | ||
| 64 | - //当父级分类拥有产品时,处理子集 | ||
| 65 | - $this->addProcessingSon($cate_id); | ||
| 66 | - $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], | ||
| 67 | - RouteMap::SOURCE_NEWS_CATE, $cate_id, $this->user['project_id']); | ||
| 68 | - $this->model->edit(['alias'=>$route],['id'=>$cate_id]); | 63 | + if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 64 | + //验证是否可编辑 | ||
| 65 | + $this->verifyEditParam($this->param['id'],$this->param['pid']); | ||
| 66 | + $this->param['operator_id'] = $this->user['id']; | ||
| 67 | + //查看路由是否更新 | ||
| 68 | + $id = $this->editCategoryRoute($this->param['id'],$this->param['alias']); | ||
| 69 | + $this->edit($this->param,['id'=>$this->param['id']]); | ||
| 70 | + }else{ | ||
| 71 | + $id = $this->model->addReturnId($this->param); | ||
| 72 | + //当父级分类拥有产品时,处理子集 | ||
| 73 | + $this->addProcessingSon($id); | ||
| 74 | + } | ||
| 75 | + $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | ||
| 76 | + $this->model->edit(['alias'=>$route],['id'=>$id]); | ||
| 69 | DB::commit(); | 77 | DB::commit(); |
| 70 | }catch (\Exception $e){ | 78 | }catch (\Exception $e){ |
| 71 | DB::rollBack(); | 79 | DB::rollBack(); |
| 72 | $this->fail('error'); | 80 | $this->fail('error'); |
| 73 | } | 81 | } |
| 74 | - //通知更新 | 82 | + //更新通知记录表 |
| 75 | $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]); | 83 | $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]); |
| 76 | return $this->success(); | 84 | return $this->success(); |
| 77 | } | 85 | } |
| 78 | 86 | ||
| 79 | - /** | ||
| 80 | - * @name :编辑分类 | ||
| 81 | - * @return void | ||
| 82 | - * @author :liyuhang | ||
| 83 | - * @method | ||
| 84 | - */ | ||
| 85 | - public function edit_news_category(){ | ||
| 86 | - //验证名称是否存在 | ||
| 87 | - $this->verifyParamName($this->param['name'],$this->param['id']); | ||
| 88 | - //验证是否可编辑 | ||
| 89 | - $this->verifyEditParam($this->param['id'],$this->param['pid']); | ||
| 90 | - $this->param['operator_id'] = $this->user['id']; | ||
| 91 | - $this->param['alias'] = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], | ||
| 92 | - RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']); | ||
| 93 | - //查看路由是否更新 | ||
| 94 | - $this->editCategoryRoute($this->param['id'],$this->param['alias']); | ||
| 95 | - $this->edit($this->param,['id'=>$this->param['id']]); | ||
| 96 | - //通知更新 | ||
| 97 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$this->param['alias']]); | ||
| 98 | - return $this->success(); | ||
| 99 | - } | ||
| 100 | 87 | ||
| 101 | /** | 88 | /** |
| 102 | * @remark :编辑路由时生成路由记录 | 89 | * @remark :编辑路由时生成路由记录 |
| @@ -115,7 +102,7 @@ class NewsCategoryLogic extends BaseLogic | @@ -115,7 +102,7 @@ class NewsCategoryLogic extends BaseLogic | ||
| 115 | ]; | 102 | ]; |
| 116 | $this->setRouteDeleteSave($data); | 103 | $this->setRouteDeleteSave($data); |
| 117 | } | 104 | } |
| 118 | - return $this->success(); | 105 | + return $id; |
| 119 | } | 106 | } |
| 120 | 107 | ||
| 121 | /** | 108 | /** |
| @@ -165,23 +152,21 @@ class NewsCategoryLogic extends BaseLogic | @@ -165,23 +152,21 @@ class NewsCategoryLogic extends BaseLogic | ||
| 165 | * @method | 152 | * @method |
| 166 | */ | 153 | */ |
| 167 | public function del_news_category(){ | 154 | public function del_news_category(){ |
| 168 | - $ids = $this->param['id']; | ||
| 169 | - foreach ($this->param['id'] as $v){ | 155 | + foreach ($this->param['id'] as $id){ |
| 170 | //查询是否有子分类 | 156 | //查询是否有子分类 |
| 171 | - $rs = $this->model->read(['pid'=>$v],['id']); | 157 | + $rs = $this->model->read(['pid'=>$id],['id']); |
| 172 | if($rs !== false){ | 158 | if($rs !== false){ |
| 173 | $this->fail('当前分类拥有子分类不允许删除'); | 159 | $this->fail('当前分类拥有子分类不允许删除'); |
| 174 | } | 160 | } |
| 175 | //查看当前分内下是否有商品 | 161 | //查看当前分内下是否有商品 |
| 176 | $newsModel = new NewsModel(); | 162 | $newsModel = new NewsModel(); |
| 177 | - $rs = $newsModel->read(['category_id'=>$v],['id']); | 163 | + $rs = $newsModel->read(['category_id'=>$id],['id']); |
| 178 | if($rs !== false){ | 164 | if($rs !== false){ |
| 179 | $this->fail('当前分类拥有商品'); | 165 | $this->fail('当前分类拥有商品'); |
| 180 | } | 166 | } |
| 181 | - $this->delRoute($v); | 167 | + $this->delRoute($id); |
| 168 | + $this->model->del(['id'=>$id]); | ||
| 182 | } | 169 | } |
| 183 | - $this->param['id'] = ['in',$this->param['id']]; | ||
| 184 | - $this->del($this->param,$ids); | ||
| 185 | return $this->success(); | 170 | return $this->success(); |
| 186 | } | 171 | } |
| 187 | 172 | ||
| @@ -207,16 +192,11 @@ class NewsCategoryLogic extends BaseLogic | @@ -207,16 +192,11 @@ class NewsCategoryLogic extends BaseLogic | ||
| 207 | * @method :post | 192 | * @method :post |
| 208 | * @time :2023/6/13 11:41 | 193 | * @time :2023/6/13 11:41 |
| 209 | */ | 194 | */ |
| 210 | - public function verifyParamName($name,$id = ''){ | ||
| 211 | - if(isset($id) && !empty($id)){ | ||
| 212 | - $condition = [ | ||
| 213 | - 'id'=>['!=',$id], | ||
| 214 | - 'name'=>$name, | ||
| 215 | - ]; | 195 | + public function verifyParamName($name){ |
| 196 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 197 | + $condition = ['id'=>['!=',$this->param['id']], 'name'=>$name]; | ||
| 216 | }else{ | 198 | }else{ |
| 217 | - $condition = [ | ||
| 218 | - 'name'=>$name | ||
| 219 | - ]; | 199 | + $condition = ['name'=>$name]; |
| 220 | } | 200 | } |
| 221 | $info = $this->model->read($condition); | 201 | $info = $this->model->read($condition); |
| 222 | if($info !== false){ | 202 | if($info !== false){ |
| @@ -235,8 +215,6 @@ class NewsCategoryLogic extends BaseLogic | @@ -235,8 +215,6 @@ class NewsCategoryLogic extends BaseLogic | ||
| 235 | $param['project_id'] = $this->user['project_id']; | 215 | $param['project_id'] = $this->user['project_id']; |
| 236 | $param['operator_id'] = $this->user['id']; | 216 | $param['operator_id'] = $this->user['id']; |
| 237 | $param['create_id'] = $this->user['id']; | 217 | $param['create_id'] = $this->user['id']; |
| 238 | - $param['created_at'] = date('Y-m-d H:i:s'); | ||
| 239 | - $param['updated_at'] = date('Y-m-d H:i:s'); | ||
| 240 | return $this->success($param); | 218 | return $this->success($param); |
| 241 | } | 219 | } |
| 242 | 220 |
| @@ -124,8 +124,8 @@ class ProductLogic extends BaseLogic | @@ -124,8 +124,8 @@ class ProductLogic extends BaseLogic | ||
| 124 | * @time :2023/8/21 17:11 | 124 | * @time :2023/8/21 17:11 |
| 125 | */ | 125 | */ |
| 126 | public function productDelete(){ | 126 | public function productDelete(){ |
| 127 | - DB::beginTransaction(); | ||
| 128 | - try { | 127 | +// DB::beginTransaction(); |
| 128 | +// try { | ||
| 129 | foreach ($this->param['ids'] as $k => $id) { | 129 | foreach ($this->param['ids'] as $k => $id) { |
| 130 | $info = $this->model->read(['id'=>$id]); | 130 | $info = $this->model->read(['id'=>$id]); |
| 131 | if($info['status'] == Product::STATUS_RECYCLE){ | 131 | if($info['status'] == Product::STATUS_RECYCLE){ |
| @@ -138,11 +138,11 @@ class ProductLogic extends BaseLogic | @@ -138,11 +138,11 @@ class ProductLogic extends BaseLogic | ||
| 138 | $this->model->edit(['status'=>Product::STATUS_RECYCLE],['id'=>$id]); | 138 | $this->model->edit(['status'=>Product::STATUS_RECYCLE],['id'=>$id]); |
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| 141 | - DB::commit(); | ||
| 142 | - }catch (\Exception $e){ | ||
| 143 | - DB::rollBack(); | ||
| 144 | - $this->fail('删除失败'); | ||
| 145 | - } | 141 | +// DB::commit(); |
| 142 | +// }catch (\Exception $e){ | ||
| 143 | +// DB::rollBack(); | ||
| 144 | +// $this->fail('删除失败'); | ||
| 145 | +// } | ||
| 146 | 146 | ||
| 147 | return $this->success(); | 147 | return $this->success(); |
| 148 | } | 148 | } |
| @@ -33,6 +33,8 @@ class RouteMap extends Base | @@ -33,6 +33,8 @@ class RouteMap extends Base | ||
| 33 | const PATH_NEWS_CATE = 'news_catalog'; | 33 | const PATH_NEWS_CATE = 'news_catalog'; |
| 34 | const PATH_BLOG_CATE = 'blog_catalog'; | 34 | const PATH_BLOG_CATE = 'blog_catalog'; |
| 35 | 35 | ||
| 36 | + const SOURCE_NAV = 'nav'; | ||
| 37 | + | ||
| 36 | /** | 38 | /** |
| 37 | * 生成路由标识 | 39 | * 生成路由标识 |
| 38 | * @param $title | 40 | * @param $title |
| @@ -50,9 +50,9 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -50,9 +50,9 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 50 | Route::prefix('news')->group(function () { | 50 | Route::prefix('news')->group(function () { |
| 51 | //分类 | 51 | //分类 |
| 52 | Route::any('/category/', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'lists'])->name('news_category_lists'); | 52 | Route::any('/category/', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'lists'])->name('news_category_lists'); |
| 53 | - Route::any('/category/add', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'add'])->name('news_category_add'); | 53 | + Route::any('/category/add', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_add'); |
| 54 | Route::any('/category/info', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'info'])->name('news_category_info'); | 54 | Route::any('/category/info', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'info'])->name('news_category_info'); |
| 55 | - Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'edit'])->name('news_category_edit'); | 55 | + Route::any('/category/edit', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'save'])->name('news_category_edit'); |
| 56 | Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del'); | 56 | Route::any('/category/del', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'del'])->name('news_category_del'); |
| 57 | Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status'); | 57 | Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status'); |
| 58 | Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList'); | 58 | Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList'); |
-
请 注册 或 登录 后发表评论