作者 lyh

gx

  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\Http\Controllers\Bside\BaseController;
  13 +use App\Http\Logic\Bside\BTemplate\VisualizationLogic;
  14 +
  15 +/**
  16 + * @remark :定制项目处理
  17 + * @name :VisualizationController
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2023/11/15 9:55
  21 + */
  22 +class VisualizationController extends BaseController
  23 +{
  24 +
  25 + public function info(){
  26 +
  27 + }
  28 +
  29 + /**
  30 + * @remark :保存定制项目html
  31 + * @name :save
  32 + * @author :lyh
  33 + * @method :post
  34 + * @time :2023/11/15 10:08
  35 + */
  36 + public function save(VisualizationLogic $logic){
  37 + $this->request->validate([
  38 + 'source'=>'required',
  39 + 'html'=>'required',
  40 + ],[
  41 + 'source.required' => '类型不能为空',
  42 + 'html.required' => 'html不能为空',
  43 + ]);
  44 + $logic->saveHtml();
  45 + $this->response('success');
  46 + }
  47 +}
@@ -114,8 +114,8 @@ class ProjectLogic extends BaseLogic @@ -114,8 +114,8 @@ class ProjectLogic extends BaseLogic
114 * @time :2023/8/30 11:57 114 * @time :2023/8/30 11:57
115 */ 115 */
116 public function projectSave(){ 116 public function projectSave(){
117 - DB::beginTransaction();  
118 - try { 117 +// DB::beginTransaction();
  118 +// try {
119 if($this->param['type'] == Project::TYPE_SEVEN){ 119 if($this->param['type'] == Project::TYPE_SEVEN){
120 //错误单直接返回,单独处理 120 //错误单直接返回,单独处理
121 $this->setTypeSevenEdit($this->param); 121 $this->setTypeSevenEdit($this->param);
@@ -135,14 +135,11 @@ class ProjectLogic extends BaseLogic @@ -135,14 +135,11 @@ class ProjectLogic extends BaseLogic
135 //创建站点 135 //创建站点
136 $this->createSite($this->param); 136 $this->createSite($this->param);
137 } 137 }
138 - DB::commit();  
139 - }catch (AsideGlobalException $e){  
140 - DB::rollBack();  
141 - $this->fail($e->getMessage());  
142 - }catch (\Exception $e){  
143 - DB::rollBack();  
144 - $this->fail('请填写完整后再提交');  
145 - } 138 +// DB::commit();
  139 +// }catch (\Exception $e){
  140 +// DB::rollBack();
  141 +// $this->fail('请填写完整后再提交');
  142 +// }
146 (new SyncService())->projectAcceptAddress($this->param['id']); 143 (new SyncService())->projectAcceptAddress($this->param['id']);
147 return $this->success(); 144 return $this->success();
148 } 145 }
  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\Visualization\Visualization;
  14 +
  15 +class VisualizationLogic extends BaseLogic
  16 +{
  17 + public function __construct()
  18 + {
  19 + parent::__construct();
  20 + $this->model = new Visualization();
  21 + $this->param = $this->requestAll;
  22 + }
  23 +
  24 + /**
  25 + * @remark :保存定制html
  26 + * @name :saveHtml
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/11/15 10:12
  30 + */
  31 + public function saveHtml(){
  32 + try {
  33 + if(isset($this->param['id']) && !empty($this->param['id'])){
  34 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  35 + }else{
  36 + $this->param['project_id'] = $this->user['project_id'];
  37 + $this->model->add($this->param);
  38 + }
  39 + }catch (\Exception $e){
  40 + $this->fail('系统错误,请联系管理员');
  41 + }
  42 + return $this->success();
  43 + }
  44 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :Visualization.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/11/15 10:11
  8 + */
  9 +
  10 +namespace App\Models\Visualization;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class Visualization extends Base
  15 +{
  16 + protected $table = 'gl_visualization_html';
  17 + //连接数据库
  18 + protected $connection = 'custom_mysql';
  19 +}