正在显示
3 个修改的文件
包含
0 行增加
和
151 行删除
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * @remark : | ||
| 4 | - * @name :VisualizationController.php | ||
| 5 | - * @author :lyh | ||
| 6 | - * @method :post | ||
| 7 | - * @time :2023/11/15 9:55 | ||
| 8 | - */ | ||
| 9 | - | ||
| 10 | -namespace App\Http\Controllers\Bside\Template; | ||
| 11 | - | ||
| 12 | -use App\Enums\Common\Code; | ||
| 13 | -use App\Http\Controllers\Bside\BaseController; | ||
| 14 | -use App\Http\Logic\Bside\BTemplate\VisualizationLogic; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * @remark :定制项目处理 | ||
| 18 | - * @name :VisualizationController | ||
| 19 | - * @author :lyh | ||
| 20 | - * @method :post | ||
| 21 | - * @time :2023/11/15 9:55 | ||
| 22 | - */ | ||
| 23 | -class VisualizationController extends BaseController | ||
| 24 | -{ | ||
| 25 | - /** | ||
| 26 | - * @remark :获取当前定制代码块详情 | ||
| 27 | - * @name :info | ||
| 28 | - * @author :lyh | ||
| 29 | - * @method :post | ||
| 30 | - * @time :2023/11/15 10:26 | ||
| 31 | - */ | ||
| 32 | - public function info(VisualizationLogic $logic){ | ||
| 33 | - $this->request->validate([ | ||
| 34 | - 'type'=>['required'], | ||
| 35 | - ],[ | ||
| 36 | - 'type.required' => '类型不能为空', | ||
| 37 | - ]); | ||
| 38 | - $info = $logic->getVisualizationInfo(); | ||
| 39 | - if($info === false){ | ||
| 40 | - $info = []; | ||
| 41 | - } | ||
| 42 | - $this->response('success',Code::SUCCESS,$info); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * @remark :保存定制项目html | ||
| 47 | - * @name :save | ||
| 48 | - * @author :lyh | ||
| 49 | - * @method :post | ||
| 50 | - * @time :2023/11/15 10:08 | ||
| 51 | - */ | ||
| 52 | - public function save(VisualizationLogic $logic){ | ||
| 53 | - $this->request->validate([ | ||
| 54 | - 'type'=>['required'], | ||
| 55 | - ],[ | ||
| 56 | - 'type.required' => '类型不能为空', | ||
| 57 | - ]); | ||
| 58 | - $logic->saveVisualization(); | ||
| 59 | - $this->response('success'); | ||
| 60 | - } | ||
| 61 | -} |
| 1 | -<?php | ||
| 2 | -/** | ||
| 3 | - * @remark : | ||
| 4 | - * @name :VisualizationLogic.php | ||
| 5 | - * @author :lyh | ||
| 6 | - * @method :post | ||
| 7 | - * @time :2023/11/15 10:09 | ||
| 8 | - */ | ||
| 9 | - | ||
| 10 | -namespace App\Http\Logic\Bside\BTemplate; | ||
| 11 | - | ||
| 12 | -use App\Http\Logic\Bside\BaseLogic; | ||
| 13 | -use App\Models\Blog\Blog; | ||
| 14 | -use App\Models\News\News; | ||
| 15 | -use App\Models\Product\Product; | ||
| 16 | -use App\Models\Project\PageSetting; | ||
| 17 | -use App\Models\RouteMap\RouteMap; | ||
| 18 | -use App\Models\Service\Service as ServiceSettingModel; | ||
| 19 | -use App\Models\Template\BTemplate; | ||
| 20 | -use App\Models\Template\BTemplateCommon; | ||
| 21 | -use App\Models\Template\BTemplateLog; | ||
| 22 | -use App\Models\Template\BTemplateMain; | ||
| 23 | -use App\Models\Template\Setting; | ||
| 24 | -use App\Models\Template\Template; | ||
| 25 | -use App\Models\Template\TemplateTypeMain; | ||
| 26 | -use App\Models\Visualization\Visualization; | ||
| 27 | - | ||
| 28 | -class VisualizationLogic extends BaseLogic | ||
| 29 | -{ | ||
| 30 | - public function __construct() | ||
| 31 | - { | ||
| 32 | - parent::__construct(); | ||
| 33 | - $this->model = new BTemplateMain(); | ||
| 34 | - $this->param = $this->requestAll; | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | - * @remark :获取代码块 | ||
| 39 | - * @name :getVisualizationInfo | ||
| 40 | - * @author :lyh | ||
| 41 | - * @method :post | ||
| 42 | - * @time :2023/11/17 14:44 | ||
| 43 | - */ | ||
| 44 | - public function getVisualizationInfo(){ | ||
| 45 | - $is_list = $this->param['is_list'] ?? 0; | ||
| 46 | - $bTemplateMainModel = new BTemplateMain(); | ||
| 47 | - $info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]); | ||
| 48 | - if($info === false){ | ||
| 49 | - $html = ''; | ||
| 50 | - }else{ | ||
| 51 | - $html = $info['main_html']; | ||
| 52 | - } | ||
| 53 | - return $this->success(['html'=>$html]); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * @remark :保存定制html | ||
| 58 | - * @name :saveHtml | ||
| 59 | - * @author :lyh | ||
| 60 | - * @method :post | ||
| 61 | - * @time :2023/11/15 10:12 | ||
| 62 | - */ | ||
| 63 | - public function saveVisualization(){ | ||
| 64 | - try { | ||
| 65 | - $is_list = $this->param['is_list'] ?? 0; | ||
| 66 | - $bTemplateMainModel = new BTemplateMain(); | ||
| 67 | - $mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]); | ||
| 68 | - if($mainInfo === false){ | ||
| 69 | - $mainData = [ | ||
| 70 | - 'project_id'=>$this->user['project_id'], | ||
| 71 | - 'type'=>$this->param['type'], | ||
| 72 | - 'is_list'=>$is_list, | ||
| 73 | - 'main_html'=>$this->param['html'] | ||
| 74 | - ]; | ||
| 75 | - $bTemplateMainModel->add($mainData); | ||
| 76 | - }else{ | ||
| 77 | - $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); | ||
| 78 | - } | ||
| 79 | - }catch (\Exception $exception){ | ||
| 80 | - $this->fail('保存失败,请联系开发人员'); | ||
| 81 | - } | ||
| 82 | - return $this->success(); | ||
| 83 | - } | ||
| 84 | -} |
| @@ -341,12 +341,6 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -341,12 +341,6 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 341 | }); | 341 | }); |
| 342 | }); | 342 | }); |
| 343 | 343 | ||
| 344 | - //定制项目上传代码块 | ||
| 345 | - Route::prefix('visualization')->group(function () { | ||
| 346 | - Route::any('/info', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'info'])->name('visualization_info'); | ||
| 347 | - Route::any('/save', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'save'])->name('visualization_save'); | ||
| 348 | - }); | ||
| 349 | - | ||
| 350 | //初始代码块 | 344 | //初始代码块 |
| 351 | Route::prefix('init_html')->group(function () { | 345 | Route::prefix('init_html')->group(function () { |
| 352 | Route::any('/getCustomizedHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'getCustomizedHtml'])->name('init_getCustomizedHtml'); | 346 | Route::any('/getCustomizedHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'getCustomizedHtml'])->name('init_getCustomizedHtml'); |
-
请 注册 或 登录 后发表评论