作者 lyh

gx

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :UpdateHtml.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/2/2 10:11
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Html;
  11 +
  12 +use App\Http\Controllers\Controller;
  13 +use App\Models\Com\NoticeLog;
  14 +use App\Models\Project\Project;
  15 +use App\Models\RouteMap\RouteMap;
  16 +use App\Models\Service\Service as ServiceSettingModel;
  17 +use App\Models\Template\BTemplate;
  18 +use App\Services\ProjectServer;
  19 +use Illuminate\Support\Facades\DB;
  20 +
  21 +class UpdateHtml extends Controller
  22 +{
  23 + protected $param;
  24 + protected $project_id;
  25 + public function __construct($data){
  26 + $this->param = $data;//Todo::传递的参数
  27 + $this->project_id = $data['project_id'];
  28 + }
  29 +
  30 + /**
  31 + * @remark :更新界面
  32 + * @name :updateHtml
  33 + * @author :lyh
  34 + * @method :post
  35 + * @time :2024/2/2 10:12
  36 + */
  37 + public function updateHtml(){
  38 + ProjectServer::useProject($this->project_id);
  39 + if(isset($this->param['route']) && $this->param['route'] == 'all'){
  40 + //TODO::更新所有界面
  41 + }else{
  42 + //TODO::更新单页
  43 + $routeMapModel = new RouteMap();
  44 + }
  45 + DB::disconnect('custom_mysql');
  46 + }
  47 +
  48 + /**
  49 + * @remark :获取页面是否为 定制/非定制 页面
  50 + * @name :getPageHtmlIsCustomized
  51 + * @param :source:类型;is_list:是否为列表页 1:列表页面
  52 + * @author :lyh
  53 + * @method :post
  54 + * @time :2024/2/2 11:03
  55 + */
  56 + public function getPageHtmlIsCustomized($source,$is_list){
  57 + $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
  58 + //查看当前页面是否定制,是否开启可视化
  59 + $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
  60 + if (in_array($type, $page_array)) {//是定制界面
  61 + return BTemplate::IS_VISUALIZATION;
  62 + }
  63 + return BTemplate::IS_NO_VISUALIZATION;
  64 + }
  65 +
  66 + /**
  67 + * @remark :获取头部底部公共部分代码
  68 + * @name :getTemplateCommon
  69 + * @author :lyh
  70 + * @method :post
  71 + * @time :2024/2/2 11:02
  72 + */
  73 + public function getTemplateCommon(){
  74 +
  75 + }
  76 +
  77 + /**
  78 + * @remark :获取装修中间内容
  79 + * @name :getTemplateMainHtml
  80 + * @author :lyh
  81 + * @method :post
  82 + * @time :2024/2/2 11:01
  83 + */
  84 + public function getTemplateMainHtml(){
  85 +
  86 + }
  87 +
  88 + /**
  89 + * @remark :获取项目详情
  90 + * @name :getProjectInfo
  91 + * @author :lyh
  92 + * @method :post
  93 + * @time :2024/2/2 10:50
  94 + */
  95 + public function getProjectInfo($project_id){
  96 + $projectModel = new Project();
  97 + $info = $projectModel->read(['id'=>$project_id],['id','is_customized']);
  98 + return $info;
  99 + }
  100 +
  101 + /**
  102 + * @remark :拼接获取公共头部底部
  103 + * @name :getHeadFooter
  104 + * @author :lyh
  105 + * @method :post
  106 + * @time :2023/7/21 17:22
  107 + */
  108 + public function getHeadFooter($html){
  109 + //获取公共主题头部底部
  110 + $serviceSettingModel = new ServiceSettingModel();
  111 + $list = $serviceSettingModel->list(['type'=>2],'created_at');
  112 + //拼接html
  113 + foreach ($list as $v){
  114 + if($v['key'] == 'head'){
  115 + $html = $v['values'].$html;
  116 + }
  117 + if($v['key'] == 'footer'){
  118 + $html = $html.$v['values'];
  119 + }
  120 + }
  121 + return $html;
  122 + }
  123 +}
@@ -51,6 +51,8 @@ class BTemplate extends Base @@ -51,6 +51,8 @@ class BTemplate extends Base
51 const IS_CUSTOM = 1;//为扩展模块 51 const IS_CUSTOM = 1;//为扩展模块
52 const IS_NO_CUSTOM = 0;//为默认模块 52 const IS_NO_CUSTOM = 0;//为默认模块
53 const IS_VISUALIZATION = 1;//定制项目 53 const IS_VISUALIZATION = 1;//定制项目
  54 +
  55 + const IS_NO_VISUALIZATION = 1;//定制项目
54 const STATUS = 0; 56 const STATUS = 0;
55 57
56 /** 58 /**