正在显示
11 个修改的文件
包含
41 行增加
和
87 行删除
| @@ -58,36 +58,23 @@ class BlogCategoryController extends BaseController | @@ -58,36 +58,23 @@ class BlogCategoryController extends BaseController | ||
| 58 | 'id.required' => 'ID不能为空' | 58 | 'id.required' => 'ID不能为空' |
| 59 | ]); | 59 | ]); |
| 60 | $info = $blogCategoryLogic->info_blog_category(); | 60 | $info = $blogCategoryLogic->info_blog_category(); |
| 61 | - $info['alias'] = RouteMap::getRoute(RouteMap::SOURCE_BLOG_CATE, $info['id'], $this->user['project_id']); | ||
| 62 | - $info['url'] = $this->user['domain'] . RouteMap::PATH_BLOG_CATE . '/' . $info['alias']; | 61 | + $info['url'] = $this->user['domain'] . $info['alias']; |
| 63 | $this->response('success',Code::SUCCESS,$info); | 62 | $this->response('success',Code::SUCCESS,$info); |
| 64 | } | 63 | } |
| 64 | + | ||
| 65 | /** | 65 | /** |
| 66 | - * @name :添加分类 | ||
| 67 | - * @author :liyuhang | ||
| 68 | - * @method | 66 | + * @remark :保存数据 |
| 67 | + * @name :save | ||
| 68 | + * @author :lyh | ||
| 69 | + * @method :post | ||
| 70 | + * @time :2023/9/7 14:04 | ||
| 69 | */ | 71 | */ |
| 70 | - public function add(BlogCategoryRequest $request,BlogCategoryLogic $blogCategoryLogic){ | 72 | + public function save(BlogCategoryRequest $request,BlogCategoryLogic $blogCategoryLogic){ |
| 71 | $request->validated(); | 73 | $request->validated(); |
| 72 | - //添加时,验证分类上级分类是否有,有则更新到当前分类中,没有时直接添加 | ||
| 73 | - $blogCategoryLogic->add_blog_category(); | 74 | + $blogCategoryLogic->categorySave(); |
| 74 | $this->response('success'); | 75 | $this->response('success'); |
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | - /** | ||
| 78 | - * @name :编辑分类 | ||
| 79 | - * @author :liyuhang | ||
| 80 | - * @method | ||
| 81 | - */ | ||
| 82 | - public function edit(BlogCategoryRequest $request,BlogCategoryLogic $blogCategoryLogic){ | ||
| 83 | - $request->validate([ | ||
| 84 | - 'id'=>['required'] | ||
| 85 | - ],[ | ||
| 86 | - 'id.required' => 'ID不能为空' | ||
| 87 | - ]); | ||
| 88 | - $blogCategoryLogic->edit_blog_category(); | ||
| 89 | - $this->response('success'); | ||
| 90 | - } | ||
| 91 | 78 | ||
| 92 | /** | 79 | /** |
| 93 | * @name :编辑状态/与排序 | 80 | * @name :编辑状态/与排序 |
| @@ -58,8 +58,7 @@ class NewsCategoryController extends BaseController | @@ -58,8 +58,7 @@ class NewsCategoryController extends BaseController | ||
| 58 | 'id.required' => 'ID不能为空' | 58 | 'id.required' => 'ID不能为空' |
| 59 | ]); | 59 | ]); |
| 60 | $info = $newsCategoryLogic->info_news_category(); | 60 | $info = $newsCategoryLogic->info_news_category(); |
| 61 | - $info['alias'] = RouteMap::getRoute(RouteMap::SOURCE_NEWS_CATE, $info['id'], $this->user['project_id']); | ||
| 62 | - $info['url'] = $this->user['domain'] . RouteMap::PATH_NEWS_CATE . '/' . $info['alias']; | 61 | + $info['url'] = $this->user['domain'] . $info['alias']; |
| 63 | $this->response('success',Code::SUCCESS,$info); | 62 | $this->response('success',Code::SUCCESS,$info); |
| 64 | } | 63 | } |
| 65 | /** | 64 | /** |
| @@ -126,7 +126,6 @@ class CategoryController extends BaseController | @@ -126,7 +126,6 @@ class CategoryController extends BaseController | ||
| 126 | ],[ | 126 | ],[ |
| 127 | 'ids.required' => 'ID不能为空' | 127 | 'ids.required' => 'ID不能为空' |
| 128 | ]); | 128 | ]); |
| 129 | - | ||
| 130 | $data = $logic->categoryDelete(); | 129 | $data = $logic->categoryDelete(); |
| 131 | return $this->success($data); | 130 | return $this->success($data); |
| 132 | } | 131 | } |
| @@ -118,8 +118,8 @@ class ProductController extends BaseController | @@ -118,8 +118,8 @@ class ProductController extends BaseController | ||
| 118 | public function save(ProductRequest $request, ProductLogic $logic) | 118 | public function save(ProductRequest $request, ProductLogic $logic) |
| 119 | { | 119 | { |
| 120 | $request->validated(); | 120 | $request->validated(); |
| 121 | - $data = $logic->productSave(); | ||
| 122 | - return $this->success($data); | 121 | + $logic->productSave(); |
| 122 | + $this->response('success'); | ||
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | /** | 125 | /** |
| @@ -52,7 +52,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -52,7 +52,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 52 | //验证参数是否可编辑 | 52 | //验证参数是否可编辑 |
| 53 | $this->verifyParamEdit($this->param['id'],$this->param['pid']); | 53 | $this->verifyParamEdit($this->param['id'],$this->param['pid']); |
| 54 | //查看路由是否更新 | 54 | //查看路由是否更新 |
| 55 | - $this->editCategoryRoute($this->param['id'],$this->param['alias']); | 55 | + $id = $this->editCategoryRoute($this->param['id'],$this->param['alias']); |
| 56 | $this->param['operator_id'] = $this->user['id']; | 56 | $this->param['operator_id'] = $this->user['id']; |
| 57 | $this->edit($this->param,['id'=>$this->param['id']]); | 57 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 58 | }else{ | 58 | }else{ |
| @@ -94,51 +94,6 @@ class BlogCategoryLogic extends BaseLogic | @@ -94,51 +94,6 @@ class BlogCategoryLogic extends BaseLogic | ||
| 94 | return $this->success(); | 94 | return $this->success(); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | - /** | ||
| 98 | - * @name :添加时验证上级分类是否有商品,有则替换带当前分类下 | ||
| 99 | - * @return void | ||
| 100 | - * @author :liyuhang | ||
| 101 | - * @method | ||
| 102 | - */ | ||
| 103 | - public function add_blog_category(){ | ||
| 104 | - //验证名称是否存在 | ||
| 105 | - $this->verifyParamName($this->param['name']); | ||
| 106 | - //拼接参数 | ||
| 107 | - $this->param = $this->addParamProcessing($this->param); | ||
| 108 | - DB::beginTransaction(); | ||
| 109 | - try { | ||
| 110 | - $cate_id = $this->model->insertGetId($this->param); | ||
| 111 | - //处理子集 | ||
| 112 | - $this->addProcessingSon($cate_id); | ||
| 113 | - $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $cate_id, $this->user['project_id']); | ||
| 114 | - DB::commit(); | ||
| 115 | - }catch (\Exception $e){ | ||
| 116 | - DB::rollBack(); | ||
| 117 | - $this->fail('error'); | ||
| 118 | - } | ||
| 119 | - //通知更新 | ||
| 120 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]); | ||
| 121 | - return $this->success(); | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - /** | ||
| 125 | - * @name :编辑分类 | ||
| 126 | - * @return void | ||
| 127 | - * @author :liyuhang | ||
| 128 | - * @method | ||
| 129 | - */ | ||
| 130 | - public function edit_blog_category(){ | ||
| 131 | - //验证名称是否存在 | ||
| 132 | - $this->verifyParamName($this->param['name'],$this->param['id']); | ||
| 133 | - //验证参数是否可编辑 | ||
| 134 | - $this->verifyParamEdit($this->param['id'],$this->param['pid']); | ||
| 135 | - $this->param['operator_id'] = $this->user['id']; | ||
| 136 | - $this->edit($this->param,['id'=>$this->param['id']]); | ||
| 137 | - $route = RouteMap::setRoute($this->param['alias'] ?: $this->param['name'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']); | ||
| 138 | - //通知更新 | ||
| 139 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]); | ||
| 140 | - return $this->success(); | ||
| 141 | - } | ||
| 142 | 97 | ||
| 143 | /** | 98 | /** |
| 144 | * @remark :查看参数是否可编辑 | 99 | * @remark :查看参数是否可编辑 |
| @@ -233,10 +233,10 @@ class NewsLogic extends BaseLogic | @@ -233,10 +233,10 @@ class NewsLogic extends BaseLogic | ||
| 233 | //删除路由映射 | 233 | //删除路由映射 |
| 234 | RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); | 234 | RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); |
| 235 | //生成一条删除路由记录 | 235 | //生成一条删除路由记录 |
| 236 | - $info = $this->model->read(['id'=>$id],['id','route']); | 236 | + $info = $this->model->read(['id'=>$id],['id','url']); |
| 237 | $data = [ | 237 | $data = [ |
| 238 | 'source'=>RouteMap::SOURCE_NEWS, | 238 | 'source'=>RouteMap::SOURCE_NEWS, |
| 239 | - 'route'=>$info['route'], | 239 | + 'route'=>$info['url'], |
| 240 | ]; | 240 | ]; |
| 241 | $this->setRouteDeleteSave($data); | 241 | $this->setRouteDeleteSave($data); |
| 242 | return $this->success(); | 242 | return $this->success(); |
| @@ -156,8 +156,8 @@ class CategoryLogic extends BaseLogic | @@ -156,8 +156,8 @@ class CategoryLogic extends BaseLogic | ||
| 156 | } | 156 | } |
| 157 | //删除路由 | 157 | //删除路由 |
| 158 | $this->delRoute($id); | 158 | $this->delRoute($id); |
| 159 | + $this->model->del(['id'=>$id]); | ||
| 159 | } | 160 | } |
| 160 | - $this->model->del(['id'=>['in',$ids]]); | ||
| 161 | DB::commit(); | 161 | DB::commit(); |
| 162 | }catch (\Exception $e){ | 162 | }catch (\Exception $e){ |
| 163 | DB::rollBack(); | 163 | DB::rollBack(); |
| @@ -129,14 +129,7 @@ class ProductLogic extends BaseLogic | @@ -129,14 +129,7 @@ class ProductLogic extends BaseLogic | ||
| 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){ |
| 132 | - //删除路由映射 | ||
| 133 | - RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | ||
| 134 | - //生成一条删除路由记录 | ||
| 135 | - $data = [ | ||
| 136 | - 'source'=>RouteMap::SOURCE_PRODUCT, | ||
| 137 | - 'route'=>$info['route'], | ||
| 138 | - ]; | ||
| 139 | - $this->setRouteDeleteSave($data); | 132 | + $this->delRoute($id); |
| 140 | //删除当前产品模版 | 133 | //删除当前产品模版 |
| 141 | $this->delProductModule($id); | 134 | $this->delProductModule($id); |
| 142 | $this->model->del(['id'=>$id]); | 135 | $this->model->del(['id'=>$id]); |
| @@ -155,6 +148,26 @@ class ProductLogic extends BaseLogic | @@ -155,6 +148,26 @@ class ProductLogic extends BaseLogic | ||
| 155 | } | 148 | } |
| 156 | 149 | ||
| 157 | /** | 150 | /** |
| 151 | + * @remark :删除路由 | ||
| 152 | + * @name :delRoute | ||
| 153 | + * @author :lyh | ||
| 154 | + * @method :post | ||
| 155 | + * @time :2023/9/7 10:50 | ||
| 156 | + */ | ||
| 157 | + public function delRoute($id){ | ||
| 158 | + //删除路由映射 | ||
| 159 | + RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | ||
| 160 | + //生成一条删除路由记录 | ||
| 161 | + $info = $this->model->read(['id'=>$id],['id','route']); | ||
| 162 | + $data = [ | ||
| 163 | + 'source'=>RouteMap::SOURCE_PRODUCT, | ||
| 164 | + 'route'=>$info['route'], | ||
| 165 | + ]; | ||
| 166 | + $this->setRouteDeleteSave($data); | ||
| 167 | + return $this->success(); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + /** | ||
| 158 | * @remark :统计数据 | 171 | * @remark :统计数据 |
| 159 | * @name :getStatusNumber | 172 | * @name :getStatusNumber |
| 160 | * @author :lyh | 173 | * @author :lyh |
| @@ -76,7 +76,6 @@ class RouteMap extends Base | @@ -76,7 +76,6 @@ class RouteMap extends Base | ||
| 76 | $where = [ | 76 | $where = [ |
| 77 | 'project_id' => $project_id, | 77 | 'project_id' => $project_id, |
| 78 | 'route' => $route, | 78 | 'route' => $route, |
| 79 | -// 'source' => $source | ||
| 80 | ]; | 79 | ]; |
| 81 | $route = self::where($where)->first(); | 80 | $route = self::where($where)->first(); |
| 82 | if($route){ | 81 | if($route){ |
| @@ -84,9 +84,9 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -84,9 +84,9 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 84 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum'); | 84 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum'); |
| 85 | //分类 | 85 | //分类 |
| 86 | Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists'); | 86 | Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists'); |
| 87 | - Route::any('/category/add', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'add'])->name('blog_category_add'); | 87 | + Route::any('/category/add', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_add'); |
| 88 | Route::any('/category/info', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'info'])->name('blog_category_info'); | 88 | Route::any('/category/info', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'info'])->name('blog_category_info'); |
| 89 | - Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'edit'])->name('blog_category_edit'); | 89 | + Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_edit'); |
| 90 | Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del'); | 90 | Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del'); |
| 91 | Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status'); | 91 | Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status'); |
| 92 | Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList'); | 92 | Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList'); |
-
请 注册 或 登录 后发表评论