Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
14 个修改的文件
包含
470 行增加
和
33 行删除
| @@ -11,6 +11,7 @@ use App\Http\Logic\Bside\Product\ProductLogic; | @@ -11,6 +11,7 @@ use App\Http\Logic\Bside\Product\ProductLogic; | ||
| 11 | use App\Http\Requests\Bside\Product\ProductRequest; | 11 | use App\Http\Requests\Bside\Product\ProductRequest; |
| 12 | use App\Models\Product\Category; | 12 | use App\Models\Product\Category; |
| 13 | use App\Models\Product\CategoryRelated; | 13 | use App\Models\Product\CategoryRelated; |
| 14 | +use App\Models\Product\Extend; | ||
| 14 | use App\Models\Product\ExtendInfo; | 15 | use App\Models\Product\ExtendInfo; |
| 15 | use App\Models\Product\Keyword; | 16 | use App\Models\Product\Keyword; |
| 16 | use App\Models\Product\KeywordRelated; | 17 | use App\Models\Product\KeywordRelated; |
| @@ -270,19 +271,55 @@ class ProductController extends BaseController | @@ -270,19 +271,55 @@ class ProductController extends BaseController | ||
| 270 | $v['is_renovation'] = $this->getProductIsRenovation($templateInfo,$v['id']); | 271 | $v['is_renovation'] = $this->getProductIsRenovation($templateInfo,$v['id']); |
| 271 | $v['url'] = $this->user['domain'].$v['route']; | 272 | $v['url'] = $this->user['domain'].$v['route']; |
| 272 | //获取当前数据扩展字段及值 | 273 | //获取当前数据扩展字段及值 |
| 274 | + $v['extend'] = $this->getExtendInfo($v['id']); | ||
| 275 | + return $v; | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + /** | ||
| 279 | + * @remark :获取扩展字段详情 | ||
| 280 | + * @name :getExtendInfo | ||
| 281 | + * @author :lyh | ||
| 282 | + * @method :post | ||
| 283 | + * @time :2023/11/14 9:45 | ||
| 284 | + */ | ||
| 285 | + public function getExtendInfo($product_id){ | ||
| 286 | + $extendModel = new Extend(); | ||
| 287 | + $list = $extendModel->list([],'id',['type','key','title']); | ||
| 288 | + if(empty($list)){ | ||
| 289 | + return []; | ||
| 290 | + } | ||
| 273 | $extendInfoModel = new ExtendInfo(); | 291 | $extendInfoModel = new ExtendInfo(); |
| 274 | - $v['extend'] = $extendInfoModel->list(['product_id'=>$v['id']],'created_at'); | ||
| 275 | - foreach ($v['extend'] as $k1=>$v1){ | ||
| 276 | - if($v1['type'] == 3){ | ||
| 277 | - $v1['values'] = getImageUrl($v1['values']); | ||
| 278 | - }elseif ($v1['type'] == 4){ | ||
| 279 | - $v1['values'] = getFileUrl($v1['values']); | 292 | + foreach ($list as $k=>$v){ |
| 293 | + $info = $extendInfoModel->read(['key'=>$v['key'],'product_id'=>$product_id]); | ||
| 294 | + if($info == false){ | ||
| 295 | + if($v['type'] == 3 || $v['type'] == 4){ | ||
| 296 | + $v['values'] = []; | ||
| 297 | + }else{ | ||
| 298 | + $v['values'] = ''; | ||
| 280 | } | 299 | } |
| 281 | - $v['extend'][$k1] = $v1; | 300 | + }else{ |
| 301 | + if($v['type'] == 3){ | ||
| 302 | + $arr = json_decode($info['values']); | ||
| 303 | + foreach ($arr as $k1=>$v1){ | ||
| 304 | + $v1 = getImageUrl($v1); | ||
| 305 | + $arr[$k1] = $v1; | ||
| 282 | } | 306 | } |
| 283 | - return $v; | 307 | + $v['values'] = $arr; |
| 308 | + }elseif($v['type'] == 4){ | ||
| 309 | + $arr1 = json_decode($info['values']); | ||
| 310 | + foreach ($arr1 as $k1=>$v1){ | ||
| 311 | + $v1 = getImageUrl($v1); | ||
| 312 | + $arr1[$k1] = $v1; | ||
| 313 | + } | ||
| 314 | + $v['values'] = $arr1; | ||
| 315 | + }else{ | ||
| 316 | + $v['values'] = $info['values']; | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + $list[$k] = $v; | ||
| 320 | + } | ||
| 321 | + return $list; | ||
| 284 | } | 322 | } |
| 285 | - | ||
| 286 | 323 | ||
| 287 | /** | 324 | /** |
| 288 | * @remark :保存产品数据 | 325 | * @remark :保存产品数据 |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BTemplateModuleProjectController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/11/14 14:34 | ||
| 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\BTemplateModuleProjectLogic; | ||
| 15 | +use App\Models\Template\BModuleProject; | ||
| 16 | + | ||
| 17 | +class BTemplateModuleProjectController extends BaseController | ||
| 18 | +{ | ||
| 19 | + /** | ||
| 20 | + * @remark :获取私有化模块列表 | ||
| 21 | + * @name :lists | ||
| 22 | + * @author :lyh | ||
| 23 | + * @method :post | ||
| 24 | + * @time :2023/11/14 14:34 | ||
| 25 | + */ | ||
| 26 | + public function lists(BModuleProject $BModuleProject){ | ||
| 27 | + $list = $BModuleProject->list($this->map); | ||
| 28 | + $this->response('success',Code::SUCCESS,$list); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * @remark :保存私有化左侧模块 | ||
| 33 | + * @name :save | ||
| 34 | + * @author :lyh | ||
| 35 | + * @method :post | ||
| 36 | + * @time :2023/11/14 14:38 | ||
| 37 | + */ | ||
| 38 | + public function save(BTemplateModuleProjectLogic $logic){ | ||
| 39 | + $this->request->validate([ | ||
| 40 | + 'name'=>'required', | ||
| 41 | + 'html'=>'required', | ||
| 42 | + ],[ | ||
| 43 | + 'name.required' => '模板名称不能为空', | ||
| 44 | + 'html.required' => 'html不能为空', | ||
| 45 | + ]); | ||
| 46 | + $logic->moduleProjectSave(); | ||
| 47 | + return $this->response('success'); | ||
| 48 | + } | ||
| 49 | +} |
| 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 | +use App\Models\Visualization\Visualization; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :定制项目处理 | ||
| 19 | + * @name :VisualizationController | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2023/11/15 9:55 | ||
| 23 | + */ | ||
| 24 | +class VisualizationController extends BaseController | ||
| 25 | +{ | ||
| 26 | + /** | ||
| 27 | + * @remark :获取当前定制代码块详情 | ||
| 28 | + * @name :info | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2023/11/15 10:26 | ||
| 32 | + */ | ||
| 33 | + public function info(Visualization $visualization){ | ||
| 34 | + //查看当前模板是否在可视化中保存 | ||
| 35 | + $info = $visualization->read(['source'=>$this->map['source']],['html','source','id','project_id']); | ||
| 36 | + if($info === false){ | ||
| 37 | + $info = []; | ||
| 38 | + } | ||
| 39 | + $this->response('success',Code::SUCCESS,$info); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * @remark :保存定制项目html | ||
| 44 | + * @name :save | ||
| 45 | + * @author :lyh | ||
| 46 | + * @method :post | ||
| 47 | + * @time :2023/11/15 10:08 | ||
| 48 | + */ | ||
| 49 | + public function save(VisualizationLogic $logic){ | ||
| 50 | + $this->request->validate([ | ||
| 51 | + 'source'=>'required', | ||
| 52 | + 'html'=>'required', | ||
| 53 | + ],[ | ||
| 54 | + 'source.required' => '类型不能为空', | ||
| 55 | + 'html.required' => 'html不能为空', | ||
| 56 | + ]); | ||
| 57 | + $logic->saveVisualization(); | ||
| 58 | + $this->response('success'); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * @remark :可视化保存 | ||
| 63 | + * @name :saveHtml | ||
| 64 | + * @author :lyh | ||
| 65 | + * @method :post | ||
| 66 | + * @time :2023/11/15 11:20 | ||
| 67 | + */ | ||
| 68 | + public function getHtml(VisualizationLogic $logic){ | ||
| 69 | + $this->request->validate([ | ||
| 70 | + 'source'=>'required', | ||
| 71 | + 'source_id'=>'required', | ||
| 72 | + ],[ | ||
| 73 | + 'source.required' => '类型不能为空', | ||
| 74 | + 'source_id.required' => 'source_id不能为空', | ||
| 75 | + ]); | ||
| 76 | + $data = $logic->getHtml(); | ||
| 77 | + $this->response('success',Code::SUCCESS,['html'=>$data]); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * @remark :保存html | ||
| 82 | + * @name :saveHtml | ||
| 83 | + * @author :lyh | ||
| 84 | + * @method :post | ||
| 85 | + * @time :2023/11/15 11:44 | ||
| 86 | + */ | ||
| 87 | + public function saveHtml(VisualizationLogic $logic){ | ||
| 88 | + $this->request->validate([ | ||
| 89 | + 'source'=>'required', | ||
| 90 | + 'source_id'=>'required', | ||
| 91 | + ],[ | ||
| 92 | + 'source.required' => '类型不能为空', | ||
| 93 | + 'source_id.required' => 'source_id不能为空', | ||
| 94 | + ]); | ||
| 95 | + $logic->saveHtml(); | ||
| 96 | + $this->response('success'); | ||
| 97 | + } | ||
| 98 | +} |
| @@ -81,6 +81,9 @@ class ProjectLogic extends BaseLogic | @@ -81,6 +81,9 @@ class ProjectLogic extends BaseLogic | ||
| 81 | if(empty($info['payment']['renewal_record'])){ | 81 | if(empty($info['payment']['renewal_record'])){ |
| 82 | $info['payment']['renewal_record'] = [["amount"=> null, "remark"=> null, "expire_at"=> null]]; | 82 | $info['payment']['renewal_record'] = [["amount"=> null, "remark"=> null, "expire_at"=> null]]; |
| 83 | } | 83 | } |
| 84 | + if(isset($info['is_customized']) && $info['is_customized'] == 1){ | ||
| 85 | + $info['is_visualization'] = json_decode($info['is_visualization']); | ||
| 86 | + } | ||
| 84 | return $this->success($info); | 87 | return $this->success($info); |
| 85 | } | 88 | } |
| 86 | 89 | ||
| @@ -130,12 +133,9 @@ class ProjectLogic extends BaseLogic | @@ -130,12 +133,9 @@ class ProjectLogic extends BaseLogic | ||
| 130 | //保存售后信息 | 133 | //保存售后信息 |
| 131 | $this->saveProjectAfter($this->param['project_after']); | 134 | $this->saveProjectAfter($this->param['project_after']); |
| 132 | //创建站点 | 135 | //创建站点 |
| 133 | - $this->createSite($this->param); | 136 | +// $this->createSite($this->param); |
| 134 | } | 137 | } |
| 135 | DB::commit(); | 138 | DB::commit(); |
| 136 | - }catch (AsideGlobalException $e){ | ||
| 137 | - DB::rollBack(); | ||
| 138 | - $this->fail($e->getMessage()); | ||
| 139 | }catch (\Exception $e){ | 139 | }catch (\Exception $e){ |
| 140 | DB::rollBack(); | 140 | DB::rollBack(); |
| 141 | $this->fail('请填写完整后再提交'); | 141 | $this->fail('请填写完整后再提交'); |
| @@ -188,6 +188,11 @@ class ProjectLogic extends BaseLogic | @@ -188,6 +188,11 @@ class ProjectLogic extends BaseLogic | ||
| 188 | 'upload_max_size' => $param['upload_config']['upload_max_size'] ?? 5, | 188 | 'upload_max_size' => $param['upload_config']['upload_max_size'] ?? 5, |
| 189 | ]; | 189 | ]; |
| 190 | } | 190 | } |
| 191 | + if(isset($param['is_customized']) && ($param['is_customized'] == 1)){ | ||
| 192 | + if(!empty($param['is_visualization'])){ | ||
| 193 | + $param['is_visualization'] = json_encode($param['is_visualization']); | ||
| 194 | + } | ||
| 195 | + } | ||
| 191 | $this->model->edit($param,['id'=>$param['id']]); | 196 | $this->model->edit($param,['id'=>$param['id']]); |
| 192 | Common::del_user_cache($this->model->getTable(),$param['id']); | 197 | Common::del_user_cache($this->model->getTable(),$param['id']); |
| 193 | return $this->success(); | 198 | return $this->success(); |
| @@ -400,7 +405,7 @@ class ProjectLogic extends BaseLogic | @@ -400,7 +405,7 @@ class ProjectLogic extends BaseLogic | ||
| 400 | $menuModel = new ProjectMenu(); | 405 | $menuModel = new ProjectMenu(); |
| 401 | $ids = $menuModel->where(['status'=>0])->pluck('id')->toArray(); | 406 | $ids = $menuModel->where(['status'=>0])->pluck('id')->toArray(); |
| 402 | $data = [ | 407 | $data = [ |
| 403 | - 'name'=>'超级管理员', | 408 | + 'name'=>'管理员', |
| 404 | 'role_menu'=>implode(',',$ids), | 409 | 'role_menu'=>implode(',',$ids), |
| 405 | 'project_id'=>$project_id, | 410 | 'project_id'=>$project_id, |
| 406 | 'type'=>1, | 411 | 'type'=>1, |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BTemplateModuleProjectLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/11/14 14:41 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Bside\BTemplate; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 13 | +use App\Models\Template\BModuleProject; | ||
| 14 | + | ||
| 15 | +class BTemplateModuleProjectLogic extends BaseLogic | ||
| 16 | +{ | ||
| 17 | + public function __construct() | ||
| 18 | + { | ||
| 19 | + parent::__construct(); | ||
| 20 | + $this->model = new BModuleProject(); | ||
| 21 | + $this->param = $this->requestAll; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * @remark :保存私有化左侧模块 | ||
| 26 | + * @name :moduleProjectSave | ||
| 27 | + * @author :lyh | ||
| 28 | + * @method :post | ||
| 29 | + * @time :2023/11/14 14:46 | ||
| 30 | + */ | ||
| 31 | + public function moduleProjectSave(){ | ||
| 32 | + try { | ||
| 33 | + $this->param['operator_id'] = $this->user['id']; | ||
| 34 | + $this->param['project_id'] = $this->user['project_id']; | ||
| 35 | + $this->model->add($this->param); | ||
| 36 | + }catch (\Exception $e){ | ||
| 37 | + $this->fail('系统错误,请联系管理员'); | ||
| 38 | + } | ||
| 39 | + return $this->success(); | ||
| 40 | + } | ||
| 41 | +} |
| 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\Template\BTemplate; | ||
| 14 | +use App\Models\Template\BTemplateCommon; | ||
| 15 | +use App\Models\Visualization\Visualization; | ||
| 16 | + | ||
| 17 | +class VisualizationLogic extends BaseLogic | ||
| 18 | +{ | ||
| 19 | + public function __construct() | ||
| 20 | + { | ||
| 21 | + parent::__construct(); | ||
| 22 | + $this->model = new Visualization(); | ||
| 23 | + $this->param = $this->requestAll; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * @remark :保存定制html | ||
| 28 | + * @name :saveHtml | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2023/11/15 10:12 | ||
| 32 | + */ | ||
| 33 | + public function saveVisualization(){ | ||
| 34 | + try { | ||
| 35 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 36 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 37 | + }else{ | ||
| 38 | + $this->param['project_id'] = $this->user['project_id']; | ||
| 39 | + $this->model->add($this->param); | ||
| 40 | + } | ||
| 41 | + }catch (\Exception $e){ | ||
| 42 | + $this->fail('系统错误,请联系管理员'); | ||
| 43 | + } | ||
| 44 | + return $this->success(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * @remark :可视化装修获取html | ||
| 49 | + * @name :getHtml | ||
| 50 | + * @author :lyh | ||
| 51 | + * @method :post | ||
| 52 | + * @time :2023/11/15 11:30 | ||
| 53 | + */ | ||
| 54 | + public function getHtml(){ | ||
| 55 | + //查询可视化是否第一次保存 | ||
| 56 | + $bTemplateModel = new BTemplate(); | ||
| 57 | + $TemplateInfo = $bTemplateModel->read([ | ||
| 58 | + 'source'=>$this->param['source'], | ||
| 59 | + 'project_id'=>$this->user['project_id'], | ||
| 60 | + 'source_id'=>$this->param['source_id'], | ||
| 61 | + ]); | ||
| 62 | + if($this->param['source'] == 2){ | ||
| 63 | + if($this->param['source_id'] == 0){$source = 3;}else{$source = 2;} | ||
| 64 | + } | ||
| 65 | + if($this->param['source'] == 3){ | ||
| 66 | + if($this->param['source_id'] == 0){$source = 5;}else{$source = 4;} | ||
| 67 | + } | ||
| 68 | + if($this->param['source'] == 4){ | ||
| 69 | + if($this->param['source_id'] == 0){$source = 7;}else{$source = 6;} | ||
| 70 | + } | ||
| 71 | + if($TemplateInfo === false){ | ||
| 72 | + $info = $this->model->read(['source'=>$source],['html','source','id','project_id']); | ||
| 73 | + if($info === false){ | ||
| 74 | + $this->fail('请先上传定制代码块'); | ||
| 75 | + } | ||
| 76 | + return $info['html']; | ||
| 77 | + } | ||
| 78 | + return $TemplateInfo['html']; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * @remark :保存定制项目可视化 | ||
| 83 | + * @name :saveHtml | ||
| 84 | + * @author :lyh | ||
| 85 | + * @method :post | ||
| 86 | + * @time :2023/11/15 11:47 | ||
| 87 | + */ | ||
| 88 | + public function saveHtml(){ | ||
| 89 | + $bTemplateModel = new BTemplate(); | ||
| 90 | + $templateInfo = $bTemplateModel->read([ | ||
| 91 | + 'source'=>$this->param['source'], | ||
| 92 | + 'project_id'=>$this->user['project_id'], | ||
| 93 | + 'source_id'=>$this->param['source_id'], | ||
| 94 | + ]); | ||
| 95 | + try { | ||
| 96 | + if($templateInfo === false){ | ||
| 97 | + $this->param['project_id'] = $this->user['project_id']; | ||
| 98 | + $bTemplateModel->add($this->param); | ||
| 99 | + }else{ | ||
| 100 | + $bTemplateModel->edit(['html'=>$this->param['html']],['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]); | ||
| 101 | + } | ||
| 102 | + }catch (\Exception $e){ | ||
| 103 | + $this->fail('系统错误请联系管理员'); | ||
| 104 | + } | ||
| 105 | + return $this->success(); | ||
| 106 | + | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + | ||
| 110 | + | ||
| 111 | +} |
| @@ -38,7 +38,7 @@ class ExtendLogic extends BaseLogic | @@ -38,7 +38,7 @@ class ExtendLogic extends BaseLogic | ||
| 38 | if($info !== false){ | 38 | if($info !== false){ |
| 39 | $this->fail('当前扩展名称已存在'); | 39 | $this->fail('当前扩展名称已存在'); |
| 40 | } | 40 | } |
| 41 | - $key = trim(strtolower(preg_replace('/[\W]+/', '-', trim(Translate::tran($this->param['title'], 'en')))), '-'); | 41 | + $key = 'pd_extended_field_'; |
| 42 | $this->param['key'] = $this->getKey($key); | 42 | $this->param['key'] = $this->getKey($key); |
| 43 | $this->param['project_id'] = $this->user['project_id']; | 43 | $this->param['project_id'] = $this->user['project_id']; |
| 44 | $rs = $this->model->add($this->param); | 44 | $rs = $this->model->add($this->param); |
| @@ -56,11 +56,10 @@ class ExtendLogic extends BaseLogic | @@ -56,11 +56,10 @@ class ExtendLogic extends BaseLogic | ||
| 56 | * @method :post | 56 | * @method :post |
| 57 | * @time :2023/11/9 15:55 | 57 | * @time :2023/11/9 15:55 |
| 58 | */ | 58 | */ |
| 59 | - public function getKey($key){ | ||
| 60 | - $info = $this->model->read(['key'=>$key]); | 59 | + public function getKey($key,$i = 1){ |
| 60 | + $info = $this->model->read(['key'=>$key.$i]); | ||
| 61 | if($info !== false){ | 61 | if($info !== false){ |
| 62 | - $key .= '-'.rand(1, 100); | ||
| 63 | - return $this->getKey($key); | 62 | + return $this->getKey($key,$i+1); |
| 64 | } | 63 | } |
| 65 | return $key; | 64 | return $key; |
| 66 | } | 65 | } |
| @@ -99,29 +99,29 @@ class ProductLogic extends BaseLogic | @@ -99,29 +99,29 @@ class ProductLogic extends BaseLogic | ||
| 99 | * @method :post | 99 | * @method :post |
| 100 | * @time :2023/11/9 15:02 | 100 | * @time :2023/11/9 15:02 |
| 101 | */ | 101 | */ |
| 102 | - public function saveExtendInfo($id,$extend){ | 102 | + public function saveExtendInfo($product_id,$extend){ |
| 103 | //先删除以前的数据 | 103 | //先删除以前的数据 |
| 104 | $extendInfoModel = new ExtendInfo(); | 104 | $extendInfoModel = new ExtendInfo(); |
| 105 | - $extendInfoModel->del(['project_id'=>$id]); | ||
| 106 | - if(!empty($extend)){ | ||
| 107 | - foreach ($extend as $v){ | 105 | + $extendInfoModel->del(['product_id'=>$product_id]); |
| 106 | + if(empty($extend)) { | ||
| 107 | + return $this->success(); | ||
| 108 | + } | ||
| 109 | + foreach ($extend as $k => $v){ | ||
| 110 | + if(empty($v['values'])){ | ||
| 111 | + continue; | ||
| 112 | + } | ||
| 108 | unset($v['title']); | 113 | unset($v['title']); |
| 109 | - if(!empty($v['values'])){ | ||
| 110 | - if($v['type'] == 3 || $v['type'] || 4){ | ||
| 111 | - if(is_array($v['values'])){ | 114 | + if($v['type'] == 3 || $v['type'] == 4){ |
| 112 | foreach ($v['values'] as $k1=>$v1){ | 115 | foreach ($v['values'] as $k1=>$v1){ |
| 113 | $v1 = str_replace_url($v1); | 116 | $v1 = str_replace_url($v1); |
| 114 | $v['values'][$k1] = $v1; | 117 | $v['values'][$k1] = $v1; |
| 115 | } | 118 | } |
| 116 | $v['values'] = json_encode($v['values']); | 119 | $v['values'] = json_encode($v['values']); |
| 117 | } | 120 | } |
| 118 | - } | ||
| 119 | $v['project_id'] = $this->user['project_id']; | 121 | $v['project_id'] = $this->user['project_id']; |
| 120 | - $v['product_id'] = $id; | 122 | + $v['product_id'] = $product_id; |
| 121 | $extendInfoModel->add($v); | 123 | $extendInfoModel->add($v); |
| 122 | } | 124 | } |
| 123 | - } | ||
| 124 | - } | ||
| 125 | return $this->success(); | 125 | return $this->success(); |
| 126 | } | 126 | } |
| 127 | 127 |
| @@ -168,6 +168,9 @@ class UserLoginLogic | @@ -168,6 +168,9 @@ class UserLoginLogic | ||
| 168 | $info['upload_config'] = $project['upload_config']; | 168 | $info['upload_config'] = $project['upload_config']; |
| 169 | $info['image_max'] = $project['image_max']; | 169 | $info['image_max'] = $project['image_max']; |
| 170 | $info['configuration'] = $project['deploy_build']['configuration']; | 170 | $info['configuration'] = $project['deploy_build']['configuration']; |
| 171 | + if($info['is_customized'] == 1){ | ||
| 172 | + $info['is_visualization'] = json_decode($project['is_visualization']); | ||
| 173 | + } | ||
| 171 | //保存项目缓存 | 174 | //保存项目缓存 |
| 172 | Cache::put('user-'.$info['project_id'],$project,$minutes = null); | 175 | Cache::put('user-'.$info['project_id'],$project,$minutes = null); |
| 173 | return $this->success($info); | 176 | return $this->success($info); |
| @@ -196,14 +199,17 @@ class UserLoginLogic | @@ -196,14 +199,17 @@ class UserLoginLogic | ||
| 196 | $info['is_customized'] = $project['is_customized']; | 199 | $info['is_customized'] = $project['is_customized']; |
| 197 | $info['is_upload_manage'] = $project['is_upload_manage']; | 200 | $info['is_upload_manage'] = $project['is_upload_manage']; |
| 198 | $info['upload_config'] = $project['upload_config']; | 201 | $info['upload_config'] = $project['upload_config']; |
| 202 | + $info['image_max'] = $project['image_max']; | ||
| 199 | $info['configuration'] = $project['deploy_build']['configuration']; | 203 | $info['configuration'] = $project['deploy_build']['configuration']; |
| 204 | + if($info['is_customized'] == 1){ | ||
| 205 | + $info['is_visualization'] = json_decode($project['is_visualization']); | ||
| 206 | + } | ||
| 200 | //保存项目缓存 | 207 | //保存项目缓存 |
| 201 | Cache::put('user-'.$info['project_id'],$project,$minutes = null); | 208 | Cache::put('user-'.$info['project_id'],$project,$minutes = null); |
| 202 | return $this->success($info); | 209 | return $this->success($info); |
| 203 | } | 210 | } |
| 204 | 211 | ||
| 205 | 212 | ||
| 206 | - | ||
| 207 | /** | 213 | /** |
| 208 | * @remark :获取项目数据详情 | 214 | * @remark :获取项目数据详情 |
| 209 | * @name :getProjectInfo | 215 | * @name :getProjectInfo |
| @@ -41,6 +41,8 @@ class Category extends Base | @@ -41,6 +41,8 @@ class Category extends Base | ||
| 41 | return $ids; | 41 | return $ids; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | + | ||
| 45 | + | ||
| 44 | /** | 46 | /** |
| 45 | * 关联产品数量 | 47 | * 关联产品数量 |
| 46 | * @param $cate_id | 48 | * @param $cate_id |
| @@ -50,7 +52,16 @@ class Category extends Base | @@ -50,7 +52,16 @@ class Category extends Base | ||
| 50 | */ | 52 | */ |
| 51 | public static function getProductNum($cate_id){ | 53 | public static function getProductNum($cate_id){ |
| 52 | $cate_ids = self::getChildIdsArr($cate_id); | 54 | $cate_ids = self::getChildIdsArr($cate_id); |
| 53 | - $product_ids = CategoryRelated::whereIn('cate_id', $cate_ids)->groupBy('product_id')->select(['product_id'])->get(); | ||
| 54 | - return count($product_ids); | 55 | + $str = 0; |
| 56 | + foreach ($cate_ids as $v){ | ||
| 57 | + $info = self::where('pid',$v)->first(); | ||
| 58 | + if($info){ | ||
| 59 | + continue; | ||
| 60 | + }else{ | ||
| 61 | + $count = Product::where('category_id','like','%,'.$v.',%')->count(); | ||
| 62 | + $str = $str+$count; | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + return $str; | ||
| 55 | } | 66 | } |
| 56 | } | 67 | } |
app/Models/Template/BModuleProject.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BModuleProject.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/11/14 14:31 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Template; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :私有化左侧模块 | ||
| 16 | + * @name :BModuleProject | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2023/11/14 14:33 | ||
| 20 | + */ | ||
| 21 | +class BModuleProject extends Base | ||
| 22 | +{ | ||
| 23 | + protected $table = 'gl_public_template_module_project'; | ||
| 24 | + //连接数据库 | ||
| 25 | + protected $connection = 'custom_mysql'; | ||
| 26 | +} |
app/Models/Template/TemplateProject.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :TemplateProject.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/11/15 14:38 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Template; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class TemplateProject extends Base | ||
| 15 | +{ | ||
| 16 | + protected $table = 'gl_web_setting_template'; | ||
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 19 | +} |
app/Models/Visualization/Visualization.php
0 → 100644
| 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 | +} |
| @@ -320,6 +320,13 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -320,6 +320,13 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 320 | Route::any('/type', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'getType'])->name('template_module_getType'); | 320 | Route::any('/type', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'getType'])->name('template_module_getType'); |
| 321 | }); | 321 | }); |
| 322 | 322 | ||
| 323 | + // 保存私有模块 | ||
| 324 | + Route::prefix('moduleProject')->group(function () { | ||
| 325 | + //获取所有左侧模版 | ||
| 326 | + Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'lists'])->name('template_module_project_lists'); | ||
| 327 | + Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'save'])->name('template_module_project_save'); | ||
| 328 | + }); | ||
| 329 | + | ||
| 323 | //编辑记录 | 330 | //编辑记录 |
| 324 | Route::prefix('log')->group(function () { | 331 | Route::prefix('log')->group(function () { |
| 325 | //获取所有左侧模版 | 332 | //获取所有左侧模版 |
| @@ -328,6 +335,15 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -328,6 +335,15 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 328 | Route::any('/rollbackVersion', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'rollbackVersion'])->name('template_log_rollbackVersion'); | 335 | Route::any('/rollbackVersion', [\App\Http\Controllers\Bside\Template\BTemplateLogController::class, 'rollbackVersion'])->name('template_log_rollbackVersion'); |
| 329 | }); | 336 | }); |
| 330 | }); | 337 | }); |
| 338 | + | ||
| 339 | + //定制项目上传代码块 | ||
| 340 | + Route::prefix('visualization')->group(function () { | ||
| 341 | + Route::any('/info', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'info'])->name('visualization_info'); | ||
| 342 | + Route::any('/save', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'save'])->name('visualization_save'); | ||
| 343 | + Route::any('/getHtml', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'getHtml'])->name('visualization_getHtml'); | ||
| 344 | + Route::any('/saveHtml', [\App\Http\Controllers\Bside\Template\VisualizationController::class, 'saveHtml'])->name('visualization_saveHtml'); | ||
| 345 | + }); | ||
| 346 | + | ||
| 331 | // 自定义页面,专题页 | 347 | // 自定义页面,专题页 |
| 332 | Route::prefix('custom')->group(function () { | 348 | Route::prefix('custom')->group(function () { |
| 333 | Route::any('/', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'lists'])->name('custom_lists'); | 349 | Route::any('/', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'lists'])->name('custom_lists'); |
-
请 注册 或 登录 后发表评论