正在显示
8 个修改的文件
包含
197 行增加
和
4 行删除
| @@ -164,4 +164,21 @@ class BlogCategoryController extends BaseController | @@ -164,4 +164,21 @@ class BlogCategoryController extends BaseController | ||
| 164 | $blogCategoryLogic->setAllSort(); | 164 | $blogCategoryLogic->setAllSort(); |
| 165 | $this->response('success'); | 165 | $this->response('success'); |
| 166 | } | 166 | } |
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * @remark :复制博客分类 | ||
| 170 | + * @name :copyCategory | ||
| 171 | + * @author :lyh | ||
| 172 | + * @method :post | ||
| 173 | + * @time :2024/5/9 9:14 | ||
| 174 | + */ | ||
| 175 | + public function copyCategory(BlogCategoryLogic $logic){ | ||
| 176 | + $this->request->validate([ | ||
| 177 | + 'id'=>'required', | ||
| 178 | + ],[ | ||
| 179 | + 'id.required' => 'id不能为空', | ||
| 180 | + ]); | ||
| 181 | + $data = $logic->copyCategory(); | ||
| 182 | + $this->response('success',Code::SUCCESS,$data); | ||
| 183 | + } | ||
| 167 | } | 184 | } |
| @@ -187,5 +187,20 @@ class CustomModuleCategoryController extends BaseController | @@ -187,5 +187,20 @@ class CustomModuleCategoryController extends BaseController | ||
| 187 | $this->response('success'); | 187 | $this->response('success'); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | - | 190 | + /** |
| 191 | + * @remark :复制新闻分类 | ||
| 192 | + * @name :copyCategory | ||
| 193 | + * @author :lyh | ||
| 194 | + * @method :post | ||
| 195 | + * @time :2024/5/9 9:14 | ||
| 196 | + */ | ||
| 197 | + public function copyCategory(CustomModuleCategoryLogic $logic){ | ||
| 198 | + $this->request->validate([ | ||
| 199 | + 'id'=>'required', | ||
| 200 | + ],[ | ||
| 201 | + 'id.required' => 'id不能为空', | ||
| 202 | + ]); | ||
| 203 | + $data = $logic->copyCategory(); | ||
| 204 | + $this->response('success',Code::SUCCESS,$data); | ||
| 205 | + } | ||
| 191 | } | 206 | } |
| @@ -168,13 +168,13 @@ class NewsCategoryController extends BaseController | @@ -168,13 +168,13 @@ class NewsCategoryController extends BaseController | ||
| 168 | * @method :post | 168 | * @method :post |
| 169 | * @time :2024/5/9 9:14 | 169 | * @time :2024/5/9 9:14 |
| 170 | */ | 170 | */ |
| 171 | - public function copyCategory(NewsCategoryLogic $newsLogic){ | 171 | + public function copyCategory(NewsCategoryLogic $logic){ |
| 172 | $this->request->validate([ | 172 | $this->request->validate([ |
| 173 | 'id'=>'required', | 173 | 'id'=>'required', |
| 174 | ],[ | 174 | ],[ |
| 175 | 'id.required' => 'id不能为空', | 175 | 'id.required' => 'id不能为空', |
| 176 | ]); | 176 | ]); |
| 177 | - $data = $newsLogic->copyCategory(); | 177 | + $data = $logic->copyCategory(); |
| 178 | $this->response('success',Code::SUCCESS,$data); | 178 | $this->response('success',Code::SUCCESS,$data); |
| 179 | } | 179 | } |
| 180 | } | 180 | } |
| @@ -27,6 +27,9 @@ class VisitController extends BaseController | @@ -27,6 +27,9 @@ class VisitController extends BaseController | ||
| 27 | */ | 27 | */ |
| 28 | public function index(VisitLogic $logic) | 28 | public function index(VisitLogic $logic) |
| 29 | { | 29 | { |
| 30 | + if(isset($this->map['updated_date']) && !empty($this->param['updated_date'])){ | ||
| 31 | + $this->map['updated_date'] = ['between',$this->map['updated_date']]; | ||
| 32 | + } | ||
| 30 | $data = $logic->getVisitList($this->map,$this->page,$this->row,$this->order); | 33 | $data = $logic->getVisitList($this->map,$this->page,$this->row,$this->order); |
| 31 | $this->response('success',Code::SUCCESS,$data); | 34 | $this->response('success',Code::SUCCESS,$data); |
| 32 | } | 35 | } |
| @@ -10,6 +10,7 @@ use App\Models\Blog\BlogCategory; | @@ -10,6 +10,7 @@ use App\Models\Blog\BlogCategory; | ||
| 10 | use App\Models\Blog\BlogCategory as BlogCategoryModel; | 10 | use App\Models\Blog\BlogCategory as BlogCategoryModel; |
| 11 | use App\Models\News\NewsCategory as NewsCategoryModel; | 11 | use App\Models\News\NewsCategory as NewsCategoryModel; |
| 12 | use App\Models\RouteMap\RouteMap; | 12 | use App\Models\RouteMap\RouteMap; |
| 13 | +use App\Models\Template\BTemplate; | ||
| 13 | use Illuminate\Support\Facades\DB; | 14 | use Illuminate\Support\Facades\DB; |
| 14 | 15 | ||
| 15 | class BlogCategoryLogic extends BaseLogic | 16 | class BlogCategoryLogic extends BaseLogic |
| @@ -277,4 +278,70 @@ class BlogCategoryLogic extends BaseLogic | @@ -277,4 +278,70 @@ class BlogCategoryLogic extends BaseLogic | ||
| 277 | } | 278 | } |
| 278 | return $this->success(); | 279 | return $this->success(); |
| 279 | } | 280 | } |
| 281 | + | ||
| 282 | + /** | ||
| 283 | + * @remark :复制新闻分类 | ||
| 284 | + * @name :copyCategory | ||
| 285 | + * @author :lyh | ||
| 286 | + * @method :post | ||
| 287 | + * @time :2024/5/9 9:16 | ||
| 288 | + */ | ||
| 289 | + public function copyCategory(){ | ||
| 290 | + $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 291 | + $param = [ | ||
| 292 | + 'name'=>$info['name']."-copy", | ||
| 293 | + 'status'=>0, | ||
| 294 | + 'sort'=>$info['sort'], | ||
| 295 | + 'pid'=>0, | ||
| 296 | + 'remark'=>$info['remark'], | ||
| 297 | + 'alias'=>$info['alias'], | ||
| 298 | + 'project_id'=>$info['project_id'], | ||
| 299 | + 'operator_id'=>$this->user['id'], | ||
| 300 | + 'create_id'=>$this->user['id'], | ||
| 301 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 302 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 303 | + ]; | ||
| 304 | + $save_id = $this->model->insertGetId($param); | ||
| 305 | + $route = RouteMap::setRoute($param['alias'], RouteMap::SOURCE_BLOG_CATE, $save_id, $this->user['project_id']); | ||
| 306 | + $this->model->edit(['alias'=>$route],['id'=>$save_id]); | ||
| 307 | + //同步可视化装修数据 | ||
| 308 | + $this->copyTemplate($this->param['id'],$info['project_id'],$save_id); | ||
| 309 | + return $this->success(['id'=>$save_id]); | ||
| 310 | + } | ||
| 311 | + | ||
| 312 | + /** | ||
| 313 | + * @remark :同步模版数据 | ||
| 314 | + * @name :copyTemplate | ||
| 315 | + * @author :lyh | ||
| 316 | + * @method :post | ||
| 317 | + * @time :2023/7/29 15:53 | ||
| 318 | + */ | ||
| 319 | + public function copyTemplate($id,$project_id,$save_id){ | ||
| 320 | + $BTemplateModel = new BTemplate(); | ||
| 321 | + $list = $BTemplateModel->list(['source'=>BTemplate::SOURCE_BLOG,'is_list'=>BTemplate::IS_LIST,'is_custom'=>BTemplate::IS_NO_CUSTOM,'source_id'=>$id,'project_id'=>$project_id]); | ||
| 322 | + if(!empty($list)){ | ||
| 323 | + $data = []; | ||
| 324 | + foreach ($list as $v){ | ||
| 325 | + $data[] = [ | ||
| 326 | + 'html'=>$v['html'], | ||
| 327 | + 'project_id'=>$v['project_id'], | ||
| 328 | + 'source'=>$v['source'], | ||
| 329 | + 'source_id'=>$save_id, | ||
| 330 | + 'template_id'=>$v['template_id'], | ||
| 331 | + 'section_list_id'=>$v['section_list_id'], | ||
| 332 | + 'main_html'=>$v['main_html'], | ||
| 333 | + 'main_css'=>$v['main_css'], | ||
| 334 | + 'is_list'=>$v['is_list'], | ||
| 335 | + 'type'=>$v['type'], | ||
| 336 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 337 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 338 | + ]; | ||
| 339 | + } | ||
| 340 | + $rs = $BTemplateModel->insert($data); | ||
| 341 | + if($rs === false){ | ||
| 342 | + $this->fail('error'); | ||
| 343 | + } | ||
| 344 | + } | ||
| 345 | + return $this->success(); | ||
| 346 | + } | ||
| 280 | } | 347 | } |
| @@ -9,10 +9,12 @@ | @@ -9,10 +9,12 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Logic\Bside\CustomModule; | 10 | namespace App\Http\Logic\Bside\CustomModule; |
| 11 | 11 | ||
| 12 | +use App\Helper\Arr; | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 13 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | use App\Models\CustomModule\CustomModuleCategory; | 14 | use App\Models\CustomModule\CustomModuleCategory; |
| 14 | use App\Models\CustomModule\CustomModuleContent; | 15 | use App\Models\CustomModule\CustomModuleContent; |
| 15 | use App\Models\RouteMap\RouteMap; | 16 | use App\Models\RouteMap\RouteMap; |
| 17 | +use App\Models\Template\BTemplate; | ||
| 16 | 18 | ||
| 17 | class CustomModuleCategoryLogic extends BaseLogic | 19 | class CustomModuleCategoryLogic extends BaseLogic |
| 18 | { | 20 | { |
| @@ -247,4 +249,92 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -247,4 +249,92 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 247 | } | 249 | } |
| 248 | return $this->success(); | 250 | return $this->success(); |
| 249 | } | 251 | } |
| 252 | + | ||
| 253 | + /** | ||
| 254 | + * @remark :复制扩展模块内容页 | ||
| 255 | + * @name :copyModuleContentInfo | ||
| 256 | + * @author :lyh | ||
| 257 | + * @method :post | ||
| 258 | + * @time :2024/4/28 16:32 | ||
| 259 | + */ | ||
| 260 | + public function copyCategory(){ | ||
| 261 | + $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 262 | + $param = $this->setContentParams($info); | ||
| 263 | + $save_id = $this->model->insertGetId($param); | ||
| 264 | + $this->copyTemplate($this->param['id'],$info['project_id'],$save_id,$info['module_id']); | ||
| 265 | + $this->response('success'); | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + /** | ||
| 269 | + * @remark :字段处理 | ||
| 270 | + * @name :setContentParams | ||
| 271 | + * @author :lyh | ||
| 272 | + * @method :post | ||
| 273 | + * @time :2024/4/28 16:33 | ||
| 274 | + */ | ||
| 275 | + public function setContentParams($info){ | ||
| 276 | + return [ | ||
| 277 | + 'name'=>$info['name'].'-copy', | ||
| 278 | + 'status'=>$info['status'], | ||
| 279 | + 'sort'=>$info['sort'], | ||
| 280 | + 'pid'=>0, | ||
| 281 | + 'remark'=>$info['remark'], | ||
| 282 | + 'route'=>$info['route'], | ||
| 283 | + 'project_id'=>$info['project_id'], | ||
| 284 | + 'operator_id'=>$this->user['id'], | ||
| 285 | + 'module_id'=>$info['module_id'], | ||
| 286 | + 'image'=>$info['image'], | ||
| 287 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 288 | + 'updated_at'=>date('Y-m-d H:i:s') | ||
| 289 | + ]; | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + /** | ||
| 293 | + * @remark :同步模版数据 | ||
| 294 | + * @name :copyTemplate | ||
| 295 | + * @author :lyh | ||
| 296 | + * @method :post | ||
| 297 | + * @time :2023/7/29 15:53 | ||
| 298 | + */ | ||
| 299 | + public function copyTemplate($id,$project_id,$save_id,$module_id){ | ||
| 300 | + $BTemplateModel = new BTemplate(); | ||
| 301 | + $list = $BTemplateModel->list(['source'=>$module_id,'source_id'=>$id,'is_list'=>BTemplate::IS_LIST,'is_custom'=>BTemplate::IS_CUSTOM,'project_id'=>$project_id]); | ||
| 302 | + if(!empty($list)){ | ||
| 303 | + $data = []; | ||
| 304 | + foreach ($list as $v){ | ||
| 305 | + $data[] = $this->setTemplateParams($v,$project_id,$save_id); | ||
| 306 | + } | ||
| 307 | + $rs = $BTemplateModel->insert($data); | ||
| 308 | + if($rs === false){ | ||
| 309 | + $this->fail('error'); | ||
| 310 | + } | ||
| 311 | + } | ||
| 312 | + return $this->success(); | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | + /** | ||
| 316 | + * @remark :组装模版数据 | ||
| 317 | + * @name :setTemplateParams | ||
| 318 | + * @author :lyh | ||
| 319 | + * @method :post | ||
| 320 | + * @time :2023/7/29 15:54 | ||
| 321 | + */ | ||
| 322 | + public function setTemplateParams($v,$project_id,$save_id){ | ||
| 323 | + $param = [ | ||
| 324 | + 'html'=>$v['html'], | ||
| 325 | + 'project_id'=>$project_id, | ||
| 326 | + 'source'=>$v['source'], | ||
| 327 | + 'source_id'=>$save_id, | ||
| 328 | + 'template_id'=>$v['template_id'], | ||
| 329 | + 'section_list_id'=>$v['section_list_id'], | ||
| 330 | + 'main_html'=>$v['main_html'], | ||
| 331 | + 'main_css'=>$v['main_css'], | ||
| 332 | + 'is_custom'=>$v['is_custom'], | ||
| 333 | + 'is_list'=>$v['is_list'], | ||
| 334 | + 'type'=>$v['type'], | ||
| 335 | + 'created_at'=>$v['created_at'], | ||
| 336 | + 'updated_at'=>$v['updated_at'] | ||
| 337 | + ]; | ||
| 338 | + return $this->success($param); | ||
| 339 | + } | ||
| 250 | } | 340 | } |
| @@ -443,7 +443,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -443,7 +443,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 443 | */ | 443 | */ |
| 444 | public function copyTemplate($id,$project_id,$save_id,$module_id){ | 444 | public function copyTemplate($id,$project_id,$save_id,$module_id){ |
| 445 | $BTemplateModel = new BTemplate(); | 445 | $BTemplateModel = new BTemplate(); |
| 446 | - $list = $BTemplateModel->list(['source'=>$module_id,'source_id'=>$id,'is_custom'=>BTemplate::IS_CUSTOM,'project_id'=>$project_id]); | 446 | + $list = $BTemplateModel->list(['source'=>$module_id,'source_id'=>$id,'is_list'=>BTemplate::IS_DETAIL,'is_custom'=>BTemplate::IS_CUSTOM,'project_id'=>$project_id]); |
| 447 | if(!empty($list)){ | 447 | if(!empty($list)){ |
| 448 | $data = []; | 448 | $data = []; |
| 449 | foreach ($list as $v){ | 449 | foreach ($list as $v){ |
| @@ -123,6 +123,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -123,6 +123,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 123 | Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_edit'); | 123 | Route::any('/category/edit', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'save'])->name('blog_category_edit'); |
| 124 | Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del'); | 124 | Route::any('/category/del', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'del'])->name('blog_category_del'); |
| 125 | Route::any('/category/allSort', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'allSort'])->name('blog_category_allSort'); | 125 | Route::any('/category/allSort', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'allSort'])->name('blog_category_allSort'); |
| 126 | + Route::any('/category/copyCategory', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'copyCategory'])->name('blog_category_copyCategory'); | ||
| 126 | Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status'); | 127 | Route::any('/category/status', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'status'])->name('blog_category_status'); |
| 127 | Route::any('/category/sort', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'sort'])->name('blog_category_sort'); | 128 | Route::any('/category/sort', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'sort'])->name('blog_category_sort'); |
| 128 | Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList'); | 129 | Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'categoryTopList'])->name('blog_category_categoryTopList'); |
-
请 注册 或 登录 后发表评论