作者 lyh

gx

... ... @@ -68,7 +68,6 @@ class UpdateRoute extends Command
*/
public function getProductKeyword(){
$keywordModel = new Keyword();
<<<<<<< HEAD
$lists = $keywordModel->list(['route'=>'']);
if(!empty($lists)){
foreach ($lists as $v){
... ... @@ -76,15 +75,6 @@ class UpdateRoute extends Command
$route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']);
$this->curlDelRoute(['new_route'=>$route]);
$this->model->edit(['route'=>$route],['id'=>$v['id']]);
=======
$lists = $keywordModel->list(['route'=>null]);
if(!empty($lists)){
foreach ($lists as $v){
echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
$route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], 75);
$this->curlDelRoute(['new_route'=>$route]);
$keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
>>>>>>> 8178402b9bc03df4ea9fefb41f4f06aaeb5f6cb5
echo date('Y-m-d H:i:s') . 'end :'.$route . PHP_EOL;
}
}
... ...
... ... @@ -13,6 +13,8 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\CustomModule\CustomModuleLogic;
use App\Models\CustomModule\CustomModule;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
/**
* @remark :自定义模块
... ... @@ -30,9 +32,12 @@ class CustomModuleController extends BaseController
* @method :post
* @time :2023/12/4 15:43
*/
public function lists(CustomModule $customModule){
public function lists(){
ProjectServer::useProject($this->param['project_id']);
$customModule = new CustomModule();
$this->map['status'] = 0;
$lists = $customModule->lists($this->map,$this->page,$this->row,$this->order);
DB::disconnect('custom_mysql');
$this->response('success',Code::SUCCESS,$lists);
}
... ...
... ... @@ -13,6 +13,8 @@ use App\Http\Logic\Aside\BaseLogic;
use App\Models\CustomModule\CustomModule;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
class CustomModuleLogic extends BaseLogic
{
... ... @@ -20,7 +22,6 @@ class CustomModuleLogic extends BaseLogic
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new CustomModule();
}
/**
... ... @@ -31,10 +32,12 @@ class CustomModuleLogic extends BaseLogic
* @time :2023/12/4 16:10
*/
public function getCustomModuleInfo(){
$info = $this->model->read($this->param);
ProjectServer::useProject($this->param['project_id']);
$info = (new CustomModule())->read($this->param);
if($info === false){
$this->fail('当前数据不存在或已被删除');
}
DB::disconnect('custom_mysql');
return $this->success($info);
}
... ... @@ -78,10 +81,12 @@ class CustomModuleLogic extends BaseLogic
* @time :2023/12/5 9:39
*/
public function moduleAdd(){
$rs = $this->model->add($this->param);
ProjectServer::useProject($this->param['project_id']);
$rs = (new CustomModule())->add($this->param);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
DB::disconnect('custom_mysql');
return $this->success();
}
... ... @@ -93,10 +98,12 @@ class CustomModuleLogic extends BaseLogic
* @time :2023/12/5 9:39
*/
public function moduleEdit(){
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
ProjectServer::useProject($this->param['project_id']);
$rs = (new CustomModule())->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
DB::disconnect('custom_mysql');
return $this->success();
}
... ... @@ -108,6 +115,7 @@ class CustomModuleLogic extends BaseLogic
* @time :2023/12/4 15:47
*/
public function customModuleDel(){
ProjectServer::useProject($this->param['project_id']);
//查看当前模块是否拥有数据
$contentModel = new CustomModuleContent();
$contentInfo = $contentModel->read(['module_id'=>$this->param['id']],['id']);
... ... @@ -123,6 +131,7 @@ class CustomModuleLogic extends BaseLogic
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
DB::disconnect('custom_mysql');
return $this->success();
}
}
... ...
... ... @@ -63,7 +63,7 @@ class BTemplateLogic extends BaseLogic
*/
public function getTemplate(){
$settingInfo = $this->getSettingTemplate();//模版详情
$data = $this->getTemplateHtml($settingInfo,$this->param['source'],$this->param['source_id'],$this->param['is_custom'] ?? 0);
$data = $this->getHtml($settingInfo,$this->param['source'],$this->param['source_id'],$this->param['is_custom'] ?? 0);
return $this->success($data);
}
... ... @@ -74,7 +74,7 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/13 10:47
*/
public function getTemplateHtml($settingInfo,$source,$source_id,$is_custom = 0){
public function getHtml($settingInfo,$source,$source_id,$is_custom = 0){
$templateInfo = $this->webTemplateInfo($settingInfo['template_id'],$source,$source_id,$is_custom);
if($templateInfo === false){
if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据
... ... @@ -327,6 +327,56 @@ class BTemplateLogic extends BaseLogic
}
/**
* @remark :可视化保存html
* @name :saveHtml
* @author :lyh
* @method :post
* @time :2023/12/13 17:02
*/
public function saveHtml($html,$source,$source_id,$template_id = 0,$is_custom = 0){
$this->saveCommonHtml($html,$source,$source_id,$template_id);//保存头部底部
$info = $this->webTemplateInfo($this->param['template_id'],$source,$source_id,$is_custom);
if($info === false){
$data = [];
$this->model->add($data);
}else{
$data = [];
$this->model->edit($data);
}
}
/**
* @remark :保存公共头部底部
* @name :saveCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/13 17:05
*/
public function saveCommonHtml($html,$source,$source_id,$template_id){
$type = $this->getType($source,$source_id);//获取头部类型1-9(首页到自定义页面)
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在
$handleInfo = $this->handleCommonParam($html);
if($commonInfo === false){
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
'type'=>$type,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'],
];
$templateCommonModel->add($data);
}else{
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
];
$templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
}
//更新所有界面的other
return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
}
/**
* @remark :演示项目不允许修改首页
* @name :showProject
* @author :lyh
... ... @@ -397,6 +447,24 @@ class BTemplateLogic extends BaseLogic
}
/**
* @remark :保存时字符串处理
* @name :handleSaveParam
* @author :lyh
* @method :post
* @time :2023/6/29 15:35
*/
public function handleCommonParam($html){
//字符串截取
$param['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s');
$param['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s');
$param['head_css'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s');
$param['footer_css'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s');
$footer_other = str_replace('<header','',characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$param['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
return $this->success($param);
}
/**
* @remark :获取设置的类型
* @name :getType
* @author :lyh
... ...