Merge remote-tracking branch 'origin/master' into akun
正在显示
44 个修改的文件
包含
1219 行增加
和
600 行删除
| @@ -187,6 +187,7 @@ class SyncProject extends Command | @@ -187,6 +187,7 @@ class SyncProject extends Command | ||
| 187 | 'lead_name' => $param['principal_name'], | 187 | 'lead_name' => $param['principal_name'], |
| 188 | 'mobile' => $param['principal_mobile'], | 188 | 'mobile' => $param['principal_mobile'], |
| 189 | 'mysql_id'=>Project::MYSQL_ID, | 189 | 'mysql_id'=>Project::MYSQL_ID, |
| 190 | + 'serve_id'=>9, | ||
| 190 | 'qq' => $param['customer_qq'], | 191 | 'qq' => $param['customer_qq'], |
| 191 | 'channel' => Channel::getProjectChannel($param['company_id'], $param['username_sales']), | 192 | 'channel' => Channel::getProjectChannel($param['company_id'], $param['username_sales']), |
| 192 | 'requirement' => $param['remark'], | 193 | 'requirement' => $param['remark'], |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +namespace App\Console\Commands\RankData; | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +use App\Helper\Arr; | ||
| 8 | +use App\Utils\HttpUtils; | ||
| 9 | +use GuzzleHttp\Exception\GuzzleException; | ||
| 10 | +use Illuminate\Console\Command; | ||
| 11 | + | ||
| 12 | +class updateAiProjects extends Command | ||
| 13 | +{ | ||
| 14 | + protected $signature = 'updateAiProjects'; | ||
| 15 | + | ||
| 16 | + protected $description = '更新AI站点域名数据'; | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + public function handle() | ||
| 20 | + { | ||
| 21 | + $api_url = 'https://demosite5.globalso.com/api/domain'; | ||
| 22 | + try { | ||
| 23 | + $data = HttpUtils::get($api_url, []); | ||
| 24 | + if ($data) { | ||
| 25 | + $data = Arr::s2a($data); | ||
| 26 | + $file_path = public_path('ai_domains.txt'); | ||
| 27 | + file_put_contents($file_path, json_encode($data['data'])); | ||
| 28 | + } | ||
| 29 | + } catch (\Exception | GuzzleException $e) { | ||
| 30 | + errorLog('AI站点项目获取失败', [], $e); | ||
| 31 | + return false; | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | +} |
| @@ -90,7 +90,7 @@ class RecommendedSuppliers extends Command | @@ -90,7 +90,7 @@ class RecommendedSuppliers extends Command | ||
| 90 | ]; | 90 | ]; |
| 91 | $res = http_post($url,json_encode($param)); | 91 | $res = http_post($url,json_encode($param)); |
| 92 | echo date('Y-m-d H:i:s') . json_encode($res) . PHP_EOL; | 92 | echo date('Y-m-d H:i:s') . json_encode($res) . PHP_EOL; |
| 93 | - if(!empty($res) && $res['code'] == 200 && !empty($res['data'])){ | 93 | + if(!empty($res) && isset($res['code']) && $res['code'] == 200 && !empty($res['data'])){ |
| 94 | //保存多条数据 | 94 | //保存多条数据 |
| 95 | $saveData = [ | 95 | $saveData = [ |
| 96 | 'project_id'=>$project_id, | 96 | 'project_id'=>$project_id, |
| @@ -115,8 +115,6 @@ class RecommendedSuppliers extends Command | @@ -115,8 +115,6 @@ class RecommendedSuppliers extends Command | ||
| 115 | * @time :2024/7/1 18:07 | 115 | * @time :2024/7/1 18:07 |
| 116 | */ | 116 | */ |
| 117 | public function getKeywords($project_id){ | 117 | public function getKeywords($project_id){ |
| 118 | - $keywordModel = new Keyword(); | ||
| 119 | - $keywordModel-> | ||
| 120 | $info = Keyword::inRandomOrder()->first(); | 118 | $info = Keyword::inRandomOrder()->first(); |
| 121 | $keywordInfo = $this->getPurchaser($info->title,$project_id); | 119 | $keywordInfo = $this->getPurchaser($info->title,$project_id); |
| 122 | if($keywordInfo !== false){ | 120 | if($keywordInfo !== false){ |
| @@ -79,9 +79,9 @@ class SyncSubmitTaskDistribution extends Command | @@ -79,9 +79,9 @@ class SyncSubmitTaskDistribution extends Command | ||
| 79 | foreach ($list as $task) { | 79 | foreach ($list as $task) { |
| 80 | $data[] = [ | 80 | $data[] = [ |
| 81 | 'type' => $task->type, | 81 | 'type' => $task->type, |
| 82 | - 'data' => json_encode($task->data), | ||
| 83 | - 'created_at' => $task['created_at'], | ||
| 84 | - 'updated_at' => $task['updated_at'], | 82 | + 'data' => $task->data, |
| 83 | + 'created_at' => $task->created_at, | ||
| 84 | + 'updated_at' => $task->updated_at, | ||
| 85 | ]; | 85 | ]; |
| 86 | } | 86 | } |
| 87 | $data && SyncSubmitTaskModel::insert($data); | 87 | $data && SyncSubmitTaskModel::insert($data); |
| @@ -8,8 +8,11 @@ | @@ -8,8 +8,11 @@ | ||
| 8 | namespace App\Console\Commands\Test; | 8 | namespace App\Console\Commands\Test; |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | +use App\Helper\Arr; | ||
| 12 | +use App\Models\Blog\Blog; | ||
| 11 | use App\Models\Com\KeywordVideoTask; | 13 | use App\Models\Com\KeywordVideoTask; |
| 12 | use App\Models\Com\KeywordVideoTaskLog; | 14 | use App\Models\Com\KeywordVideoTaskLog; |
| 15 | +use App\Models\CustomModule\CustomModuleContent; | ||
| 13 | use App\Models\Devops\ServerConfig; | 16 | use App\Models\Devops\ServerConfig; |
| 14 | use App\Models\Devops\Servers; | 17 | use App\Models\Devops\Servers; |
| 15 | use App\Models\Devops\ServersIp; | 18 | use App\Models\Devops\ServersIp; |
| @@ -23,6 +26,8 @@ use App\Models\Project\DeployOptimize; | @@ -23,6 +26,8 @@ use App\Models\Project\DeployOptimize; | ||
| 23 | use App\Models\Project\MinorLanguages; | 26 | use App\Models\Project\MinorLanguages; |
| 24 | use App\Models\Project\Project; | 27 | use App\Models\Project\Project; |
| 25 | use App\Models\Purchaser\PurchaserInfo; | 28 | use App\Models\Purchaser\PurchaserInfo; |
| 29 | +use App\Models\RouteMap\RouteMap; | ||
| 30 | +use App\Models\Template\BTemplateCom; | ||
| 26 | use App\Services\AmazonS3Service; | 31 | use App\Services\AmazonS3Service; |
| 27 | use App\Services\ProjectServer; | 32 | use App\Services\ProjectServer; |
| 28 | use App\Utils\EncryptUtils; | 33 | use App\Utils\EncryptUtils; |
| @@ -48,7 +53,17 @@ class Demo extends Command | @@ -48,7 +53,17 @@ class Demo extends Command | ||
| 48 | protected $description = 'demo'; | 53 | protected $description = 'demo'; |
| 49 | 54 | ||
| 50 | public function handle(){ | 55 | public function handle(){ |
| 51 | - $this->synchronizationFile('/upload/m/file/2024-07/tongli-haiyuan-keywords.pdf'); | 56 | + $projectModel = new Project(); |
| 57 | + $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0]); | ||
| 58 | + foreach ($list as $v){ | ||
| 59 | + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | ||
| 60 | + ProjectServer::useProject($v['id']); | ||
| 61 | + $templateComModel = new BTemplateCom(); | ||
| 62 | + $templateComModel->edit(['source'=>3,'is_list'=>1],['source'=>5,'is_list'=>0,'is_custom'=>0]); | ||
| 63 | + $templateComModel->edit(['source'=>4,'is_list'=>1],['source'=>7,'is_list'=>0,'is_custom'=>0]); | ||
| 64 | + DB::disconnect('custom_mysql'); | ||
| 65 | + } | ||
| 66 | + | ||
| 52 | } | 67 | } |
| 53 | 68 | ||
| 54 | public function synchronizationFile($path_name){ | 69 | public function synchronizationFile($path_name){ |
| @@ -77,6 +77,28 @@ class HeaderFooter extends Command | @@ -77,6 +77,28 @@ class HeaderFooter extends Command | ||
| 77 | $commonList = $templateCommonModel->list(['template_id'=>['in',[$settingInfo['template_id'],0]]]); | 77 | $commonList = $templateCommonModel->list(['template_id'=>['in',[$settingInfo['template_id'],0]]]); |
| 78 | if(!empty($commonList)){ | 78 | if(!empty($commonList)){ |
| 79 | foreach ($commonList as $v){ | 79 | foreach ($commonList as $v){ |
| 80 | + if($v['is_custom'] == 0){ | ||
| 81 | + if($v['type'] == 3){ | ||
| 82 | + $v['type'] = 2; | ||
| 83 | + $v['is_list'] = 1; | ||
| 84 | + } | ||
| 85 | + if($v['type'] == 4){ | ||
| 86 | + $v['type'] = 3; | ||
| 87 | + $v['is_list'] = 0; | ||
| 88 | + } | ||
| 89 | + if($v['type'] == 5){ | ||
| 90 | + $v['type'] = 3; | ||
| 91 | + $v['is_list'] = 1; | ||
| 92 | + } | ||
| 93 | + if($v['type'] == 6){ | ||
| 94 | + $v['type'] = 4; | ||
| 95 | + $v['is_list'] = 0; | ||
| 96 | + } | ||
| 97 | + if($v['type'] == 7){ | ||
| 98 | + $v['type'] = 4; | ||
| 99 | + $v['is_list'] = 1; | ||
| 100 | + } | ||
| 101 | + } | ||
| 80 | $typeArr = [1, 2, 3]; | 102 | $typeArr = [1, 2, 3]; |
| 81 | foreach ($typeArr as $type){ | 103 | foreach ($typeArr as $type){ |
| 82 | if($type == 1){ | 104 | if($type == 1){ |
| @@ -11,6 +11,7 @@ namespace App\Console\Commands\Test; | @@ -11,6 +11,7 @@ namespace App\Console\Commands\Test; | ||
| 11 | 11 | ||
| 12 | use App\Helper\Arr; | 12 | use App\Helper\Arr; |
| 13 | use App\Helper\Translate; | 13 | use App\Helper\Translate; |
| 14 | +use App\Models\Blog\Blog; | ||
| 14 | use App\Models\CustomModule\CustomModuleCategory; | 15 | use App\Models\CustomModule\CustomModuleCategory; |
| 15 | use App\Models\Product\CategoryRelated; | 16 | use App\Models\Product\CategoryRelated; |
| 16 | use App\Models\Product\Keyword; | 17 | use App\Models\Product\Keyword; |
| @@ -54,13 +55,14 @@ class UpdateRoute extends Command | @@ -54,13 +55,14 @@ class UpdateRoute extends Command | ||
| 54 | */ | 55 | */ |
| 55 | public function handle(){ | 56 | public function handle(){ |
| 56 | $projectModel = new Project(); | 57 | $projectModel = new Project(); |
| 57 | - $list = $projectModel->list(['id'=>['in',[664]]]); | 58 | + $list = $projectModel->list(['id'=>['in',[802]]]); |
| 58 | $data = []; | 59 | $data = []; |
| 59 | foreach ($list as $v){ | 60 | foreach ($list as $v){ |
| 60 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 61 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 61 | ProjectServer::useProject($v['id']); | 62 | ProjectServer::useProject($v['id']); |
| 62 | // $this->getProduct(); | 63 | // $this->getProduct(); |
| 63 | $this->setProductKeyword(); | 64 | $this->setProductKeyword(); |
| 65 | +// $this->getBlog(); | ||
| 64 | DB::disconnect('custom_mysql'); | 66 | DB::disconnect('custom_mysql'); |
| 65 | } | 67 | } |
| 66 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 68 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -386,4 +388,14 @@ class UpdateRoute extends Command | @@ -386,4 +388,14 @@ class UpdateRoute extends Command | ||
| 386 | } | 388 | } |
| 387 | return true; | 389 | return true; |
| 388 | } | 390 | } |
| 391 | + | ||
| 392 | + public function getBlog(){ | ||
| 393 | + $blogModel = new Blog(); | ||
| 394 | + $lists = $blogModel->list(); | ||
| 395 | + foreach ($lists as $v){ | ||
| 396 | + $route = RouteMap::setRoute($v['name'], RouteMap::SOURCE_BLOG, $v['id'], 1462); | ||
| 397 | + $blogModel->edit(['url'=>$route],['id'=>$v['id']]); | ||
| 398 | + } | ||
| 399 | + return true; | ||
| 400 | + } | ||
| 389 | } | 401 | } |
| @@ -40,6 +40,9 @@ class Kernel extends ConsoleKernel | @@ -40,6 +40,9 @@ class Kernel extends ConsoleKernel | ||
| 40 | $schedule->command('delete_template_log')->monthlyOn(15, '00:01')->withoutOverlapping(); | 40 | $schedule->command('delete_template_log')->monthlyOn(15, '00:01')->withoutOverlapping(); |
| 41 | // 每日推送已完成视频任务项目生成对应界面 | 41 | // 每日推送已完成视频任务项目生成对应界面 |
| 42 | $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1); | 42 | $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1); |
| 43 | + | ||
| 44 | + //更新AI站点数据 | ||
| 45 | + $schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1); | ||
| 43 | } | 46 | } |
| 44 | 47 | ||
| 45 | /** | 48 | /** |
| @@ -531,24 +531,12 @@ class OptimizationReportController extends BaseController | @@ -531,24 +531,12 @@ class OptimizationReportController extends BaseController | ||
| 531 | */ | 531 | */ |
| 532 | public function getAiProjects($domain = null) | 532 | public function getAiProjects($domain = null) |
| 533 | { | 533 | { |
| 534 | - $key = 'ai_projects_list'; | ||
| 535 | - $data = Cache::get($key); | ||
| 536 | - if (!$data) { | ||
| 537 | - $api_url = 'https://demosite5.globalso.com/api/domain'; | ||
| 538 | - try { | ||
| 539 | - $data = HttpUtils::get($api_url, []); | ||
| 540 | - if ($data) { | ||
| 541 | - $data = Arr::s2a($data); | ||
| 542 | - Cache::put($key, $data, 4 * 3600); | ||
| 543 | - } | ||
| 544 | - } catch (\Exception | GuzzleException $e) { | ||
| 545 | - errorLog('AI站点项目获取失败', [], $e); | ||
| 546 | - return false; | ||
| 547 | - } | ||
| 548 | - } | 534 | + $file_path = public_path('ai_domains.txt'); |
| 535 | + $data = file_get_contents($file_path); | ||
| 536 | + $data = json_decode($data, true); | ||
| 549 | if ($domain !== null) { | 537 | if ($domain !== null) { |
| 550 | $domain = parse_url($domain); | 538 | $domain = parse_url($domain); |
| 551 | - $data = collect($data['data'])->where('bind_domain', $domain['host'] ?? $domain['path'])->first(); | 539 | + $data = collect($data)->where('bind_domain', $domain['host'] ?? $domain['path'])->first(); |
| 552 | return $data ?: []; | 540 | return $data ?: []; |
| 553 | } | 541 | } |
| 554 | return $data; | 542 | return $data; |
| @@ -14,6 +14,7 @@ use App\Http\Controllers\Aside\BaseController; | @@ -14,6 +14,7 @@ use App\Http\Controllers\Aside\BaseController; | ||
| 14 | use App\Http\Logic\Aside\Devops\ServersLogic; | 14 | use App\Http\Logic\Aside\Devops\ServersLogic; |
| 15 | use App\Models\Devops\Servers as ServersModel; | 15 | use App\Models\Devops\Servers as ServersModel; |
| 16 | use App\Models\Devops\ServersIp; | 16 | use App\Models\Devops\ServersIp; |
| 17 | +use App\Models\Project\Project; | ||
| 17 | 18 | ||
| 18 | class ServersController extends BaseController | 19 | class ServersController extends BaseController |
| 19 | { | 20 | { |
| @@ -46,6 +47,18 @@ class ServersController extends BaseController | @@ -46,6 +47,18 @@ class ServersController extends BaseController | ||
| 46 | if(isset($this->map['server_name']) && !empty($this->map['server_name'])){ | 47 | if(isset($this->map['server_name']) && !empty($this->map['server_name'])){ |
| 47 | $this->map['server_name'] = ['like','%'.$this->map['server_name'].'%']; | 48 | $this->map['server_name'] = ['like','%'.$this->map['server_name'].'%']; |
| 48 | } | 49 | } |
| 50 | + if(isset($this->map['project_name']) && !empty($this->map['project_name'])){ | ||
| 51 | + $projectModel = new Project(); | ||
| 52 | + $projectInfo = $projectModel->read(['title'=>['like','%'.$this->map['project_name'].'%']],['id','serve_id']); | ||
| 53 | + if($projectInfo !== false){ | ||
| 54 | + $serversIpModel = new ServersIp(); | ||
| 55 | + $ipInfo = $serversIpModel->read(['id'=>$projectInfo['serve_id']],['servers_id']); | ||
| 56 | + if($ipInfo !== false){ | ||
| 57 | + $this->map['id'] = $ipInfo['servers_id']; | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + unset($this->map['project_name']); | ||
| 61 | + } | ||
| 49 | $serversModel = new ServersModel(); | 62 | $serversModel = new ServersModel(); |
| 50 | $data = $serversModel->lists($this->map,$this->page,$this->row,$this->order); | 63 | $data = $serversModel->lists($this->map,$this->page,$this->row,$this->order); |
| 51 | $this->response('success',Code::SUCCESS,$data); | 64 | $this->response('success',Code::SUCCESS,$data); |
| @@ -39,7 +39,7 @@ class ServersIpController extends BaseController | @@ -39,7 +39,7 @@ class ServersIpController extends BaseController | ||
| 39 | } | 39 | } |
| 40 | $serversIpModel = new ServersIpModel(); | 40 | $serversIpModel = new ServersIpModel(); |
| 41 | $this->map['status'] = 0; | 41 | $this->map['status'] = 0; |
| 42 | - $data = $serversIpModel->list($this->map); | 42 | + $data = $serversIpModel->list($this->map,'total',['*'],'asc'); |
| 43 | foreach ($data as $k => $v){ | 43 | foreach ($data as $k => $v){ |
| 44 | $v['is_optional'] = 0;//是否可选择 | 44 | $v['is_optional'] = 0;//是否可选择 |
| 45 | if($v['total'] >= $info['ip_total']){ | 45 | if($v['total'] >= $info['ip_total']){ |
| @@ -174,6 +174,7 @@ class OptimizeController extends BaseController | @@ -174,6 +174,7 @@ class OptimizeController extends BaseController | ||
| 174 | 'gl_project.is_translate AS is_translate', | 174 | 'gl_project.is_translate AS is_translate', |
| 175 | 'gl_project.is_translate_tag AS is_translate_tag', | 175 | 'gl_project.is_translate_tag AS is_translate_tag', |
| 176 | 'gl_project.is_upgrade AS is_upgrade', | 176 | 'gl_project.is_upgrade AS is_upgrade', |
| 177 | + 'gl_project.site_status AS site_status', | ||
| 177 | 'gl_project_online_check.id AS online_check_id', | 178 | 'gl_project_online_check.id AS online_check_id', |
| 178 | 'gl_project_online_check.question AS question', | 179 | 'gl_project_online_check.question AS question', |
| 179 | 'gl_project_online_check.go_question AS go_question', | 180 | 'gl_project_online_check.go_question AS go_question', |
| @@ -220,6 +221,9 @@ class OptimizeController extends BaseController | @@ -220,6 +221,9 @@ class OptimizeController extends BaseController | ||
| 220 | if(isset($this->map['title']) && !empty($this->map['title'])){ | 221 | if(isset($this->map['title']) && !empty($this->map['title'])){ |
| 221 | $query = $query->where('gl_project.title','like','%'.$this->map['title'].'%'); | 222 | $query = $query->where('gl_project.title','like','%'.$this->map['title'].'%'); |
| 222 | } | 223 | } |
| 224 | + if(isset($this->map['site_status'])){ | ||
| 225 | + $query = $query->where('gl_project.site_status',$this->map['site_status']); | ||
| 226 | + } | ||
| 223 | if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){ | 227 | if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){ |
| 224 | $query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']); | 228 | $query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']); |
| 225 | } | 229 | } |
| @@ -48,7 +48,6 @@ class CNoticeController extends BaseController | @@ -48,7 +48,6 @@ class CNoticeController extends BaseController | ||
| 48 | $url = $request->input('url', []); | 48 | $url = $request->input('url', []); |
| 49 | $language = $request->input('language', []); | 49 | $language = $request->input('language', []); |
| 50 | $is_sitemap = intval($request->input('is_sitemap', 0)); | 50 | $is_sitemap = intval($request->input('is_sitemap', 0)); |
| 51 | - | ||
| 52 | //获取项目所在服务器 | 51 | //获取项目所在服务器 |
| 53 | $project_model = new Project(); | 52 | $project_model = new Project(); |
| 54 | $project_info = $project_model->read(['id'=>$project_id],['serve_id']); | 53 | $project_info = $project_model->read(['id'=>$project_id],['serve_id']); |
| @@ -106,8 +105,10 @@ class CNoticeController extends BaseController | @@ -106,8 +105,10 @@ class CNoticeController extends BaseController | ||
| 106 | 'is_sitemap' => $is_sitemap | 105 | 'is_sitemap' => $is_sitemap |
| 107 | ]; | 106 | ]; |
| 108 | http_post($c_url, json_encode($param)); | 107 | http_post($c_url, json_encode($param)); |
| 108 | +// $shell = 'curl -X POST ' . escapeshellarg($c_url) . ' -H "Content-Type: application/json"' . | ||
| 109 | +// ' -d ' . escapeshellarg(json_encode($param)) . ' > /dev/null 2>&1 &'; | ||
| 110 | +// shell_exec($shell); | ||
| 109 | } | 111 | } |
| 110 | - | ||
| 111 | $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!'); | 112 | $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!'); |
| 112 | } | 113 | } |
| 113 | 114 |
| @@ -69,6 +69,9 @@ class BlogController extends BaseController | @@ -69,6 +69,9 @@ class BlogController extends BaseController | ||
| 69 | } | 69 | } |
| 70 | }); | 70 | }); |
| 71 | } | 71 | } |
| 72 | + if(isset($this->map['operator_id'])){ | ||
| 73 | + $query = $query->where('operator_id',$this->map['operator_id']); | ||
| 74 | + } | ||
| 72 | if(isset($this->map['status'])){ | 75 | if(isset($this->map['status'])){ |
| 73 | $query = $query->where('status',$this->map['status']); | 76 | $query = $query->where('status',$this->map['status']); |
| 74 | } | 77 | } |
| @@ -32,8 +32,7 @@ class CustomModuleExtentController extends BaseController | @@ -32,8 +32,7 @@ class CustomModuleExtentController extends BaseController | ||
| 32 | 'module_id.required' => 'module_id不能为空', | 32 | 'module_id.required' => 'module_id不能为空', |
| 33 | ]); | 33 | ]); |
| 34 | $this->map['project_id'] = $this->user['project_id']; | 34 | $this->map['project_id'] = $this->user['project_id']; |
| 35 | - $filed = ['id','title','status','type','operator_id','project_id','module_id','created_at','updated_at']; | ||
| 36 | - $lists = $customModuleExtend->list($this->map,$this->order,$filed); | 35 | + $lists = $customModuleExtend->list($this->map,$this->order,['id','title','key','status','type','operator_id','project_id','module_id','created_at','updated_at']); |
| 37 | $this->response('success',Code::SUCCESS,$lists); | 36 | $this->response('success',Code::SUCCESS,$lists); |
| 38 | } | 37 | } |
| 39 | 38 |
| @@ -73,6 +73,9 @@ class NewsController extends BaseController | @@ -73,6 +73,9 @@ class NewsController extends BaseController | ||
| 73 | } | 73 | } |
| 74 | }); | 74 | }); |
| 75 | } | 75 | } |
| 76 | + if(isset($this->map['operator_id'])){ | ||
| 77 | + $query = $query->where('operator_id',$this->map['operator_id']); | ||
| 78 | + } | ||
| 76 | if(isset($this->map['status'])){ | 79 | if(isset($this->map['status'])){ |
| 77 | $query = $query->where('status',$this->map['status']); | 80 | $query = $query->where('status',$this->map['status']); |
| 78 | } | 81 | } |
| @@ -165,6 +165,9 @@ class ProductController extends BaseController | @@ -165,6 +165,9 @@ class ProductController extends BaseController | ||
| 165 | if(isset($this->map['status'])){ | 165 | if(isset($this->map['status'])){ |
| 166 | $query = $query->where('status',$this->map['status']); | 166 | $query = $query->where('status',$this->map['status']); |
| 167 | } | 167 | } |
| 168 | + if(isset($this->map['created_uid'])){ | ||
| 169 | + $query = $query->where('created_uid',$this->map['created_uid']); | ||
| 170 | + } | ||
| 168 | if(!empty($this->param['start_at']) && !empty($this->param['end_at'])){ | 171 | if(!empty($this->param['start_at']) && !empty($this->param['end_at'])){ |
| 169 | $query->where('created_at', '>=' ,$this->param['start_at'].' 00:00:00')->where('created_at', '<=' ,$this->param['end_at'].' 59:59:59'); | 172 | $query->where('created_at', '>=' ,$this->param['start_at'].' 00:00:00')->where('created_at', '<=' ,$this->param['end_at'].' 59:59:59'); |
| 170 | } | 173 | } |
| @@ -625,4 +628,21 @@ class ProductController extends BaseController | @@ -625,4 +628,21 @@ class ProductController extends BaseController | ||
| 625 | $data = $logic->getSearchCategoryList(); | 628 | $data = $logic->getSearchCategoryList(); |
| 626 | $this->response('success',Code::SUCCESS,$data); | 629 | $this->response('success',Code::SUCCESS,$data); |
| 627 | } | 630 | } |
| 631 | + | ||
| 632 | + /** | ||
| 633 | + * @remark :清空所有的产品+关键词关联 | ||
| 634 | + * @name :delProductKeyword | ||
| 635 | + * @author :lyh | ||
| 636 | + * @method :post | ||
| 637 | + * @time :2024/8/5 15:47 | ||
| 638 | + */ | ||
| 639 | + public function delProductKeyword(ProductLogic $logic){ | ||
| 640 | + $this->request->validate([ | ||
| 641 | + 'id'=>'required', | ||
| 642 | + ],[ | ||
| 643 | + 'id.required' => 'id不为空', | ||
| 644 | + ]); | ||
| 645 | + $logic->delProductKeyword(); | ||
| 646 | + $this->response('success'); | ||
| 647 | + } | ||
| 628 | } | 648 | } |
| @@ -27,4 +27,5 @@ class LanguageController extends BaseController | @@ -27,4 +27,5 @@ class LanguageController extends BaseController | ||
| 27 | $lists = $webLanguageModel->list(); | 27 | $lists = $webLanguageModel->list(); |
| 28 | $this->response('success',Code::SUCCESS,$lists); | 28 | $this->response('success',Code::SUCCESS,$lists); |
| 29 | } | 29 | } |
| 30 | + | ||
| 30 | } | 31 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :LanguageTxtController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/6 14:40 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Bside\Setting; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Bside\BaseController; | ||
| 14 | +use App\Models\WebSetting\LanguageTxt; | ||
| 15 | + | ||
| 16 | +class LanguageTxtController extends BaseController | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @remark :获取文本信息 | ||
| 20 | + * @name :getLanguageTxt | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2024/8/5 17:29 | ||
| 24 | + */ | ||
| 25 | + public function getLanguageTxt(){ | ||
| 26 | + $languageTxtModel = new LanguageTxt(); | ||
| 27 | + $data = $languageTxtModel->list(); | ||
| 28 | + $this->response('success',Code::SUCCESS,$data); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * @remark :保存用户配置 | ||
| 33 | + * @name :saveLanguageTxt | ||
| 34 | + * @author :lyh | ||
| 35 | + * @method :post | ||
| 36 | + * @time :2024/8/6 14:41 | ||
| 37 | + */ | ||
| 38 | + public function saveLanguageTxt(){ | ||
| 39 | + $this->request->validate([ | ||
| 40 | + 'name'=>'required', | ||
| 41 | + 'en_name'=>'required', | ||
| 42 | + ],[ | ||
| 43 | + 'name.required' => 'name不能为空', | ||
| 44 | + 'en_name'=>'自定义名称en_name不为空', | ||
| 45 | + ]); | ||
| 46 | + $languageTxtModel = new LanguageTxt(); | ||
| 47 | + $id = $languageTxtModel->addReturnId($this->param); | ||
| 48 | + $this->response('success',Code::SUCCESS,['id'=>$id]); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * @remark :删除数据 | ||
| 53 | + * @name :delLanguageTxt | ||
| 54 | + * @author :lyh | ||
| 55 | + * @method :post | ||
| 56 | + * @time :2024/8/6 14:48 | ||
| 57 | + */ | ||
| 58 | + public function delLanguageTxt(){ | ||
| 59 | + $this->request->validate([ | ||
| 60 | + 'id'=>'required', | ||
| 61 | + ],[ | ||
| 62 | + 'id.required' => 'name不能为空', | ||
| 63 | + ]); | ||
| 64 | + $languageTxtModel = new LanguageTxt(); | ||
| 65 | + $languageTxtModel->del(['id'=>['in',$this->param['id']]]); | ||
| 66 | + $this->response('success'); | ||
| 67 | + } | ||
| 68 | +} |
| @@ -6,6 +6,7 @@ use App\Enums\Common\Code; | @@ -6,6 +6,7 @@ use App\Enums\Common\Code; | ||
| 6 | use App\Http\Controllers\Bside\BaseController; | 6 | use App\Http\Controllers\Bside\BaseController; |
| 7 | use App\Http\Logic\Aside\Domain\DomainInfoLogic; | 7 | use App\Http\Logic\Aside\Domain\DomainInfoLogic; |
| 8 | use App\Http\Logic\Bside\Setting\ProjectCountryLogic; | 8 | use App\Http\Logic\Bside\Setting\ProjectCountryLogic; |
| 9 | +use App\Models\WebSetting\LanguageTxt; | ||
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| 11 | * @name:项目配置多语言设置 | 12 | * @name:项目配置多语言设置 |
| @@ -84,7 +85,6 @@ class ProjectCountryController extends BaseController | @@ -84,7 +85,6 @@ class ProjectCountryController extends BaseController | ||
| 84 | ],[ | 85 | ],[ |
| 85 | 'language_id.required' => 'language_id不能为空' | 86 | 'language_id.required' => 'language_id不能为空' |
| 86 | ]); | 87 | ]); |
| 87 | - | ||
| 88 | $info = $projectCountryLogic->country_custom_info(); | 88 | $info = $projectCountryLogic->country_custom_info(); |
| 89 | $this->response('success',Code::SUCCESS,$info); | 89 | $this->response('success',Code::SUCCESS,$info); |
| 90 | } | 90 | } |
| @@ -60,9 +60,9 @@ class TranslateController extends BaseController | @@ -60,9 +60,9 @@ class TranslateController extends BaseController | ||
| 60 | 'language_id.required' => 'language_id不能为空', | 60 | 'language_id.required' => 'language_id不能为空', |
| 61 | ]); | 61 | ]); |
| 62 | $this->map['type'] = 1; | 62 | $this->map['type'] = 1; |
| 63 | - $data = $translate->list($this->map); | 63 | + $data = $translate->formatQuery($this->map)->with('translate_data')->get()->toArray(); |
| 64 | foreach ($data as $k=>$v){ | 64 | foreach ($data as $k=>$v){ |
| 65 | - $v['data'] = json_decode($v['data']); | 65 | + $v['data'] = json_decode($v['translate_data']['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); |
| 66 | $data[$k] = $v; | 66 | $data[$k] = $v; |
| 67 | } | 67 | } |
| 68 | $this->response('success',Code::SUCCESS,$data); | 68 | $this->response('success',Code::SUCCESS,$data); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BProjectComConfigController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/1 14:24 | ||
| 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\BProjectComConfigLogic; | ||
| 15 | + | ||
| 16 | +class BProjectComConfigController extends BaseController | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @remark :获取头部底部配置 | ||
| 20 | + * @name :getIsComConfig | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2024/8/1 15:08 | ||
| 24 | + */ | ||
| 25 | + public function getIsComConfig(BProjectComConfigLogic $logic){ | ||
| 26 | + $data = $logic->getIsComConfig(); | ||
| 27 | + $this->response('success',Code::SUCCESS,$data); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * @remark :保存配置 | ||
| 32 | + * @name :saveComConfig | ||
| 33 | + * @author :lyh | ||
| 34 | + * @method :post | ||
| 35 | + * @time :2024/8/1 15:38 | ||
| 36 | + */ | ||
| 37 | + public function saveComConfig(BProjectComConfigLogic $logic){ | ||
| 38 | + $this->request->validate([ | ||
| 39 | + 'data'=>'required', | ||
| 40 | + ],[ | ||
| 41 | + 'data.required' => 'data不能为空', | ||
| 42 | + ]); | ||
| 43 | + $logic->saveComConfig(); | ||
| 44 | + $this->response('success'); | ||
| 45 | + } | ||
| 46 | +} |
| @@ -31,6 +31,23 @@ class BTemplateController extends BaseController | @@ -31,6 +31,23 @@ class BTemplateController extends BaseController | ||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | + * @remark :获取数据详情 | ||
| 35 | + * @name :templateInfo | ||
| 36 | + * @author :lyh | ||
| 37 | + * @method :post | ||
| 38 | + * @time :2024/7/31 14:27 | ||
| 39 | + */ | ||
| 40 | + public function publicInfo(BTemplateLogic $BTemplateLogic){ | ||
| 41 | + $this->request->validate([ | ||
| 42 | + 'id'=>'required', | ||
| 43 | + ],[ | ||
| 44 | + 'id.required' => 'id不能为空', | ||
| 45 | + ]); | ||
| 46 | + $info = $BTemplateLogic->getPublicTemplateInfo(); | ||
| 47 | + $this->response('success',Code::SUCCESS,$info); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 34 | * @remark :获取用户模版id | 51 | * @remark :获取用户模版id |
| 35 | * @name :getUserTemplate | 52 | * @name :getUserTemplate |
| 36 | * @author :lyh | 53 | * @author :lyh |
| @@ -74,7 +74,7 @@ class BTemplateLogController extends BaseController | @@ -74,7 +74,7 @@ class BTemplateLogController extends BaseController | ||
| 74 | $this->response('请先选择模版',Code::SYSTEM_ERROR); | 74 | $this->response('请先选择模版',Code::SYSTEM_ERROR); |
| 75 | } | 75 | } |
| 76 | $this->map = ['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'is_custom'=>$is_custom,'template_id'=>$settingInfo['template_id']]; | 76 | $this->map = ['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'is_custom'=>$is_custom,'template_id'=>$settingInfo['template_id']]; |
| 77 | - $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']); | 77 | + $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','source_id','created_at','updated_at']); |
| 78 | if(!empty($lists['list'])){ | 78 | if(!empty($lists['list'])){ |
| 79 | $templateModel = new Template(); | 79 | $templateModel = new Template(); |
| 80 | $userModel = new User(); | 80 | $userModel = new User(); |
| @@ -109,4 +109,17 @@ class UserController extends BaseController | @@ -109,4 +109,17 @@ class UserController extends BaseController | ||
| 109 | $userLogic->user_del(); | 109 | $userLogic->user_del(); |
| 110 | $this->response('success'); | 110 | $this->response('success'); |
| 111 | } | 111 | } |
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * @remark :获取当前项目的所有管理员 | ||
| 115 | + * @name :getUserLists | ||
| 116 | + * @author :lyh | ||
| 117 | + * @method :post | ||
| 118 | + * @time :2024/8/6 9:40 | ||
| 119 | + */ | ||
| 120 | + public function getUserLists(){ | ||
| 121 | + $userModel = new UserModel(); | ||
| 122 | + $list = $userModel->list(['project_id'=>$this->user['project_id']]); | ||
| 123 | + $this->response('success',Code::SUCCESS,$list); | ||
| 124 | + } | ||
| 112 | } | 125 | } |
| @@ -13,6 +13,7 @@ use App\Http\Logic\Aside\BaseLogic; | @@ -13,6 +13,7 @@ use App\Http\Logic\Aside\BaseLogic; | ||
| 13 | use App\Models\CustomModule\CustomModule; | 13 | use App\Models\CustomModule\CustomModule; |
| 14 | use App\Models\CustomModule\CustomModuleCategory; | 14 | use App\Models\CustomModule\CustomModuleCategory; |
| 15 | use App\Models\CustomModule\CustomModuleContent; | 15 | use App\Models\CustomModule\CustomModuleContent; |
| 16 | +use App\Models\IsCom\ProjectComConfig; | ||
| 16 | use App\Models\RouteMap\RouteMap; | 17 | use App\Models\RouteMap\RouteMap; |
| 17 | use App\Services\ProjectServer; | 18 | use App\Services\ProjectServer; |
| 18 | use Illuminate\Support\Facades\DB; | 19 | use Illuminate\Support\Facades\DB; |
| @@ -93,9 +94,11 @@ class CustomModuleLogic extends BaseLogic | @@ -93,9 +94,11 @@ class CustomModuleLogic extends BaseLogic | ||
| 93 | 'name'=>$this->param['route'], | 94 | 'name'=>$this->param['route'], |
| 94 | 'module_id'=>$id, | 95 | 'module_id'=>$id, |
| 95 | 'project_id'=>$this->param['project_id'], | 96 | 'project_id'=>$this->param['project_id'], |
| 96 | - 'route'=>RouteMap::setRoute($this->param['route'],RouteMap::SOURCE_MODULE_CATE,$id,$this->param['project_id']) | 97 | + 'route'=>$this->param['route'] |
| 97 | ]; | 98 | ]; |
| 98 | - $customModuleCateModel->add($data); | 99 | + $cateId = $customModuleCateModel->addReturnId($data); |
| 100 | + $route = RouteMap::setRoute($this->param['route'],RouteMap::SOURCE_MODULE_CATE,$cateId,$this->param['project_id']); | ||
| 101 | + $customModuleCateModel->edit(['route'=>$route],['id'=>$cateId]); | ||
| 99 | } | 102 | } |
| 100 | return $this->success(); | 103 | return $this->success(); |
| 101 | } | 104 | } |
| @@ -154,6 +157,9 @@ class CustomModuleLogic extends BaseLogic | @@ -154,6 +157,9 @@ class CustomModuleLogic extends BaseLogic | ||
| 154 | $this->fail('当前模块拥有分类不允许删除'); | 157 | $this->fail('当前模块拥有分类不允许删除'); |
| 155 | } | 158 | } |
| 156 | $rs = (new CustomModule())->del($this->param); | 159 | $rs = (new CustomModule())->del($this->param); |
| 160 | + //对应删除项目头部底部配置 | ||
| 161 | + $projectComConfigModel = new ProjectComConfig(); | ||
| 162 | + $projectComConfigModel->del(['source'=>$this->param['id'],'is_custom'=>1]); | ||
| 157 | if($rs === false){ | 163 | if($rs === false){ |
| 158 | $this->fail('系统错误,请联系管理员'); | 164 | $this->fail('系统错误,请联系管理员'); |
| 159 | } | 165 | } |
| @@ -7,7 +7,7 @@ use App\Models\Manage\Manage; | @@ -7,7 +7,7 @@ use App\Models\Manage\Manage; | ||
| 7 | use App\Models\RouteMap\RouteMap; | 7 | use App\Models\RouteMap\RouteMap; |
| 8 | use App\Models\Service\Service as ServiceSettingModel; | 8 | use App\Models\Service\Service as ServiceSettingModel; |
| 9 | use App\Models\Template\BTemplate; | 9 | use App\Models\Template\BTemplate; |
| 10 | -use App\Models\Template\BTemplateCommon; | 10 | +use App\Models\Template\BTemplateCom; |
| 11 | use App\Models\Template\Template; | 11 | use App\Models\Template\Template; |
| 12 | use App\Models\Template\Setting; | 12 | use App\Models\Template\Setting; |
| 13 | use App\Services\ProjectServer; | 13 | use App\Services\ProjectServer; |
| @@ -210,25 +210,34 @@ class ATemplateLogic extends BaseLogic | @@ -210,25 +210,34 @@ class ATemplateLogic extends BaseLogic | ||
| 210 | $templateInfo = $this->model->read(['id'=>$template_id]); | 210 | $templateInfo = $this->model->read(['id'=>$template_id]); |
| 211 | ProjectServer::useProject($project_id); | 211 | ProjectServer::useProject($project_id); |
| 212 | $bTemplateModel = new BTemplate(); | 212 | $bTemplateModel = new BTemplate(); |
| 213 | - $info = $bTemplateModel->read(['source'=>1,'template_id'=>$template_id]); | 213 | + $info = $bTemplateModel->read(['source'=>BTemplate::SOURCE_HOME,'template_id'=>$template_id]); |
| 214 | if($info === false){ | 214 | if($info === false){ |
| 215 | $data = [ | 215 | $data = [ |
| 216 | - 'source'=>1, 'source_id'=>0, 'template_id'=>$template_id, 'main_html'=>$templateInfo['main_html'], | 216 | + 'source'=>BTemplate::SOURCE_HOME, 'source_id'=>0, 'template_id'=>$template_id, 'main_html'=>$templateInfo['main_html'], |
| 217 | 'main_css'=>$templateInfo['main_css'], 'project_id'=>$project_id, | 217 | 'main_css'=>$templateInfo['main_css'], 'project_id'=>$project_id, |
| 218 | ]; | 218 | ]; |
| 219 | $bTemplateModel->add($data); | 219 | $bTemplateModel->add($data); |
| 220 | } | 220 | } |
| 221 | - //保存一次公共头部信息 | ||
| 222 | - $bCommonTemplateModel = new BTemplateCommon(); | ||
| 223 | - $commonInfo = $bCommonTemplateModel->read(['template_id'=>$template_id,'type'=>1]); | ||
| 224 | - if($commonInfo === false){ | ||
| 225 | - $commonData = [ | ||
| 226 | - 'type'=>1, 'template_id'=>$template_id, 'head_html'=>$templateInfo['head_html'], | ||
| 227 | - 'head_css'=>$templateInfo['head_css'], 'footer_html'=>$templateInfo['footer_html'], | ||
| 228 | - 'footer_css'=>$templateInfo['footer_css'],'project_id'=>$project_id, | ||
| 229 | - 'other'=>str_replace('<header','',characterTruncation($templateInfo['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")) | ||
| 230 | - ]; | ||
| 231 | - $bCommonTemplateModel->add($commonData); | 221 | + //保存一次公共头部+底部+other信息 |
| 222 | + $bComTemplateModel = new BTemplateCom(); | ||
| 223 | + $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_HEAD,'source'=>BTemplate::SOURCE_COM]; | ||
| 224 | + $headInfo = $bComTemplateModel->read($condition); | ||
| 225 | + if($headInfo === false){ | ||
| 226 | + $headData = ['html'=>$templateInfo['head_html'], 'html_style'=>$templateInfo['head_css'], 'project_id'=>$project_id]; | ||
| 227 | + $bComTemplateModel->add(array_merge($condition,$headData)); | ||
| 228 | + } | ||
| 229 | + $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_FOOTER,'source'=>BTemplate::SOURCE_COM]; | ||
| 230 | + $footerInfo = $bComTemplateModel->read($condition); | ||
| 231 | + if($footerInfo === false){ | ||
| 232 | + $footerData = ['html'=>$templateInfo['footer_html'], 'html_style'=>$templateInfo['footer_css'], 'project_id'=>$project_id]; | ||
| 233 | + $bComTemplateModel->add(array_merge($condition,$footerData)); | ||
| 234 | + } | ||
| 235 | + $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_OTHER,'source'=>BTemplate::SOURCE_COM]; | ||
| 236 | + $footerInfo = $bComTemplateModel->read($condition); | ||
| 237 | + if($footerInfo === false){ | ||
| 238 | + $other = str_replace('<header','',characterTruncation($templateInfo['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")); | ||
| 239 | + $otherData = ['html'=>$other, 'html_style'=>'', 'project_id'=>$project_id]; | ||
| 240 | + $bComTemplateModel->add(array_merge($condition,$otherData)); | ||
| 232 | } | 241 | } |
| 233 | RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $project_id); | 242 | RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $project_id); |
| 234 | DB::disconnect('custom_mysql'); | 243 | DB::disconnect('custom_mysql'); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BProjectComConfigLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/1 14:25 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Bside\BTemplate; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 13 | +use App\Models\CustomModule\CustomModule; | ||
| 14 | +use App\Models\IsCom\ProjectComConfig; | ||
| 15 | +use App\Models\Template\BTemplate; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :独立头部——底部设置 | ||
| 19 | + * @name :BProjectComConfigLogic | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2024/8/1 14:43 | ||
| 23 | + */ | ||
| 24 | +class BProjectComConfigLogic extends BaseLogic | ||
| 25 | +{ | ||
| 26 | + /** | ||
| 27 | + * 初始化数据 | ||
| 28 | + */ | ||
| 29 | + public function __construct() | ||
| 30 | + { | ||
| 31 | + parent::__construct(); | ||
| 32 | + $this->model = new ProjectComConfig(); | ||
| 33 | + $this->param = $this->requestAll; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + const PUB_STATUS = 0;//公共 | ||
| 37 | + const PRO_STATUS = 1;//獨立 | ||
| 38 | + const IS_LIST = 1; | ||
| 39 | + const IS_DETAIL = 0; | ||
| 40 | + const IS_NO_CUSTOM = 0; | ||
| 41 | + const IS_CUSTOM = 1;//扩展模块 | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * @remark :获取初始数据 | ||
| 45 | + * @name :getIsComSetting | ||
| 46 | + * @author :lyh | ||
| 47 | + * @method :post | ||
| 48 | + * @time :2024/8/1 15:02 | ||
| 49 | + */ | ||
| 50 | + public function getIsComConfig(){ | ||
| 51 | + $data = []; | ||
| 52 | + $data = $this->initParamData($data); | ||
| 53 | + $data = $this->initPageParamData($data); | ||
| 54 | + $data = $this->initCustomData($data); | ||
| 55 | + return $this->success($data); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * @remark :(独立头底)初始数据 | ||
| 61 | + * @name :initializedData | ||
| 62 | + * @author :lyh | ||
| 63 | + * @method :post | ||
| 64 | + * @time :2024/8/1 11:52 | ||
| 65 | + */ | ||
| 66 | + public function initParamData(&$data){ | ||
| 67 | + //默认模块 | ||
| 68 | + $initParam = $this->model->initParam; | ||
| 69 | + foreach ($initParam as $pKey => $pValue){ | ||
| 70 | + $is_list = [self::IS_LIST,self::IS_DETAIL]; | ||
| 71 | + foreach ($is_list as $isValue){ | ||
| 72 | + //查询当前数据是否已保存 | ||
| 73 | + $info = $this->model->read(['source'=>$pValue,'is_list'=>$isValue,'is_custom'=>BTemplate::IS_NO_CUSTOM],['id','name','source','is_list','is_custom','header_status','footer_status']); | ||
| 74 | + if($info !== false){ | ||
| 75 | + $data[] = $info; | ||
| 76 | + }else{ | ||
| 77 | + $data[] = [ | ||
| 78 | + 'name'=>$pKey.($isValue == 0 ? '详情' : '列表'), | ||
| 79 | + 'source'=>$pValue, | ||
| 80 | + 'is_list'=>$isValue, | ||
| 81 | + 'is_custom'=>self::IS_NO_CUSTOM, | ||
| 82 | + 'header_status'=>self::PUB_STATUS, | ||
| 83 | + 'footer_status'=>self::PUB_STATUS, | ||
| 84 | + ]; | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + return $this->success($data); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * @remark :单页面初始化 | ||
| 93 | + * @name :initPageParamData | ||
| 94 | + * @author :lyh | ||
| 95 | + * @method :post | ||
| 96 | + * @time :2024/8/1 14:37 | ||
| 97 | + */ | ||
| 98 | + public function initPageParamData(&$data){ | ||
| 99 | + $initPageParam = $this->model->initPageParam; | ||
| 100 | + foreach($initPageParam as $key => $value){ | ||
| 101 | + $info = $this->model->read(['source'=>$value,'is_list'=>self::IS_DETAIL,'is_custom'=>BTemplate::IS_NO_CUSTOM],['id','name','source','is_list','is_custom','header_status','footer_status']); | ||
| 102 | + if($info !== false){ | ||
| 103 | + $data[] = $info; | ||
| 104 | + }else{ | ||
| 105 | + $data[] = [ | ||
| 106 | + 'name'=>$key, | ||
| 107 | + 'source'=>$value, | ||
| 108 | + 'is_list'=>self::IS_DETAIL, | ||
| 109 | + 'is_custom'=>self::IS_NO_CUSTOM, | ||
| 110 | + 'header_status'=>self::PUB_STATUS, | ||
| 111 | + 'footer_status'=>self::PUB_STATUS, | ||
| 112 | + ]; | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + return $this->success($data); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * @remark :获取扩展模块初始数据 | ||
| 120 | + * @name :initCustomData | ||
| 121 | + * @author :lyh | ||
| 122 | + * @method :post | ||
| 123 | + * @time :2024/8/1 14:42 | ||
| 124 | + */ | ||
| 125 | + public function initCustomData(&$data){ | ||
| 126 | + $customModel = new CustomModule(); | ||
| 127 | + $customList = $customModel->list(['status'=>0]); | ||
| 128 | + $is_list = [self::IS_LIST,self::IS_DETAIL]; | ||
| 129 | + foreach($customList as $value){ | ||
| 130 | + foreach ($is_list as $isValue){ | ||
| 131 | + $info = $this->model->read(['source'=>$value['id'],'is_list'=>$isValue,'is_custom'=>BTemplate::IS_CUSTOM],['id','name','source','is_list','is_custom','header_status','footer_status']); | ||
| 132 | + if($info !== false){ | ||
| 133 | + $data[] = $info; | ||
| 134 | + }else{ | ||
| 135 | + $data[] = [ | ||
| 136 | + 'name'=>$value['name'].($isValue == self::IS_DETAIL ? '详情' : '列表'), | ||
| 137 | + 'source'=>$value['id'], | ||
| 138 | + 'is_list'=>$isValue, | ||
| 139 | + 'is_custom'=>self::IS_CUSTOM, | ||
| 140 | + 'header_status'=>self::PUB_STATUS, | ||
| 141 | + 'footer_status'=>self::PUB_STATUS, | ||
| 142 | + ]; | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + return $this->success($data); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * @remark :保存配置 | ||
| 151 | + * @name :saveComConfig | ||
| 152 | + * @author :lyh | ||
| 153 | + * @method :post | ||
| 154 | + * @time :2024/8/1 15:41 | ||
| 155 | + */ | ||
| 156 | + public function saveComConfig(){ | ||
| 157 | + $data = $this->param['data']; | ||
| 158 | + foreach ($data as $k => $v){ | ||
| 159 | + if(isset($v['id']) && !empty($v['id'])){ | ||
| 160 | + $id = $v['id']; | ||
| 161 | + unset($v['id']); | ||
| 162 | + $this->model->edit($v,['id'=>$id]); | ||
| 163 | + }else{ | ||
| 164 | + //查询当前数据是否存在 | ||
| 165 | + $this->model->add($v); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + return $this->success(); | ||
| 169 | + } | ||
| 170 | +} |
| @@ -10,9 +10,11 @@ | @@ -10,9 +10,11 @@ | ||
| 10 | namespace App\Http\Logic\Bside\BTemplate; | 10 | namespace App\Http\Logic\Bside\BTemplate; |
| 11 | 11 | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | +use App\Models\IsCom\ProjectComConfig; | ||
| 13 | use App\Models\Project\PageSetting; | 14 | use App\Models\Project\PageSetting; |
| 14 | use App\Models\Service\Service as ServiceSettingModel; | 15 | use App\Models\Service\Service as ServiceSettingModel; |
| 15 | use App\Models\Template\BTemplate; | 16 | use App\Models\Template\BTemplate; |
| 17 | +use App\Models\Template\BTemplateCom; | ||
| 16 | use App\Models\Template\BTemplateCommon; | 18 | use App\Models\Template\BTemplateCommon; |
| 17 | use App\Models\Template\BTemplateLog; | 19 | use App\Models\Template\BTemplateLog; |
| 18 | use App\Models\Template\Setting; | 20 | use App\Models\Template\Setting; |
| @@ -64,13 +66,18 @@ class BTemplateLogLogic extends BaseLogic | @@ -64,13 +66,18 @@ class BTemplateLogLogic extends BaseLogic | ||
| 64 | 'is_list'=>$info['is_list'],'is_custom'=>$info['is_custom']]; | 66 | 'is_list'=>$info['is_list'],'is_custom'=>$info['is_custom']]; |
| 65 | //TODO::还原头部+底部 | 67 | //TODO::还原头部+底部 |
| 66 | $bTemplateModel->edit(['html'=>$info['text']],$condition); | 68 | $bTemplateModel->edit(['html'=>$info['text']],$condition); |
| 67 | - $commonData = [ | ||
| 68 | - 'head_html'=>$info['head_html'], 'head_css'=>$info['head_css'], | ||
| 69 | - 'footer_html'=>$info['footer_html'], 'footer_css'=>$info['footer_css'] | ||
| 70 | - ]; | ||
| 71 | - $type = $this->getCustomizedType($info['source'],$info['is_list']); | ||
| 72 | - $commonTemplateModel = new BTemplateCommon(); | ||
| 73 | - $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]); | 69 | + $commonTemplateModel = new BTemplateCom(); |
| 70 | + //还原头部 | ||
| 71 | + $condition = ['template_id'=>$info['template_id'],'source'=>$info['source'], | ||
| 72 | + 'is_list'=>$info['is_list'],'is_custom'=>$info['is_custom'],'project_id'=>$this->user['project_id']]; | ||
| 73 | + $condition['common_type'] = BTemplate::COMMON_HEAD; | ||
| 74 | + $commonTemplateModel->edit(['html'=>$info['head_html'], 'html_style'=>$info['head_css']],$condition); | ||
| 75 | + $condition['common_type'] = BTemplate::COMMON_FOOTER; | ||
| 76 | + $commonTemplateModel->edit(['html'=>$info['footer_html'], 'html_style'=>$info['footer_css']],$condition); | ||
| 77 | + $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s')); | ||
| 78 | + $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 79 | + $condition['common_type'] = BTemplate::COMMON_OTHER; | ||
| 80 | + $commonTemplateModel->edit(['html'=>$other, 'html_style'=>''],$condition); | ||
| 74 | return $this->success(); | 81 | return $this->success(); |
| 75 | } | 82 | } |
| 76 | 83 | ||
| @@ -99,18 +106,9 @@ class BTemplateLogLogic extends BaseLogic | @@ -99,18 +106,9 @@ class BTemplateLogLogic extends BaseLogic | ||
| 99 | $bTemplateModel->edit($data,$condition); | 106 | $bTemplateModel->edit($data,$condition); |
| 100 | //还原头部+底部 | 107 | //还原头部+底部 |
| 101 | $commonData = [ | 108 | $commonData = [ |
| 102 | - 'head_html'=>$info['head_html'], 'head_css'=>$info['head_css'], 'footer_html'=>$info['footer_html'], 'footer_css'=>$info['footer_css'] | 109 | + 'head_html'=>$info['head_html'], 'head_style'=>$info['head_css'], 'footer_html'=>$info['footer_html'], 'footer_style'=>$info['footer_css'],'other'=>$info['other'] |
| 103 | ]; | 110 | ]; |
| 104 | - $commonTemplateModel = new BTemplateCommon(); | ||
| 105 | - $type = $this->getType($info['source'],$info['is_list'],$info['is_custom']); | ||
| 106 | - $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]); | ||
| 107 | - if(!empty($info['other'])){ | ||
| 108 | - $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$info['type']]); | ||
| 109 | - }else{ | ||
| 110 | - $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s')); | ||
| 111 | - $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 112 | - $commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$type]); | ||
| 113 | - } | 111 | + $this->saveTemplateCom($commonData,$info['template_id'],$info['source'],$info['is_list'],$info['is_custom']); |
| 114 | }catch (\Exception $e){ | 112 | }catch (\Exception $e){ |
| 115 | $this->fail('系统错误,请联系管理员'); | 113 | $this->fail('系统错误,请联系管理员'); |
| 116 | } | 114 | } |
| @@ -118,36 +116,40 @@ class BTemplateLogLogic extends BaseLogic | @@ -118,36 +116,40 @@ class BTemplateLogLogic extends BaseLogic | ||
| 118 | } | 116 | } |
| 119 | 117 | ||
| 120 | /** | 118 | /** |
| 121 | - * @remark :定制页面头部类型---根据source获取type类型 | ||
| 122 | - * @name :getType | 119 | + * @remark :保存公共部分(头部。底部。连接部分) |
| 120 | + * @name :saveTemplateCom | ||
| 123 | * @author :lyh | 121 | * @author :lyh |
| 124 | * @method :post | 122 | * @method :post |
| 125 | - * @time :2023/11/16 11:20 | 123 | + * @time :2024/4/29 10:32 |
| 126 | */ | 124 | */ |
| 127 | - public function getCustomizedType($source,$is_list){ | ||
| 128 | - $type = BTemplate::TYPE_HOME; | ||
| 129 | - if($source == BTemplate::SOURCE_PRODUCT){ | ||
| 130 | - if($is_list == BTemplate::IS_LIST){ | ||
| 131 | - $type = BTemplate::TYPE_PRODUCT_LIST; | 125 | + public function saveTemplateCom($handleInfo,$template_id,$source,$is_list,$is_custom){ |
| 126 | + $typeArr = [BTemplate::COMMON_HEAD, BTemplate::COMMON_FOOTER, BTemplate::COMMON_OTHER]; | ||
| 127 | + $templateComModel = new BTemplateCom(); | ||
| 128 | + foreach ($typeArr as $type){ | ||
| 129 | + if($type == BTemplate::COMMON_HEAD){ | ||
| 130 | + $param['html'] = $handleInfo['head_html']; | ||
| 131 | + $param['html_style'] = $handleInfo['head_style']; | ||
| 132 | + $typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);//头部是否为独立头部 | ||
| 133 | + }elseif ($type == BTemplate::COMMON_FOOTER){ | ||
| 134 | + $param['html'] = $handleInfo['footer_html']; | ||
| 135 | + $param['html_style'] = $handleInfo['footer_style']; | ||
| 136 | + $typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id); | ||
| 132 | }else{ | 137 | }else{ |
| 133 | - $type = BTemplate::TYPE_PRODUCT_DETAIL; | 138 | + $param['html'] = $handleInfo['other']; |
| 139 | + $param['html_style'] = null; | ||
| 140 | + $typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id); | ||
| 134 | } | 141 | } |
| 135 | - } | ||
| 136 | - if($source == BTemplate::SOURCE_BLOG){ | ||
| 137 | - if($is_list == BTemplate::IS_LIST){ | ||
| 138 | - $type = BTemplate::TYPE_BLOG_LIST; | ||
| 139 | - }else{ | ||
| 140 | - $type = BTemplate::TYPE_BLOG_DETAIL; | ||
| 141 | - } | ||
| 142 | - } | ||
| 143 | - if($source == BTemplate::SOURCE_NEWS){ | ||
| 144 | - if($is_list == BTemplate::IS_LIST){ | ||
| 145 | - $type = BTemplate::TYPE_NEWS_LIST; | 142 | + //查看当前数据是否还存在 |
| 143 | + $condition = ['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type]; | ||
| 144 | + $info = $templateComModel->read($condition); | ||
| 145 | + if($info === false){ | ||
| 146 | + $data = array_merge($param,$condition); | ||
| 147 | + $templateComModel->add($data); | ||
| 146 | }else{ | 148 | }else{ |
| 147 | - $type = BTemplate::TYPE_NEWS_DETAIL; | 149 | + $templateComModel->edit($param,$condition); |
| 148 | } | 150 | } |
| 149 | } | 151 | } |
| 150 | - return $type; | 152 | + return $this->success(); |
| 151 | } | 153 | } |
| 152 | 154 | ||
| 153 | /** | 155 | /** |
| @@ -157,26 +159,28 @@ class BTemplateLogLogic extends BaseLogic | @@ -157,26 +159,28 @@ class BTemplateLogLogic extends BaseLogic | ||
| 157 | * @method :post | 159 | * @method :post |
| 158 | * @time :2023/10/21 17:29 | 160 | * @time :2023/10/21 17:29 |
| 159 | */ | 161 | */ |
| 160 | - public function getType($source,$is_list,$is_custom = 0){ | ||
| 161 | - $type = BTemplate::SOURCE_HOME;//首页公共头部底部 | 162 | + public function getType($source,$is_list,$is_custom = BTemplate::IS_NO_CUSTOM,$commonType = BTemplate::COMMON_HEAD,$template_id = 0){ |
| 163 | + if($template_id == 0){ | ||
| 164 | + return $this->success($source); | ||
| 165 | + } | ||
| 166 | + $type = BTemplate::SOURCE_COM;//公共头部底部 | ||
| 162 | $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; | 167 | $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; |
| 163 | - if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部 | 168 | + if($is_head == BTemplate::IS_NO_HEADER){//拓展模块为公共头+底 |
| 164 | return $this->success($type); | 169 | return $this->success($type); |
| 165 | } | 170 | } |
| 166 | //查看页面是否设置自定义头部底部 | 171 | //查看页面是否设置自定义头部底部 |
| 167 | - if($is_head != BTemplate::IS_NO_HEADER) { | ||
| 168 | - $pageSettingModel = new PageSetting(); | ||
| 169 | - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]); | ||
| 170 | - if ($pageInfo === false) { | 172 | + $comConfigModel = new ProjectComConfig(); |
| 173 | + $configInfo = $comConfigModel->read(['source'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom]); | ||
| 174 | + if($configInfo === false){ | ||
| 171 | return $this->success($type); | 175 | return $this->success($type); |
| 172 | } | 176 | } |
| 173 | - if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}} | ||
| 174 | - else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}} | ||
| 175 | - if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}} | ||
| 176 | - else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}} | ||
| 177 | - if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}} | ||
| 178 | - else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}} | ||
| 179 | - if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}} | 177 | + //头部 |
| 178 | + if($commonType == BTemplate::COMMON_HEAD){ | ||
| 179 | + return $this->success($configInfo['header_status'] == 0 ? $type : $source); | ||
| 180 | + } | ||
| 181 | + //底部 | ||
| 182 | + if($commonType == BTemplate::COMMON_FOOTER){ | ||
| 183 | + return $this->success($configInfo['footer_status'] == 0 ? $type : $source); | ||
| 180 | } | 184 | } |
| 181 | return $this->success($type); | 185 | return $this->success($type); |
| 182 | } | 186 | } |
| @@ -6,12 +6,13 @@ use App\Http\Logic\Bside\BaseLogic; | @@ -6,12 +6,13 @@ use App\Http\Logic\Bside\BaseLogic; | ||
| 6 | use App\Models\Blog\BlogCategory; | 6 | use App\Models\Blog\BlogCategory; |
| 7 | use App\Models\CustomModule\CustomModule; | 7 | use App\Models\CustomModule\CustomModule; |
| 8 | use App\Models\CustomModule\CustomModuleCategory; | 8 | use App\Models\CustomModule\CustomModuleCategory; |
| 9 | +use App\Models\IsCom\ProjectComConfig; | ||
| 9 | use App\Models\News\NewsCategory; | 10 | use App\Models\News\NewsCategory; |
| 10 | use App\Models\Product\Category; | 11 | use App\Models\Product\Category; |
| 11 | use App\Models\Project\PageSetting; | 12 | use App\Models\Project\PageSetting; |
| 12 | use App\Models\RouteMap\RouteMap; | 13 | use App\Models\RouteMap\RouteMap; |
| 13 | use App\Models\Service\Service as ServiceSettingModel; | 14 | use App\Models\Service\Service as ServiceSettingModel; |
| 14 | -use App\Models\Template\BTemplateCommon; | 15 | +use App\Models\Template\BTemplateCom; |
| 15 | use App\Models\Template\BTemplateMain; | 16 | use App\Models\Template\BTemplateMain; |
| 16 | use App\Models\Template\Setting; | 17 | use App\Models\Template\Setting; |
| 17 | use App\Models\Template\BTemplate; | 18 | use App\Models\Template\BTemplate; |
| @@ -52,6 +53,19 @@ class BTemplateLogic extends BaseLogic | @@ -52,6 +53,19 @@ class BTemplateLogic extends BaseLogic | ||
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | /** | 55 | /** |
| 56 | + * @remark :获取模版详情 | ||
| 57 | + * @name :getPublicTemplateInfo | ||
| 58 | + * @author :lyh | ||
| 59 | + * @method :post | ||
| 60 | + * @time :2024/7/31 14:31 | ||
| 61 | + */ | ||
| 62 | + public function getPublicTemplateInfo(){ | ||
| 63 | + $templateModel = new Template(); | ||
| 64 | + $info = $templateModel->read($this->param); | ||
| 65 | + return $this->success($info); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 55 | * @remark :获取可视化html | 69 | * @remark :获取可视化html |
| 56 | * @name :getTemplateHtml | 70 | * @name :getTemplateHtml |
| 57 | * @author :lyh | 71 | * @author :lyh |
| @@ -63,11 +77,11 @@ class BTemplateLogic extends BaseLogic | @@ -63,11 +77,11 @@ class BTemplateLogic extends BaseLogic | ||
| 63 | $is_list = $this->param['is_list'] ?? 0;//是否为列表页 | 77 | $is_list = $this->param['is_list'] ?? 0;//是否为列表页 |
| 64 | $template_id = $this->getSettingTemplate($this->param['source'],$is_list,$is_custom);//设置的模版id | 78 | $template_id = $this->getSettingTemplate($this->param['source'],$is_list,$is_custom);//设置的模版id |
| 65 | $templateInfo = $this->webTemplateInfo($this->param['source'],$this->param['source_id'],$template_id,$is_custom,$is_list); | 79 | $templateInfo = $this->webTemplateInfo($this->param['source'],$this->param['source_id'],$template_id,$is_custom,$is_list); |
| 66 | - if($templateInfo === false){ | 80 | + if($templateInfo === false){//todo::无装修数据处理 |
| 67 | if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//处理定制页面初始数据 | 81 | if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//处理定制页面初始数据 |
| 68 | - $html = $this->customizedReturnHtml($this->param['source'],$template_id,$is_custom,$is_list); | ||
| 69 | - if($html !== false){ | ||
| 70 | - return $this->success($html); | 82 | + $data = $this->customizedReturnHtml($this->param['source'],$template_id,$is_custom,$is_list); |
| 83 | + if($data !== false){ | ||
| 84 | + return $this->success($data); | ||
| 71 | } | 85 | } |
| 72 | } | 86 | } |
| 73 | //非定制初始中间部分 | 87 | //非定制初始中间部分 |
| @@ -78,15 +92,83 @@ class BTemplateLogic extends BaseLogic | @@ -78,15 +92,83 @@ class BTemplateLogic extends BaseLogic | ||
| 78 | } | 92 | } |
| 79 | $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; | 93 | $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; |
| 80 | } | 94 | } |
| 81 | - $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,$template_id,$is_custom);//获取非定制头部 | ||
| 82 | - $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; | 95 | + $commonInfo = $this->getTemplateComHtml($this->param['source'],$is_list,$is_custom,$template_id);//获取非定制头部 |
| 96 | + $html = $commonInfo['head_style'].$mainInfo['main_css'].$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; | ||
| 83 | $html = $this->getHeadFooter($html); | 97 | $html = $this->getHeadFooter($html); |
| 84 | $result = ['html'=>$html,'template_id'=>$template_id]; | 98 | $result = ['html'=>$html,'template_id'=>$template_id]; |
| 85 | - if($templateInfo !== false) {$result['id'] = $templateInfo['id'];$result['updated_at'] = $templateInfo['updated_at'];} | 99 | + if($templateInfo !== false) { |
| 100 | + $result['id'] = $templateInfo['id']; | ||
| 101 | + $result['updated_at'] = $templateInfo['updated_at']; | ||
| 102 | + } | ||
| 86 | return $this->success($result); | 103 | return $this->success($result); |
| 87 | } | 104 | } |
| 88 | 105 | ||
| 89 | /** | 106 | /** |
| 107 | + * @remark :非定制获取头部+底部 | ||
| 108 | + * @name :getTemplateComHtml | ||
| 109 | + * @author :lyh | ||
| 110 | + * @method :post | ||
| 111 | + * @time :2024/4/29 16:53 | ||
| 112 | + */ | ||
| 113 | + public function getTemplateComHtml($source,$is_list,$is_custom,$template_id){ | ||
| 114 | + $condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>'','is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id]; | ||
| 115 | + $headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id); | ||
| 116 | + $bTemplateComModel = new BTemplateCom(); | ||
| 117 | + $otherInfo = $bTemplateComModel->read(['source'=>$headComInfo['source'],'common_type'=>BTemplate::COMMON_OTHER,'is_list'=>$headComInfo['is_list'],'is_custom'=>$headComInfo['is_custom']]); | ||
| 118 | + if($otherInfo === false){ | ||
| 119 | + $this->fail('获取失败,请联系管理员222'); | ||
| 120 | + } | ||
| 121 | + $footerComInfo = $this->getFooterComHtml($condition,$source,$is_list,$is_custom,$template_id); | ||
| 122 | + $data = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '', | ||
| 123 | + 'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? '']; | ||
| 124 | + return $this->success($data); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * @remark :公共头部 | ||
| 129 | + * @name :HeadComHtml | ||
| 130 | + * @author :lyh | ||
| 131 | + * @method :post | ||
| 132 | + * @time :2024/4/29 17:20 | ||
| 133 | + */ | ||
| 134 | + public function getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id){ | ||
| 135 | + $commonHead = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_HEAD,$template_id); | ||
| 136 | + $bTemplateComModel = new BTemplateCom(); | ||
| 137 | + $condition['source'] = $commonHead; | ||
| 138 | + $condition['common_type'] = BTemplate::COMMON_HEAD; | ||
| 139 | + $headComInfo = $bTemplateComModel->read($condition); | ||
| 140 | + if($headComInfo === false){ | ||
| 141 | + //取默认公共的 | ||
| 142 | + $headComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_HEAD]); | ||
| 143 | + if($headComInfo === false){ | ||
| 144 | + $this->fail('获取失败,请联系管理员111'); | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + return $this->success($headComInfo); | ||
| 148 | + } | ||
| 149 | + /** | ||
| 150 | + * @remark :公共底部 | ||
| 151 | + * @name :footerComHtml | ||
| 152 | + * @author :lyh | ||
| 153 | + * @method :post | ||
| 154 | + * @time :2024/4/29 17:18 | ||
| 155 | + */ | ||
| 156 | + public function getFooterComHtml($condition,$source,$is_list,$is_custom,$template_id){ | ||
| 157 | + $bTemplateComModel = new BTemplateCom(); | ||
| 158 | + $condition['common_type'] = BTemplate::COMMON_FOOTER; | ||
| 159 | + $condition['source'] = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_FOOTER,$template_id); | ||
| 160 | + $footerComInfo = $bTemplateComModel->read($condition); | ||
| 161 | + if($footerComInfo === false){ | ||
| 162 | + //取默认首页的 | ||
| 163 | + $footerComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_FOOTER]); | ||
| 164 | + if($footerComInfo === false){ | ||
| 165 | + $this->fail('获取失败,请联系管理员'); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + return $this->success($footerComInfo); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + /** | ||
| 90 | * @remark :获取整个html代码 | 172 | * @remark :获取整个html代码 |
| 91 | * @name :getCustomizeAllHtml | 173 | * @name :getCustomizeAllHtml |
| 92 | * @author :lyh | 174 | * @author :lyh |
| @@ -95,11 +177,11 @@ class BTemplateLogic extends BaseLogic | @@ -95,11 +177,11 @@ class BTemplateLogic extends BaseLogic | ||
| 95 | */ | 177 | */ |
| 96 | public function getCustomizeAllHtml($templateInfo,$template_id,$is_custom,$is_list){ | 178 | public function getCustomizeAllHtml($templateInfo,$template_id,$is_custom,$is_list){ |
| 97 | if($is_custom == BTemplate::IS_CUSTOM){ | 179 | if($is_custom == BTemplate::IS_CUSTOM){ |
| 98 | - $commonInfo = $this->getCustomizedCommonHtml($this->param['source'],$is_custom,$is_list);//获取定制头部 | 180 | + $commonInfo = $this->getCustomizeTemplateComHtml($templateInfo['source'],$is_custom,$is_list);//获取定制头部 |
| 99 | $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); | 181 | $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); |
| 100 | }else{ | 182 | }else{ |
| 101 | - $type = $this->getCustomizedType($this->param['source'],$is_list); | ||
| 102 | - $commonInfo = $this->getCustomizedCommonHtml($type,$is_custom,$is_list);//获取定制头部 | 183 | + $type = $this->getCustomizedType($templateInfo['source'],$is_list); |
| 184 | + $commonInfo = $this->getCustomizeTemplateComHtml($type,$is_custom,$is_list);//获取定制头部 | ||
| 103 | $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); | 185 | $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); |
| 104 | } | 186 | } |
| 105 | return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]); | 187 | return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]); |
| @@ -136,11 +218,12 @@ class BTemplateLogic extends BaseLogic | @@ -136,11 +218,12 @@ class BTemplateLogic extends BaseLogic | ||
| 136 | if($info === false){ | 218 | if($info === false){ |
| 137 | $this->fail('当前扩展模块不存在或已被删除'); | 219 | $this->fail('当前扩展模块不存在或已被删除'); |
| 138 | } | 220 | } |
| 139 | - //扩展模块定制 | 221 | + //扩展模块定制列表 |
| 140 | if($is_list == BTemplate::IS_LIST && $info['list_customized'] == BTemplate::IS_VISUALIZATION){ | 222 | if($is_list == BTemplate::IS_LIST && $info['list_customized'] == BTemplate::IS_VISUALIZATION){ |
| 141 | $html = $this->customModuleCustomizeHtml($source,$is_list,$is_custom); | 223 | $html = $this->customModuleCustomizeHtml($source,$is_list,$is_custom); |
| 142 | return $this->success(['html'=>$html,'template_id'=>$template_id]); | 224 | return $this->success(['html'=>$html,'template_id'=>$template_id]); |
| 143 | } | 225 | } |
| 226 | + //扩展模块定制详情 | ||
| 144 | if($is_list == BTemplate::IS_DETAIL && $info['detail_customized'] == BTemplate::IS_VISUALIZATION){ | 227 | if($is_list == BTemplate::IS_DETAIL && $info['detail_customized'] == BTemplate::IS_VISUALIZATION){ |
| 145 | $html = $this->customModuleCustomizeHtml($source,$is_list,$is_custom); | 228 | $html = $this->customModuleCustomizeHtml($source,$is_list,$is_custom); |
| 146 | return $this->success(['html'=>$html,'template_id'=>$template_id]); | 229 | return $this->success(['html'=>$html,'template_id'=>$template_id]); |
| @@ -169,7 +252,7 @@ class BTemplateLogic extends BaseLogic | @@ -169,7 +252,7 @@ class BTemplateLogic extends BaseLogic | ||
| 169 | if($customHtmlInfo === false){ | 252 | if($customHtmlInfo === false){ |
| 170 | $this->fail('定制页面,请先上传代码块'); | 253 | $this->fail('定制页面,请先上传代码块'); |
| 171 | } | 254 | } |
| 172 | - $commonInfo = $this->getCustomizedCommonHtml($source,$is_custom,$is_list);//获取定制头部 | 255 | + $commonInfo = $this->getCustomizeTemplateComHtml($source,$is_custom,$is_list);//获取定制头部 |
| 173 | if($commonInfo !== false){ | 256 | if($commonInfo !== false){ |
| 174 | $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); | 257 | $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); |
| 175 | } | 258 | } |
| @@ -221,11 +304,11 @@ class BTemplateLogic extends BaseLogic | @@ -221,11 +304,11 @@ class BTemplateLogic extends BaseLogic | ||
| 221 | * @time :2023/12/13 15:39 | 304 | * @time :2023/12/13 15:39 |
| 222 | */ | 305 | */ |
| 223 | public function handleAllHtml($commonInfo,$html){ | 306 | public function handleAllHtml($commonInfo,$html){ |
| 224 | - if(!empty($commonInfo)){ | 307 | + if(!empty($commonInfo['head_html']) && !empty($commonInfo['footer_html'])){ |
| 225 | $html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html); | 308 | $html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html); |
| 226 | $html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html); | 309 | $html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html); |
| 227 | - $html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_css'], $html); | ||
| 228 | - $html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $commonInfo['footer_css'], $html); | 310 | + $html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_style'] ?? '', $html); |
| 311 | + $html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $commonInfo['footer_style'] ?? '', $html); | ||
| 229 | } | 312 | } |
| 230 | return $html; | 313 | return $html; |
| 231 | } | 314 | } |
| @@ -249,7 +332,7 @@ class BTemplateLogic extends BaseLogic | @@ -249,7 +332,7 @@ class BTemplateLogic extends BaseLogic | ||
| 249 | if($customHtmlInfo === false){ | 332 | if($customHtmlInfo === false){ |
| 250 | $this->fail('定制页面,请先上传代码块'); | 333 | $this->fail('定制页面,请先上传代码块'); |
| 251 | } | 334 | } |
| 252 | - $commonInfo = $this->getCustomizedCommonHtml($type,$is_custom,$is_list);//获取定制头部 | 335 | + $commonInfo = $this->getCustomizeTemplateComHtml($type,$is_custom,$is_list);//获取定制头部 |
| 253 | if($commonInfo !== false){ | 336 | if($commonInfo !== false){ |
| 254 | $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); | 337 | $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); |
| 255 | } | 338 | } |
| @@ -265,49 +348,25 @@ class BTemplateLogic extends BaseLogic | @@ -265,49 +348,25 @@ class BTemplateLogic extends BaseLogic | ||
| 265 | * @method :post | 348 | * @method :post |
| 266 | * @time :2023/12/29 13:13 | 349 | * @time :2023/12/29 13:13 |
| 267 | */ | 350 | */ |
| 268 | - public function getCustomizedCommonHtml($type,$is_custom = 0,$is_list = 0){ | ||
| 269 | - $data = [ | ||
| 270 | - 'template_id' => 0, | ||
| 271 | - 'project_id' => $this->user['project_id'], | ||
| 272 | - 'type'=>$type, | ||
| 273 | - 'is_custom'=>$is_custom, | ||
| 274 | - 'is_list'=>$is_list | ||
| 275 | - ]; | ||
| 276 | - $commonTemplateModel = new BTemplateCommon(); | ||
| 277 | - return $commonTemplateModel->read($data); | ||
| 278 | - } | ||
| 279 | - | ||
| 280 | - /** | ||
| 281 | - * @remark :定制页面头部类型---根据source获取type类型 | ||
| 282 | - * @name :getType | ||
| 283 | - * @author :lyh | ||
| 284 | - * @method :post | ||
| 285 | - * @time :2023/11/16 11:20 | ||
| 286 | - */ | ||
| 287 | - public function getCustomizedType($source,$is_list){ | ||
| 288 | - $type = BTemplate::TYPE_HOME; | ||
| 289 | - if($source == BTemplate::SOURCE_PRODUCT){ | ||
| 290 | - if($is_list == BTemplate::IS_LIST){ | ||
| 291 | - $type = BTemplate::TYPE_PRODUCT_LIST; | 351 | + public function getCustomizeTemplateComHtml($type,$is_custom,$is_list,$template_id = 0){ |
| 352 | + $data = ['head_html'=>'','head_style'=>'','footer_html'=>'','footer_style'=>'','other'=>'']; | ||
| 353 | + $param = ['template_id'=>$template_id,'source'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]; | ||
| 354 | + $commonTemplateModel = new BTemplateCom(); | ||
| 355 | + $commonList = $commonTemplateModel->list($param); | ||
| 356 | + if(!empty($commonList)){ | ||
| 357 | + foreach ($commonList as $v){ | ||
| 358 | + if($v['common_type'] == BTemplate::COMMON_HEAD){ | ||
| 359 | + $data['head_html'] = $v['html']; | ||
| 360 | + $data['head_style'] = $v['html_style']; | ||
| 361 | + }elseif ($v['common_type'] == BTemplate::COMMON_FOOTER){ | ||
| 362 | + $data['footer_html'] = $v['html']; | ||
| 363 | + $data['footer_style'] = $v['html_style']; | ||
| 292 | }else{ | 364 | }else{ |
| 293 | - $type = BTemplate::TYPE_PRODUCT_DETAIL; | ||
| 294 | - } | ||
| 295 | - } | ||
| 296 | - if($source == BTemplate::SOURCE_BLOG){ | ||
| 297 | - if($is_list == BTemplate::IS_LIST){ | ||
| 298 | - $type = BTemplate::TYPE_BLOG_LIST; | ||
| 299 | - }else{ | ||
| 300 | - $type = BTemplate::TYPE_BLOG_DETAIL; | 365 | + $data['other'] = $v['html']; |
| 301 | } | 366 | } |
| 302 | } | 367 | } |
| 303 | - if($source == BTemplate::SOURCE_NEWS){ | ||
| 304 | - if($is_list == BTemplate::IS_LIST){ | ||
| 305 | - $type = BTemplate::TYPE_NEWS_LIST; | ||
| 306 | - }else{ | ||
| 307 | - $type = BTemplate::TYPE_NEWS_DETAIL; | ||
| 308 | } | 368 | } |
| 309 | - } | ||
| 310 | - return $type; | 369 | + return $this->success($data); |
| 311 | } | 370 | } |
| 312 | 371 | ||
| 313 | /** | 372 | /** |
| @@ -346,38 +405,10 @@ class BTemplateLogic extends BaseLogic | @@ -346,38 +405,10 @@ class BTemplateLogic extends BaseLogic | ||
| 346 | if($info === false){ | 405 | if($info === false){ |
| 347 | $this->fail('请先选择模版'); | 406 | $this->fail('请先选择模版'); |
| 348 | } | 407 | } |
| 349 | - $template_id = $info['template_id']; | ||
| 350 | - return $this->success($template_id); | 408 | + return $this->success($info['template_id']); |
| 351 | } | 409 | } |
| 352 | 410 | ||
| 353 | /** | 411 | /** |
| 354 | - * @remark :根据类型获取公共头和底 | ||
| 355 | - * @name :getCommonPage | ||
| 356 | - * @author :lyh | ||
| 357 | - * @method :post | ||
| 358 | - * @time :2023/10/21 16:55 | ||
| 359 | - */ | ||
| 360 | - public function getCommonHtml($source,$is_list,$template_id,$is_custom = 0){ | ||
| 361 | - $type = $this->getType($source,$is_list,$is_custom); | ||
| 362 | - $data = [ | ||
| 363 | - 'template_id' => $template_id, | ||
| 364 | - 'project_id' => $this->user['project_id'], | ||
| 365 | - 'type'=>$type, | ||
| 366 | - 'is_custom'=>0, | ||
| 367 | - ]; | ||
| 368 | - $commonTemplateModel = new BTemplateCommon(); | ||
| 369 | - $commonInfo = $commonTemplateModel->read($data); | ||
| 370 | - if($commonInfo === false){ | ||
| 371 | - $data['type'] = BTemplate::SOURCE_HOME; | ||
| 372 | - $commonInfo = $commonTemplateModel->read($data); | ||
| 373 | - } | ||
| 374 | - return $this->success($commonInfo); | ||
| 375 | - } | ||
| 376 | - | ||
| 377 | - | ||
| 378 | - | ||
| 379 | - | ||
| 380 | - /** | ||
| 381 | * @remark :保存修改后的模版 | 412 | * @remark :保存修改后的模版 |
| 382 | * @name :templateSave | 413 | * @name :templateSave |
| 383 | * @author :lyh | 414 | * @author :lyh |
| @@ -404,14 +435,12 @@ class BTemplateLogic extends BaseLogic | @@ -404,14 +435,12 @@ class BTemplateLogic extends BaseLogic | ||
| 404 | 'is_custom'=>$this->param['is_custom'], 'template_id'=>$this->param['template_id'], | 435 | 'is_custom'=>$this->param['is_custom'], 'template_id'=>$this->param['template_id'], |
| 405 | 'is_list'=>$this->param['is_list'] | 436 | 'is_list'=>$this->param['is_list'] |
| 406 | ]; | 437 | ]; |
| 407 | - $data = [ | ||
| 408 | - 'section_list_id'=>$this->param['section_list_id'] | ||
| 409 | - ]; | 438 | + $data = ['section_list_id'=>$this->param['section_list_id']]; |
| 410 | $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['is_custom'],$data); | 439 | $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['is_custom'],$data); |
| 411 | $this->model->edit($data,$condition); | 440 | $this->model->edit($data,$condition); |
| 412 | } | 441 | } |
| 413 | //更新头部信息 | 442 | //更新头部信息 |
| 414 | - $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['template_id'],$this->param['is_custom']); | 443 | + $this->saveTemplateCom($this->param['html'],$this->param['template_id'],$this->param['source'],$this->param['is_list'],$this->param['is_custom']); |
| 415 | $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom'],$this->param['is_list']); | 444 | $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom'],$this->param['is_list']); |
| 416 | //通知更新 | 445 | //通知更新 |
| 417 | $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']); | 446 | $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']); |
| @@ -441,7 +470,6 @@ class BTemplateLogic extends BaseLogic | @@ -441,7 +470,6 @@ class BTemplateLogic extends BaseLogic | ||
| 441 | * @time :2023/12/15 10:59 | 470 | * @time :2023/12/15 10:59 |
| 442 | */ | 471 | */ |
| 443 | public function handleVisualizationParam($html,$source, $is_list,$is_custom,$data){ | 472 | public function handleVisualizationParam($html,$source, $is_list,$is_custom,$data){ |
| 444 | - if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目 | ||
| 445 | //TODO::扩展模块定制单独处理 | 473 | //TODO::扩展模块定制单独处理 |
| 446 | if($is_custom == BTemplate::IS_CUSTOM){ | 474 | if($is_custom == BTemplate::IS_CUSTOM){ |
| 447 | $customModuleModel = new CustomModule(); | 475 | $customModuleModel = new CustomModule(); |
| @@ -456,102 +484,60 @@ class BTemplateLogic extends BaseLogic | @@ -456,102 +484,60 @@ class BTemplateLogic extends BaseLogic | ||
| 456 | return $this->success($data); | 484 | return $this->success($data); |
| 457 | } | 485 | } |
| 458 | }else{ | 486 | }else{ |
| 487 | + if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){ | ||
| 459 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 | 488 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 |
| 460 | - //查看当前页面是否定制,是否开启可视化 | ||
| 461 | $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 | 489 | $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 |
| 462 | - if (in_array($type, $page_array)) {//当前页面是定制界面 | 490 | + if(in_array($type, $page_array)){ |
| 463 | $data['html'] = $html; | 491 | $data['html'] = $html; |
| 464 | $data['type'] = BTemplate::ALL_HTML; | 492 | $data['type'] = BTemplate::ALL_HTML; |
| 465 | return $this->success($data); | 493 | return $this->success($data); |
| 466 | } | 494 | } |
| 467 | } | 495 | } |
| 468 | } | 496 | } |
| 469 | - $mainInfo = $this->handleTemplateHtml($html); | ||
| 470 | - $data['main_html'] = $mainInfo['main_html']; | ||
| 471 | - $data['main_css'] = $mainInfo['main_css']; | 497 | + $data['main_html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'); |
| 498 | + $data['main_css'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | ||
| 472 | return $this->success($data); | 499 | return $this->success($data); |
| 473 | } | 500 | } |
| 474 | 501 | ||
| 475 | /** | 502 | /** |
| 476 | - * @remark :保存公共头部底部 | ||
| 477 | - * @name :saveCommonHtml | 503 | + * @remark :保存公共部分(头部。底部。连接部分) |
| 504 | + * @name :saveTemplateCom | ||
| 478 | * @author :lyh | 505 | * @author :lyh |
| 479 | * @method :post | 506 | * @method :post |
| 480 | - * @time :2023/12/13 17:05 | 507 | + * @time :2024/4/29 10:32 |
| 481 | */ | 508 | */ |
| 482 | - public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){ | ||
| 483 | - //TODO::定制扩展模块单独处理 | ||
| 484 | - if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 485 | - $code = $this->saveCustomModuleCommonHtml($html,$source,$is_custom,$is_list,$template_id); | ||
| 486 | - if($code === false){ | ||
| 487 | - return $this->success(); | ||
| 488 | - } | ||
| 489 | - } | ||
| 490 | - //todo::其他情况 | ||
| 491 | - $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面) | ||
| 492 | - if($template_id == 0){//定制页面默认为独立头部 | ||
| 493 | - $type = $this->getCustomizedType($source,$is_list);//定制默认独立头部 | ||
| 494 | - } | ||
| 495 | - $templateCommonModel = new BTemplateCommon(); | ||
| 496 | - $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type,'is_custom'=>0]);//查看当前头部是否存在 | 509 | + public function saveTemplateCom($html,$template_id,$source,$is_list,$is_custom){ |
| 510 | + $typeArr = [BTemplate::COMMON_HEAD, BTemplate::COMMON_FOOTER, BTemplate::COMMON_OTHER]; | ||
| 497 | $handleInfo = $this->handleCommonParam($html); | 511 | $handleInfo = $this->handleCommonParam($html); |
| 498 | - if($commonInfo === false){ | ||
| 499 | - $data = [ | ||
| 500 | - 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 501 | - 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 502 | - 'type'=>$type,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'], | ||
| 503 | - ]; | ||
| 504 | - $templateCommonModel->add($data); | 512 | + $templateComModel = new BTemplateCom(); |
| 513 | + foreach ($typeArr as $type){ | ||
| 514 | + if($type == BTemplate::COMMON_HEAD){ | ||
| 515 | + $param['html'] = $handleInfo['head_html']; | ||
| 516 | + $param['html_style'] = $handleInfo['head_style']; | ||
| 517 | + $typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);//头部是否为独立头部 | ||
| 518 | + }elseif ($type == BTemplate::COMMON_FOOTER){ | ||
| 519 | + $param['html'] = $handleInfo['footer_html']; | ||
| 520 | + $param['html_style'] = $handleInfo['footer_style']; | ||
| 521 | + $typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id); | ||
| 505 | }else{ | 522 | }else{ |
| 506 | - $data = [ | ||
| 507 | - 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 508 | - 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 509 | - ]; | ||
| 510 | - $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); | 523 | + $param['html'] = $handleInfo['other']; |
| 524 | + $param['html_style'] = null; | ||
| 525 | + $typeSource = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_HEAD,$template_id); | ||
| 511 | } | 526 | } |
| 512 | - //更新所有界面的other | ||
| 513 | - if($template_id != 0){ | ||
| 514 | - return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]); | 527 | + if($typeSource == 99){ |
| 528 | + $is_custom = $is_list = 0; | ||
| 515 | } | 529 | } |
| 516 | - } | ||
| 517 | - | ||
| 518 | - /** | ||
| 519 | - * @remark :扩展模块定制保存头部处理 | ||
| 520 | - * @name :saveCustomModuleCommonHtml | ||
| 521 | - * @author :lyh | ||
| 522 | - * @method :post | ||
| 523 | - * @time :2024/1/10 11:33 | ||
| 524 | - */ | ||
| 525 | - public function saveCustomModuleCommonHtml($html,$source,$is_custom,$is_list,$template_id){ | ||
| 526 | - $customModuleModel = new CustomModule(); | ||
| 527 | - $info = $customModuleModel->read(['id'=>$source]); | 530 | + //查看当前数据是否还存在 |
| 531 | + $condition = ['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type]; | ||
| 532 | + $info = $templateComModel->read($condition); | ||
| 528 | if($info === false){ | 533 | if($info === false){ |
| 529 | - $this->fail('当前扩展模块不存在或已被删除'); | ||
| 530 | - } | ||
| 531 | - //todo::扩展模块(列表页/详情页)定制 | ||
| 532 | - if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) { | ||
| 533 | - $data = ['type'=>$source,'is_custom'=>$is_custom,'is_list'=>$is_list,'template_id'=>$template_id]; | ||
| 534 | - $templateCommonModel = new BTemplateCommon(); | ||
| 535 | - $commonInfo = $templateCommonModel->read($data);//查看当前头部是否存在 | ||
| 536 | - $handleInfo = $this->handleCommonParam($html); | ||
| 537 | - if($commonInfo === false){ | ||
| 538 | - $data = [ | ||
| 539 | - 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 540 | - 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 541 | - 'type'=>$source,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'], | ||
| 542 | - 'is_custom'=>$is_custom,'is_list'=>$is_list, | ||
| 543 | - ]; | ||
| 544 | - $templateCommonModel->add($data); | 534 | + $data = array_merge($param,$condition); |
| 535 | + $templateComModel->add($data); | ||
| 545 | }else{ | 536 | }else{ |
| 546 | - $data = [ | ||
| 547 | - 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 548 | - 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 549 | - ]; | ||
| 550 | - $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); | 537 | + $templateComModel->edit($param,$condition); |
| 551 | } | 538 | } |
| 552 | - return false; | ||
| 553 | } | 539 | } |
| 554 | - return true; | 540 | + return $this->success(); |
| 555 | } | 541 | } |
| 556 | 542 | ||
| 557 | /** | 543 | /** |
| @@ -580,59 +566,46 @@ class BTemplateLogic extends BaseLogic | @@ -580,59 +566,46 @@ class BTemplateLogic extends BaseLogic | ||
| 580 | //字符串截取 | 566 | //字符串截取 |
| 581 | $param['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'); | 567 | $param['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'); |
| 582 | $param['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'); | 568 | $param['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'); |
| 583 | - $param['head_css'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'); | ||
| 584 | - $param['footer_css'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'); | 569 | + $param['head_style'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'); |
| 570 | + $param['footer_style'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'); | ||
| 585 | $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); | 571 | $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 586 | $param['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | 572 | $param['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); |
| 587 | return $this->success($param); | 573 | return $this->success($param); |
| 588 | } | 574 | } |
| 589 | 575 | ||
| 590 | /** | 576 | /** |
| 591 | - * @remark :保存时字符串处理 | ||
| 592 | - * @name :handleSaveParam | 577 | + * @remark :获取类型 |
| 578 | + * @name :getTypes | ||
| 593 | * @author :lyh | 579 | * @author :lyh |
| 594 | * @method :post | 580 | * @method :post |
| 595 | - * @time :2023/6/29 15:35 | 581 | + * @time :2024/8/1 16:01 |
| 596 | */ | 582 | */ |
| 597 | - public function handleTemplateHtml($html){ | ||
| 598 | - //字符串截取 | ||
| 599 | - $param['main_html'] = characterTruncationStr($html,"<main","</main>"); | ||
| 600 | - $param['main_css'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | ||
| 601 | - return $this->success($param); | 583 | + public function getType($source,$is_list,$is_custom = BTemplate::IS_NO_CUSTOM,$commonType = BTemplate::COMMON_HEAD,$template_id = 0){ |
| 584 | + if($template_id == 0){ | ||
| 585 | + return $this->success($source); | ||
| 602 | } | 586 | } |
| 603 | - | ||
| 604 | - /** | ||
| 605 | - * @remark :(非定制)保存时获取获取设置的类型 | ||
| 606 | - * @name :getType | ||
| 607 | - * @author :lyh | ||
| 608 | - * @method :post | ||
| 609 | - * @time :2023/10/21 17:29 | ||
| 610 | - */ | ||
| 611 | - public function getType($source,$is_list,$is_custom = 0){ | ||
| 612 | - $type = BTemplate::SOURCE_HOME;//首页公共头部底部 | 587 | + $type = BTemplate::SOURCE_COM;//公共头部底部 |
| 613 | $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; | 588 | $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; |
| 614 | - if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部 | 589 | + if($is_head == BTemplate::IS_NO_HEADER){//拓展模块为公共头+底 |
| 615 | return $this->success($type); | 590 | return $this->success($type); |
| 616 | } | 591 | } |
| 617 | //查看页面是否设置自定义头部底部 | 592 | //查看页面是否设置自定义头部底部 |
| 618 | - if($is_head != BTemplate::IS_NO_HEADER) { | ||
| 619 | - $pageSettingModel = new PageSetting(); | ||
| 620 | - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]); | ||
| 621 | - if ($pageInfo === false) { | 593 | + $comConfigModel = new ProjectComConfig(); |
| 594 | + $configInfo = $comConfigModel->read(['source'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom]); | ||
| 595 | + if($configInfo === false){ | ||
| 622 | return $this->success($type); | 596 | return $this->success($type); |
| 623 | } | 597 | } |
| 624 | - if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}} | ||
| 625 | - else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}} | ||
| 626 | - if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}} | ||
| 627 | - else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}} | ||
| 628 | - if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}} | ||
| 629 | - else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}} | ||
| 630 | - if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}} | 598 | + //头部 |
| 599 | + if($commonType == BTemplate::COMMON_HEAD){ | ||
| 600 | + return $this->success($configInfo['header_status'] == 0 ? $type : $source); | ||
| 601 | + } | ||
| 602 | + //底部 | ||
| 603 | + if($commonType == BTemplate::COMMON_FOOTER){ | ||
| 604 | + return $this->success($configInfo['footer_status'] == 0 ? $type : $source); | ||
| 631 | } | 605 | } |
| 632 | return $this->success($type); | 606 | return $this->success($type); |
| 633 | } | 607 | } |
| 634 | 608 | ||
| 635 | - | ||
| 636 | /** | 609 | /** |
| 637 | * @remark :生成记录 | 610 | * @remark :生成记录 |
| 638 | * @name :setTemplateLog | 611 | * @name :setTemplateLog |
| @@ -933,22 +906,35 @@ class BTemplateLogic extends BaseLogic | @@ -933,22 +906,35 @@ class BTemplateLogic extends BaseLogic | ||
| 933 | } | 906 | } |
| 934 | 907 | ||
| 935 | /** | 908 | /** |
| 936 | - * @remark :设置模版 | ||
| 937 | - * @name :setCustomTemplate | 909 | + * @remark :定制页面头部类型---根据source获取type类型 |
| 910 | + * @name :getType | ||
| 938 | * @author :lyh | 911 | * @author :lyh |
| 939 | * @method :post | 912 | * @method :post |
| 940 | - * @time :2024/5/24 15:55 | 913 | + * @time :2023/11/16 11:20 |
| 941 | */ | 914 | */ |
| 942 | - public function setCustomTemplate(){ | ||
| 943 | - $templateModel = new Template(); | ||
| 944 | - $templateInfo = $templateModel->read(['id'=>$this->param['template_id']],['id','main_html','main_css']); | ||
| 945 | - if($templateInfo === false){ | ||
| 946 | - $this->fail('未获取到模版数据'); | 915 | + public function getCustomizedType($source,$is_list){ |
| 916 | + $type = BTemplate::TYPE_HOME; | ||
| 917 | + if($source == BTemplate::SOURCE_PRODUCT){ | ||
| 918 | + if($is_list == BTemplate::IS_LIST){ | ||
| 919 | + $type = BTemplate::TYPE_PRODUCT_LIST; | ||
| 920 | + }else{ | ||
| 921 | + $type = BTemplate::TYPE_PRODUCT_DETAIL; | ||
| 947 | } | 922 | } |
| 948 | - if(empty($templateInfo['main_html']) || empty($templateInfo['main_css'])){ | ||
| 949 | - $this->fail('当前模版替换数据错误'); | ||
| 950 | } | 923 | } |
| 951 | - $this->model->edit(['html'=>$templateInfo['main_html'],'html_style'=>$templateInfo['main_css']],['id'=>$this->param['id']]); | ||
| 952 | - return $this->success(); | 924 | + if($source == BTemplate::SOURCE_BLOG){ |
| 925 | + if($is_list == BTemplate::IS_LIST){ | ||
| 926 | + $type = BTemplate::TYPE_BLOG_LIST; | ||
| 927 | + }else{ | ||
| 928 | + $type = BTemplate::TYPE_BLOG_DETAIL; | ||
| 929 | + } | ||
| 930 | + } | ||
| 931 | + if($source == BTemplate::SOURCE_NEWS){ | ||
| 932 | + if($is_list == BTemplate::IS_LIST){ | ||
| 933 | + $type = BTemplate::TYPE_NEWS_LIST; | ||
| 934 | + }else{ | ||
| 935 | + $type = BTemplate::TYPE_NEWS_DETAIL; | ||
| 936 | + } | ||
| 937 | + } | ||
| 938 | + return $type; | ||
| 953 | } | 939 | } |
| 954 | } | 940 | } |
| @@ -3,11 +3,12 @@ | @@ -3,11 +3,12 @@ | ||
| 3 | namespace App\Http\Logic\Bside\BTemplate; | 3 | namespace App\Http\Logic\Bside\BTemplate; |
| 4 | 4 | ||
| 5 | use App\Http\Logic\Bside\BaseLogic; | 5 | use App\Http\Logic\Bside\BaseLogic; |
| 6 | +use App\Models\IsCom\ProjectComConfig; | ||
| 6 | use App\Models\Project\PageSetting; | 7 | use App\Models\Project\PageSetting; |
| 7 | use App\Models\RouteMap\RouteMap; | 8 | use App\Models\RouteMap\RouteMap; |
| 8 | use App\Models\Service\Service as ServiceSettingModel; | 9 | use App\Models\Service\Service as ServiceSettingModel; |
| 9 | use App\Models\Template\BCustomTemplate; | 10 | use App\Models\Template\BCustomTemplate; |
| 10 | -use App\Models\Template\BTemplateCommon; | 11 | +use App\Models\Template\BTemplateCom; |
| 11 | use App\Models\Template\BTemplateLog; | 12 | use App\Models\Template\BTemplateLog; |
| 12 | use App\Models\Template\BTemplateMain; | 13 | use App\Models\Template\BTemplateMain; |
| 13 | use App\Models\Template\Setting; | 14 | use App\Models\Template\Setting; |
| @@ -30,7 +31,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -30,7 +31,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 30 | * @time :2023/6/29 15:46 | 31 | * @time :2023/6/29 15:46 |
| 31 | */ | 32 | */ |
| 32 | public function customTemplateLists($map,$page,$row,$order = 'created_at'){ | 33 | public function customTemplateLists($map,$page,$row,$order = 'created_at'){ |
| 33 | - $filed = ['id','name','status','url','title','keywords','description','project_id','is_upgrade','six_read','is_visualization','created_at','updated_at']; | 34 | + $filed = ['id','name','status','url','operator_id','title','keywords','description','project_id','is_upgrade','six_read','is_visualization','created_at','updated_at']; |
| 34 | $map['deleted_status'] = 0; | 35 | $map['deleted_status'] = 0; |
| 35 | $map['project_id'] = $this->user['project_id']; | 36 | $map['project_id'] = $this->user['project_id']; |
| 36 | $lists = $this->model->lists($map,$page,$row,$order,$filed); | 37 | $lists = $this->model->lists($map,$page,$row,$order,$filed); |
| @@ -50,13 +51,85 @@ class CustomTemplateLogic extends BaseLogic | @@ -50,13 +51,85 @@ class CustomTemplateLogic extends BaseLogic | ||
| 50 | $this->fail('当前数据不存在'); | 51 | $this->fail('当前数据不存在'); |
| 51 | } | 52 | } |
| 52 | if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){ | 53 | if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){ |
| 53 | - $html = $this->getBodyHeaderFooter($info['html'],$info['html_style']); | 54 | + $html = $this->getTemplateComHtml($info['html'],$info['html_style']); |
| 54 | $info['html'] = $this->getHeadFooter($html); | 55 | $info['html'] = $this->getHeadFooter($html); |
| 55 | } | 56 | } |
| 56 | return $this->success($info); | 57 | return $this->success($info); |
| 57 | } | 58 | } |
| 58 | 59 | ||
| 59 | /** | 60 | /** |
| 61 | + * @remark :非定制获取头部+底部 | ||
| 62 | + * @name :getTemplateComHtml | ||
| 63 | + * @author :lyh | ||
| 64 | + * @method :post | ||
| 65 | + * @time :2024/4/29 16:53 | ||
| 66 | + */ | ||
| 67 | + public function getTemplateComHtml($html,$html_style){ | ||
| 68 | + if(empty($html)){ | ||
| 69 | + $html = "<main></main>"; | ||
| 70 | + $html_style = "<style id='globalsojs-styles'></style>"; | ||
| 71 | + } | ||
| 72 | + $headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD]); | ||
| 73 | + $bTemplateComModel = new BTemplateCom(); | ||
| 74 | + $condition['common_type'] = BTemplate::COMMON_OTHER; | ||
| 75 | + $condition['source'] = $headComInfo['source']; | ||
| 76 | + $otherInfo = $bTemplateComModel->read($condition); | ||
| 77 | + if($otherInfo === false){ | ||
| 78 | + $this->fail('获取失败,请联系管理员'); | ||
| 79 | + } | ||
| 80 | + $footerComInfo = $this->getFooterComHtml(); | ||
| 81 | + $commonInfo = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '', | ||
| 82 | + 'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? '']; | ||
| 83 | + $html = $commonInfo['head_style'].$html_style.$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$html.$commonInfo['footer_html']; | ||
| 84 | + return $this->success($html); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * @remark :公共头部 | ||
| 89 | + * @name :HeadComHtml | ||
| 90 | + * @author :lyh | ||
| 91 | + * @method :post | ||
| 92 | + * @time :2024/4/29 17:20 | ||
| 93 | + */ | ||
| 94 | + public function getHeadComHtml($condition){ | ||
| 95 | + $bTemplateComModel = new BTemplateCom(); | ||
| 96 | + $condition['source'] = $this->getType(); | ||
| 97 | + $condition['common_type'] = BTemplate::COMMON_HEAD; | ||
| 98 | + $headComInfo = $bTemplateComModel->read($condition); | ||
| 99 | + if($headComInfo === false){ | ||
| 100 | + //取默认公共的 | ||
| 101 | + $condition['source'] = BTemplate::SOURCE_COM; | ||
| 102 | + $headComInfo = $bTemplateComModel->read($condition); | ||
| 103 | + if($headComInfo === false){ | ||
| 104 | + $this->fail('获取失败,请联系管理员'); | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + return $this->success($headComInfo); | ||
| 108 | + } | ||
| 109 | + /** | ||
| 110 | + * @remark :公共底部 | ||
| 111 | + * @name :footerComHtml | ||
| 112 | + * @author :lyh | ||
| 113 | + * @method :post | ||
| 114 | + * @time :2024/4/29 17:18 | ||
| 115 | + */ | ||
| 116 | + public function getFooterComHtml(){ | ||
| 117 | + $bTemplateComModel = new BTemplateCom(); | ||
| 118 | + $condition['common_type'] = BTemplate::COMMON_FOOTER; | ||
| 119 | + $condition['source'] = $this->getType(BTemplate::COMMON_FOOTER); | ||
| 120 | + $footerComInfo = $bTemplateComModel->read($condition); | ||
| 121 | + if($footerComInfo === false){ | ||
| 122 | + //取默认首页的 | ||
| 123 | + $condition['source'] = BTemplate::SOURCE_COM; | ||
| 124 | + $footerComInfo = $bTemplateComModel->read($condition); | ||
| 125 | + if($footerComInfo === false){ | ||
| 126 | + $this->fail('获取失败,请联系管理员'); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + return $this->success($footerComInfo); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + /** | ||
| 60 | * @remark :保存自定义界面 | 133 | * @remark :保存自定义界面 |
| 61 | * @name :customTemplateSave | 134 | * @name :customTemplateSave |
| 62 | * @author :lyh | 135 | * @author :lyh |
| @@ -64,13 +137,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -64,13 +137,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 64 | * @time :2023/6/29 16:21 | 137 | * @time :2023/6/29 16:21 |
| 65 | */ | 138 | */ |
| 66 | public function customTemplateSave(){ | 139 | public function customTemplateSave(){ |
| 67 | - $this->param['url'] = str_replace_url($this->param['url']); | ||
| 68 | - if(($this->project['deploy_build']['is_search'] == 0) && ($this->param['url'] == 'search')){ | ||
| 69 | - $this->fail('请先开启搜索页可视化'); | ||
| 70 | - } | ||
| 71 | - if(($this->project['deploy_build']['is_keyword'] == 0) && ($this->param['url'] == 'keyword')){ | ||
| 72 | - $this->fail('请先开启聚合页可视化'); | ||
| 73 | - } | 140 | + $this->param = $this->handleSaveParam();; |
| 74 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 141 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 75 | $id = $this->param['id']; | 142 | $id = $this->param['id']; |
| 76 | $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 | 143 | $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 |
| @@ -82,6 +149,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -82,6 +149,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 82 | } | 149 | } |
| 83 | } | 150 | } |
| 84 | $this->editCustomRoute($this->param['url']); | 151 | $this->editCustomRoute($this->param['url']); |
| 152 | + unset($this->param['html'],$this->param['html_style']); | ||
| 85 | $this->model->edit($this->param,['id'=>$id]); | 153 | $this->model->edit($this->param,['id'=>$id]); |
| 86 | }else{ | 154 | }else{ |
| 87 | if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ | 155 | if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ |
| @@ -107,6 +175,25 @@ class CustomTemplateLogic extends BaseLogic | @@ -107,6 +175,25 @@ class CustomTemplateLogic extends BaseLogic | ||
| 107 | } | 175 | } |
| 108 | 176 | ||
| 109 | /** | 177 | /** |
| 178 | + * @remark :参数验证 | ||
| 179 | + * @name :handleSaveParam | ||
| 180 | + * @author :lyh | ||
| 181 | + * @method :post | ||
| 182 | + * @time :2024/8/6 16:52 | ||
| 183 | + */ | ||
| 184 | + public function handleSaveParam(){ | ||
| 185 | + $this->param['url'] = str_replace_url($this->param['url']); | ||
| 186 | + $this->param['operator_id'] = $this->user['id']; | ||
| 187 | + if(($this->project['deploy_build']['is_search'] == 0) && ($this->param['url'] == 'search')){ | ||
| 188 | + $this->fail('请先开启搜索页可视化'); | ||
| 189 | + } | ||
| 190 | + if(($this->project['deploy_build']['is_keyword'] == 0) && ($this->param['url'] == 'keyword')){ | ||
| 191 | + $this->fail('请先开启聚合页可视化'); | ||
| 192 | + } | ||
| 193 | + return $this->success($this->param); | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + /** | ||
| 110 | * @remark :可视化保存html | 197 | * @remark :可视化保存html |
| 111 | * @name :saveHtml | 198 | * @name :saveHtml |
| 112 | * @author :lyh | 199 | * @author :lyh |
| @@ -126,9 +213,13 @@ class CustomTemplateLogic extends BaseLogic | @@ -126,9 +213,13 @@ class CustomTemplateLogic extends BaseLogic | ||
| 126 | if($bSettingInfo === false){ | 213 | if($bSettingInfo === false){ |
| 127 | $this->fail('请先选择模版'); | 214 | $this->fail('请先选择模版'); |
| 128 | } | 215 | } |
| 129 | - $this->saveCommonTemplate($html,$bSettingInfo['template_id']); | ||
| 130 | - $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'); | ||
| 131 | - $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | 216 | + |
| 217 | + $handleInfo = $this->handleResultParam($html); | ||
| 218 | + if(!isset($this->param['template_status'])){//代表直接替换模版 不更新头部底部 | ||
| 219 | + $this->saveTemplateCom($handleInfo,$bSettingInfo['template_id']); | ||
| 220 | + } | ||
| 221 | + $this->param['html'] = $handleInfo['main_html']; | ||
| 222 | + $this->param['html_style'] = $handleInfo['main_style']; | ||
| 132 | } | 223 | } |
| 133 | $rs = $this->model->edit($this->param,['id'=>$this->param['id'],'project_id'=>$this->user['project_id']]); | 224 | $rs = $this->model->edit($this->param,['id'=>$this->param['id'],'project_id'=>$this->user['project_id']]); |
| 134 | if($rs === false){ | 225 | if($rs === false){ |
| @@ -149,6 +240,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -149,6 +240,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 149 | * @time :2023/8/23 11:16 | 240 | * @time :2023/8/23 11:16 |
| 150 | */ | 241 | */ |
| 151 | public function setTemplateLog($template_id,$html,$source_id){ | 242 | public function setTemplateLog($template_id,$html,$source_id){ |
| 243 | + $handleInfo = $this->handleResultParam($html); | ||
| 152 | $data = [ | 244 | $data = [ |
| 153 | 'template_id'=>$template_id, | 245 | 'template_id'=>$template_id, |
| 154 | 'project_id'=>$this->user['project_id'], | 246 | 'project_id'=>$this->user['project_id'], |
| @@ -156,71 +248,109 @@ class CustomTemplateLogic extends BaseLogic | @@ -156,71 +248,109 @@ class CustomTemplateLogic extends BaseLogic | ||
| 156 | 'text'=>$html, | 248 | 'text'=>$html, |
| 157 | 'source'=>9, | 249 | 'source'=>9, |
| 158 | 'source_id'=>$source_id, | 250 | 'source_id'=>$source_id, |
| 159 | - 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'), | ||
| 160 | - 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'), | ||
| 161 | - 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), | ||
| 162 | - 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), | ||
| 163 | - 'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'), | ||
| 164 | - 'main_css' => characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'), | 251 | + 'head_html'=>$handleInfo['head_html'], |
| 252 | + 'head_css'=>$handleInfo['head_style'], | ||
| 253 | + 'footer_html'=>$handleInfo['footer_html'], | ||
| 254 | + 'footer_css'=>$handleInfo['footer_style'], | ||
| 255 | + 'main_html' => $handleInfo['main_html'], | ||
| 256 | + 'main_css' => $handleInfo['main_style'], | ||
| 257 | + 'other'=>$handleInfo['other'] | ||
| 165 | ]; | 258 | ]; |
| 166 | - $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); | ||
| 167 | - $data['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 168 | $bTemplateLogModel = new BTemplateLog(); | 259 | $bTemplateLogModel = new BTemplateLog(); |
| 169 | return $bTemplateLogModel->add($data); | 260 | return $bTemplateLogModel->add($data); |
| 170 | } | 261 | } |
| 171 | 262 | ||
| 172 | /** | 263 | /** |
| 173 | - * @remark :保存头部公共数据 | ||
| 174 | - * @name :saveCommonTemplate | 264 | + * @remark :截取数据返回 |
| 265 | + * @name :handleResultParam | ||
| 175 | * @author :lyh | 266 | * @author :lyh |
| 176 | * @method :post | 267 | * @method :post |
| 177 | - * @time :2023/10/13 14:27 | 268 | + * @time :2024/5/6 14:14 |
| 178 | */ | 269 | */ |
| 179 | - public function saveCommonTemplate($html,$template_id){ | ||
| 180 | - $type = $this->getType(); | ||
| 181 | - $templateCommonModel = new BTemplateCommon(); | ||
| 182 | - $info = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]); | ||
| 183 | - $data = [ | 270 | + public function handleResultParam($html){ |
| 271 | + $handleInfo = [ | ||
| 184 | 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'), | 272 | 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'), |
| 185 | - 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'), | 273 | + 'head_style'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'), |
| 186 | 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), | 274 | 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), |
| 187 | - 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), | 275 | + 'footer_style'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), |
| 276 | + 'main_html' => characterTruncationStr($html,"<main","</main>"), | ||
| 277 | + 'main_style' => characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'), | ||
| 188 | ]; | 278 | ]; |
| 189 | $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); | 279 | $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 190 | $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | 280 | $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); |
| 281 | + $handleInfo['other'] = $other; | ||
| 282 | + return $this->success($handleInfo); | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + /** | ||
| 286 | + * @remark :保存公共部分(头部。底部。连接部分) | ||
| 287 | + * @name :saveTemplateCom | ||
| 288 | + * @author :lyh | ||
| 289 | + * @method :post | ||
| 290 | + * @time :2024/4/29 10:32 | ||
| 291 | + */ | ||
| 292 | + public function saveTemplateCom($handleInfo,$template_id){ | ||
| 293 | + $typeArr = [BTemplate::COMMON_HEAD, BTemplate::COMMON_FOOTER, BTemplate::COMMON_OTHER]; | ||
| 294 | + $templateComModel = new BTemplateCom(); | ||
| 295 | + foreach ($typeArr as $type){ | ||
| 296 | + if($type == BTemplate::COMMON_HEAD){ | ||
| 297 | + $param['html'] = $handleInfo['head_html']; | ||
| 298 | + $param['html_style'] = $handleInfo['head_style']; | ||
| 299 | + $typeSource = $this->getType($type);//头部是否为独立头部 | ||
| 300 | + }elseif ($type == BTemplate::COMMON_FOOTER){ | ||
| 301 | + $param['html'] = $handleInfo['footer_html']; | ||
| 302 | + $param['html_style'] = $handleInfo['footer_style']; | ||
| 303 | + $typeSource = $this->getType($type); | ||
| 304 | + }else{ | ||
| 305 | + $param['html'] = $handleInfo['other']; | ||
| 306 | + $param['html_style'] = null; | ||
| 307 | + $type == BTemplate::COMMON_HEAD; | ||
| 308 | + $typeSource = $this->getType($type); | ||
| 309 | + } | ||
| 310 | + //查看当前数据是否还存在 | ||
| 311 | + $condition = ['template_id'=>$template_id,'source'=>$typeSource,'common_type'=>$type]; | ||
| 312 | + $info = $templateComModel->read($condition); | ||
| 191 | if($info === false){ | 313 | if($info === false){ |
| 192 | - $data['template_id'] = $template_id; | ||
| 193 | - $data['project_id'] = $this->user['project_id']; | ||
| 194 | - $data['type'] = $type; | ||
| 195 | - $templateCommonModel->add($data); | 314 | + $data = array_merge($param,$condition); |
| 315 | + $rs = $templateComModel->add($data); | ||
| 196 | }else{ | 316 | }else{ |
| 197 | - $templateCommonModel->edit($data,['id'=>$info['id']]); | 317 | + $rs = $templateComModel->edit($param,$condition); |
| 318 | + } | ||
| 319 | + if($rs === false){ | ||
| 320 | + $this->fail('保存错误,请联系管理员'); | ||
| 321 | + } | ||
| 198 | } | 322 | } |
| 199 | - //更新所有界面的other | ||
| 200 | - $templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id']]); | ||
| 201 | return $this->success(); | 323 | return $this->success(); |
| 202 | } | 324 | } |
| 203 | 325 | ||
| 204 | /** | 326 | /** |
| 205 | - * @remark :获取设置的类型 | 327 | + * @remark :(非定制)保存时获取获取设置的类型 |
| 206 | * @name :getType | 328 | * @name :getType |
| 207 | * @author :lyh | 329 | * @author :lyh |
| 208 | * @method :post | 330 | * @method :post |
| 209 | * @time :2023/10/21 17:29 | 331 | * @time :2023/10/21 17:29 |
| 210 | */ | 332 | */ |
| 211 | - public function getType(){ | ||
| 212 | - $type = 1;//首页公共头部底部 | 333 | + public function getType($commonType = BTemplate::COMMON_HEAD){ |
| 334 | + $type = BTemplate::SOURCE_COM;//公共头部底部 | ||
| 335 | + $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; | ||
| 336 | + if($is_head == BTemplate::IS_NO_HEADER){ | ||
| 337 | + return $this->success($type); | ||
| 338 | + } | ||
| 213 | //查看页面是否设置自定义头部底部 | 339 | //查看页面是否设置自定义头部底部 |
| 214 | - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) { | ||
| 215 | - $pageSettingModel = new PageSetting(); | ||
| 216 | - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]); | ||
| 217 | - if ($pageInfo !== false) { | ||
| 218 | - if ($pageInfo['page_list'] != 0) { | ||
| 219 | - $type = 9; | 340 | + $comConfigModel = new ProjectComConfig(); |
| 341 | + $configInfo = $comConfigModel->read(['source'=>9,'is_list'=>0,'is_custom'=>0]); | ||
| 342 | + if ($configInfo === false) { | ||
| 343 | + return $this->success($type); | ||
| 220 | } | 344 | } |
| 345 | + //头部 | ||
| 346 | + if($commonType == BTemplate::COMMON_HEAD){ | ||
| 347 | + return $this->success($configInfo['header_status'] == 0 ? $type : 9); | ||
| 221 | } | 348 | } |
| 349 | + //底部 | ||
| 350 | + if($commonType == BTemplate::COMMON_FOOTER){ | ||
| 351 | + return $this->success($configInfo['footer_status'] == 0 ? $type : 9); | ||
| 222 | } | 352 | } |
| 223 | - return $type; | 353 | + return $this->success($type); |
| 224 | } | 354 | } |
| 225 | 355 | ||
| 226 | /** | 356 | /** |
| @@ -288,59 +418,6 @@ class CustomTemplateLogic extends BaseLogic | @@ -288,59 +418,6 @@ class CustomTemplateLogic extends BaseLogic | ||
| 288 | } | 418 | } |
| 289 | 419 | ||
| 290 | /** | 420 | /** |
| 291 | - * @remark :获取body的详情 | ||
| 292 | - * @name :getBodyHeaderFooter | ||
| 293 | - * @author :lyh | ||
| 294 | - * @method :post | ||
| 295 | - * @time :2023/7/21 18:08 | ||
| 296 | - */ | ||
| 297 | - public function getBodyHeaderFooter($preg_html,$html_style){ | ||
| 298 | - if(empty($preg_html)){ | ||
| 299 | - $preg_html = "<main></main>"; | ||
| 300 | - $html_style = "<style id='globalsojs-styles'></style>"; | ||
| 301 | - } | ||
| 302 | - //获取设置的默认模版 | ||
| 303 | - $bSettingModel = new Setting(); | ||
| 304 | - $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]); | ||
| 305 | - if($info === false){ | ||
| 306 | - $this->fail('请先设置模版'); | ||
| 307 | - } | ||
| 308 | - //获取type类型 | ||
| 309 | - $commonInfo = $this->getCommonPage($info['template_id']); | ||
| 310 | - $html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other']. | ||
| 311 | - $commonInfo['head_html'].$preg_html.$commonInfo['footer_html']; | ||
| 312 | - return $this->success($html); | ||
| 313 | - } | ||
| 314 | - | ||
| 315 | - /** | ||
| 316 | - * @remark :根据类型获取公共头和底 | ||
| 317 | - * @name :getCommonPage | ||
| 318 | - * @author :lyh | ||
| 319 | - * @method :post | ||
| 320 | - * @time :2023/10/21 16:55 | ||
| 321 | - */ | ||
| 322 | - public function getCommonPage($template_id){ | ||
| 323 | - if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) { | ||
| 324 | - //查看页面是否设置自定义头部底部 | ||
| 325 | - $pageSettingModel = new PageSetting(); | ||
| 326 | - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]); | ||
| 327 | - if ($pageInfo !== false) { | ||
| 328 | - $commonTemplateModel = new BTemplateCommon(); | ||
| 329 | - if ($pageInfo['page_list'] != 0) { | ||
| 330 | - //使用独立头和底 | ||
| 331 | - $commonInfo = $commonTemplateModel->read(['template_id' => $template_id, 'project_id' => $this->user['project_id'], 'type' => 9]); | ||
| 332 | - } | ||
| 333 | - } | ||
| 334 | - } | ||
| 335 | - if(!isset($commonInfo) || $commonInfo === false){ | ||
| 336 | - //获取首页公共的头部和底部 | ||
| 337 | - $commonTemplateModel = new BTemplateCommon(); | ||
| 338 | - $commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]); | ||
| 339 | - } | ||
| 340 | - return $commonInfo; | ||
| 341 | - } | ||
| 342 | - | ||
| 343 | - /** | ||
| 344 | * @remark :拼接获取公共头部底部 | 421 | * @remark :拼接获取公共头部底部 |
| 345 | * @name :getHeadFooter | 422 | * @name :getHeadFooter |
| 346 | * @author :lyh | 423 | * @author :lyh |
| @@ -421,27 +498,37 @@ class CustomTemplateLogic extends BaseLogic | @@ -421,27 +498,37 @@ class CustomTemplateLogic extends BaseLogic | ||
| 421 | * @name :copyCustomTemplateInfo | 498 | * @name :copyCustomTemplateInfo |
| 422 | * @author :lyh | 499 | * @author :lyh |
| 423 | * @method :post | 500 | * @method :post |
| 424 | - * @time :2024/5/24 14:47 | 501 | + * @time :2024/4/28 16:16 |
| 425 | */ | 502 | */ |
| 426 | public function copyCustomTemplateInfo(){ | 503 | public function copyCustomTemplateInfo(){ |
| 427 | $info = $this->model->read(['id'=>$this->param['id']]); | 504 | $info = $this->model->read(['id'=>$this->param['id']]); |
| 428 | - if($info === false){ | ||
| 429 | - $this->fail('当前数据不存在'); | 505 | + $param = $this->setCustomTemplateParams($info); |
| 506 | + $save_id = $this->model->insertGetId($param); | ||
| 507 | + $route = RouteMap::setRoute($param['url'], RouteMap::SOURCE_PRODUCT, $save_id, $this->user['project_id']); | ||
| 508 | + $this->model->edit(['route'=>$route],['id'=>$save_id]); | ||
| 509 | + return $this->success(['id'=>$save_id]); | ||
| 430 | } | 510 | } |
| 431 | - $param = [ | ||
| 432 | - 'name'=>$info['name'].'-copy', | ||
| 433 | - 'status'=>$info['status'], | ||
| 434 | - 'url'=>$info['url'].'-copy', | ||
| 435 | - 'html'=>$info['html'], | ||
| 436 | - 'html_style'=>$info['html_style'], | ||
| 437 | - 'project_id'=>$info['project_id'], | ||
| 438 | - 'is_visualization'=>$info['is_visualization'], | ||
| 439 | - 'six_read'=>$info['six_read'], | ||
| 440 | - 'is_upgrade'=>$info['is_upgrade'], | 511 | + |
| 512 | + /** | ||
| 513 | + * @remark :组装数据 | ||
| 514 | + * @name :setCustomTemplateParams | ||
| 515 | + * @author :lyh | ||
| 516 | + * @method :post | ||
| 517 | + * @time :2024/4/28 16:18 | ||
| 518 | + */ | ||
| 519 | + public function setCustomTemplateParams($info) | ||
| 520 | + { | ||
| 521 | + return [ | ||
| 522 | + 'name' => $info['name'] . '-copy', | ||
| 523 | + 'status' => $info['status'], | ||
| 524 | + 'url' => $info['url'], | ||
| 525 | + 'html' => $info['html'], | ||
| 526 | + 'html_style' => $info['html_style'], | ||
| 527 | + 'project_id' => $info['project_id'], | ||
| 528 | + 'section_list_id' => $info['section_list_id'], | ||
| 529 | + 'is_visualization' => $info['is_visualization'], | ||
| 530 | + 'created_at' => date('Y-m-d H:i:s'), | ||
| 531 | + 'updated_at' => date('Y-m-d H:i:s'), | ||
| 441 | ]; | 532 | ]; |
| 442 | - $id = $this->model->addReturnId($param); | ||
| 443 | - $route = RouteMap::setRoute($param['url'],RouteMap::SOURCE_PAGE,$id,$param['project_id']); | ||
| 444 | - $this->model->edit(['url'=>$route],['id'=>$id]); | ||
| 445 | - return $this->success(['id'=>$id]); | ||
| 446 | } | 533 | } |
| 447 | } | 534 | } |
| @@ -10,11 +10,12 @@ | @@ -10,11 +10,12 @@ | ||
| 10 | namespace App\Http\Logic\Bside\BTemplate; | 10 | namespace App\Http\Logic\Bside\BTemplate; |
| 11 | 11 | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | +use App\Models\IsCom\ProjectComConfig; | ||
| 13 | use App\Models\Project\PageSetting; | 14 | use App\Models\Project\PageSetting; |
| 14 | use App\Models\RouteMap\RouteMap; | 15 | use App\Models\RouteMap\RouteMap; |
| 15 | use App\Models\Service\Service as ServiceSettingModel; | 16 | use App\Models\Service\Service as ServiceSettingModel; |
| 16 | use App\Models\Template\BTemplate; | 17 | use App\Models\Template\BTemplate; |
| 17 | -use App\Models\Template\BTemplateCommon; | 18 | +use App\Models\Template\BTemplateCom; |
| 18 | use App\Models\Template\BTemplateMain; | 19 | use App\Models\Template\BTemplateMain; |
| 19 | use App\Models\Template\Setting; | 20 | use App\Models\Template\Setting; |
| 20 | use App\Models\Template\TemplateTypeMain; | 21 | use App\Models\Template\TemplateTypeMain; |
| @@ -51,14 +52,79 @@ class InitHtmlLogic extends BaseLogic | @@ -51,14 +52,79 @@ class InitHtmlLogic extends BaseLogic | ||
| 51 | $data['id'] = $mainInfo['id']; | 52 | $data['id'] = $mainInfo['id']; |
| 52 | $data['updated_at'] = $mainInfo['updated_at']; | 53 | $data['updated_at'] = $mainInfo['updated_at']; |
| 53 | } | 54 | } |
| 54 | - $commonInfo = $this->getCommonHtml($this->param['type'],$is_list,$template_id,$is_custom); //获取头部 | ||
| 55 | - $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html']; | 55 | + $commonInfo = $this->getTemplateComHtml($this->param['type'],$is_list,$is_custom,$template_id); //获取头部 |
| 56 | + $html = $commonInfo['head_style'].$main_style.$commonInfo['footer_style'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html']; | ||
| 56 | $html = $this->getHeadFooter($html);//组装数据 | 57 | $html = $this->getHeadFooter($html);//组装数据 |
| 57 | $data['html'] = $html; | 58 | $data['html'] = $html; |
| 58 | return $this->success($data); | 59 | return $this->success($data); |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | /** | 62 | /** |
| 63 | + * @remark :非定制获取头部+底部 | ||
| 64 | + * @name :getTemplateComHtml | ||
| 65 | + * @author :lyh | ||
| 66 | + * @method :post | ||
| 67 | + * @time :2024/4/29 16:53 | ||
| 68 | + */ | ||
| 69 | + public function getTemplateComHtml($source,$is_list,$is_custom,$template_id){ | ||
| 70 | + $condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id]; | ||
| 71 | + $headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id); | ||
| 72 | + $bTemplateComModel = new BTemplateCom(); | ||
| 73 | + $otherInfo = $bTemplateComModel->read(['source'=>$headComInfo['source'],'common_type'=>BTemplate::COMMON_OTHER,'is_list'=>$headComInfo['is_list'],'is_custom'=>$headComInfo['is_custom']]); | ||
| 74 | + if($otherInfo === false){ | ||
| 75 | + $this->fail('获取失败,请联系管理员'); | ||
| 76 | + } | ||
| 77 | + $footerComInfo = $this->getFooterComHtml($condition,$source,$is_list,$is_custom,$template_id); | ||
| 78 | + $data = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '', | ||
| 79 | + 'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? '']; | ||
| 80 | + return $this->success($data); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * @remark :公共头部 | ||
| 85 | + * @name :HeadComHtml | ||
| 86 | + * @author :lyh | ||
| 87 | + * @method :post | ||
| 88 | + * @time :2024/4/29 17:20 | ||
| 89 | + */ | ||
| 90 | + public function getHeadComHtml($condition,$source,$is_list,$is_custom,$template_id){ | ||
| 91 | + $commonHead = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_HEAD,$template_id); | ||
| 92 | + $bTemplateComModel = new BTemplateCom(); | ||
| 93 | + $condition['source'] = $commonHead; | ||
| 94 | + $condition['common_type'] = BTemplate::COMMON_HEAD; | ||
| 95 | + $headComInfo = $bTemplateComModel->read($condition); | ||
| 96 | + if($headComInfo === false){ | ||
| 97 | + //取默认公共的 | ||
| 98 | + $headComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_HEAD]); | ||
| 99 | + if($headComInfo === false){ | ||
| 100 | + $this->fail('获取失败,请联系管理员'); | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + return $this->success($headComInfo); | ||
| 104 | + } | ||
| 105 | + /** | ||
| 106 | + * @remark :公共底部 | ||
| 107 | + * @name :footerComHtml | ||
| 108 | + * @author :lyh | ||
| 109 | + * @method :post | ||
| 110 | + * @time :2024/4/29 17:18 | ||
| 111 | + */ | ||
| 112 | + public function getFooterComHtml($condition,$source,$is_list,$is_custom,$template_id){ | ||
| 113 | + $bTemplateComModel = new BTemplateCom(); | ||
| 114 | + $condition['common_type'] = BTemplate::COMMON_FOOTER; | ||
| 115 | + $condition['source'] = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_FOOTER,$template_id); | ||
| 116 | + $footerComInfo = $bTemplateComModel->read($condition); | ||
| 117 | + if($footerComInfo === false){ | ||
| 118 | + //取默认首页的 | ||
| 119 | + $footerComInfo = $bTemplateComModel->read(['source'=>BTemplate::SOURCE_COM,'common_type'=>BTemplate::COMMON_FOOTER]); | ||
| 120 | + if($footerComInfo === false){ | ||
| 121 | + $this->fail('获取失败,请联系管理员'); | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + return $this->success($footerComInfo); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + /** | ||
| 62 | * @remark :拼接获取公共头部底部 | 128 | * @remark :拼接获取公共头部底部 |
| 63 | * @name :getHeadFooter | 129 | * @name :getHeadFooter |
| 64 | * @author :lyh | 130 | * @author :lyh |
| @@ -116,96 +182,85 @@ class InitHtmlLogic extends BaseLogic | @@ -116,96 +182,85 @@ class InitHtmlLogic extends BaseLogic | ||
| 116 | ]; | 182 | ]; |
| 117 | $bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]); | 183 | $bTemplateMainModel->edit($data,['id'=>$mainInfo['id']]); |
| 118 | } | 184 | } |
| 119 | - $this->saveCommonHtml($this->param['html'],$this->param['type'],$is_list,$template_id,$is_custom); | 185 | + $this->saveTemplateCom($this->param['html'],$template_id,$this->param['type'],$is_list,$is_custom); |
| 120 | $route = RouteMap::getRoute('all',0,$this->user['project_id']); | 186 | $route = RouteMap::getRoute('all',0,$this->user['project_id']); |
| 121 | $this->curlDelRoute(['route'=>$route,'new_route'=>$route]); | 187 | $this->curlDelRoute(['route'=>$route,'new_route'=>$route]); |
| 122 | return $this->success(); | 188 | return $this->success(); |
| 123 | } | 189 | } |
| 124 | 190 | ||
| 125 | /** | 191 | /** |
| 126 | - * @remark :保存公共头部底部 | ||
| 127 | - * @name :saveCommonHtml | 192 | + * @remark :保存公共部分(头部。底部。连接部分) |
| 193 | + * @name :saveTemplateCom | ||
| 128 | * @author :lyh | 194 | * @author :lyh |
| 129 | * @method :post | 195 | * @method :post |
| 130 | - * @time :2023/12/13 17:05 | 196 | + * @time :2024/4/29 10:32 |
| 131 | */ | 197 | */ |
| 132 | - public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){ | ||
| 133 | - $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面) | ||
| 134 | - $templateCommonModel = new BTemplateCommon(); | ||
| 135 | - $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在 | 198 | + public function saveTemplateCom($html,$template_id,$source,$is_list,$is_custom){ |
| 199 | + $typeArr = [BTemplate::COMMON_HEAD, BTemplate::COMMON_FOOTER, BTemplate::COMMON_OTHER]; | ||
| 136 | $handleInfo = $this->handleCommonParam($html); | 200 | $handleInfo = $this->handleCommonParam($html); |
| 137 | - if($commonInfo === false){ | ||
| 138 | - $data = [ | ||
| 139 | - 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 140 | - 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 141 | - 'type'=>$type,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'], | ||
| 142 | - ]; | ||
| 143 | - $templateCommonModel->add($data); | 201 | + $templateComModel = new BTemplateCom(); |
| 202 | + foreach ($typeArr as $type){ | ||
| 203 | + if($type == BTemplate::COMMON_HEAD){ | ||
| 204 | + $param['html'] = $handleInfo['head_html']; | ||
| 205 | + $param['html_style'] = $handleInfo['head_style']; | ||
| 206 | + $typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id);//头部是否为独立头部 | ||
| 207 | + }elseif ($type == BTemplate::COMMON_FOOTER){ | ||
| 208 | + $param['html'] = $handleInfo['footer_html']; | ||
| 209 | + $param['html_style'] = $handleInfo['footer_style']; | ||
| 210 | + $typeSource = $this->getType($source,$is_list,$is_custom,$type,$template_id); | ||
| 144 | }else{ | 211 | }else{ |
| 145 | - $data = [ | ||
| 146 | - 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 147 | - 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 148 | - ]; | ||
| 149 | - $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); | 212 | + $param['html'] = $handleInfo['other']; |
| 213 | + $param['html_style'] = null; | ||
| 214 | + $typeSource = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_HEAD,$template_id); | ||
| 150 | } | 215 | } |
| 151 | - //更新所有界面的other | ||
| 152 | - return $templateCommonModel->edit(['other'=>$handleInfo['other']],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]); | 216 | + if($typeSource == 99){ |
| 217 | + $is_custom = $is_list = 0; | ||
| 153 | } | 218 | } |
| 154 | - | ||
| 155 | - /** | ||
| 156 | - * @remark :根据类型获取公共头和底 | ||
| 157 | - * @name :getCommonPage | ||
| 158 | - * @author :lyh | ||
| 159 | - * @method :post | ||
| 160 | - * @time :2023/10/21 16:55 | ||
| 161 | - */ | ||
| 162 | - public function getCommonHtml($source,$is_list,$template_id,$is_custom){ | ||
| 163 | - $type = $this->getType($source,$is_list,$is_custom); | ||
| 164 | - $data = [ | ||
| 165 | - 'template_id' => $template_id, | ||
| 166 | - 'project_id' => $this->user['project_id'], | ||
| 167 | - 'type'=>$type | ||
| 168 | - ]; | ||
| 169 | - $commonTemplateModel = new BTemplateCommon(); | ||
| 170 | - $commonInfo = $commonTemplateModel->read($data); | ||
| 171 | - if($commonInfo === false){ | ||
| 172 | - $data['type'] = BTemplate::SOURCE_HOME; | ||
| 173 | - $commonInfo = $commonTemplateModel->read($data); | 219 | + //查看当前数据是否还存在 |
| 220 | + $condition = ['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type]; | ||
| 221 | + $info = $templateComModel->read($condition); | ||
| 222 | + if($info === false){ | ||
| 223 | + $data = array_merge($param,$condition); | ||
| 224 | + $templateComModel->add($data); | ||
| 225 | + }else{ | ||
| 226 | + $templateComModel->edit($param,$condition); | ||
| 174 | } | 227 | } |
| 175 | - return $this->success($commonInfo); | 228 | + } |
| 229 | + return $this->success(); | ||
| 176 | } | 230 | } |
| 177 | 231 | ||
| 178 | /** | 232 | /** |
| 179 | - * @remark :保存时获取获取设置的类型 | 233 | + * @remark :(非定制)保存时获取获取设置的类型 |
| 180 | * @name :getType | 234 | * @name :getType |
| 181 | * @author :lyh | 235 | * @author :lyh |
| 182 | * @method :post | 236 | * @method :post |
| 183 | * @time :2023/10/21 17:29 | 237 | * @time :2023/10/21 17:29 |
| 184 | */ | 238 | */ |
| 185 | - public function getType($source,$is_list,$is_custom = 0){ | ||
| 186 | - $type = BTemplate::SOURCE_HOME;//首页公共头部底部 | 239 | + public function getType($source,$is_list,$is_custom = BTemplate::IS_NO_CUSTOM,$commonType = BTemplate::COMMON_HEAD,$template_id = 0){ |
| 240 | + if($template_id == 0){ | ||
| 241 | + return $this->success($source); | ||
| 242 | + } | ||
| 243 | + $type = BTemplate::SOURCE_COM;//公共头部底部 | ||
| 187 | $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; | 244 | $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER; |
| 188 | - if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部 | 245 | + if($is_head == BTemplate::IS_NO_HEADER){//拓展模块为公共头+底 |
| 189 | return $this->success($type); | 246 | return $this->success($type); |
| 190 | } | 247 | } |
| 191 | //查看页面是否设置自定义头部底部 | 248 | //查看页面是否设置自定义头部底部 |
| 192 | - if($is_head != BTemplate::IS_NO_HEADER) { | ||
| 193 | - $pageSettingModel = new PageSetting(); | ||
| 194 | - $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]); | ||
| 195 | - if ($pageInfo === false) { | 249 | + $comConfigModel = new ProjectComConfig(); |
| 250 | + $configInfo = $comConfigModel->read(['source'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom]); | ||
| 251 | + if($configInfo === false){ | ||
| 196 | return $this->success($type); | 252 | return $this->success($type); |
| 197 | } | 253 | } |
| 198 | - if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}} | ||
| 199 | - else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}} | ||
| 200 | - if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}} | ||
| 201 | - else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}} | ||
| 202 | - if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}} | ||
| 203 | - else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}} | ||
| 204 | - if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}} | 254 | + //头部 |
| 255 | + if($commonType == BTemplate::COMMON_HEAD){ | ||
| 256 | + return $this->success($configInfo['header_status'] == 0 ? $type : $source); | ||
| 257 | + } | ||
| 258 | + //底部 | ||
| 259 | + if($commonType == BTemplate::COMMON_FOOTER){ | ||
| 260 | + return $this->success($configInfo['footer_status'] == 0 ? $type : $source); | ||
| 205 | } | 261 | } |
| 206 | return $this->success($type); | 262 | return $this->success($type); |
| 207 | } | 263 | } |
| 208 | - | ||
| 209 | /** | 264 | /** |
| 210 | * @remark :保存时字符串处理 | 265 | * @remark :保存时字符串处理 |
| 211 | * @name :handleCommonParam | 266 | * @name :handleCommonParam |
| @@ -217,8 +272,8 @@ class InitHtmlLogic extends BaseLogic | @@ -217,8 +272,8 @@ class InitHtmlLogic extends BaseLogic | ||
| 217 | //字符串截取 | 272 | //字符串截取 |
| 218 | $param['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'); | 273 | $param['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'); |
| 219 | $param['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'); | 274 | $param['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'); |
| 220 | - $param['head_css'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'); | ||
| 221 | - $param['footer_css'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'); | 275 | + $param['head_style'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'); |
| 276 | + $param['footer_style'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'); | ||
| 222 | $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); | 277 | $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 223 | $param['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | 278 | $param['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); |
| 224 | return $this->success($param); | 279 | return $this->success($param); |
| @@ -271,21 +326,39 @@ class InitHtmlLogic extends BaseLogic | @@ -271,21 +326,39 @@ class InitHtmlLogic extends BaseLogic | ||
| 271 | if($info === false){ | 326 | if($info === false){ |
| 272 | $html = ''; | 327 | $html = ''; |
| 273 | }else{ | 328 | }else{ |
| 274 | - //扩展模块获取头部 | ||
| 275 | - if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 276 | - $type = $this->param['type']; | 329 | + $commonInfo = $this->getCustomizeTemplateComHtml($this->param['type'],$is_custom,$is_list); |
| 330 | + $html = $this->handleAllHtml($commonInfo,$info['main_html']); | ||
| 331 | + } | ||
| 332 | + //更新头部底部 | ||
| 333 | + return $this->success(['html'=>$html]); | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + /** | ||
| 337 | + * @remark :定制获取头部底部 | ||
| 338 | + * @name :getCustomizedCommonHtml | ||
| 339 | + * @author :lyh | ||
| 340 | + * @method :post | ||
| 341 | + * @time :2023/12/29 13:13 | ||
| 342 | + */ | ||
| 343 | + public function getCustomizeTemplateComHtml($type,$is_custom,$is_list,$template_id = 0){ | ||
| 344 | + $data = ['head_html'=>'','head_style'=>'','footer_html'=>'','footer_style'=>'','other'=>'']; | ||
| 345 | + $param = ['template_id'=>$template_id,'source'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]; | ||
| 346 | + $commonTemplateModel = new BTemplateCom(); | ||
| 347 | + $commonList = $commonTemplateModel->list($param); | ||
| 348 | + if(!empty($commonList)){ | ||
| 349 | + foreach ($commonList as $v){ | ||
| 350 | + if($v['common_type'] == BTemplate::COMMON_HEAD){ | ||
| 351 | + $data['head_html'] = $v['html']; | ||
| 352 | + $data['head_style'] = $v['html_style']; | ||
| 353 | + }elseif ($v['common_type'] == BTemplate::COMMON_FOOTER){ | ||
| 354 | + $data['footer_html'] = $v['html']; | ||
| 355 | + $data['footer_style'] = $v['html_style']; | ||
| 277 | }else{ | 356 | }else{ |
| 278 | - $type = $this->getCustomizedType($this->param['type'],$is_list); | 357 | + $data['other'] = $v['html']; |
| 279 | } | 358 | } |
| 280 | - $commonTemplateModel = new BTemplateCommon(); | ||
| 281 | - $commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]); | ||
| 282 | - if($commonInfo !== false){ | ||
| 283 | - $info['main_html'] = $this->handleAllHtml($commonInfo,$info['main_html']); | ||
| 284 | } | 359 | } |
| 285 | - $html = $info['main_html']; | ||
| 286 | } | 360 | } |
| 287 | - //更新头部底部 | ||
| 288 | - return $this->success(['html'=>$html]); | 361 | + return $this->success($data); |
| 289 | } | 362 | } |
| 290 | 363 | ||
| 291 | /** | 364 | /** |
| @@ -296,11 +369,11 @@ class InitHtmlLogic extends BaseLogic | @@ -296,11 +369,11 @@ class InitHtmlLogic extends BaseLogic | ||
| 296 | * @time :2023/12/13 15:39 | 369 | * @time :2023/12/13 15:39 |
| 297 | */ | 370 | */ |
| 298 | public function handleAllHtml($commonInfo,$html){ | 371 | public function handleAllHtml($commonInfo,$html){ |
| 299 | - if(!empty($commonInfo)){ | 372 | + if(!empty($commonInfo['head_html']) && !empty($commonInfo['footer_html'])){ |
| 300 | $html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html); | 373 | $html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html); |
| 301 | $html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html); | 374 | $html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html); |
| 302 | - $html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_css'], $html); | ||
| 303 | - $html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $commonInfo['footer_css'], $html); | 375 | + $html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_style'] ?? '', $html); |
| 376 | + $html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $commonInfo['footer_style'] ?? '', $html); | ||
| 304 | } | 377 | } |
| 305 | return $html; | 378 | return $html; |
| 306 | } | 379 | } |
| @@ -331,7 +404,7 @@ class InitHtmlLogic extends BaseLogic | @@ -331,7 +404,7 @@ class InitHtmlLogic extends BaseLogic | ||
| 331 | $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); | 404 | $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); |
| 332 | } | 405 | } |
| 333 | //更新头部底部 | 406 | //更新头部底部 |
| 334 | - $this->saveCustomizeCommon($this->param['html'],$this->param['type'],$is_list,$is_custom); | 407 | + $this->saveTemplateCom($this->param['html'],0,$this->param['type'],$is_list,$is_custom); |
| 335 | }catch (\Exception $exception){ | 408 | }catch (\Exception $exception){ |
| 336 | $this->fail('保存失败,请联系开发人员'); | 409 | $this->fail('保存失败,请联系开发人员'); |
| 337 | } | 410 | } |
| @@ -339,73 +412,6 @@ class InitHtmlLogic extends BaseLogic | @@ -339,73 +412,6 @@ class InitHtmlLogic extends BaseLogic | ||
| 339 | } | 412 | } |
| 340 | 413 | ||
| 341 | /** | 414 | /** |
| 342 | - * @remark :定制代码更新头部信息 | ||
| 343 | - * @name :saveCustomizeCommon | ||
| 344 | - * @author :lyh | ||
| 345 | - * @method :post | ||
| 346 | - * @time :2024/1/6 10:29 | ||
| 347 | - */ | ||
| 348 | - public function saveCustomizeCommon($html,$source,$is_list,$is_custom){ | ||
| 349 | - if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 350 | - $type = $source; | ||
| 351 | - }else{ | ||
| 352 | - $type = $this->getCustomizedType($source,$is_list); | ||
| 353 | - } | ||
| 354 | - $templateCommonModel = new BTemplateCommon(); | ||
| 355 | - $commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]);//查看当前头部是否存在 | ||
| 356 | - $handleInfo = $this->handleCommonParam($html); | ||
| 357 | - if($commonInfo === false){ | ||
| 358 | - $data = [ | ||
| 359 | - 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'], | ||
| 360 | - 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 361 | - 'type'=>$type,'template_id'=>0, 'project_id'=>$this->user['project_id'], | ||
| 362 | - 'is_custom'=>$is_custom,'is_list'=>$is_list | ||
| 363 | - ]; | ||
| 364 | - $templateCommonModel->add($data); | ||
| 365 | - }else{ | ||
| 366 | - $data = [ | ||
| 367 | - 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'], | ||
| 368 | - 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 369 | - ]; | ||
| 370 | - $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); | ||
| 371 | - } | ||
| 372 | - return $this->success(); | ||
| 373 | - } | ||
| 374 | - | ||
| 375 | - /** | ||
| 376 | - * @remark :定制页面头部类型---根据source获取type类型 | ||
| 377 | - * @name :getType | ||
| 378 | - * @author :lyh | ||
| 379 | - * @method :post | ||
| 380 | - * @time :2023/11/16 11:20 | ||
| 381 | - */ | ||
| 382 | - public function getCustomizedType($source,$is_list){ | ||
| 383 | - $type = BTemplate::TYPE_HOME; | ||
| 384 | - if($source == BTemplate::SOURCE_PRODUCT){ | ||
| 385 | - if($is_list == BTemplate::IS_LIST){ | ||
| 386 | - $type = BTemplate::TYPE_PRODUCT_LIST; | ||
| 387 | - }else{ | ||
| 388 | - $type = BTemplate::TYPE_PRODUCT_DETAIL; | ||
| 389 | - } | ||
| 390 | - } | ||
| 391 | - if($source == BTemplate::SOURCE_BLOG){ | ||
| 392 | - if($is_list == BTemplate::IS_LIST){ | ||
| 393 | - $type = BTemplate::TYPE_BLOG_LIST; | ||
| 394 | - }else{ | ||
| 395 | - $type = BTemplate::TYPE_BLOG_DETAIL; | ||
| 396 | - } | ||
| 397 | - } | ||
| 398 | - if($source == BTemplate::SOURCE_NEWS){ | ||
| 399 | - if($is_list == BTemplate::IS_LIST){ | ||
| 400 | - $type = BTemplate::TYPE_NEWS_LIST; | ||
| 401 | - }else{ | ||
| 402 | - $type = BTemplate::TYPE_NEWS_DETAIL; | ||
| 403 | - } | ||
| 404 | - } | ||
| 405 | - return $type; | ||
| 406 | - } | ||
| 407 | - | ||
| 408 | - /** | ||
| 409 | * @remark :前端获取设置模块(侧边栏) | 415 | * @remark :前端获取设置模块(侧边栏) |
| 410 | * @name :getInitModuleMain | 416 | * @name :getInitModuleMain |
| 411 | * @author :lyh | 417 | * @author :lyh |
| @@ -170,11 +170,11 @@ class BlogLogic extends BaseLogic | @@ -170,11 +170,11 @@ class BlogLogic extends BaseLogic | ||
| 170 | * @time :2023/6/13 11:30 | 170 | * @time :2023/6/13 11:30 |
| 171 | */ | 171 | */ |
| 172 | public function paramProcessing($param){ | 172 | public function paramProcessing($param){ |
| 173 | + $param['operator_id'] = $this->user['id']; | ||
| 173 | if(isset($this->param['id'])){ | 174 | if(isset($this->param['id'])){ |
| 174 | $param['operator_id'] = $this->user['id']; | 175 | $param['operator_id'] = $this->user['id']; |
| 175 | }else{ | 176 | }else{ |
| 176 | $param['create_id'] = $this->user['id']; | 177 | $param['create_id'] = $this->user['id']; |
| 177 | - $param['operator_id'] = $this->user['id']; | ||
| 178 | $param['project_id'] = $this->user['project_id']; | 178 | $param['project_id'] = $this->user['project_id']; |
| 179 | } | 179 | } |
| 180 | if(isset($param['category_id']) && !empty($param['category_id'])){ | 180 | if(isset($param['category_id']) && !empty($param['category_id'])){ |
| @@ -193,8 +193,11 @@ class BlogLogic extends BaseLogic | @@ -193,8 +193,11 @@ class BlogLogic extends BaseLogic | ||
| 193 | * @time :2023/10/20 9:02 | 193 | * @time :2023/10/20 9:02 |
| 194 | */ | 194 | */ |
| 195 | public function getCategory($category){ | 195 | public function getCategory($category){ |
| 196 | + if(empty($category)){ | ||
| 197 | + return ''; | ||
| 198 | + } | ||
| 196 | $str = implode(',',$category); | 199 | $str = implode(',',$category); |
| 197 | - return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; | 200 | + return !empty(trim(trim($str,','),',')) ? ','.trim(trim($str,','),',').',' : ''; |
| 198 | } | 201 | } |
| 199 | 202 | ||
| 200 | /** | 203 | /** |
| @@ -240,10 +240,8 @@ class CustomModuleContentLogic extends BaseLogic | @@ -240,10 +240,8 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 240 | { | 240 | { |
| 241 | //生成一条删除路由记录 | 241 | //生成一条删除路由记录 |
| 242 | $info = $this->model->read(['id' => $id], ['id', 'route']); | 242 | $info = $this->model->read(['id' => $id], ['id', 'route']); |
| 243 | - if ($info['route'] != $route) { | ||
| 244 | $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route); | 243 | $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route); |
| 245 | $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]); | 244 | $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]); |
| 246 | - } | ||
| 247 | return true; | 245 | return true; |
| 248 | } | 246 | } |
| 249 | 247 |
| @@ -183,6 +183,7 @@ class NewsLogic extends BaseLogic | @@ -183,6 +183,7 @@ class NewsLogic extends BaseLogic | ||
| 183 | */ | 183 | */ |
| 184 | public function paramProcessing($param) | 184 | public function paramProcessing($param) |
| 185 | { | 185 | { |
| 186 | + $param['operator_id'] = $this->user['id']; | ||
| 186 | if(isset($param['image'])){ | 187 | if(isset($param['image'])){ |
| 187 | $param['image'] = str_replace_url($param['image'] ?? ''); | 188 | $param['image'] = str_replace_url($param['image'] ?? ''); |
| 188 | } | 189 | } |
| @@ -193,7 +194,6 @@ class NewsLogic extends BaseLogic | @@ -193,7 +194,6 @@ class NewsLogic extends BaseLogic | ||
| 193 | $param['operator_id'] = $this->user['id']; | 194 | $param['operator_id'] = $this->user['id']; |
| 194 | }else{ | 195 | }else{ |
| 195 | $param['create_id'] = $this->user['id']; | 196 | $param['create_id'] = $this->user['id']; |
| 196 | - $param['operator_id'] = $this->user['id']; | ||
| 197 | $param['project_id'] = $this->user['project_id']; | 197 | $param['project_id'] = $this->user['project_id']; |
| 198 | } | 198 | } |
| 199 | if(isset($param['category_id']) && !empty($param['category_id'])){ | 199 | if(isset($param['category_id']) && !empty($param['category_id'])){ |
| @@ -213,7 +213,7 @@ class NewsLogic extends BaseLogic | @@ -213,7 +213,7 @@ class NewsLogic extends BaseLogic | ||
| 213 | */ | 213 | */ |
| 214 | public function getCategory($category){ | 214 | public function getCategory($category){ |
| 215 | $str = implode(',',$category); | 215 | $str = implode(',',$category); |
| 216 | - return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; | 216 | + return !empty(trim(trim($str,','),',')) ? ','.trim(trim($str,','),',').',' : ''; |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | /** | 219 | /** |
| @@ -921,4 +921,16 @@ class ProductLogic extends BaseLogic | @@ -921,4 +921,16 @@ class ProductLogic extends BaseLogic | ||
| 921 | } | 921 | } |
| 922 | return $this->success($data); | 922 | return $this->success($data); |
| 923 | } | 923 | } |
| 924 | + | ||
| 925 | + /** | ||
| 926 | + * @remark :删除数据 | ||
| 927 | + * @name :delProductKeyword | ||
| 928 | + * @author :lyh | ||
| 929 | + * @method :post | ||
| 930 | + * @time :2024/8/5 15:49 | ||
| 931 | + */ | ||
| 932 | + public function delProductKeyword(){ | ||
| 933 | + $this->model->edit(['keyword_id'=>null],['id'=>$this->param['id']]); | ||
| 934 | + return $this->success(['id'=>$this->param['id']]); | ||
| 935 | + } | ||
| 924 | } | 936 | } |
| @@ -307,29 +307,18 @@ class RankDataLogic extends BaseLogic | @@ -307,29 +307,18 @@ class RankDataLogic extends BaseLogic | ||
| 307 | 307 | ||
| 308 | /** | 308 | /** |
| 309 | * 获取AI站点项目 | 309 | * 获取AI站点项目 |
| 310 | + * | ||
| 310 | * @author zbj | 311 | * @author zbj |
| 311 | * @date 2023/5/12 | 312 | * @date 2023/5/12 |
| 312 | */ | 313 | */ |
| 313 | public function getAiProjects($domain = null) | 314 | public function getAiProjects($domain = null) |
| 314 | { | 315 | { |
| 315 | - $key = 'ai_projects_list'; | ||
| 316 | - $data = Cache::get($key); | ||
| 317 | - if (!$data) { | ||
| 318 | - $api_url = 'https://demosite5.globalso.com/api/domain'; | ||
| 319 | - try { | ||
| 320 | - $data = HttpUtils::get($api_url, []); | ||
| 321 | - if ($data) { | ||
| 322 | - $data = Arr::s2a($data); | ||
| 323 | - Cache::put($key, $data, 4 * 3600); | ||
| 324 | - } | ||
| 325 | - } catch (\Exception | GuzzleException $e) { | ||
| 326 | - errorLog('AI站点项目获取失败', [], $e); | ||
| 327 | - return false; | ||
| 328 | - } | ||
| 329 | - } | 316 | + $file_path = public_path('ai_domains.txt'); |
| 317 | + $data = file_get_contents($file_path); | ||
| 318 | + $data = json_decode($data, true); | ||
| 330 | if ($domain !== null) { | 319 | if ($domain !== null) { |
| 331 | $domain = parse_url($domain); | 320 | $domain = parse_url($domain); |
| 332 | - $data = collect($data['data'])->where('bind_domain', $domain['host'] ?? $domain['path'])->first(); | 321 | + $data = collect($data)->where('bind_domain', $domain['host'] ?? $domain['path'])->first(); |
| 333 | return $data ?: []; | 322 | return $data ?: []; |
| 334 | } | 323 | } |
| 335 | return $data; | 324 | return $data; |
| @@ -188,6 +188,7 @@ class UserLoginLogic | @@ -188,6 +188,7 @@ class UserLoginLogic | ||
| 188 | $info['is_visualization'] = json_decode($project['is_visualization']); | 188 | $info['is_visualization'] = json_decode($project['is_visualization']); |
| 189 | } | 189 | } |
| 190 | $info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority']; | 190 | $info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority']; |
| 191 | + $info['is_inquiry_country'] = $project['is_inquiry_country']; | ||
| 191 | //是否开通AMP | 192 | //是否开通AMP |
| 192 | $is_amp = 0; | 193 | $is_amp = 0; |
| 193 | if(!empty($project['deploy_optimize']['domain'])){ | 194 | if(!empty($project['deploy_optimize']['domain'])){ |
| @@ -293,6 +294,7 @@ class UserLoginLogic | @@ -293,6 +294,7 @@ class UserLoginLogic | ||
| 293 | $info['is_visualization'] = json_decode($project['is_visualization']); | 294 | $info['is_visualization'] = json_decode($project['is_visualization']); |
| 294 | } | 295 | } |
| 295 | $info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority']; | 296 | $info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority']; |
| 297 | + $info['is_inquiry_country'] = $project['is_inquiry_country']; | ||
| 296 | //是否开通AMP | 298 | //是否开通AMP |
| 297 | $is_amp = 0; | 299 | $is_amp = 0; |
| 298 | if(!empty($project['deploy_optimize']['domain'])){ | 300 | if(!empty($project['deploy_optimize']['domain'])){ |
app/Models/IsCom/ProjectComConfig.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ProjectComConfig.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/1 11:50 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\IsCom; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | +use App\Models\Project\Project; | ||
| 14 | +use App\Models\Template\BTemplate; | ||
| 15 | +use App\Models\Template\Template; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :是否为独立头部+底部 | ||
| 19 | + * @name :ProjectComConfig | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2024/8/1 11:51 | ||
| 23 | + */ | ||
| 24 | +class ProjectComConfig extends Base | ||
| 25 | +{ | ||
| 26 | + protected $table = 'gl_project_com_config'; | ||
| 27 | + //连接数据库 | ||
| 28 | + protected $connection = 'custom_mysql'; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * @name :(包含详情页+列表页) | ||
| 32 | + * @var array | ||
| 33 | + */ | ||
| 34 | + public $initParam = [ | ||
| 35 | + '产品'=>BTemplate::SOURCE_PRODUCT, | ||
| 36 | + '博客'=>BTemplate::SOURCE_BLOG, | ||
| 37 | + '新闻'=>BTemplate::SOURCE_NEWS, | ||
| 38 | + ]; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * @name : 单一界面 | ||
| 42 | + * @var array | ||
| 43 | + */ | ||
| 44 | + public $initPageParam = [ | ||
| 45 | + '首页'=>BTemplate::SOURCE_HOME, | ||
| 46 | + '单页面'=>BTemplate::SOURCE_PAGE, | ||
| 47 | + ]; | ||
| 48 | + | ||
| 49 | +} |
| @@ -23,6 +23,8 @@ class BTemplate extends Base | @@ -23,6 +23,8 @@ class BTemplate extends Base | ||
| 23 | 23 | ||
| 24 | const SOURCE_NEWS = 4;//新闻详情页 | 24 | const SOURCE_NEWS = 4;//新闻详情页 |
| 25 | const SOURCE_KEYWORD = 5;//聚合页 | 25 | const SOURCE_KEYWORD = 5;//聚合页 |
| 26 | + | ||
| 27 | + const SOURCE_PAGE = 9;//单页面 | ||
| 26 | const SOURCE_CUSTOM = 7;//自定义模块 | 28 | const SOURCE_CUSTOM = 7;//自定义模块 |
| 27 | 29 | ||
| 28 | /** | 30 | /** |
| @@ -34,8 +36,8 @@ class BTemplate extends Base | @@ -34,8 +36,8 @@ class BTemplate extends Base | ||
| 34 | * 公共头部底部连接部分 | 36 | * 公共头部底部连接部分 |
| 35 | */ | 37 | */ |
| 36 | const COMMON_HEAD = 1;//公共头部 | 38 | const COMMON_HEAD = 1;//公共头部 |
| 37 | - const COMMON_FOOTER = 2;//公共头部 | ||
| 38 | - const COMMON_OTHER = 3;//公共头部 | 39 | + const COMMON_FOOTER = 2;//公共底部 |
| 40 | + const COMMON_OTHER = 3;//公共other | ||
| 39 | /** | 41 | /** |
| 40 | * 独立头部类型 | 42 | * 独立头部类型 |
| 41 | */ | 43 | */ |
app/Models/WebSetting/LanguageTxt.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :LanguageTxtController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/5 17:36 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\WebSetting; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class LanguageTxt extends Base | ||
| 15 | +{ | ||
| 16 | + protected $table = 'gl_language_txt'; | ||
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 19 | + | ||
| 20 | +} |
public/ai_domains.txt
0 → 100644
此 diff 太大无法显示。
| @@ -44,7 +44,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -44,7 +44,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 44 | Route::any('/info', [\App\Http\Controllers\Bside\User\UserController::class, 'info'])->name('user_info'); | 44 | Route::any('/info', [\App\Http\Controllers\Bside\User\UserController::class, 'info'])->name('user_info'); |
| 45 | Route::any('/role_list', [\App\Http\Controllers\Bside\User\UserController::class, 'role_list'])->name('user_role_list'); | 45 | Route::any('/role_list', [\App\Http\Controllers\Bside\User\UserController::class, 'role_list'])->name('user_role_list'); |
| 46 | Route::any('/del', [\App\Http\Controllers\Bside\User\UserController::class, 'del'])->name('user_del'); | 46 | Route::any('/del', [\App\Http\Controllers\Bside\User\UserController::class, 'del'])->name('user_del'); |
| 47 | - | 47 | + Route::any('/getUserLists', [\App\Http\Controllers\Bside\User\UserController::class, 'getUserLists'])->name('user_getUserLists'); |
| 48 | }); | 48 | }); |
| 49 | //项目独立头部和底部设置 | 49 | //项目独立头部和底部设置 |
| 50 | Route::prefix('pageSetting')->group(function () { | 50 | Route::prefix('pageSetting')->group(function () { |
| @@ -256,6 +256,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -256,6 +256,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 256 | Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Product\ProductController::class, 'batchSetCategory'])->name('product_batchSetCategory'); | 256 | Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Product\ProductController::class, 'batchSetCategory'])->name('product_batchSetCategory'); |
| 257 | Route::any('/sendAiProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sendAiProduct'])->name('product_sendAiProduct'); | 257 | Route::any('/sendAiProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sendAiProduct'])->name('product_sendAiProduct'); |
| 258 | Route::any('/getSearchCategoryList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getSearchCategoryList'])->name('product_getSearchCategoryList'); | 258 | Route::any('/getSearchCategoryList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getSearchCategoryList'])->name('product_getSearchCategoryList'); |
| 259 | + Route::any('/delProductKeyword', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductKeyword'])->name('product_delProductKeyword'); | ||
| 259 | //产品分类 | 260 | //产品分类 |
| 260 | Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category'); | 261 | Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category'); |
| 261 | Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info'); | 262 | Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info'); |
| @@ -356,6 +357,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -356,6 +357,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 356 | Route::prefix('template')->group(function () { | 357 | Route::prefix('template')->group(function () { |
| 357 | //获取所有公共主题模版 | 358 | //获取所有公共主题模版 |
| 358 | Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists'); | 359 | Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists'); |
| 360 | + Route::any('/publicInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicInfo'])->name('template_publicInfo'); | ||
| 359 | //获取选中的主题模版 | 361 | //获取选中的主题模版 |
| 360 | Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate'); | 362 | Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate'); |
| 361 | Route::any('/getTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTemplate'])->name('template_getTemplate'); | 363 | Route::any('/getTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTemplate'])->name('template_getTemplate'); |
| @@ -553,6 +555,17 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -553,6 +555,17 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 553 | Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'save'])->name('template_label_save'); | 555 | Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'save'])->name('template_label_save'); |
| 554 | Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'del'])->name('template_label_del'); | 556 | Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'del'])->name('template_label_del'); |
| 555 | }); | 557 | }); |
| 558 | + //设置公共头部+底部配置 | ||
| 559 | + Route::prefix('com_config')->group(function () { | ||
| 560 | + Route::any('/getIsComConfig', [\App\Http\Controllers\Bside\Template\BProjectComConfigController::class, 'getIsComConfig'])->name('com_config_getIsComConfig'); | ||
| 561 | + Route::any('/saveComConfig', [\App\Http\Controllers\Bside\Template\BProjectComConfigController::class, 'saveComConfig'])->name('com_config_getIsComConfig'); | ||
| 562 | + }); | ||
| 563 | + //自定义小语种文本信息 | ||
| 564 | + Route::prefix('language_txt')->group(function () { | ||
| 565 | + Route::any('/getLanguageTxt', [\App\Http\Controllers\Bside\Setting\LanguageTxtController::class, 'getLanguageTxt'])->name('language_txt_getLanguageTxt'); | ||
| 566 | + Route::any('/saveLanguageTxt', [\App\Http\Controllers\Bside\Setting\LanguageTxtController::class, 'saveLanguageTxt'])->name('language_txt_saveLanguageTxt'); | ||
| 567 | + Route::any('/delLanguageTxt', [\App\Http\Controllers\Bside\Setting\LanguageTxtController::class, 'delLanguageTxt'])->name('language_txt_delLanguageTxt'); | ||
| 568 | + }); | ||
| 556 | }); | 569 | }); |
| 557 | //无需登录验证的路由组 | 570 | //无需登录验证的路由组 |
| 558 | Route::group([], function () { | 571 | Route::group([], function () { |
-
请 注册 或 登录 后发表评论