Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
33 个修改的文件
包含
872 行增加
和
612 行删除
| @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command | @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command | ||
| 33 | protected $description = '升级项目统计'; | 33 | protected $description = '升级项目统计'; |
| 34 | 34 | ||
| 35 | public function handle(){ | 35 | public function handle(){ |
| 36 | - $project_id = 555; | 36 | + $project_id = 566; |
| 37 | ProjectServer::useProject($project_id); | 37 | ProjectServer::useProject($project_id); |
| 38 | $this->count($project_id); | 38 | $this->count($project_id); |
| 39 | DB::disconnect('custom_mysql'); | 39 | DB::disconnect('custom_mysql'); |
| @@ -43,8 +43,10 @@ class DomainInfo extends Command | @@ -43,8 +43,10 @@ class DomainInfo extends Command | ||
| 43 | foreach ($list as $v){ | 43 | foreach ($list as $v){ |
| 44 | if(empty($v['private_key']) || empty($v['private_cert'])){ | 44 | if(empty($v['private_key']) || empty($v['private_cert'])){ |
| 45 | //域名结束时间<2天时,重新生成 | 45 | //域名结束时间<2天时,重新生成 |
| 46 | - if(!empty($v['certificate_end_time']) && ($v['certificate_end_time'] > date('Y-m-d H:i:s',time() + 24*3600))){ | ||
| 47 | - $this->updatePrivate($v); | 46 | + if(!empty($v['certificate_end_time'])){ |
| 47 | + if(($v['certificate_end_time'] > date('Y-m-d H:i:s',time() + 24*3600)) || ($v['certificate_end_time'] < date('Y-m-d H:i:s',time()))){ | ||
| 48 | + $this->updatePrivate($v); | ||
| 49 | + } | ||
| 48 | } | 50 | } |
| 49 | } | 51 | } |
| 50 | $ssl = $this->updateDomainSsl($v['domain']); | 52 | $ssl = $this->updateDomainSsl($v['domain']); |
| @@ -77,7 +79,6 @@ class DomainInfo extends Command | @@ -77,7 +79,6 @@ class DomainInfo extends Command | ||
| 77 | public function updatePrivate($param) | 79 | public function updatePrivate($param) |
| 78 | { | 80 | { |
| 79 | $url = 'https://' . $param['domain']. '/api/applySsl/'; | 81 | $url = 'https://' . $param['domain']. '/api/applySsl/'; |
| 80 | - $extend_config = json_decode($param['extend_config'], true); | ||
| 81 | $top_domain = $this->getTopDomain($param['domain']); | 82 | $top_domain = $this->getTopDomain($param['domain']); |
| 82 | if ((empty($extend_config) || empty($extend_config[0]['origin'])) && $param['id'] != 3) { | 83 | if ((empty($extend_config) || empty($extend_config[0]['origin'])) && $param['id'] != 3) { |
| 83 | $extend_config = [ | 84 | $extend_config = [ |
| @@ -89,13 +90,14 @@ class DomainInfo extends Command | @@ -89,13 +90,14 @@ class DomainInfo extends Command | ||
| 89 | 'type' => 1, | 90 | 'type' => 1, |
| 90 | 'route' => 1, | 91 | 'route' => 1, |
| 91 | "domain" =>$param['domain'], | 92 | "domain" =>$param['domain'], |
| 92 | - "rewrite"=> $extend_config, | 93 | + "rewrite"=> $extend_config ?? [], |
| 93 | 'other_domain' => [$top_domain, '*.' . $top_domain], | 94 | 'other_domain' => [$top_domain, '*.' . $top_domain], |
| 94 | 'private_key' => '', | 95 | 'private_key' => '', |
| 95 | 'cert' => '' | 96 | 'cert' => '' |
| 96 | ]; | 97 | ]; |
| 97 | $result = $this->curlRequest($url, $param); | 98 | $result = $this->curlRequest($url, $param); |
| 98 | - Log::info('domain id: ' . $param['id'] . ', domain: ' . $param['domain'] . ', result: ' . var_export($result, true)); | 99 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($result, true) . PHP_EOL, FILE_APPEND); |
| 100 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($param['domain'], true) . PHP_EOL, FILE_APPEND); | ||
| 99 | } | 101 | } |
| 100 | 102 | ||
| 101 | public static function getTopDomain ($url) { | 103 | public static function getTopDomain ($url) { |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Console\Commands\MonthlyCount; | 10 | namespace App\Console\Commands\MonthlyCount; |
| 11 | 11 | ||
| 12 | use App\Helper\FormGlobalsoApi; | 12 | use App\Helper\FormGlobalsoApi; |
| 13 | +use App\Models\Com\UpdateOldInfo; | ||
| 13 | use App\Models\HomeCount\MonthCount; | 14 | use App\Models\HomeCount\MonthCount; |
| 14 | use App\Models\Project\Project; | 15 | use App\Models\Project\Project; |
| 15 | use App\Models\Visit\Visit; | 16 | use App\Models\Visit\Visit; |
| @@ -35,8 +36,10 @@ class UpgradeProjectCount extends Command | @@ -35,8 +36,10 @@ class UpgradeProjectCount extends Command | ||
| 35 | protected $description = '升级项目统计'; | 36 | protected $description = '升级项目统计'; |
| 36 | 37 | ||
| 37 | public function handle(){ | 38 | public function handle(){ |
| 38 | - $project_id = 555; | ||
| 39 | - $url = 'www.sincoherenaesthetics.com'; | 39 | + $project_id = 566; |
| 40 | + $oldModel = new UpdateOldInfo(); | ||
| 41 | + $info = $oldModel->read(['project_id'=>$project_id]); | ||
| 42 | + $url = $info['old_domain_online']; | ||
| 40 | ProjectServer::useProject($project_id); | 43 | ProjectServer::useProject($project_id); |
| 41 | $this->count($project_id,$url); | 44 | $this->count($project_id,$url); |
| 42 | 45 | ||
| @@ -67,6 +70,14 @@ class UpgradeProjectCount extends Command | @@ -67,6 +70,14 @@ class UpgradeProjectCount extends Command | ||
| 67 | $arr['month_total'] = 0; | 70 | $arr['month_total'] = 0; |
| 68 | if(isset($res['data']['count'])){ | 71 | if(isset($res['data']['count'])){ |
| 69 | $arr['month_total'] = $res['data']['count']; | 72 | $arr['month_total'] = $res['data']['count']; |
| 73 | + //获取上一个的count | ||
| 74 | + $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month')); | ||
| 75 | + $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]); | ||
| 76 | + if($previousInfo === false){ | ||
| 77 | + $arr['total'] = $arr['month_total']; | ||
| 78 | + }else{ | ||
| 79 | + $arr['total'] = $res['data']['count'] + ($previousInfo['total'] ?? 0); | ||
| 80 | + } | ||
| 70 | } | 81 | } |
| 71 | if(isset($res['data']['data'])){ | 82 | if(isset($res['data']['data'])){ |
| 72 | $arr['country'] = json_encode($res['data']['data']); | 83 | $arr['country'] = json_encode($res['data']['data']); |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Console\Commands\Update; | ||
| 4 | - | ||
| 5 | -use App\Models\Collect\CollectSource; | ||
| 6 | -use App\Models\Collect\CollectTask; | ||
| 7 | -use App\Models\Com\UpdateLog; | ||
| 8 | -use App\Models\Com\UpdateOldInfo; | ||
| 9 | -use App\Models\RouteMap\RouteMap; | ||
| 10 | -use App\Services\CosService; | ||
| 11 | -use App\Services\ProjectServer; | ||
| 12 | -use Illuminate\Console\Command; | ||
| 13 | -use Illuminate\Support\Facades\DB; | ||
| 14 | -use Illuminate\Support\Facades\Redis; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * 4.0,5.0升级到6.0,主站自定义页面采集 | ||
| 18 | - * Class ProjectImport | ||
| 19 | - * @package App\Console\Commands | ||
| 20 | - * @author Akun | ||
| 21 | - * @date 2023/12/13 14:44 | ||
| 22 | - */ | ||
| 23 | -class HtmlCustomCollect extends Command | ||
| 24 | -{ | ||
| 25 | - /** | ||
| 26 | - * The name and signature of the console command. | ||
| 27 | - * | ||
| 28 | - * @var string | ||
| 29 | - */ | ||
| 30 | - protected $signature = 'project_html_custom_collect'; | ||
| 31 | - | ||
| 32 | - /** | ||
| 33 | - * The console command description. | ||
| 34 | - * | ||
| 35 | - * @var string | ||
| 36 | - */ | ||
| 37 | - protected $description = '执行项目自定义html页面采集'; | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - public function handle() | ||
| 41 | - { | ||
| 42 | - ini_set('memory_limit', '512M'); | ||
| 43 | - | ||
| 44 | -// $project_id = 437; | ||
| 45 | -// $project_site = 'v6-1500k.globalso.site'; | ||
| 46 | -// $pages = [ | ||
| 47 | -// 'https://www.tourletent.com/project/b300-glamping-tent-in-china/', | ||
| 48 | -// 'https://www.tourletent.com/project/lotus-bell-tent-in-australia/', | ||
| 49 | -// 'https://www.tourletent.com/project/luxury-resort-in-china/', | ||
| 50 | -// 'https://www.tourletent.com/project/canvas-safari-tent-inthailand/', | ||
| 51 | -// 'https://www.tourletent.com/project/safari-tent-for-m8-in-mexcio/', | ||
| 52 | -// 'https://www.tourletent.com/project/9m-pvc-dome-tent-in-canada/', | ||
| 53 | -// 'https://www.tourletent.com/project/c900-hotel-tent-in-korea/', | ||
| 54 | -// 'https://www.tourletent.com/project/safari-tent-in-guizhou/', | ||
| 55 | -// 'https://www.tourletent.com/project/dome-tent-in-austin/', | ||
| 56 | -// 'https://www.tourletent.com/project/safari-tent-in-italy/', | ||
| 57 | -// 'https://www.tourletent.com/project/glass-igloo-in-china/', | ||
| 58 | -// 'https://www.tourletent.com/project/tree-house-in-sichuan/' | ||
| 59 | -// ]; | ||
| 60 | - | ||
| 61 | -// $project_id = 517; | ||
| 62 | -// $project_site = 'v6-1gee9.globalso.site'; | ||
| 63 | -// $pages = [ | ||
| 64 | -// 'https://www.beifa.group/help/send-results/', | ||
| 65 | -// 'https://www.beifa.group/help/terms-of-use/', | ||
| 66 | -// 'https://www.beifa.group/help/position-3/', | ||
| 67 | -// 'https://www.beifa.group/help/position-2/', | ||
| 68 | -// 'https://www.beifa.group/help/position-1/', | ||
| 69 | -// 'https://www.beifa.group/help/social-media/', | ||
| 70 | -// 'https://www.beifa.group/help/globle-exibition-2/', | ||
| 71 | -// 'https://www.beifa.group/help/job/', | ||
| 72 | -// 'https://www.beifa.group/help/vr/', | ||
| 73 | -// 'https://www.beifa.group/help/on-live-video/', | ||
| 74 | -// 'https://www.beifa.group/help/honor/', | ||
| 75 | -// 'https://www.beifa.group/help/certification/', | ||
| 76 | -// 'https://www.beifa.group/help/quanity-control/', | ||
| 77 | -// 'https://www.beifa.group/help/testing-center/', | ||
| 78 | -// 'https://www.beifa.group/help/rd/', | ||
| 79 | -// 'https://www.beifa.group/help/design-trend/', | ||
| 80 | -// 'https://www.beifa.group/help/partner/', | ||
| 81 | -// 'https://www.beifa.group/help/social-responsibility/', | ||
| 82 | -// 'https://www.beifa.group/help/contact/', | ||
| 83 | -// ]; | ||
| 84 | - | ||
| 85 | - $project_id = 546; | ||
| 86 | - $project_site = 'v6-kx260.globalso.site'; | ||
| 87 | - $pages = [ | ||
| 88 | - 'https://www.grechofiberglass.com/success_stories/', | ||
| 89 | - 'https://www.grechofiberglass.com/success_stories/achieving-transformative-improvements-for-polyurethane-exterior-insulation-panels-in-france/', | ||
| 90 | - 'https://www.grechofiberglass.com/success_stories/grechos-fiberglass-rebar-revolutionizing-canadian-construction-projects-with-unparalleled-quality/', | ||
| 91 | - 'https://www.grechofiberglass.com/success_stories/customer-from-the-uk-purchases-fiberglass-coated-mats-for-plasterboards-from-grecho/', | ||
| 92 | - 'https://www.grechofiberglass.com/success_stories/supplying-carbon-fiber-to-australian-surfboard-manufacturer/', | ||
| 93 | - 'https://www.grechofiberglass.com/success_stories/300g-chopped-strand-mat-for-composite-slates-shipped-to-malaysia/', | ||
| 94 | - 'https://www.grechofiberglass.com/success_stories/fiberglass-roving-for-pipewater-tank-shipped-to-russia/', | ||
| 95 | - 'https://www.grechofiberglass.com/success_stories/fiberglass-fleece-for-acoustic-ceiling-shipped-to-russia/', | ||
| 96 | - 'https://www.grechofiberglass.com/success_stories/600g-fiberglass-aluminum-foil-cloth-shipped-to-australia-for-pipe-heat-shielding/', | ||
| 97 | - 'https://www.grechofiberglass.com/success_stories/shipping-our-first-truck-of-fiberglass-tissue-in-2022/', | ||
| 98 | - ]; | ||
| 99 | - | ||
| 100 | -// $project_id = 586; | ||
| 101 | -// $project_site = 'v6-m605x.globalso.site'; | ||
| 102 | -// $pages = [ | ||
| 103 | -// 'https://www.citymax-group.com/case/', | ||
| 104 | -// 'https://www.citymax-group.com/case_catalog/crop-classification/', | ||
| 105 | -// 'https://www.citymax-group.com/case_catalog/field-crops/', | ||
| 106 | -// 'https://www.citymax-group.com/case_catalog/fruits/', | ||
| 107 | -// 'https://www.citymax-group.com/case_catalog/vegetables/', | ||
| 108 | -// 'https://www.citymax-group.com/case/report-on-use-of-citymax-products-on-grapes-2/', | ||
| 109 | -// 'https://www.citymax-group.com/case/report-on-use-of-citymax-products-on-cucumber/', | ||
| 110 | -// 'https://www.citymax-group.com/case/field-experiment-crop-lettuce/', | ||
| 111 | -// ]; | ||
| 112 | - | ||
| 113 | -// $project_id = 626; | ||
| 114 | -// $project_site = 'v6-m342g.globalso.site'; | ||
| 115 | -// $pages = [ | ||
| 116 | -// 'https://www.lecusostreetlight.com/project_catalog/project/', | ||
| 117 | -// 'https://www.lecusostreetlight.com/project_catalog/project/page/2/', | ||
| 118 | -// 'https://www.lecusostreetlight.com/project/560pcs-250w-smart-led-street-light-in-manila-city-philippines/', | ||
| 119 | -// 'https://www.lecusostreetlight.com/project/3200pcs-8m-150w-solar-street-light-in-cebu-philippines/', | ||
| 120 | -// 'https://lecusostreetlight.com/project/170pcs-100w-split-lithium-battery-solar-street-light-in-tanzania/', | ||
| 121 | -// 'https://www.lecusostreetlight.com/project/250pcs-40w-sl-series-solar-street-light-in-kuwait/', | ||
| 122 | -// 'https://www.lecusostreetlight.com/project/272pcs-8m-80w-solar-street-light-in-tanzania/', | ||
| 123 | -// 'https://www.lecusostreetlight.com/project/185pcs-10m-120w-highway-solar-street-light-in-jordan/', | ||
| 124 | -// 'https://www.lecusostreetlight.com/project/270pcs-9m-patterned-decorative-light-pole-with-150w-led-cobra-light-in-cambodia/', | ||
| 125 | -// 'https://www.lecusostreetlight.com/project/48pcs-5m-24w-decorative-aluminium-pole-in-dubai-uae/', | ||
| 126 | -// 'https://www.lecusostreetlight.com/project/105pcs-9m-100w-led-street-light-in-sri-lanka/', | ||
| 127 | -// 'https://www.lecusostreetlight.com/project/45pcs-6m-hot-dip-galvanized-double-arm-street-light-pole-in-dubai-uae/', | ||
| 128 | -// 'https://www.lecusostreetlight.com/project/356pcs-8m-100w-solar-street-light-in-ethiopia/', | ||
| 129 | -// 'https://www.lecusostreetlight.com/project/52pcs-6m-30w-solar-led-street-light-with-gel-battery-in-poland/', | ||
| 130 | -// 'https://www.lecusostreetlight.com/project/225pcs-6m-80w-solar-street-light-in-vietnam/', | ||
| 131 | -// 'https://www.lecusostreetlight.com/project/450pcs-7m-60w-double-arm-solar-light-in-nigeria/', | ||
| 132 | -// 'https://www.lecusostreetlight.com/project/100pcs-6m-50w-led-street-light-in-maldives/', | ||
| 133 | -// 'https://www.lecusostreetlight.com/project/202pcs-6m-40w-3000k-solar-street-light-in-manila-philippines/', | ||
| 134 | -// 'https://www.lecusostreetlight.com/project/245pcs-120w-smart-led-street-light-in-bangkok-thailand/', | ||
| 135 | -// 'https://www.lecusostreetlight.com/project/170pcs-7m-50w-all-in-one-solar-light-in-davao-philippines/', | ||
| 136 | -// 'https://www.lecusostreetlight.com/project/80pcs-9m-150w-led-street-light-in-iraq/', | ||
| 137 | -// 'https://www.lecusostreetlight.com/project/252pcs-6m-40w-separate-solar-street-light-with-lithium-battery-in-thailand/', | ||
| 138 | -// 'https://www.lecusostreetlight.com/project/198pcs-8m-80w-zc-series-all-in-two-solar-light-in-philippines/', | ||
| 139 | -// 'https://www.lecusostreetlight.com/project/5m-30w-morden-led-garden-light-in-russian/', | ||
| 140 | -// 'https://www.lecusostreetlight.com/project/135pcs-all-in-one-solar-street-light-in-uae-dubai-park/' | ||
| 141 | -// ]; | ||
| 142 | - | ||
| 143 | -// $project_id = 633; | ||
| 144 | -// $project_site = 'v6-ke5nz.globalso.site'; | ||
| 145 | -// $pages = [ | ||
| 146 | -// 'https://www.mach-sales.com/case_catalog/cases/', | ||
| 147 | -// 'https://www.mach-sales.com/case_catalog/cases/page/2/', | ||
| 148 | -// 'https://www.mach-sales.com/case_catalog/cases/page/3/', | ||
| 149 | -// 'https://www.mach-sales.com/case/growing-with-customers-from-small-motors-to-big-drivers/', | ||
| 150 | -// 'https://www.mach-sales.com/case/growing-together-with-customers-the-journey-of-intelligent-manufacturing-in-a-modernized-factory/', | ||
| 151 | -// 'https://www.mach-sales.com/case/%e3%80%90growing-together-with-customers%e3%80%91-the-evolutionary-journey-of-a-baking-brand/', | ||
| 152 | -// 'https://www.mach-sales.com/case/sumecs-footprints-in-belt-and-road-singapore/', | ||
| 153 | -// 'https://www.mach-sales.com/case/sumecs-footprints-in-belt-and-road-southeast-asia/', | ||
| 154 | -// 'https://www.mach-sales.com/case/naming-and-delivery-of-a-new-ship-1/', | ||
| 155 | -// 'https://www.mach-sales.com/case/a-newly-signed-contract-cable-manufacturing-equipment/', | ||
| 156 | -// 'https://www.mach-sales.com/case/its-amazing-that-the-glass-can-also-save-energy/', | ||
| 157 | -// 'https://www.mach-sales.com/case/%e3%80%90grow-with-customers%e3%80%91better-service-for-papermaking-equipment-procurement/', | ||
| 158 | -// 'https://www.mach-sales.com/case/expansion-of-blower-equipment-contributes-to-environmental-protection/', | ||
| 159 | -// 'https://www.mach-sales.com/case/new-ship-type-new-contract/', | ||
| 160 | -// 'https://www.mach-sales.com/case/new-arrival-introducing-the-latest-ship-model/', | ||
| 161 | -// 'https://www.mach-sales.com/case/another-contract-signed-in-the-philippines/', | ||
| 162 | -// 'https://www.mach-sales.com/case/the-road-to-going-global-is-supported-by-sumec-services/', | ||
| 163 | -// 'https://www.mach-sales.com/case/sumec-textile-launches-sun-protection-series-in-collaboration-with-skechers-kids/', | ||
| 164 | -// 'https://www.mach-sales.com/case/footwear-manufacturing-equipment-new-contract/', | ||
| 165 | -// 'https://www.mach-sales.com/case/sumec-energy-company-has-successfully-signed-a-photovoltaic-component-supply-agreement-with-wattkraft-a-german-engineering-system-integrator/', | ||
| 166 | -// 'https://www.mach-sales.com/case/sumec-technology-company-successfully-signed-a-contract-for-the-equipment-related-to-the-high-strength-particleboard-project/', | ||
| 167 | -// 'https://www.mach-sales.com/case/%e3%80%90growing-together-with-our-customers%e3%80%91together-on-the-road-to-transformation/', | ||
| 168 | -// 'https://www.mach-sales.com/case/new-signing/', | ||
| 169 | -// 'https://www.mach-sales.com/case/complete-the-last-mile-equipment-procurement-from-around-the-world/', | ||
| 170 | -// 'https://www.mach-sales.com/case/science-and-technology-to-rejuvenate-agriculture-this-plant-factory-is-not-simple/', | ||
| 171 | -// 'https://www.mach-sales.com/case/new-cooperation-high-end-equipment-going-global/', | ||
| 172 | -// 'https://www.mach-sales.com/case/a-new-cooperation-with-an-annual-output-of-40000-tons/', | ||
| 173 | -// 'https://www.mach-sales.com/case/a-new-contract-cooperation-upgrades/', | ||
| 174 | -// 'https://www.mach-sales.com/case/annual-output-of-50000-tons-this-bopp-film-production-line-was-officially-put-into-operation/', | ||
| 175 | -// 'https://www.mach-sales.com/case/this-is-sumec-speed/', | ||
| 176 | -// 'https://www.mach-sales.com/case/the-first-order-of-a-new-semiconductor-brand-equipment-direct-sales-bear-fruit-again/', | ||
| 177 | -// 'https://www.mach-sales.com/case/sumec-touch-world-celebrates-its-5th-anniversary-with-well-known-suppliers/', | ||
| 178 | -// 'https://www.mach-sales.com/case/from-traditional-agency-to-digital-service/', | ||
| 179 | -// 'https://www.mach-sales.com/case/cooperation-win-win-and-starting-anew-sumec-creates-a-new-sample-of-strong-enterprise-cooperation/' | ||
| 180 | -// ]; | ||
| 181 | - | ||
| 182 | - foreach ($pages as $page) { | ||
| 183 | - $this->start_collect(urldecode($page), $project_id, $project_site); | ||
| 184 | - } | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - protected function start_collect($page, $project_id, $project_site) | ||
| 188 | - { | ||
| 189 | - $page_arr = parse_url($page); | ||
| 190 | - $domain = $page_arr['host']; | ||
| 191 | - $path = $page_arr['path']; | ||
| 192 | - | ||
| 193 | - //设置数据库 | ||
| 194 | - $project = ProjectServer::useProject($project_id); | ||
| 195 | - if ($project) { | ||
| 196 | - echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', page: ' . $page . ', collect start' . PHP_EOL; | ||
| 197 | - | ||
| 198 | - //获取站点原始域名信息 | ||
| 199 | - $old_info = UpdateOldInfo::getOldDomain($project_id, $domain); | ||
| 200 | - | ||
| 201 | - //采集html页面,下载资源到本地并替换 | ||
| 202 | - try { | ||
| 203 | - $html = curl_c($page, false); | ||
| 204 | - if ($html == '0') { | ||
| 205 | - echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', page: ' . $page . ', error: no html' . PHP_EOL; | ||
| 206 | - sleep(2); | ||
| 207 | - return true; | ||
| 208 | - } | ||
| 209 | - | ||
| 210 | - //如果有base64图片,先替换掉,再进行资源匹配 | ||
| 211 | - $new_html = $html; | ||
| 212 | - preg_match_all("/data:([^;]*);base64,(.*)?\"/", $new_html, $result_img); | ||
| 213 | - $img_base64 = $result_img[2] ?? []; | ||
| 214 | - foreach ($img_base64 as $v64) { | ||
| 215 | - $new_html = str_replace($v64, '', $new_html); | ||
| 216 | - } | ||
| 217 | - | ||
| 218 | - //匹配资源链接 | ||
| 219 | - $source_list = $this->html_preg($new_html, $project_id, $domain, $old_info['web_url_domain'], $old_info['home_url']); | ||
| 220 | - | ||
| 221 | - //下载资源 | ||
| 222 | - if ($source_list) { | ||
| 223 | - $html = $this->upload_source($html, $source_list, $project_id, $domain, $old_info['web_url_domain'], $old_info['home_url']); | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - //替换域名 | ||
| 227 | - $html = str_replace($old_info['web_url_domain'], $project_site, $html); | ||
| 228 | - $html = str_replace($old_info['home_url'], $project_site, $html); | ||
| 229 | - | ||
| 230 | - //暂时隐藏小语种 | ||
| 231 | -// $html = str_replace('<div class="change-language ensemble">', '<div class="change-language ensemble" style="display: none">', $html); | ||
| 232 | -// $html = str_replace('<div class="language_more">', '<div class="language_more" style="display: none">', $html); | ||
| 233 | - | ||
| 234 | - //处理搜索 | ||
| 235 | - preg_match_all('/<form\s+[^>]*?action\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_search); | ||
| 236 | - $search = $result_search[2] ?? []; | ||
| 237 | - foreach ($search as $vc) { | ||
| 238 | - if((strpos($vc,'search.php') !== false) || (strpos($vc,'index.php') !== false)){ | ||
| 239 | - $html = str_replace($vc,'/search/',$html); | ||
| 240 | - } | ||
| 241 | - } | ||
| 242 | - | ||
| 243 | - //增加统计代码 | ||
| 244 | - $html = str_replace('</body>', '<script src="https://ecdn6.globalso.com/public/customerVisit.min.js\"></script></body>', $html); | ||
| 245 | - | ||
| 246 | - //html写入文件 | ||
| 247 | - $file_path = '/www/wwwroot/globalso-v6-c-glo/public/' . $project_site . $path; | ||
| 248 | - if (!file_exists($file_path)) { | ||
| 249 | - mkdir($file_path, 0777, true); | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - file_put_contents($file_path . 'index.html', $html); | ||
| 253 | - chmod($file_path . 'index.html', 0777); | ||
| 254 | - | ||
| 255 | - } catch (\Exception $e) { | ||
| 256 | - echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', page: ' . $page . ', error: ' . $e->getMessage() . PHP_EOL; | ||
| 257 | - sleep(2); | ||
| 258 | - return true; | ||
| 259 | - } | ||
| 260 | - | ||
| 261 | - | ||
| 262 | - echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', page: ' . $page . ', collect end' . PHP_EOL; | ||
| 263 | - } else { | ||
| 264 | - echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', page: ' . $page . ', no project' . PHP_EOL; | ||
| 265 | - } | ||
| 266 | - //关闭数据库 | ||
| 267 | - DB::disconnect('custom_mysql'); | ||
| 268 | - | ||
| 269 | - sleep(2); | ||
| 270 | - return true; | ||
| 271 | - } | ||
| 272 | - | ||
| 273 | - //正则匹配html资源 | ||
| 274 | - protected function html_preg($html, $project_id, $domain, $web_url_domain, $home_url) | ||
| 275 | - { | ||
| 276 | - $source = []; | ||
| 277 | - | ||
| 278 | - if (!$html) { | ||
| 279 | - return $source; | ||
| 280 | - } | ||
| 281 | - | ||
| 282 | - //image | ||
| 283 | - preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_img); | ||
| 284 | - $img = $result_img[2] ?? []; | ||
| 285 | - foreach ($img as $vi) { | ||
| 286 | - $check_vi = $this->url_check($vi, $project_id, $domain, $web_url_domain, $home_url); | ||
| 287 | - $check_vi && $source[] = $check_vi; | ||
| 288 | - } | ||
| 289 | - | ||
| 290 | - //js | ||
| 291 | - preg_match_all('/<script\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_js); | ||
| 292 | - $js = $result_js[2] ?? []; | ||
| 293 | - foreach ($js as $vj) { | ||
| 294 | - $check_vj = $this->url_check($vj, $project_id, $domain, $web_url_domain, $home_url); | ||
| 295 | - $check_vj && $source[] = $check_vj; | ||
| 296 | - } | ||
| 297 | - | ||
| 298 | - //video | ||
| 299 | - preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_video); | ||
| 300 | - $video = $result_video[2] ?? []; | ||
| 301 | - foreach ($video as $vv) { | ||
| 302 | - $check_vv = $this->url_check($vv, $project_id, $domain, $web_url_domain, $home_url); | ||
| 303 | - $check_vv && $source[] = $check_vv; | ||
| 304 | - } | ||
| 305 | - | ||
| 306 | - //css | ||
| 307 | - preg_match_all('/<link\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_css); | ||
| 308 | - $css = $result_css[2] ?? []; | ||
| 309 | - foreach ($css as $vc) { | ||
| 310 | - $check_vc = $this->url_check($vc, $project_id, $domain, $web_url_domain, $home_url); | ||
| 311 | - $check_vc && $source[] = $check_vc; | ||
| 312 | - } | ||
| 313 | - | ||
| 314 | - //css background | ||
| 315 | - preg_match_all("/url\(['\"]?(\s*[^>]+?)['\"]?\)/i", $html, $result_css_b); | ||
| 316 | - $css_b = $result_css_b[1] ?? []; | ||
| 317 | - foreach ($css_b as $vc_b) { | ||
| 318 | - $check_vc_b = $this->url_check($vc_b, $project_id, $domain, $web_url_domain, $home_url); | ||
| 319 | - $check_vc_b && $source[] = $check_vc_b; | ||
| 320 | - } | ||
| 321 | - | ||
| 322 | - //a标签下载资源 | ||
| 323 | - preg_match_all('/<a\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_a); | ||
| 324 | - $down = $result_a[2] ?? []; | ||
| 325 | - foreach ($down as $vd) { | ||
| 326 | - $check_vd = $this->url_check($vd, $project_id, $domain, $web_url_domain, $home_url); | ||
| 327 | - $check_vd && $source[] = $check_vd; | ||
| 328 | - } | ||
| 329 | - | ||
| 330 | - return $source; | ||
| 331 | - } | ||
| 332 | - | ||
| 333 | - //判断资源是否需要下载 | ||
| 334 | - protected function url_check($url, $project_id, $domain, $web_url_domain, $home_url) | ||
| 335 | - { | ||
| 336 | - if ($url) { | ||
| 337 | - $url = str_replace('"', '', $url); | ||
| 338 | - $arr = parse_url($url); | ||
| 339 | - $scheme = $arr['scheme'] ?? ''; | ||
| 340 | - $host = $arr['host'] ?? ''; | ||
| 341 | - $path = $arr['path'] ?? ''; | ||
| 342 | - $query = $arr['query'] ?? ''; | ||
| 343 | - | ||
| 344 | - $path_arr = explode('.', $path); | ||
| 345 | - if ( | ||
| 346 | - (empty($scheme) || $scheme == 'https' || $scheme == 'http') | ||
| 347 | - && (empty($host) || (strpos($web_url_domain, $host) !== false) || (strpos($home_url, $host) !== false)) | ||
| 348 | - && $path | ||
| 349 | - && (substr($path, 0, 1) == '/') | ||
| 350 | - && (strpos($path, '.') !== false) | ||
| 351 | - && (!in_array(end($path_arr), ['html', 'php', 'com', 'xml'])) | ||
| 352 | - ) { | ||
| 353 | - $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); | ||
| 354 | - if (!$source) { | ||
| 355 | - return [ | ||
| 356 | - 'download' => true, | ||
| 357 | - 'url' => $url, | ||
| 358 | - 'url_complete' => ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path . ($query ? '?' . $query : '') | ||
| 359 | - ]; | ||
| 360 | - } else { | ||
| 361 | - return [ | ||
| 362 | - 'download' => false, | ||
| 363 | - 'url' => $url, | ||
| 364 | - 'url_complete' => $source['target'] | ||
| 365 | - ]; | ||
| 366 | - } | ||
| 367 | - } else { | ||
| 368 | - return false; | ||
| 369 | - } | ||
| 370 | - } else { | ||
| 371 | - return false; | ||
| 372 | - } | ||
| 373 | - } | ||
| 374 | - | ||
| 375 | - //下载并替换资源 | ||
| 376 | - protected function upload_source($html, $source, $project_id, $domain, $web_url_domain, $home_url) | ||
| 377 | - { | ||
| 378 | - foreach ($source as $vs) { | ||
| 379 | - | ||
| 380 | - if ($vs['download']) { | ||
| 381 | - $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete']); | ||
| 382 | - if ($new_source) { | ||
| 383 | - CollectSource::insert([ | ||
| 384 | - 'project_id' => $project_id, | ||
| 385 | - 'origin' => $vs['url'], | ||
| 386 | - 'target' => $new_source, | ||
| 387 | - 'created_at' => date('Y-m-d H:i:s'), | ||
| 388 | - 'updated_at' => date('Y-m-d H:i:s'), | ||
| 389 | - ]); | ||
| 390 | - $html = str_replace($vs['url'], getImageUrl($new_source), $html); | ||
| 391 | - | ||
| 392 | - if (substr($new_source, -3, 3) == 'css' || substr($new_source, -2, 2) == 'js') { | ||
| 393 | - | ||
| 394 | - $source_html = curl_c(getImageUrl($new_source), false); | ||
| 395 | - | ||
| 396 | - if (substr($new_source, -3, 3) == 'css') { | ||
| 397 | - preg_match_all("/url\(['\"]?(\s*[^>]+?)['\"]?\)/i", $source_html, $result_source); | ||
| 398 | - } else { | ||
| 399 | - preg_match_all("/[large|thumb]+URL:['\"]+(\s*[^>]+?)['\"]+,/i", $source_html, $result_source); | ||
| 400 | - } | ||
| 401 | - | ||
| 402 | - $js_css_source = $result_source[1] ?? []; | ||
| 403 | - if ($js_css_source) { | ||
| 404 | - foreach ($js_css_source as $vjs) { | ||
| 405 | - $vjs_down = str_replace('"', '', $vjs); | ||
| 406 | - if (strpos($vjs_down, 'data:') !== false) { | ||
| 407 | - //过滤二进制文件 | ||
| 408 | - continue; | ||
| 409 | - } | ||
| 410 | - if (strlen($vjs_down) > 255) { | ||
| 411 | - //过滤太长文件 | ||
| 412 | - continue; | ||
| 413 | - } | ||
| 414 | - | ||
| 415 | - $vjs_down_arr = parse_url($vjs_down); | ||
| 416 | - $vjs_down_host = $vjs_down_arr['host'] ?? ''; | ||
| 417 | - | ||
| 418 | - $cos = config('filesystems.disks.cos'); | ||
| 419 | - $cosCdn = $cos['cdn']; | ||
| 420 | - | ||
| 421 | - if ($vjs_down_host && $vjs_down_host == $cosCdn) { | ||
| 422 | - //过滤已经下载的 | ||
| 423 | - continue; | ||
| 424 | - } | ||
| 425 | - | ||
| 426 | - if (empty($vjs_down_host) && substr($vjs_down, 0, 1) != '/') { | ||
| 427 | - //相对路径 | ||
| 428 | - $url_arr = explode('/', $vs['url']); | ||
| 429 | - $url_arr[count($url_arr) - 1] = $vjs_down; | ||
| 430 | - $vjs_down = implode('/', $url_arr); | ||
| 431 | - } | ||
| 432 | - | ||
| 433 | - $vjs_result = $this->url_check($vjs_down, $project_id, $domain, $web_url_domain, $home_url); | ||
| 434 | - if (!$vjs_result) { | ||
| 435 | - continue; | ||
| 436 | - } | ||
| 437 | - | ||
| 438 | - if ($vjs_result['download']) { | ||
| 439 | - $new_vjs = CosService::uploadRemote($project_id, 'source', $vjs_result['url_complete']); | ||
| 440 | - if ($new_vjs) { | ||
| 441 | - CollectSource::insert([ | ||
| 442 | - 'project_id' => $project_id, | ||
| 443 | - 'origin' => $vjs_result['url'], | ||
| 444 | - 'target' => $new_vjs, | ||
| 445 | - 'created_at' => date('Y-m-d H:i:s'), | ||
| 446 | - 'updated_at' => date('Y-m-d H:i:s'), | ||
| 447 | - ]); | ||
| 448 | - $source_html = str_replace($vjs, getImageUrl($new_vjs), $source_html); | ||
| 449 | - } | ||
| 450 | - } else { | ||
| 451 | - $source_html = str_replace($vjs, getImageUrl($vjs_result['url_complete']), $source_html); | ||
| 452 | - } | ||
| 453 | - } | ||
| 454 | - | ||
| 455 | - CosService::uploadRemote($project_id, 'source', $new_source, $new_source, $source_html); | ||
| 456 | - } | ||
| 457 | - } | ||
| 458 | - } | ||
| 459 | - } else { | ||
| 460 | - $html = str_replace($vs['url'], getImageUrl($vs['url_complete']), $html); | ||
| 461 | - } | ||
| 462 | - } | ||
| 463 | - | ||
| 464 | - return $html; | ||
| 465 | - } | ||
| 466 | -} |
| @@ -544,21 +544,15 @@ class ProjectUpdate extends Command | @@ -544,21 +544,15 @@ class ProjectUpdate extends Command | ||
| 544 | $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]); | 544 | $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]); |
| 545 | $data = curl_c($url); | 545 | $data = curl_c($url); |
| 546 | if (isset($data['code']) && $data['code'] == 200) { | 546 | if (isset($data['code']) && $data['code'] == 200) { |
| 547 | - $category = $data['data']['category'] ?? []; | ||
| 548 | - if (empty($category)) { | ||
| 549 | - $route_model = new RouteMap(); | ||
| 550 | - $route_page = $route_model->read(['source' => 'page', 'route' => $custom_info['route']], 'id'); | ||
| 551 | - if (!$route_page) { | ||
| 552 | - $category = [ | ||
| 553 | - [ | ||
| 554 | - 'id' => 0, | ||
| 555 | - 'name' => $custom_info['route'], | ||
| 556 | - 'url' => '/' . $custom_info['route'], | ||
| 557 | - 'parent' => 0 | ||
| 558 | - ] | ||
| 559 | - ]; | ||
| 560 | - } | ||
| 561 | - } | 547 | + $category = [ |
| 548 | + [ | ||
| 549 | + 'id' => 0, | ||
| 550 | + 'name' => $custom_info['route'], | ||
| 551 | + 'url' => '/' . $custom_info['route'], | ||
| 552 | + 'parent' => 0, | ||
| 553 | + 'children' => $data['data']['category'] ?? [] | ||
| 554 | + ] | ||
| 555 | + ]; | ||
| 562 | $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); | 556 | $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); |
| 563 | 557 | ||
| 564 | $count = $data['data']['count'] ?? 0; | 558 | $count = $data['data']['count'] ?? 0; |
| @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command | @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command | ||
| 50 | public function handle(){ | 50 | public function handle(){ |
| 51 | //获取所有项目 | 51 | //获取所有项目 |
| 52 | $projectModel = new Project(); | 52 | $projectModel = new Project(); |
| 53 | - $list = $projectModel->list(['type'=>['in',[1,2,3,4]]],'id',['id']); | 53 | + $list = $projectModel->list(['id'=>['in',[218]]],'id',['id']); |
| 54 | echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; | 54 | echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; |
| 55 | try { | 55 | try { |
| 56 | foreach ($list as $v) { | 56 | foreach ($list as $v) { |
| @@ -94,9 +94,8 @@ class UpdateProductCategory extends Command | @@ -94,9 +94,8 @@ class UpdateProductCategory extends Command | ||
| 94 | if(!empty($cate_arr) && is_array($cate_arr)){ | 94 | if(!empty($cate_arr) && is_array($cate_arr)){ |
| 95 | foreach ($cate_arr as $v){ | 95 | foreach ($cate_arr as $v){ |
| 96 | $categoryModel = new Category(); | 96 | $categoryModel = new Category(); |
| 97 | - $info = $categoryModel->read(['pid'=>$v],['id']); | ||
| 98 | - if($info !== false){ | ||
| 99 | - //有下级时,跳过 | 97 | + $info = $categoryModel->read(['id'=>$v],['id']); |
| 98 | + if($info === false){ | ||
| 100 | continue; | 99 | continue; |
| 101 | }else{ | 100 | }else{ |
| 102 | //更新关联表 | 101 | //更新关联表 |
| @@ -10,11 +10,15 @@ | @@ -10,11 +10,15 @@ | ||
| 10 | namespace App\Console\Commands; | 10 | namespace App\Console\Commands; |
| 11 | 11 | ||
| 12 | use App\Helper\Arr; | 12 | use App\Helper\Arr; |
| 13 | +use App\Helper\Translate; | ||
| 14 | +use App\Models\CustomModule\CustomModuleCategory; | ||
| 15 | +use App\Models\CustomModule\CustomModuleContent; | ||
| 13 | use App\Models\Product\CategoryRelated; | 16 | use App\Models\Product\CategoryRelated; |
| 14 | use App\Models\Product\Keyword; | 17 | use App\Models\Product\Keyword; |
| 15 | use App\Models\Product\Product; | 18 | use App\Models\Product\Product; |
| 16 | use App\Models\Project\Project; | 19 | use App\Models\Project\Project; |
| 17 | use App\Models\RouteMap\RouteMap; | 20 | use App\Models\RouteMap\RouteMap; |
| 21 | +use App\Models\Template\BTemplate; | ||
| 18 | use App\Services\ProjectServer; | 22 | use App\Services\ProjectServer; |
| 19 | use Illuminate\Console\Command; | 23 | use Illuminate\Console\Command; |
| 20 | use Illuminate\Support\Facades\DB; | 24 | use Illuminate\Support\Facades\DB; |
| @@ -51,7 +55,7 @@ class UpdateRoute extends Command | @@ -51,7 +55,7 @@ class UpdateRoute extends Command | ||
| 51 | */ | 55 | */ |
| 52 | public function handle(){ | 56 | public function handle(){ |
| 53 | $projectModel = new Project(); | 57 | $projectModel = new Project(); |
| 54 | - $list = $projectModel->list(['id'=>209]); | 58 | + $list = $projectModel->list(['id'=>426]); |
| 55 | foreach ($list as $v){ | 59 | foreach ($list as $v){ |
| 56 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 60 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 57 | ProjectServer::useProject($v['id']); | 61 | ProjectServer::useProject($v['id']); |
| @@ -60,11 +64,28 @@ class UpdateRoute extends Command | @@ -60,11 +64,28 @@ class UpdateRoute extends Command | ||
| 60 | // $this->getRouteMap(); | 64 | // $this->getRouteMap(); |
| 61 | // $this->getProductCategory(); | 65 | // $this->getProductCategory(); |
| 62 | // $this->delRouteMap(); | 66 | // $this->delRouteMap(); |
| 67 | +// $this->setCustomRoute($v['id']); | ||
| 63 | DB::disconnect('custom_mysql'); | 68 | DB::disconnect('custom_mysql'); |
| 64 | } | 69 | } |
| 65 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 70 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 66 | } | 71 | } |
| 67 | 72 | ||
| 73 | + public function setCustomRoute($project_id){ | ||
| 74 | +// $customModel = new CustomModuleContent(); | ||
| 75 | +// $list = $customModel->list(); | ||
| 76 | +// foreach ($list as $v){ | ||
| 77 | +// $route = RouteMap::setRoute($v['name'], RouteMap::SOURCE_MODULE, $v['id'], $project_id); | ||
| 78 | +// $customModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 79 | +// } | ||
| 80 | + $cateModel = new CustomModuleCategory(); | ||
| 81 | + $lists = $cateModel->list(); | ||
| 82 | + foreach ($lists as $v1){ | ||
| 83 | + $route = RouteMap::setRoute($v1['name'], RouteMap::SOURCE_MODULE_CATE, $v1['id'], $project_id); | ||
| 84 | + $cateModel->edit(['route'=>$route],['id'=>$v1['id']]); | ||
| 85 | + | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + | ||
| 68 | /** | 89 | /** |
| 69 | * @remark :写入 | 90 | * @remark :写入 |
| 70 | * @name :getProductKeyword | 91 | * @name :getProductKeyword |
| @@ -80,10 +101,15 @@ class UpdateRoute extends Command | @@ -80,10 +101,15 @@ class UpdateRoute extends Command | ||
| 80 | if(!empty($v['route'])){ | 101 | if(!empty($v['route'])){ |
| 81 | $tag = "-tag"; | 102 | $tag = "-tag"; |
| 82 | if (!(substr($v['route'], -strlen($tag)) === $tag)) { | 103 | if (!(substr($v['route'], -strlen($tag)) === $tag)) { |
| 83 | - $route = $v['route'].$tag; | 104 | +// $route = Translate::tran($v['route'], 'en').$tag; |
| 84 | // 如果不是以 '-tag' 结尾,则拼接上 '-tag' | 105 | // 如果不是以 '-tag' 结尾,则拼接上 '-tag' |
| 106 | + $route = $v['route'].$tag; | ||
| 85 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); | 107 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); |
| 86 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | 108 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 109 | +// }else{ | ||
| 110 | +// $route = Translate::tran($v['title'], 'en').$tag; | ||
| 111 | +// $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); | ||
| 112 | +// $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 87 | } | 113 | } |
| 88 | }else{ | 114 | }else{ |
| 89 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | 115 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; |
| @@ -34,8 +34,10 @@ class PrivateController extends BaseController | @@ -34,8 +34,10 @@ class PrivateController extends BaseController | ||
| 34 | $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') | 34 | $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') |
| 35 | ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') | 35 | ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') |
| 36 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') | 36 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') |
| 37 | - ->where('c.qa_status', '=', OnlineCheck::STATUS_ONLINE_TRUE) | ||
| 38 | ->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR]) | 37 | ->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR]) |
| 38 | + ->where(function ($subQuery) { | ||
| 39 | + $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE); | ||
| 40 | + }) | ||
| 39 | ->paginate($page_size) | 41 | ->paginate($page_size) |
| 40 | ->toArray(); | 42 | ->toArray(); |
| 41 | return $this->success($result); | 43 | return $this->success($result); |
| @@ -9,7 +9,6 @@ | @@ -9,7 +9,6 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Controllers\Aside\Com; | 10 | namespace App\Http\Controllers\Aside\Com; |
| 11 | 11 | ||
| 12 | -use App\Helper\Common; | ||
| 13 | use App\Http\Controllers\Bside\BaseController; | 12 | use App\Http\Controllers\Bside\BaseController; |
| 14 | use App\Models\Com\UpdateLog; | 13 | use App\Models\Com\UpdateLog; |
| 15 | use App\Models\Com\UpdateOldInfo; | 14 | use App\Models\Com\UpdateOldInfo; |
| @@ -17,7 +16,6 @@ use App\Models\Domain\DomainInfo; | @@ -17,7 +16,6 @@ use App\Models\Domain\DomainInfo; | ||
| 17 | use App\Models\Project\ProjectUpdateTdk; | 16 | use App\Models\Project\ProjectUpdateTdk; |
| 18 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| 19 | use Illuminate\Support\Facades\DB; | 18 | use Illuminate\Support\Facades\DB; |
| 20 | -use Illuminate\Support\Facades\Redis; | ||
| 21 | 19 | ||
| 22 | /** | 20 | /** |
| 23 | * @remark :b端网站更新相关 | 21 | * @remark :b端网站更新相关 |
| @@ -105,12 +103,23 @@ class UpdateController extends BaseController | @@ -105,12 +103,23 @@ class UpdateController extends BaseController | ||
| 105 | //关闭数据库 | 103 | //关闭数据库 |
| 106 | DB::disconnect('custom_mysql'); | 104 | DB::disconnect('custom_mysql'); |
| 107 | 105 | ||
| 108 | - $update = ['collect_status' => 0]; | ||
| 109 | - if ($this->param['type'] == 2 && !$domain_info) { | ||
| 110 | - $update['status'] = 0; | 106 | + if ($domain_info) { |
| 107 | + $old_info = UpdateOldInfo::where('project_id', $this->param['project_id'])->first(); | ||
| 108 | + if (!$old_info) { | ||
| 109 | + $old_info = new UpdateOldInfo(); | ||
| 110 | + $old_info->project_id = $this->param['project_id']; | ||
| 111 | + $old_info->link_type = 0; | ||
| 112 | + $old_info->old_domain_online = $domain_info->domain; | ||
| 113 | + } | ||
| 114 | + $old_info->old_domain_test = $test_domain; | ||
| 115 | + $old_info->save(); | ||
| 111 | } | 116 | } |
| 112 | 117 | ||
| 113 | - UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update); | 118 | + UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news', 'website_info', 'tag'])->update(['collect_status' => 0]); |
| 119 | + | ||
| 120 | + if ($this->param['type'] == 2 && !$domain_info) { | ||
| 121 | + UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->update(['status' => 0]); | ||
| 122 | + } | ||
| 114 | 123 | ||
| 115 | $this->response('采集任务添加成功'); | 124 | $this->response('采集任务添加成功'); |
| 116 | } | 125 | } |
| @@ -65,6 +65,7 @@ class OnlineController extends BaseController | @@ -65,6 +65,7 @@ class OnlineController extends BaseController | ||
| 65 | 'gl_project.channel AS channel', | 65 | 'gl_project.channel AS channel', |
| 66 | 'gl_project.type AS type', | 66 | 'gl_project.type AS type', |
| 67 | 'gl_project.created_at AS created_at', | 67 | 'gl_project.created_at AS created_at', |
| 68 | + 'gl_project.is_upgrade AS is_upgrade', | ||
| 68 | 'gl_project_online_check.id AS online_check_id', | 69 | 'gl_project_online_check.id AS online_check_id', |
| 69 | 'gl_project_online_check.question AS question', | 70 | 'gl_project_online_check.question AS question', |
| 70 | 'gl_project_online_check.optimist_status AS optimist_status', | 71 | 'gl_project_online_check.optimist_status AS optimist_status', |
| @@ -145,6 +146,9 @@ class OnlineController extends BaseController | @@ -145,6 +146,9 @@ class OnlineController extends BaseController | ||
| 145 | if(isset($this->map['all_status'])){ | 146 | if(isset($this->map['all_status'])){ |
| 146 | $query->where('gl_project_online_check.qa_status',$this->map['all_status']); | 147 | $query->where('gl_project_online_check.qa_status',$this->map['all_status']); |
| 147 | } | 148 | } |
| 149 | + if(isset($this->map['is_upgrade'])){ | ||
| 150 | + $query->where('gl_project.is_upgrade',$this->map['is_upgrade']); | ||
| 151 | + } | ||
| 148 | if(isset($this->map['optimist_status'])){ | 152 | if(isset($this->map['optimist_status'])){ |
| 149 | $query->where('gl_project_online_check.optimist_status',$this->map['optimist_status']); | 153 | $query->where('gl_project_online_check.optimist_status',$this->map['optimist_status']); |
| 150 | } | 154 | } |
| @@ -133,6 +133,7 @@ class OptimizeController extends BaseController | @@ -133,6 +133,7 @@ class OptimizeController extends BaseController | ||
| 133 | 'gl_project.robots AS robots', | 133 | 'gl_project.robots AS robots', |
| 134 | 'gl_project.is_translate AS is_translate', | 134 | 'gl_project.is_translate AS is_translate', |
| 135 | 'gl_project.is_translate_tag AS is_translate_tag', | 135 | 'gl_project.is_translate_tag AS is_translate_tag', |
| 136 | + 'gl_project.is_upgrade AS is_upgrade', | ||
| 136 | 'gl_project_online_check.id AS online_check_id', | 137 | 'gl_project_online_check.id AS online_check_id', |
| 137 | 'gl_project_online_check.question AS question', | 138 | 'gl_project_online_check.question AS question', |
| 138 | 'gl_project_online_check.go_question AS go_question', | 139 | 'gl_project_online_check.go_question AS go_question', |
| @@ -191,6 +192,9 @@ class OptimizeController extends BaseController | @@ -191,6 +192,9 @@ class OptimizeController extends BaseController | ||
| 191 | if(isset($this->map['optimize_manager_mid']) && !empty($this->map['optimize_manager_mid'])){ | 192 | if(isset($this->map['optimize_manager_mid']) && !empty($this->map['optimize_manager_mid'])){ |
| 192 | $query = $query->where('gl_project_deploy_optimize.manager_mid','like','%'.$this->map['optimize_manager_mid'].'%'); | 193 | $query = $query->where('gl_project_deploy_optimize.manager_mid','like','%'.$this->map['optimize_manager_mid'].'%'); |
| 193 | } | 194 | } |
| 195 | + if(isset($this->map['is_upgrade']) && !empty($this->map['is_upgrade'])){ | ||
| 196 | + $query = $query->where('gl_project.is_upgrade',$this->map['is_upgrade']); | ||
| 197 | + } | ||
| 194 | if(isset($this->map['optimize_tech_mid']) && !empty($this->map['optimize_tech_mid'])){ | 198 | if(isset($this->map['optimize_tech_mid']) && !empty($this->map['optimize_tech_mid'])){ |
| 195 | $query = $query->where('gl_project_deploy_optimize.tech_mid','like','%'.$this->map['optimize_tech_mid'].'%'); | 199 | $query = $query->where('gl_project_deploy_optimize.tech_mid','like','%'.$this->map['optimize_tech_mid'].'%'); |
| 196 | } | 200 | } |
| @@ -70,7 +70,7 @@ class AyrReleaseController extends BaseController | @@ -70,7 +70,7 @@ class AyrReleaseController extends BaseController | ||
| 70 | //参数处理 | 70 | //参数处理 |
| 71 | $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); | 71 | $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); |
| 72 | //时间处理 | 72 | //时间处理 |
| 73 | - $datetime = new \DateTime($this->param['schedule_date']); | 73 | + $datetime = new \DateTime($this->param['schedule_date'] ?? date('Y-m-d H:i:s')); |
| 74 | $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z"); | 74 | $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z"); |
| 75 | //统一生成发布 | 75 | //统一生成发布 |
| 76 | $param = [ | 76 | $param = [ |
| @@ -176,9 +176,8 @@ class BlogController extends BaseController | @@ -176,9 +176,8 @@ class BlogController extends BaseController | ||
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | /** | 178 | /** |
| 179 | - * @name :获取当前博客详情 | ||
| 180 | - * @author :liyuhang | ||
| 181 | - * @method | 179 | + * 获取当前博客详情 |
| 180 | + * @param BlogLogic $blogLogic | ||
| 182 | */ | 181 | */ |
| 183 | public function info(BlogLogic $blogLogic){ | 182 | public function info(BlogLogic $blogLogic){ |
| 184 | $this->request->validate([ | 183 | $this->request->validate([ |
| @@ -187,15 +186,17 @@ class BlogController extends BaseController | @@ -187,15 +186,17 @@ class BlogController extends BaseController | ||
| 187 | 'id.required' => 'ID不能为空' | 186 | 'id.required' => 'ID不能为空' |
| 188 | ]); | 187 | ]); |
| 189 | $info = $blogLogic->blogInfo(); | 188 | $info = $blogLogic->blogInfo(); |
| 189 | + | ||
| 190 | + $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL); | ||
| 191 | + $info['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL,$template_id, $info['id']); | ||
| 192 | + | ||
| 190 | $this->response('success',Code::SUCCESS,$info); | 193 | $this->response('success',Code::SUCCESS,$info); |
| 191 | } | 194 | } |
| 192 | 195 | ||
| 193 | /** | 196 | /** |
| 194 | - * @remark :保存数据 | ||
| 195 | - * @name :save | ||
| 196 | - * @author :lyh | ||
| 197 | - * @method :post | ||
| 198 | - * @time :2023/9/7 13:40 | 197 | + * 保存数据 |
| 198 | + * @param BlogRequest $request | ||
| 199 | + * @param BlogLogic $blogLogic | ||
| 199 | */ | 200 | */ |
| 200 | public function save(BlogRequest $request,BlogLogic $blogLogic){ | 201 | public function save(BlogRequest $request,BlogLogic $blogLogic){ |
| 201 | $request->validated(); | 202 | $request->validated(); |
| @@ -275,4 +276,37 @@ class BlogController extends BaseController | @@ -275,4 +276,37 @@ class BlogController extends BaseController | ||
| 275 | $logic->setSort(); | 276 | $logic->setSort(); |
| 276 | $this->response('success'); | 277 | $this->response('success'); |
| 277 | } | 278 | } |
| 279 | + | ||
| 280 | + /** | ||
| 281 | + * @remark :批量排序 | ||
| 282 | + * @name :allSort | ||
| 283 | + * @author :lyh | ||
| 284 | + * @method :post | ||
| 285 | + * @time :2024/1/11 9:46 | ||
| 286 | + */ | ||
| 287 | + public function allSort(BlogLogic $logic){ | ||
| 288 | + $logic->setAllSort(); | ||
| 289 | + $this->response('success'); | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + /** | ||
| 293 | + * @remark :批量设置产品分类及状态 | ||
| 294 | + * @name :batchSetCategory | ||
| 295 | + * @author :lyh | ||
| 296 | + * @method :post | ||
| 297 | + * @time :2023/8/15 17:51 | ||
| 298 | + */ | ||
| 299 | + public function batchSetCategory(BlogLogic $logic){ | ||
| 300 | + $this->request->validate([ | ||
| 301 | + 'id'=>'required', | ||
| 302 | + 'category_id'=>'required', | ||
| 303 | + 'status'=>'required' | ||
| 304 | + ],[ | ||
| 305 | + 'id.required' => '产品ID不能为空', | ||
| 306 | + 'category_id.required' => '分类ID不能为空', | ||
| 307 | + 'status.required'=>'状态不能为空' | ||
| 308 | + ]); | ||
| 309 | + $logic->batchSetCategory(); | ||
| 310 | + $this->response('success'); | ||
| 311 | + } | ||
| 278 | } | 312 | } |
| @@ -299,9 +299,4 @@ class LoginController extends BaseController | @@ -299,9 +299,4 @@ class LoginController extends BaseController | ||
| 299 | } | 299 | } |
| 300 | return $data; | 300 | return $data; |
| 301 | } | 301 | } |
| 302 | - | ||
| 303 | - public function ceshi(){ | ||
| 304 | - $ceshi = Translate::tran('Полностью Сварной Пластинчатый Теплообменник', 'en'); | ||
| 305 | - return $ceshi; | ||
| 306 | - } | ||
| 307 | } | 302 | } |
| @@ -154,18 +154,19 @@ class NewsController extends BaseController | @@ -154,18 +154,19 @@ class NewsController extends BaseController | ||
| 154 | 154 | ||
| 155 | 155 | ||
| 156 | /** | 156 | /** |
| 157 | - * @name :添加新闻时获取分类列表 | ||
| 158 | - * @author :liyuhang | ||
| 159 | - * @method | 157 | + * 添加新闻时获取分类列表 |
| 158 | + * @param NewsLogic $newsLogic | ||
| 159 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 160 | */ | 160 | */ |
| 161 | public function get_category_list(NewsLogic $newsLogic){ | 161 | public function get_category_list(NewsLogic $newsLogic){ |
| 162 | $list = $newsLogic->news_get_category_list(); | 162 | $list = $newsLogic->news_get_category_list(); |
| 163 | $this->response('success',Code::SUCCESS,$list); | 163 | $this->response('success',Code::SUCCESS,$list); |
| 164 | } | 164 | } |
| 165 | + | ||
| 165 | /** | 166 | /** |
| 166 | - * @name :获取详情 | ||
| 167 | - * @author :liyuhang | ||
| 168 | - * @method | 167 | + * 获取新闻详情 |
| 168 | + * @param NewsLogic $newsLogic | ||
| 169 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 169 | */ | 170 | */ |
| 170 | public function info(NewsLogic $newsLogic){ | 171 | public function info(NewsLogic $newsLogic){ |
| 171 | $this->request->validate([ | 172 | $this->request->validate([ |
| @@ -174,6 +175,10 @@ class NewsController extends BaseController | @@ -174,6 +175,10 @@ class NewsController extends BaseController | ||
| 174 | 'id.required' => 'ID不能为空', | 175 | 'id.required' => 'ID不能为空', |
| 175 | ]); | 176 | ]); |
| 176 | $info = $newsLogic->newsInfo(); | 177 | $info = $newsLogic->newsInfo(); |
| 178 | + | ||
| 179 | + $template_id = $this->getTemplateId(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL);//获取模版id | ||
| 180 | + $info['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id, $info['id']); | ||
| 181 | + | ||
| 177 | $this->response('success',Code::SUCCESS,$info); | 182 | $this->response('success',Code::SUCCESS,$info); |
| 178 | } | 183 | } |
| 179 | 184 | ||
| @@ -262,4 +267,38 @@ class NewsController extends BaseController | @@ -262,4 +267,38 @@ class NewsController extends BaseController | ||
| 262 | $newsLogic->setSort(); | 267 | $newsLogic->setSort(); |
| 263 | $this->response('success'); | 268 | $this->response('success'); |
| 264 | } | 269 | } |
| 270 | + | ||
| 271 | + /** | ||
| 272 | + * @remark :批量排序 | ||
| 273 | + * @name :allSort | ||
| 274 | + * @author :lyh | ||
| 275 | + * @method :post | ||
| 276 | + * @time :2024/1/11 9:47 | ||
| 277 | + */ | ||
| 278 | + public function allSort(NewsLogic $newsLogic){ | ||
| 279 | + $newsLogic->setAllSort(); | ||
| 280 | + $this->response('success'); | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + | ||
| 284 | + /** | ||
| 285 | + * @remark :批量设置产品分类及状态 | ||
| 286 | + * @name :batchSetCategory | ||
| 287 | + * @author :lyh | ||
| 288 | + * @method :post | ||
| 289 | + * @time :2023/8/15 17:51 | ||
| 290 | + */ | ||
| 291 | + public function batchSetCategory(NewsLogic $logic){ | ||
| 292 | + $this->request->validate([ | ||
| 293 | + 'id'=>'required', | ||
| 294 | + 'category_id'=>'required', | ||
| 295 | + 'status'=>'required' | ||
| 296 | + ],[ | ||
| 297 | + 'id.required' => '产品ID不能为空', | ||
| 298 | + 'category_id.required' => '分类ID不能为空', | ||
| 299 | + 'status.required'=>'状态不能为空' | ||
| 300 | + ]); | ||
| 301 | + $logic->batchSetCategory(); | ||
| 302 | + $this->response('success'); | ||
| 303 | + } | ||
| 265 | } | 304 | } |
| @@ -238,9 +238,13 @@ class ProductController extends BaseController | @@ -238,9 +238,13 @@ class ProductController extends BaseController | ||
| 238 | } | 238 | } |
| 239 | $v['keyword_id_text'] = trim($v['keyword_id_text'],','); | 239 | $v['keyword_id_text'] = trim($v['keyword_id_text'],','); |
| 240 | } | 240 | } |
| 241 | - $v['status_text'] = Product::statusMap()[$v['status']] ?? ''; | 241 | + if(!empty($v['status'])){ |
| 242 | + $v['status_text'] = Product::statusMap()[$v['status']] ?? ''; | ||
| 243 | + }else{ | ||
| 244 | + $v['status_text'] = ''; | ||
| 245 | + } | ||
| 242 | //获取当前用户选择的模版 | 246 | //获取当前用户选择的模版 |
| 243 | - $v['video'] = json_decode($v['video']); | 247 | + $v['video'] = json_decode($v['video'] ?? ''); |
| 244 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL); | 248 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL); |
| 245 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']); | 249 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']); |
| 246 | $v['url'] = $this->user['domain'].$v['route']; | 250 | $v['url'] = $this->user['domain'].$v['route']; |
| @@ -421,4 +425,16 @@ class ProductController extends BaseController | @@ -421,4 +425,16 @@ class ProductController extends BaseController | ||
| 421 | $logic->setSort(); | 425 | $logic->setSort(); |
| 422 | $this->response('success'); | 426 | $this->response('success'); |
| 423 | } | 427 | } |
| 428 | + | ||
| 429 | + /** | ||
| 430 | + * @remark :批量更新排序 | ||
| 431 | + * @name :allSort | ||
| 432 | + * @author :lyh | ||
| 433 | + * @method :post | ||
| 434 | + * @time :2024/1/10 15:34 | ||
| 435 | + */ | ||
| 436 | + public function allSort(ProductLogic $logic){ | ||
| 437 | + $logic->setAllSort(); | ||
| 438 | + $this->response('success'); | ||
| 439 | + } | ||
| 424 | } | 440 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :TranslateController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/1/12 9:39 | ||
| 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\Http\Logic\Bside\Setting\TranslateLogic; | ||
| 15 | +use App\Models\WebSetting\WebLanguage; | ||
| 16 | + | ||
| 17 | +class TranslateController extends BaseController | ||
| 18 | +{ | ||
| 19 | + /** | ||
| 20 | + * @remark :获取翻译校队列表 | ||
| 21 | + * @name :lists | ||
| 22 | + * @author :lyh | ||
| 23 | + * @method :post | ||
| 24 | + * @time :2024/1/12 9:39 | ||
| 25 | + */ | ||
| 26 | + public function lists(TranslateLogic $logic){ | ||
| 27 | + $this->request->validate([ | ||
| 28 | + 'type'=>'required', | ||
| 29 | + 'language_id'=>'required', | ||
| 30 | + 'url'=>'required', | ||
| 31 | + ],[ | ||
| 32 | + 'type.required' => 'type不能为空', | ||
| 33 | + 'language_id.required' => 'language_id不能为空', | ||
| 34 | + 'url.required' => 'url不能为空', | ||
| 35 | + ]); | ||
| 36 | + $data = $logic->getTranslateList(); | ||
| 37 | + $this->response('success',Code::SUCCESS,$data); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * @remark :图片列表 | ||
| 42 | + * @name :imageList | ||
| 43 | + * @author :lyh | ||
| 44 | + * @method :post | ||
| 45 | + * @time :2024/1/12 11:18 | ||
| 46 | + */ | ||
| 47 | + public function imageList(TranslateLogic $logic){ | ||
| 48 | + $this->request->validate([ | ||
| 49 | + 'type'=>'required', | ||
| 50 | + 'language_id'=>'required', | ||
| 51 | + 'url'=>'required', | ||
| 52 | + ],[ | ||
| 53 | + 'type.required' => 'type不能为空', | ||
| 54 | + 'language_id.required' => 'language_id不能为空', | ||
| 55 | + 'url.required' => 'url不能为空', | ||
| 56 | + ]); | ||
| 57 | + $data = $logic->getTranslateImageList(); | ||
| 58 | + $this->response('success',Code::SUCCESS,$data); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * @remark :保存数据 | ||
| 63 | + * @name :save | ||
| 64 | + * @author :lyh | ||
| 65 | + * @method :post | ||
| 66 | + * @time :2024/1/12 11:19 | ||
| 67 | + */ | ||
| 68 | + public function save(TranslateLogic $logic){ | ||
| 69 | + $this->request->validate([ | ||
| 70 | + 'type'=>'required', | ||
| 71 | + 'language_id'=>'required', | ||
| 72 | + 'url'=>'required', | ||
| 73 | + 'alias'=>'required', | ||
| 74 | + ],[ | ||
| 75 | + 'type.required' => 'type不能为空', | ||
| 76 | + 'language_id.required' => 'language_id不能为空', | ||
| 77 | + 'url.required' => 'url不能为空', | ||
| 78 | + 'alias.required' => 'url不能为空', | ||
| 79 | + ]); | ||
| 80 | + $logic->translateSave(); | ||
| 81 | + $this->response('success'); | ||
| 82 | + } | ||
| 83 | +} |
| @@ -38,7 +38,7 @@ class InitHtmlController extends BaseController | @@ -38,7 +38,7 @@ class InitHtmlController extends BaseController | ||
| 38 | 'type.required' => '类型不能为空', | 38 | 'type.required' => '类型不能为空', |
| 39 | ]); | 39 | ]); |
| 40 | $html = $logic->getDetailHtml(); | 40 | $html = $logic->getDetailHtml(); |
| 41 | - $this->response('success',Code::SUCCESS,['html'=>$html]); | 41 | + $this->response('success',Code::SUCCESS,$html); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | /** | 44 | /** |
| @@ -116,7 +116,7 @@ class CustomModuleLogic extends BaseLogic | @@ -116,7 +116,7 @@ class CustomModuleLogic extends BaseLogic | ||
| 116 | public function checkIsName($name,$id = 0){ | 116 | public function checkIsName($name,$id = 0){ |
| 117 | $param['name'] = $name; | 117 | $param['name'] = $name; |
| 118 | if(!empty($id)){ | 118 | if(!empty($id)){ |
| 119 | - $param['id'] = ['id'=>['!=',$id],]; | 119 | + $param['id'] = ['id'=>['!=',$id]]; |
| 120 | } | 120 | } |
| 121 | $info = (new CustomModule())->read($param); | 121 | $info = (new CustomModule())->read($param); |
| 122 | if($info !== false){ | 122 | if($info !== false){ |
| @@ -60,6 +60,12 @@ class CreateKeywordLogic extends BaseLogic | @@ -60,6 +60,12 @@ class CreateKeywordLogic extends BaseLogic | ||
| 60 | if($info !== false){ | 60 | if($info !== false){ |
| 61 | $this->fail('当前名称已存在'); | 61 | $this->fail('当前名称已存在'); |
| 62 | } | 62 | } |
| 63 | + }else{ | ||
| 64 | + $data['id'] = ['!=',$param['id']]; | ||
| 65 | + $info = $this->model->read($data); | ||
| 66 | + if($info !== false){ | ||
| 67 | + $this->fail('当前名称已存在'); | ||
| 68 | + } | ||
| 63 | } | 69 | } |
| 64 | return $this->success($data); | 70 | return $this->success($data); |
| 65 | } | 71 | } |
| @@ -66,43 +66,118 @@ class BTemplateLogic extends BaseLogic | @@ -66,43 +66,118 @@ class BTemplateLogic extends BaseLogic | ||
| 66 | public function getTemplateHtml(){ | 66 | public function getTemplateHtml(){ |
| 67 | $is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块 | 67 | $is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块 |
| 68 | $is_list = $this->param['is_list'] ?? 0;//是否为列表页 | 68 | $is_list = $this->param['is_list'] ?? 0;//是否为列表页 |
| 69 | - $template_id = $this->getSettingTemplate($this->param['source'],$is_list);//设置的模版id | ||
| 70 | - $templateInfo = $this->model->read([ | ||
| 71 | - 'template_id'=>$template_id, 'source'=>$this->param['source'], | ||
| 72 | - 'project_id'=>$this->user['project_id'], 'source_id'=>$this->param['source_id'], | ||
| 73 | - 'is_custom'=>$is_custom, 'is_list'=>$is_list | ||
| 74 | - ]); | 69 | + $template_id = $this->getSettingTemplate($this->param['source'],$is_list,$is_custom);//设置的模版id |
| 70 | + $templateInfo = $this->webTemplateInfo($this->param['source'],$this->param['source_id'],$template_id,$is_custom,$is_list); | ||
| 75 | if($templateInfo === false){ | 71 | if($templateInfo === false){ |
| 76 | if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//处理定制页面初始数据 | 72 | if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//处理定制页面初始数据 |
| 77 | - $html = $this->isCustomizedPage($this->param['source'],$is_list);//获取定制页面的html | ||
| 78 | - if(!empty($html)){ | ||
| 79 | - return $this->success(['html'=>$html,'template_id'=>$template_id]); | 73 | + $html = $this->customizedReturnHtml($this->param['source'],$template_id,$is_custom,$is_list); |
| 74 | + if($html !== false){ | ||
| 75 | + return $this->success($html); | ||
| 80 | } | 76 | } |
| 81 | } | 77 | } |
| 78 | + //非定制初始中间部分 | ||
| 82 | $mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码 | 79 | $mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码 |
| 83 | }else{ | 80 | }else{ |
| 84 | if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码 | 81 | if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码 |
| 85 | - $type = $this->getCustomizedType($this->param['source'],$is_list); | ||
| 86 | - $commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部 | ||
| 87 | - $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); | ||
| 88 | - return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]); | 82 | + return $this->getCustomizeAllHtml($templateInfo,$template_id,$is_custom,$is_list); |
| 89 | } | 83 | } |
| 90 | $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; | 84 | $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; |
| 91 | } | 85 | } |
| 92 | - $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,$template_id,$is_custom);//获取定制头部 | ||
| 93 | - $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. | ||
| 94 | - $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; | 86 | + $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,$template_id,$is_custom);//获取非定制头部 |
| 87 | + $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; | ||
| 95 | $html = $this->getHeadFooter($html); | 88 | $html = $this->getHeadFooter($html); |
| 96 | $result = ['html'=>$html,'template_id'=>$template_id]; | 89 | $result = ['html'=>$html,'template_id'=>$template_id]; |
| 97 | - if($templateInfo !== false) | ||
| 98 | - { | ||
| 99 | - $result['id'] = $templateInfo['id']; | ||
| 100 | - $result['updated_at'] = $templateInfo['updated_at']; | ||
| 101 | - } | 90 | + if($templateInfo !== false) {$result['id'] = $templateInfo['id'];$result['updated_at'] = $templateInfo['updated_at'];} |
| 102 | return $this->success($result); | 91 | return $this->success($result); |
| 103 | } | 92 | } |
| 104 | 93 | ||
| 105 | /** | 94 | /** |
| 95 | + * @remark :获取整个html代码 | ||
| 96 | + * @name :getCustomizeAllHtml | ||
| 97 | + * @author :lyh | ||
| 98 | + * @method :post | ||
| 99 | + * @time :2024/1/10 14:15 | ||
| 100 | + */ | ||
| 101 | + public function getCustomizeAllHtml($templateInfo,$template_id,$is_custom,$is_list){ | ||
| 102 | + if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 103 | + $commonInfo = $this->getCustomizedCommonHtml($this->param['source'],$is_custom,$is_list);//获取定制头部 | ||
| 104 | + $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); | ||
| 105 | + }else{ | ||
| 106 | + $type = $this->getCustomizedType($this->param['source'],$is_list); | ||
| 107 | + $commonInfo = $this->getCustomizedCommonHtml($type,$is_custom,$is_list);//获取定制头部 | ||
| 108 | + $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); | ||
| 109 | + } | ||
| 110 | + return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * @remark :获取装修详情 | ||
| 115 | + * @name :webTemplateInfo | ||
| 116 | + * @author :lyh | ||
| 117 | + * @method :post | ||
| 118 | + * @time :2024/1/10 13:43 | ||
| 119 | + */ | ||
| 120 | + public function webTemplateInfo($source,$source_id,$template_id,$is_custom,$is_list){ | ||
| 121 | + $templateInfo = $this->model->read([ | ||
| 122 | + 'template_id'=>$template_id, 'source'=>$source, | ||
| 123 | + 'project_id'=>$this->user['project_id'], 'source_id'=>$source_id, | ||
| 124 | + 'is_custom'=>$is_custom, 'is_list'=>$is_list | ||
| 125 | + ]); | ||
| 126 | + return $this->success($templateInfo); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * @remark :定制页面获取html | ||
| 131 | + * @name :customizedReturnHtml | ||
| 132 | + * @author :lyh | ||
| 133 | + * @method :post | ||
| 134 | + * @time :2024/1/10 13:46 | ||
| 135 | + */ | ||
| 136 | + public function customizedReturnHtml($source,$template_id,$is_custom,$is_list){ | ||
| 137 | + //TODO::扩展模块定制单独处理 | ||
| 138 | + if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 139 | + $customModuleModel = new CustomModule(); | ||
| 140 | + $info = $customModuleModel->read(['id'=>$source]); | ||
| 141 | + if($info === false){ | ||
| 142 | + $this->fail('当前扩展模块不存在或已被删除'); | ||
| 143 | + } | ||
| 144 | + //扩展模块定制 | ||
| 145 | + if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION){ | ||
| 146 | + $html = $this->customModuleCustomizeHtml($source,$is_list,$is_custom); | ||
| 147 | + return $this->success(['html'=>$html,'template_id'=>$template_id]); | ||
| 148 | + } | ||
| 149 | + return false; | ||
| 150 | + } | ||
| 151 | + //TODO::默认模块定制 | ||
| 152 | + $html = $this->isCustomizedPage($source,$is_list,$is_custom);//获取定制页面的html | ||
| 153 | + if(!empty($html)){ | ||
| 154 | + return $this->success(['html'=>$html,'template_id'=>$template_id]); | ||
| 155 | + } | ||
| 156 | + return false; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + /** | ||
| 160 | + * @remark :扩展模块定制html | ||
| 161 | + * @name :customModuleInfo | ||
| 162 | + * @author :lyh | ||
| 163 | + * @method :post | ||
| 164 | + * @time :2024/1/10 9:20 | ||
| 165 | + */ | ||
| 166 | + public function customModuleCustomizeHtml($source,$is_list,$is_custom){ | ||
| 167 | + $bTemplateMainModel = new BTemplateMain(); | ||
| 168 | + //TODO::获取初始代码 | ||
| 169 | + $customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom]); | ||
| 170 | + if($customHtmlInfo === false){ | ||
| 171 | + $this->fail('定制页面,请先上传代码块'); | ||
| 172 | + } | ||
| 173 | + $commonInfo = $this->getCustomizedCommonHtml($source,$is_custom,$is_list);//获取定制头部 | ||
| 174 | + if($commonInfo !== false){ | ||
| 175 | + $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); | ||
| 176 | + } | ||
| 177 | + return $customHtmlInfo['main_html']; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + /** | ||
| 106 | * @remark :获取中间部分的html | 181 | * @remark :获取中间部分的html |
| 107 | * @name :getMAinHtml | 182 | * @name :getMAinHtml |
| 108 | * @author :lyh | 183 | * @author :lyh |
| @@ -163,7 +238,7 @@ class BTemplateLogic extends BaseLogic | @@ -163,7 +238,7 @@ class BTemplateLogic extends BaseLogic | ||
| 163 | * @method :post | 238 | * @method :post |
| 164 | * @time :2023/12/13 10:55 | 239 | * @time :2023/12/13 10:55 |
| 165 | */ | 240 | */ |
| 166 | - public function isCustomizedPage($source,$is_list) | 241 | + public function isCustomizedPage($source,$is_list,$is_custom) |
| 167 | { | 242 | { |
| 168 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 | 243 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 |
| 169 | //查看当前页面是否定制,是否开启可视化 | 244 | //查看当前页面是否定制,是否开启可视化 |
| @@ -171,17 +246,17 @@ class BTemplateLogic extends BaseLogic | @@ -171,17 +246,17 @@ class BTemplateLogic extends BaseLogic | ||
| 171 | if (in_array($type, $page_array)) {//是定制界面 | 246 | if (in_array($type, $page_array)) {//是定制界面 |
| 172 | //TODO::获取初始代码 | 247 | //TODO::获取初始代码 |
| 173 | $bTemplateMainModel = new BTemplateMain(); | 248 | $bTemplateMainModel = new BTemplateMain(); |
| 174 | - $customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_list'=>$is_list]); | 249 | + $customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_custom'=>$is_custom,'is_list'=>$is_list]); |
| 175 | if($customHtmlInfo === false){ | 250 | if($customHtmlInfo === false){ |
| 176 | $this->fail('定制页面,请先上传代码块'); | 251 | $this->fail('定制页面,请先上传代码块'); |
| 177 | } | 252 | } |
| 178 | - $commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部 | 253 | + $commonInfo = $this->getCustomizedCommonHtml($type,$is_custom,$is_list);//获取定制头部 |
| 179 | if($commonInfo !== false){ | 254 | if($commonInfo !== false){ |
| 180 | $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); | 255 | $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); |
| 181 | } | 256 | } |
| 182 | return $customHtmlInfo['main_html']; | 257 | return $customHtmlInfo['main_html']; |
| 183 | } | 258 | } |
| 184 | - return []; | 259 | + return false; |
| 185 | } | 260 | } |
| 186 | 261 | ||
| 187 | /** | 262 | /** |
| @@ -191,11 +266,13 @@ class BTemplateLogic extends BaseLogic | @@ -191,11 +266,13 @@ class BTemplateLogic extends BaseLogic | ||
| 191 | * @method :post | 266 | * @method :post |
| 192 | * @time :2023/12/29 13:13 | 267 | * @time :2023/12/29 13:13 |
| 193 | */ | 268 | */ |
| 194 | - public function getCustomizedCommonHtml($type){ | 269 | + public function getCustomizedCommonHtml($type,$is_custom = 0,$is_list = 0){ |
| 195 | $data = [ | 270 | $data = [ |
| 196 | 'template_id' => 0, | 271 | 'template_id' => 0, |
| 197 | 'project_id' => $this->user['project_id'], | 272 | 'project_id' => $this->user['project_id'], |
| 198 | - 'type'=>$type | 273 | + 'type'=>$type, |
| 274 | + 'is_custom'=>$is_custom, | ||
| 275 | + 'is_list'=>$is_list | ||
| 199 | ]; | 276 | ]; |
| 200 | $commonTemplateModel = new BTemplateCommon(); | 277 | $commonTemplateModel = new BTemplateCommon(); |
| 201 | return $commonTemplateModel->read($data); | 278 | return $commonTemplateModel->read($data); |
| @@ -241,14 +318,25 @@ class BTemplateLogic extends BaseLogic | @@ -241,14 +318,25 @@ class BTemplateLogic extends BaseLogic | ||
| 241 | * @method :post | 318 | * @method :post |
| 242 | * @time :2023/12/13 10:48 | 319 | * @time :2023/12/13 10:48 |
| 243 | */ | 320 | */ |
| 244 | - public function getSettingTemplate($source,$is_list){ | 321 | + public function getSettingTemplate($source,$is_list,$is_custom){ |
| 245 | $template_id = 0; | 322 | $template_id = 0; |
| 246 | if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目 | 323 | if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目 |
| 247 | - $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 | ||
| 248 | - //查看当前页面是否定制,是否开启可视化 | ||
| 249 | - $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 | ||
| 250 | - if (in_array($type, $page_array)) {//是定制界面 | ||
| 251 | - return $this->success($template_id); | 324 | + if($is_custom == BTemplate::IS_CUSTOM){ |
| 325 | + $customModuleModel = new CustomModule(); | ||
| 326 | + $info = $customModuleModel->read(['id'=>$source]); | ||
| 327 | + if($info === false){ | ||
| 328 | + $this->fail('当前扩展模块不存在或已被删除'); | ||
| 329 | + } | ||
| 330 | + if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION){ | ||
| 331 | + return $this->success($template_id); | ||
| 332 | + } | ||
| 333 | + }else{ | ||
| 334 | + $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 | ||
| 335 | + //查看当前页面是否定制,是否开启可视化 | ||
| 336 | + $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 | ||
| 337 | + if (in_array($type, $page_array)) {//是定制界面 | ||
| 338 | + return $this->success($template_id); | ||
| 339 | + } | ||
| 252 | } | 340 | } |
| 253 | } | 341 | } |
| 254 | $bSettingModel = new Setting(); | 342 | $bSettingModel = new Setting(); |
| @@ -272,7 +360,8 @@ class BTemplateLogic extends BaseLogic | @@ -272,7 +360,8 @@ class BTemplateLogic extends BaseLogic | ||
| 272 | $data = [ | 360 | $data = [ |
| 273 | 'template_id' => $template_id, | 361 | 'template_id' => $template_id, |
| 274 | 'project_id' => $this->user['project_id'], | 362 | 'project_id' => $this->user['project_id'], |
| 275 | - 'type'=>$type | 363 | + 'type'=>$type, |
| 364 | + 'is_custom'=>0, | ||
| 276 | ]; | 365 | ]; |
| 277 | $commonTemplateModel = new BTemplateCommon(); | 366 | $commonTemplateModel = new BTemplateCommon(); |
| 278 | $commonInfo = $commonTemplateModel->read($data); | 367 | $commonInfo = $commonTemplateModel->read($data); |
| @@ -294,16 +383,10 @@ class BTemplateLogic extends BaseLogic | @@ -294,16 +383,10 @@ class BTemplateLogic extends BaseLogic | ||
| 294 | * @time :2023/6/29 11:05 | 383 | * @time :2023/6/29 11:05 |
| 295 | */ | 384 | */ |
| 296 | public function templateSave(){ | 385 | public function templateSave(){ |
| 297 | - //演示项目不允许修改 | 386 | + //TODO::演示项目不允许修改 |
| 298 | $this->showProjectNoEdit($this->param['source']); | 387 | $this->showProjectNoEdit($this->param['source']); |
| 299 | $this->param = $this->handleDefaultString($this->param);//设置默认数据 | 388 | $this->param = $this->handleDefaultString($this->param);//设置默认数据 |
| 300 | - $templateInfo = $this->model->read([ | ||
| 301 | - 'template_id'=>$this->param['template_id'], | ||
| 302 | - 'source'=>$this->param['source'], | ||
| 303 | - 'source_id'=>$this->param['source_id'], | ||
| 304 | - 'is_custom'=>$this->param['is_custom'], | ||
| 305 | - 'is_list'=>$this->param['is_list'] | ||
| 306 | - ]); | 389 | + $templateInfo = $this->webTemplateInfo($this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom'],$this->param['is_list']); |
| 307 | if($templateInfo === false){//执行新增 | 390 | if($templateInfo === false){//执行新增 |
| 308 | $data = [ | 391 | $data = [ |
| 309 | 'source'=>$this->param['source'], 'source_id'=>$this->param['source_id'],'type'=>BTemplate::PAGE_HTML, | 392 | 'source'=>$this->param['source'], 'source_id'=>$this->param['source_id'],'type'=>BTemplate::PAGE_HTML, |
| @@ -311,7 +394,7 @@ class BTemplateLogic extends BaseLogic | @@ -311,7 +394,7 @@ class BTemplateLogic extends BaseLogic | ||
| 311 | 'section_list_id'=>$this->param['section_list_id'],'is_custom'=>$this->param['is_custom'], | 394 | 'section_list_id'=>$this->param['section_list_id'],'is_custom'=>$this->param['is_custom'], |
| 312 | 'is_list'=>$this->param['is_list'] | 395 | 'is_list'=>$this->param['is_list'] |
| 313 | ]; | 396 | ]; |
| 314 | - $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$data); | 397 | + $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['is_custom'],$data); |
| 315 | $this->model->add($data); | 398 | $this->model->add($data); |
| 316 | }else{//执行编辑 | 399 | }else{//执行编辑 |
| 317 | $condition = [ | 400 | $condition = [ |
| @@ -322,7 +405,7 @@ class BTemplateLogic extends BaseLogic | @@ -322,7 +405,7 @@ class BTemplateLogic extends BaseLogic | ||
| 322 | $data = [ | 405 | $data = [ |
| 323 | 'section_list_id'=>$this->param['section_list_id'] | 406 | 'section_list_id'=>$this->param['section_list_id'] |
| 324 | ]; | 407 | ]; |
| 325 | - $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$data); | 408 | + $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['is_custom'],$data); |
| 326 | $this->model->edit($data,$condition); | 409 | $this->model->edit($data,$condition); |
| 327 | } | 410 | } |
| 328 | //更新头部信息 | 411 | //更新头部信息 |
| @@ -355,7 +438,7 @@ class BTemplateLogic extends BaseLogic | @@ -355,7 +438,7 @@ class BTemplateLogic extends BaseLogic | ||
| 355 | * @method :post | 438 | * @method :post |
| 356 | * @time :2023/12/15 10:59 | 439 | * @time :2023/12/15 10:59 |
| 357 | */ | 440 | */ |
| 358 | - public function handleVisualizationParam($html,$source, $is_list,$data){ | 441 | + public function handleVisualizationParam($html,$source, $is_list,$is_custom,$data){ |
| 359 | if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目 | 442 | if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目 |
| 360 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 | 443 | $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 |
| 361 | //查看当前页面是否定制,是否开启可视化 | 444 | //查看当前页面是否定制,是否开启可视化 |
| @@ -364,6 +447,19 @@ class BTemplateLogic extends BaseLogic | @@ -364,6 +447,19 @@ class BTemplateLogic extends BaseLogic | ||
| 364 | $data['html'] = $html; | 447 | $data['html'] = $html; |
| 365 | $data['type'] = BTemplate::ALL_HTML; | 448 | $data['type'] = BTemplate::ALL_HTML; |
| 366 | }else{ | 449 | }else{ |
| 450 | + //TODO::扩展模块定制单独处理 | ||
| 451 | + if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 452 | + $customModuleModel = new CustomModule(); | ||
| 453 | + $info = $customModuleModel->read(['id'=>$source]); | ||
| 454 | + if($info === false){ | ||
| 455 | + $this->fail('当前扩展模块不存在或已被删除'); | ||
| 456 | + } | ||
| 457 | + //todo::扩展模块(列表页/详情页)定制 | ||
| 458 | + if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) { | ||
| 459 | + $data['html'] = $html; | ||
| 460 | + $data['type'] = BTemplate::ALL_HTML; | ||
| 461 | + } | ||
| 462 | + } | ||
| 367 | $mainInfo = $this->handleTemplateHtml($html); | 463 | $mainInfo = $this->handleTemplateHtml($html); |
| 368 | $data['main_html'] = $mainInfo['main_html']; | 464 | $data['main_html'] = $mainInfo['main_html']; |
| 369 | $data['main_css'] = $mainInfo['main_css']; | 465 | $data['main_css'] = $mainInfo['main_css']; |
| @@ -376,7 +472,6 @@ class BTemplateLogic extends BaseLogic | @@ -376,7 +472,6 @@ class BTemplateLogic extends BaseLogic | ||
| 376 | return $data; | 472 | return $data; |
| 377 | } | 473 | } |
| 378 | 474 | ||
| 379 | - | ||
| 380 | /** | 475 | /** |
| 381 | * @remark :保存公共头部底部 | 476 | * @remark :保存公共头部底部 |
| 382 | * @name :saveCommonHtml | 477 | * @name :saveCommonHtml |
| @@ -385,12 +480,20 @@ class BTemplateLogic extends BaseLogic | @@ -385,12 +480,20 @@ class BTemplateLogic extends BaseLogic | ||
| 385 | * @time :2023/12/13 17:05 | 480 | * @time :2023/12/13 17:05 |
| 386 | */ | 481 | */ |
| 387 | public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){ | 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 | + //其他情况 | ||
| 388 | $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面) | 491 | $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面) |
| 389 | if($template_id == 0){//定制页面默认为独立头部 | 492 | if($template_id == 0){//定制页面默认为独立头部 |
| 390 | $type = $this->getCustomizedType($source,$is_list);//定制默认独立头部 | 493 | $type = $this->getCustomizedType($source,$is_list);//定制默认独立头部 |
| 391 | } | 494 | } |
| 392 | $templateCommonModel = new BTemplateCommon(); | 495 | $templateCommonModel = new BTemplateCommon(); |
| 393 | - $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在 | 496 | + $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type,'is_custom'=>0]);//查看当前头部是否存在 |
| 394 | $handleInfo = $this->handleCommonParam($html); | 497 | $handleInfo = $this->handleCommonParam($html); |
| 395 | if($commonInfo === false){ | 498 | if($commonInfo === false){ |
| 396 | $data = [ | 499 | $data = [ |
| @@ -411,6 +514,45 @@ class BTemplateLogic extends BaseLogic | @@ -411,6 +514,45 @@ class BTemplateLogic extends BaseLogic | ||
| 411 | } | 514 | } |
| 412 | 515 | ||
| 413 | /** | 516 | /** |
| 517 | + * @remark :扩展模块定制保存头部处理 | ||
| 518 | + * @name :saveCustomModuleCommonHtml | ||
| 519 | + * @author :lyh | ||
| 520 | + * @method :post | ||
| 521 | + * @time :2024/1/10 11:33 | ||
| 522 | + */ | ||
| 523 | + public function saveCustomModuleCommonHtml($html,$source,$is_custom,$is_list,$template_id){ | ||
| 524 | + $customModuleModel = new CustomModule(); | ||
| 525 | + $info = $customModuleModel->read(['id'=>$source]); | ||
| 526 | + if($info === false){ | ||
| 527 | + $this->fail('当前扩展模块不存在或已被删除'); | ||
| 528 | + } | ||
| 529 | + //todo::扩展模块(列表页/详情页)定制 | ||
| 530 | + if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) { | ||
| 531 | + $data = ['type'=>$source,'is_custom'=>$is_custom,'is_list'=>$is_list,'template_id'=>$template_id]; | ||
| 532 | + $templateCommonModel = new BTemplateCommon(); | ||
| 533 | + $commonInfo = $templateCommonModel->read($data);//查看当前头部是否存在 | ||
| 534 | + $handleInfo = $this->handleCommonParam($html); | ||
| 535 | + if($commonInfo === false){ | ||
| 536 | + $data = [ | ||
| 537 | + 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 538 | + 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 539 | + 'type'=>$source,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'], | ||
| 540 | + 'is_custom'=>$is_custom,'is_list'=>$is_list, | ||
| 541 | + ]; | ||
| 542 | + $templateCommonModel->add($data); | ||
| 543 | + }else{ | ||
| 544 | + $data = [ | ||
| 545 | + 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'], | ||
| 546 | + 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | ||
| 547 | + ]; | ||
| 548 | + $templateCommonModel->edit($data,['id'=>$commonInfo['id']]); | ||
| 549 | + } | ||
| 550 | + return false; | ||
| 551 | + } | ||
| 552 | + return true; | ||
| 553 | + } | ||
| 554 | + | ||
| 555 | + /** | ||
| 414 | * @remark :演示项目不允许修改首页 | 556 | * @remark :演示项目不允许修改首页 |
| 415 | * @name :showProject | 557 | * @name :showProject |
| 416 | * @author :lyh | 558 | * @author :lyh |
| @@ -457,7 +599,7 @@ class BTemplateLogic extends BaseLogic | @@ -457,7 +599,7 @@ class BTemplateLogic extends BaseLogic | ||
| 457 | return $this->success($param); | 599 | return $this->success($param); |
| 458 | } | 600 | } |
| 459 | /** | 601 | /** |
| 460 | - * @remark :保存时获取获取设置的类型 | 602 | + * @remark :(非定制)保存时获取获取设置的类型 |
| 461 | * @name :getType | 603 | * @name :getType |
| 462 | * @author :lyh | 604 | * @author :lyh |
| 463 | * @method :post | 605 | * @method :post |
| @@ -38,6 +38,7 @@ class InitHtmlLogic extends BaseLogic | @@ -38,6 +38,7 @@ class InitHtmlLogic extends BaseLogic | ||
| 38 | $template_id = $this->getTemplateId(); | 38 | $template_id = $this->getTemplateId(); |
| 39 | $is_custom = $this->param['is_custom'] ?? 0;//TODO::1:代表扩展模块 | 39 | $is_custom = $this->param['is_custom'] ?? 0;//TODO::1:代表扩展模块 |
| 40 | $is_list = $this->param['is_list'] ?? 0;//TODO::1:代表分类列表模块 | 40 | $is_list = $this->param['is_list'] ?? 0;//TODO::1:代表分类列表模块 |
| 41 | + $data = array(); | ||
| 41 | //获取设置的默认中间部分 | 42 | //获取设置的默认中间部分 |
| 42 | $bTemplateMainModel = new BTemplateMain(); | 43 | $bTemplateMainModel = new BTemplateMain(); |
| 43 | $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_list'=>$is_list,'is_custom'=>$is_custom]); | 44 | $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_list'=>$is_list,'is_custom'=>$is_custom]); |
| @@ -47,11 +48,14 @@ class InitHtmlLogic extends BaseLogic | @@ -47,11 +48,14 @@ class InitHtmlLogic extends BaseLogic | ||
| 47 | }else{ | 48 | }else{ |
| 48 | $main_html = $mainInfo['main_html']; | 49 | $main_html = $mainInfo['main_html']; |
| 49 | $main_style = $mainInfo['main_css']; | 50 | $main_style = $mainInfo['main_css']; |
| 51 | + $data['id'] = $mainInfo['id']; | ||
| 52 | + $data['updated_at'] = $mainInfo['updated_at']; | ||
| 50 | } | 53 | } |
| 51 | $commonInfo = $this->getCommonHtml($this->param['type'],$is_list,$template_id,$is_custom); //获取头部 | 54 | $commonInfo = $this->getCommonHtml($this->param['type'],$is_list,$template_id,$is_custom); //获取头部 |
| 52 | $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html']; | 55 | $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html']; |
| 53 | $html = $this->getHeadFooter($html);//组装数据 | 56 | $html = $this->getHeadFooter($html);//组装数据 |
| 54 | - return $this->success($html); | 57 | + $data['html'] = $html; |
| 58 | + return $this->success($data); | ||
| 55 | } | 59 | } |
| 56 | 60 | ||
| 57 | /** | 61 | /** |
| @@ -259,14 +263,20 @@ class InitHtmlLogic extends BaseLogic | @@ -259,14 +263,20 @@ class InitHtmlLogic extends BaseLogic | ||
| 259 | */ | 263 | */ |
| 260 | public function getCustomizedHtml(){ | 264 | public function getCustomizedHtml(){ |
| 261 | $is_list = $this->param['is_list'] ?? 0; | 265 | $is_list = $this->param['is_list'] ?? 0; |
| 266 | + $is_custom = $this->param['is_custom'] ?? 0; | ||
| 262 | $bTemplateMainModel = new BTemplateMain(); | 267 | $bTemplateMainModel = new BTemplateMain(); |
| 263 | - $info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]); | 268 | + $info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]); |
| 264 | if($info === false){ | 269 | if($info === false){ |
| 265 | $html = ''; | 270 | $html = ''; |
| 266 | }else{ | 271 | }else{ |
| 267 | - $type = $this->getCustomizedType($this->param['type'],$is_list); | 272 | + //扩展模块获取头部 |
| 273 | + if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 274 | + $type = $this->param['type']; | ||
| 275 | + }else{ | ||
| 276 | + $type = $this->getCustomizedType($this->param['type'],$is_list); | ||
| 277 | + } | ||
| 268 | $commonTemplateModel = new BTemplateCommon(); | 278 | $commonTemplateModel = new BTemplateCommon(); |
| 269 | - $commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type]); | 279 | + $commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]); |
| 270 | if($commonInfo !== false){ | 280 | if($commonInfo !== false){ |
| 271 | $info['main_html'] = $this->handleAllHtml($commonInfo,$info['main_html']); | 281 | $info['main_html'] = $this->handleAllHtml($commonInfo,$info['main_html']); |
| 272 | } | 282 | } |
| @@ -303,21 +313,23 @@ class InitHtmlLogic extends BaseLogic | @@ -303,21 +313,23 @@ class InitHtmlLogic extends BaseLogic | ||
| 303 | public function saveCustomizedHtml(){ | 313 | public function saveCustomizedHtml(){ |
| 304 | try { | 314 | try { |
| 305 | $is_list = $this->param['is_list'] ?? 0; | 315 | $is_list = $this->param['is_list'] ?? 0; |
| 316 | + $is_custom = $this->param['is_custom'] ?? 0; | ||
| 306 | $bTemplateMainModel = new BTemplateMain(); | 317 | $bTemplateMainModel = new BTemplateMain(); |
| 307 | - $mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]); | 318 | + $mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]); |
| 308 | if($mainInfo === false){ | 319 | if($mainInfo === false){ |
| 309 | $mainData = [ | 320 | $mainData = [ |
| 310 | 'project_id'=>$this->user['project_id'], | 321 | 'project_id'=>$this->user['project_id'], |
| 311 | 'type'=>$this->param['type'], | 322 | 'type'=>$this->param['type'], |
| 312 | 'is_list'=>$is_list, | 323 | 'is_list'=>$is_list, |
| 313 | - 'main_html'=>$this->param['html'] | 324 | + 'main_html'=>$this->param['html'], |
| 325 | + 'is_custom'=>$is_custom | ||
| 314 | ]; | 326 | ]; |
| 315 | $bTemplateMainModel->add($mainData); | 327 | $bTemplateMainModel->add($mainData); |
| 316 | }else{ | 328 | }else{ |
| 317 | $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); | 329 | $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); |
| 318 | } | 330 | } |
| 319 | //更新头部底部 | 331 | //更新头部底部 |
| 320 | - $this->saveCustomizeCommon($this->param['html'],$this->param['type'],$is_list); | 332 | + $this->saveCustomizeCommon($this->param['html'],$this->param['type'],$is_list,$is_custom); |
| 321 | }catch (\Exception $exception){ | 333 | }catch (\Exception $exception){ |
| 322 | $this->fail('保存失败,请联系开发人员'); | 334 | $this->fail('保存失败,请联系开发人员'); |
| 323 | } | 335 | } |
| @@ -331,16 +343,21 @@ class InitHtmlLogic extends BaseLogic | @@ -331,16 +343,21 @@ class InitHtmlLogic extends BaseLogic | ||
| 331 | * @method :post | 343 | * @method :post |
| 332 | * @time :2024/1/6 10:29 | 344 | * @time :2024/1/6 10:29 |
| 333 | */ | 345 | */ |
| 334 | - public function saveCustomizeCommon($html,$source,$is_list){ | ||
| 335 | - $type = $this->getCustomizedType($source,$is_list); | 346 | + public function saveCustomizeCommon($html,$source,$is_list,$is_custom){ |
| 347 | + if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 348 | + $type = $source; | ||
| 349 | + }else{ | ||
| 350 | + $type = $this->getCustomizedType($source,$is_list); | ||
| 351 | + } | ||
| 336 | $templateCommonModel = new BTemplateCommon(); | 352 | $templateCommonModel = new BTemplateCommon(); |
| 337 | - $commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type]);//查看当前头部是否存在 | 353 | + $commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]);//查看当前头部是否存在 |
| 338 | $handleInfo = $this->handleCommonParam($html); | 354 | $handleInfo = $this->handleCommonParam($html); |
| 339 | if($commonInfo === false){ | 355 | if($commonInfo === false){ |
| 340 | $data = [ | 356 | $data = [ |
| 341 | 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'], | 357 | 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'], |
| 342 | 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | 358 | 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], |
| 343 | 'type'=>$type,'template_id'=>0, 'project_id'=>$this->user['project_id'], | 359 | 'type'=>$type,'template_id'=>0, 'project_id'=>$this->user['project_id'], |
| 360 | + 'is_custom'=>$is_custom,'is_list'=>$is_list | ||
| 344 | ]; | 361 | ]; |
| 345 | $templateCommonModel->add($data); | 362 | $templateCommonModel->add($data); |
| 346 | }else{ | 363 | }else{ |
| @@ -234,6 +234,20 @@ class BlogLogic extends BaseLogic | @@ -234,6 +234,20 @@ class BlogLogic extends BaseLogic | ||
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | /** | 236 | /** |
| 237 | + * @remark : | ||
| 238 | + * @name :setAllSort | ||
| 239 | + * @author :lyh | ||
| 240 | + * @method :post | ||
| 241 | + * @time :2024/1/10 15:40 | ||
| 242 | + */ | ||
| 243 | + public function setAllSort(){ | ||
| 244 | + foreach ($this->param['data'] as $k => $v){ | ||
| 245 | + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]); | ||
| 246 | + } | ||
| 247 | + return $this->success(); | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + /** | ||
| 237 | * 博客导入 | 251 | * 博客导入 |
| 238 | * @param $project_id | 252 | * @param $project_id |
| 239 | * @param $user_id | 253 | * @param $user_id |
| @@ -348,4 +362,32 @@ class BlogLogic extends BaseLogic | @@ -348,4 +362,32 @@ class BlogLogic extends BaseLogic | ||
| 348 | 362 | ||
| 349 | return false; | 363 | return false; |
| 350 | } | 364 | } |
| 365 | + | ||
| 366 | + /** | ||
| 367 | + * @remark :批量设置产品分类及状态 | ||
| 368 | + * @name :batchSetCategory | ||
| 369 | + * @author :lyh | ||
| 370 | + * @method :post | ||
| 371 | + * @time :2023/8/15 17:53 | ||
| 372 | + */ | ||
| 373 | + public function batchSetCategory(){ | ||
| 374 | + if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { | ||
| 375 | + DB::connection('custom_mysql')->beginTransaction(); | ||
| 376 | + $this->param['category_id'] = ','.implode(',',$this->param['category_id']).','; | ||
| 377 | + try { | ||
| 378 | + //批量 | ||
| 379 | + $param = [ | ||
| 380 | + 'category_id'=>$this->param['category_id'], | ||
| 381 | + 'status'=>$this->param['status'] | ||
| 382 | + ]; | ||
| 383 | + $this->model->edit($param,['id'=>['in',$this->param['id']]]); | ||
| 384 | + DB::connection('custom_mysql')->commit(); | ||
| 385 | + //对应添加关联表 | ||
| 386 | + }catch (\Exception $e){ | ||
| 387 | + DB::connection('custom_mysql')->rollBack(); | ||
| 388 | + $this->fail('系统错误,请联系管理员'); | ||
| 389 | + } | ||
| 390 | + } | ||
| 391 | + return $this->success(); | ||
| 392 | + } | ||
| 351 | } | 393 | } |
| @@ -250,6 +250,21 @@ class NewsLogic extends BaseLogic | @@ -250,6 +250,21 @@ class NewsLogic extends BaseLogic | ||
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | /** | 252 | /** |
| 253 | + * @remark : | ||
| 254 | + * @name :setAllSort | ||
| 255 | + * @author :lyh | ||
| 256 | + * @method :post | ||
| 257 | + * @time :2024/1/10 15:40 | ||
| 258 | + */ | ||
| 259 | + public function setAllSort(){ | ||
| 260 | + foreach ($this->param['data'] as $k => $v){ | ||
| 261 | + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]); | ||
| 262 | + } | ||
| 263 | + return $this->success(); | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + | ||
| 267 | + /** | ||
| 253 | * @remark :删除路由 | 268 | * @remark :删除路由 |
| 254 | * @name :delRoute | 269 | * @name :delRoute |
| 255 | * @author :lyh | 270 | * @author :lyh |
| @@ -381,4 +396,32 @@ class NewsLogic extends BaseLogic | @@ -381,4 +396,32 @@ class NewsLogic extends BaseLogic | ||
| 381 | 396 | ||
| 382 | return false; | 397 | return false; |
| 383 | } | 398 | } |
| 399 | + | ||
| 400 | + /** | ||
| 401 | + * @remark :批量设置产品分类及状态 | ||
| 402 | + * @name :batchSetCategory | ||
| 403 | + * @author :lyh | ||
| 404 | + * @method :post | ||
| 405 | + * @time :2023/8/15 17:53 | ||
| 406 | + */ | ||
| 407 | + public function batchSetCategory(){ | ||
| 408 | + if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { | ||
| 409 | + DB::connection('custom_mysql')->beginTransaction(); | ||
| 410 | + $this->param['category_id'] = ','.implode(',',$this->param['category_id']).','; | ||
| 411 | + try { | ||
| 412 | + //批量 | ||
| 413 | + $param = [ | ||
| 414 | + 'category_id'=>$this->param['category_id'], | ||
| 415 | + 'status'=>$this->param['status'] | ||
| 416 | + ]; | ||
| 417 | + $this->model->edit($param,['id'=>['in',$this->param['id']]]); | ||
| 418 | + DB::connection('custom_mysql')->commit(); | ||
| 419 | + //对应添加关联表 | ||
| 420 | + }catch (\Exception $e){ | ||
| 421 | + DB::connection('custom_mysql')->rollBack(); | ||
| 422 | + $this->fail('系统错误,请联系管理员'); | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + return $this->success(); | ||
| 426 | + } | ||
| 384 | } | 427 | } |
| @@ -599,6 +599,20 @@ class ProductLogic extends BaseLogic | @@ -599,6 +599,20 @@ class ProductLogic extends BaseLogic | ||
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | /** | 601 | /** |
| 602 | + * @remark : | ||
| 603 | + * @name :setAllSort | ||
| 604 | + * @author :lyh | ||
| 605 | + * @method :post | ||
| 606 | + * @time :2024/1/10 15:40 | ||
| 607 | + */ | ||
| 608 | + public function setAllSort(){ | ||
| 609 | + foreach ($this->param['data'] as $k => $v){ | ||
| 610 | + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]); | ||
| 611 | + } | ||
| 612 | + return $this->success(); | ||
| 613 | + } | ||
| 614 | + | ||
| 615 | + /** | ||
| 602 | * 产品导入 | 616 | * 产品导入 |
| 603 | * @param $project_id | 617 | * @param $project_id |
| 604 | * @param $user_id | 618 | * @param $user_id |
| @@ -722,13 +736,11 @@ class ProductLogic extends BaseLogic | @@ -722,13 +736,11 @@ class ProductLogic extends BaseLogic | ||
| 722 | if($data[10]??''){ | 736 | if($data[10]??''){ |
| 723 | $seo_description = substr(strip_tags($data[10]),0,200); | 737 | $seo_description = substr(strip_tags($data[10]),0,200); |
| 724 | } | 738 | } |
| 725 | - | ||
| 726 | $seo_mate = [ | 739 | $seo_mate = [ |
| 727 | 'title' => $seo_title, | 740 | 'title' => $seo_title, |
| 728 | 'keyword' => $seo_keywords, | 741 | 'keyword' => $seo_keywords, |
| 729 | 'description' => $seo_description | 742 | 'description' => $seo_description |
| 730 | ]; | 743 | ]; |
| 731 | - | ||
| 732 | //处理参数 | 744 | //处理参数 |
| 733 | $attrs = []; | 745 | $attrs = []; |
| 734 | if($data[4]??''){ | 746 | if($data[4]??''){ |
| @@ -746,10 +758,8 @@ class ProductLogic extends BaseLogic | @@ -746,10 +758,8 @@ class ProductLogic extends BaseLogic | ||
| 746 | } | 758 | } |
| 747 | } | 759 | } |
| 748 | } | 760 | } |
| 749 | - | ||
| 750 | //处理描述切换栏 | 761 | //处理描述切换栏 |
| 751 | $describe = []; | 762 | $describe = []; |
| 752 | - | ||
| 753 | for ($i=11;$i<=20;$i+=2){ | 763 | for ($i=11;$i<=20;$i+=2){ |
| 754 | if(($data[$i]??'') && ($data[$i+1]??'')){ | 764 | if(($data[$i]??'') && ($data[$i+1]??'')){ |
| 755 | preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc); | 765 | preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc); |
| @@ -759,7 +769,6 @@ class ProductLogic extends BaseLogic | @@ -759,7 +769,6 @@ class ProductLogic extends BaseLogic | ||
| 759 | $new_vdesc_img && $data[$i+1] = str_replace($vdesc_img,$new_vdesc_img,$data[$i+1]); | 769 | $new_vdesc_img && $data[$i+1] = str_replace($vdesc_img,$new_vdesc_img,$data[$i+1]); |
| 760 | } | 770 | } |
| 761 | } | 771 | } |
| 762 | - | ||
| 763 | preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc_video); | 772 | preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc_video); |
| 764 | if($result_desc_video[2]??[]){ | 773 | if($result_desc_video[2]??[]){ |
| 765 | foreach ($result_desc_video[2] as $vdesc_video){ | 774 | foreach ($result_desc_video[2] as $vdesc_video){ |
| @@ -776,7 +785,6 @@ class ProductLogic extends BaseLogic | @@ -776,7 +785,6 @@ class ProductLogic extends BaseLogic | ||
| 776 | break; | 785 | break; |
| 777 | } | 786 | } |
| 778 | } | 787 | } |
| 779 | - | ||
| 780 | $id = $this->model->addReturnId( | 788 | $id = $this->model->addReturnId( |
| 781 | [ | 789 | [ |
| 782 | 'project_id' => $project_id, | 790 | 'project_id' => $project_id, |
| @@ -794,7 +802,6 @@ class ProductLogic extends BaseLogic | @@ -794,7 +802,6 @@ class ProductLogic extends BaseLogic | ||
| 794 | 'status' => Product::STATUS_ON | 802 | 'status' => Product::STATUS_ON |
| 795 | ] | 803 | ] |
| 796 | ); | 804 | ); |
| 797 | - | ||
| 798 | //更新路由 | 805 | //更新路由 |
| 799 | if($route){ | 806 | if($route){ |
| 800 | $route_map = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->where('source_id', $id)->first(); | 807 | $route_map = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->where('source_id', $id)->first(); |
| @@ -810,17 +817,13 @@ class ProductLogic extends BaseLogic | @@ -810,17 +817,13 @@ class ProductLogic extends BaseLogic | ||
| 810 | }else{ | 817 | }else{ |
| 811 | $route = RouteMap::setRoute($data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id); | 818 | $route = RouteMap::setRoute($data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id); |
| 812 | } | 819 | } |
| 813 | - | ||
| 814 | $this->edit(['route' => $route], ['id' => $id]); | 820 | $this->edit(['route' => $route], ['id' => $id]); |
| 815 | - | ||
| 816 | //关联分类 | 821 | //关联分类 |
| 817 | if($category_arr){ | 822 | if($category_arr){ |
| 818 | CategoryRelated::saveRelated($id, $category_arr); | 823 | CategoryRelated::saveRelated($id, $category_arr); |
| 819 | } | 824 | } |
| 820 | - | ||
| 821 | return true; | 825 | return true; |
| 822 | } | 826 | } |
| 823 | - | ||
| 824 | return false; | 827 | return false; |
| 825 | } | 828 | } |
| 826 | } | 829 | } |
| @@ -82,19 +82,19 @@ class RankDataLogic extends BaseLogic | @@ -82,19 +82,19 @@ class RankDataLogic extends BaseLogic | ||
| 82 | $lang_data = $quanqiusou_api->getLangRankData($api_no); | 82 | $lang_data = $quanqiusou_api->getLangRankData($api_no); |
| 83 | $lang_data = Arr::setValueToKey($lang_data, 'language'); | 83 | $lang_data = Arr::setValueToKey($lang_data, 'language'); |
| 84 | $data['langs'] = []; | 84 | $data['langs'] = []; |
| 85 | - foreach($project['deploy_optimize']['minor_languages']??[] as $lang){ | ||
| 86 | - $remain_day = $lang_data[$lang['tl']]['dabiao_day'] ?? 0; | ||
| 87 | - $data['langs'][$lang['tl'] ?? ''] = [ | ||
| 88 | - 'lang_text' => Translate::getTls($lang['tl'] ?? ''), | ||
| 89 | - 'keyword_num' => $lang['keywords'] ?? 0, | ||
| 90 | - 'reach_day' => $lang_data[$lang['tl']]['dabiao_day'] ?? 0, | ||
| 91 | - 'home_cnt' => $lang_data[$lang['tl']]['home_cnt'] ?? 0, | ||
| 92 | - 'remain_day' => ($lang['type']??0) == 1 ? $data['project']['remain_day'] : $lang['service_day'] - $remain_day, | ||
| 93 | - 'type' => $lang['type'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数 | ||
| 94 | - ]; | 85 | + if(isset($project['deploy_optimize']['minor_languages']) && !empty($project['deploy_optimize']['minor_languages']) && is_array($project['deploy_optimize']['minor_languages'])){ |
| 86 | + foreach($project['deploy_optimize']['minor_languages']??[] as $lang){ | ||
| 87 | + $remain_day = $lang_data[$lang['tl']]['dabiao_day'] ?? 0; | ||
| 88 | + $data['langs'][$lang['tl'] ?? ''] = [ | ||
| 89 | + 'lang_text' => Translate::getTls($lang['tl'] ?? ''), | ||
| 90 | + 'keyword_num' => $lang['keywords'] ?? 0, | ||
| 91 | + 'reach_day' => $lang_data[$lang['tl']]['dabiao_day'] ?? 0, | ||
| 92 | + 'home_cnt' => $lang_data[$lang['tl']]['home_cnt'] ?? 0, | ||
| 93 | + 'remain_day' => ($lang['type']??0) == 1 ? $data['project']['remain_day'] : $lang['service_day'] - $remain_day, | ||
| 94 | + 'type' => $lang['type'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数 | ||
| 95 | + ]; | ||
| 96 | + } | ||
| 95 | } | 97 | } |
| 96 | - | ||
| 97 | - | ||
| 98 | //测速 | 98 | //测速 |
| 99 | $data['speed'] = $speed['data'] ?? []; | 99 | $data['speed'] = $speed['data'] ?? []; |
| 100 | 100 |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :TranslateLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/1/12 9:42 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Bside\Setting; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 14 | +use App\Models\WebSetting\Proofreading; | ||
| 15 | +use App\Models\WebSetting\Translate as TranslateModel; | ||
| 16 | +use App\Models\WebSetting\WebLanguage; | ||
| 17 | +use App\Helper\Translate; | ||
| 18 | +use Illuminate\Support\Facades\DB; | ||
| 19 | + | ||
| 20 | +class TranslateLogic extends BaseLogic | ||
| 21 | +{ | ||
| 22 | + public function __construct() | ||
| 23 | + { | ||
| 24 | + parent::__construct(); | ||
| 25 | + $this->model = new TranslateModel(); | ||
| 26 | + $this->param = $this->requestAll; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * @remark : | ||
| 31 | + * @name :getTranslateList | ||
| 32 | + * @author :lyh | ||
| 33 | + * @method :post | ||
| 34 | + * @time :2024/1/12 9:43 | ||
| 35 | + */ | ||
| 36 | + public function getTranslateList(){ | ||
| 37 | + $languageInfo = $this->getLanguage($this->param['language_id']); | ||
| 38 | + $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); | ||
| 39 | + //获取当前URl的所有文本内容 | ||
| 40 | + $new_key = $this->getUrlRead($this->param['url']); | ||
| 41 | + if($info === false){ | ||
| 42 | + $data = []; | ||
| 43 | + $translate_list = Translate::tran($new_key, $languageInfo['short']); | ||
| 44 | + foreach ($new_key as $k=>$v){ | ||
| 45 | + $data[] = [ | ||
| 46 | + trim($v)=>$translate_list[$k], | ||
| 47 | + ]; | ||
| 48 | + } | ||
| 49 | + return $this->response('success',Code::SUCCESS,$data); | ||
| 50 | + } | ||
| 51 | + $old_key = [];//key值组成数据 | ||
| 52 | + $data = json_decode($info['data'],true); | ||
| 53 | + foreach ($data as $k => $v){ | ||
| 54 | + $old_key[] = $k; | ||
| 55 | + } | ||
| 56 | + $arr2 = array_values(array_diff($new_key, $old_key)); | ||
| 57 | + if(!empty($arr2)){ | ||
| 58 | + $translate_list = Translate::tran($arr2, $languageInfo['short']); | ||
| 59 | + foreach ($arr2 as $k1=>$v1){ | ||
| 60 | + $data[] = [ | ||
| 61 | + trim($v1)=>$translate_list[$k1] | ||
| 62 | + ]; | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + $this->response('success',Code::SUCCESS,$data); | ||
| 66 | + } | ||
| 67 | + /** | ||
| 68 | + * @remark :获取图片列表 | ||
| 69 | + * @name :imageList | ||
| 70 | + * @author :lyh | ||
| 71 | + * @method :post | ||
| 72 | + * @time :2023/11/23 17:29 | ||
| 73 | + */ | ||
| 74 | + public function getTranslateImageList(){ | ||
| 75 | + $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); | ||
| 76 | + $data = []; | ||
| 77 | + if($info === false){ | ||
| 78 | + $new_list = $this->getUrlImageRead($this->param['url']); | ||
| 79 | + foreach ($new_list as $v){ | ||
| 80 | + $data[] = [ | ||
| 81 | + $v=>$v, | ||
| 82 | + ]; | ||
| 83 | + } | ||
| 84 | + return $this->response('success',Code::SUCCESS,$data); | ||
| 85 | + } | ||
| 86 | + $new_list = $this->getUrlImageRead($this->param['url']); | ||
| 87 | + $old_list = []; | ||
| 88 | + $data = json_decode($info['data'],true); | ||
| 89 | + foreach ($data as $k=>$v){ | ||
| 90 | + $old_list[] = $v; | ||
| 91 | + $data[] = [ | ||
| 92 | + $k=>$v, | ||
| 93 | + ]; | ||
| 94 | + } | ||
| 95 | + $arr2 = array_values(array_diff($new_list, $old_list)); | ||
| 96 | + if(!empty($arr2)){ | ||
| 97 | + foreach ($arr2 as $v1){ | ||
| 98 | + $data[] = [ | ||
| 99 | + $v1=>$v1 | ||
| 100 | + ]; | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + $this->response('success',Code::SUCCESS,$data); | ||
| 104 | + } | ||
| 105 | + /** | ||
| 106 | + * @remark :获取语种信息 | ||
| 107 | + * @name :getLanguage | ||
| 108 | + * @author :lyh | ||
| 109 | + * @method :post | ||
| 110 | + * @time :2024/1/12 9:45 | ||
| 111 | + */ | ||
| 112 | + public function getLanguage($language_id){ | ||
| 113 | + //获取语种信息 | ||
| 114 | + $languageModel = new WebLanguage(); | ||
| 115 | + $languageInfo = $languageModel->read(['id'=>$language_id]); | ||
| 116 | + if($languageInfo === false){ | ||
| 117 | + $this->fail('请选择语种'); | ||
| 118 | + } | ||
| 119 | + return $this->success($languageInfo); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * @remark :获取Url内容 | ||
| 124 | + * @name :getUrlRead | ||
| 125 | + * @author :lyh | ||
| 126 | + * @method :post | ||
| 127 | + * @time :2023/11/22 10:02 | ||
| 128 | + */ | ||
| 129 | + public function getUrlRead($url){ | ||
| 130 | + $contextOptions = [ | ||
| 131 | + 'ssl' => [ | ||
| 132 | + 'verify_peer' => false, | ||
| 133 | + 'verify_peer_name' => false, | ||
| 134 | + ], | ||
| 135 | + ]; | ||
| 136 | + $context = stream_context_create($contextOptions); | ||
| 137 | + $sourceCode = file_get_contents($url, false, $context); | ||
| 138 | + $pattern = '/<style\b[^>]*>(.*?)<\/style>/s'; // 定义匹配`<style>`标签及其内容的正则表达式 | ||
| 139 | + $strippedContent = preg_replace($pattern, '', $sourceCode); // 删除`<style>`标签及其内容 | ||
| 140 | + $pattern = '/<script\b[^>]*>(.*?)<\/script>/s'; // 定义匹配`<script>`标签及其内容的正则表达式 | ||
| 141 | + $strippedContent = preg_replace($pattern, '', $strippedContent); // 删除`<script>`标签及其内容 | ||
| 142 | + $pattern = '/<link\b[^>]*>/'; // 定义匹配 `<link>` 标签的正则表达式 | ||
| 143 | + $strippedContent = preg_replace($pattern, '', $strippedContent); // 删除 `<link>` 标签 | ||
| 144 | + $pattern = '/>([^<]+)</'; // 定义匹配中间内容不是标签的正则表达式 | ||
| 145 | + $matches = array(); | ||
| 146 | + preg_match_all($pattern, $strippedContent, $matches); | ||
| 147 | + $textContentArray = array_filter($matches[1], function($item) { | ||
| 148 | + return !empty(trim($item)); | ||
| 149 | + }); | ||
| 150 | + $data = []; | ||
| 151 | + foreach ($textContentArray as $v){ | ||
| 152 | + $content = trim($v); | ||
| 153 | + $trimmedString = preg_replace('/\s+/', ' ', $content); | ||
| 154 | + $data[] = $trimmedString; | ||
| 155 | + } | ||
| 156 | + $data = array_values($data); | ||
| 157 | + return $data; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * @remark :获取Url内容 | ||
| 162 | + * @name :getUrlRead | ||
| 163 | + * @author :lyh | ||
| 164 | + * @method :post | ||
| 165 | + * @time :2023/11/22 10:02 | ||
| 166 | + */ | ||
| 167 | + public function getUrlImageRead($url){ | ||
| 168 | + $contextOptions = [ | ||
| 169 | + 'ssl' => [ | ||
| 170 | + 'verify_peer' => false, | ||
| 171 | + 'verify_peer_name' => false, | ||
| 172 | + ], | ||
| 173 | + ]; | ||
| 174 | + $pattern = '/<img.*?src="(.*?)".*?>/i'; | ||
| 175 | + $matches = array(); | ||
| 176 | + $context = stream_context_create($contextOptions); | ||
| 177 | + $sourceCode = file_get_contents($url, false, $context); | ||
| 178 | + preg_match_all($pattern, $sourceCode, $matches); | ||
| 179 | + $textContentArray = $matches[1]; | ||
| 180 | + $data = []; | ||
| 181 | + foreach ($textContentArray as $v){ | ||
| 182 | + if(!empty($v)){ | ||
| 183 | + $data[] = $v; | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + $uniqueArray = array_unique($data); | ||
| 187 | + $data = array_values($uniqueArray); | ||
| 188 | + return $data; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + /** | ||
| 192 | + * @name :(新增/更新多语言)save | ||
| 193 | + * @author :lyh | ||
| 194 | + * @method :post | ||
| 195 | + * @time :2023/6/12 10:52 | ||
| 196 | + */ | ||
| 197 | + public function translateSave(){ | ||
| 198 | + try { | ||
| 199 | + $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); | ||
| 200 | + if($info === false){ | ||
| 201 | + $param = [ | ||
| 202 | + 'type'=>1, | ||
| 203 | + 'project_id'=>$this->user['project_id'], | ||
| 204 | + 'url'=>$this->param['url'], | ||
| 205 | + 'language_id'=>$this->param['language_id'], | ||
| 206 | + 'alias'=>$this->param['alias'], | ||
| 207 | + ]; | ||
| 208 | + $param['data'] = json_encode($this->param['data'],true); | ||
| 209 | + $this->model->add($param); | ||
| 210 | + }else{ | ||
| 211 | + $data = json_encode($this->param['data'],true); | ||
| 212 | + $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); | ||
| 213 | + } | ||
| 214 | + }catch (\Exception $e){ | ||
| 215 | + $this->fail('系统错误请联系管理员'); | ||
| 216 | + } | ||
| 217 | + $this->response('success'); | ||
| 218 | + } | ||
| 219 | +} |
| @@ -27,6 +27,7 @@ class AyrReleaseRequest extends FormRequest | @@ -27,6 +27,7 @@ class AyrReleaseRequest extends FormRequest | ||
| 27 | 'content'=>'required', | 27 | 'content'=>'required', |
| 28 | 'share_id'=>'required', | 28 | 'share_id'=>'required', |
| 29 | 'platforms'=>'required|array', | 29 | 'platforms'=>'required|array', |
| 30 | + 'schedule_date'=>'required' | ||
| 30 | ]; | 31 | ]; |
| 31 | } | 32 | } |
| 32 | 33 |
| @@ -2,9 +2,10 @@ | @@ -2,9 +2,10 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Models\Com; | 3 | namespace App\Models\Com; |
| 4 | 4 | ||
| 5 | +use App\Models\Base; | ||
| 5 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
| 6 | 7 | ||
| 7 | -class UpdateOldInfo extends Model | 8 | +class UpdateOldInfo extends Base |
| 8 | { | 9 | { |
| 9 | //设置关联表名 | 10 | //设置关联表名 |
| 10 | protected $table = 'gl_update_old_info'; | 11 | protected $table = 'gl_update_old_info'; |
| @@ -30,6 +30,10 @@ class Project extends Base | @@ -30,6 +30,10 @@ class Project extends Base | ||
| 30 | 30 | ||
| 31 | const TYPE_SEVEN = 7;//错误单 | 31 | const TYPE_SEVEN = 7;//错误单 |
| 32 | const MYSQL_ID = 2;//默认数据库id | 32 | const MYSQL_ID = 2;//默认数据库id |
| 33 | + | ||
| 34 | + const IS_UPGRADE_FALSE = 0; | ||
| 35 | + const IS_UPGRADE_TRUE = 1; | ||
| 36 | + | ||
| 33 | /** | 37 | /** |
| 34 | * 星级客户 | 38 | * 星级客户 |
| 35 | * @return string[] | 39 | * @return string[] |
| @@ -81,6 +85,7 @@ class Project extends Base | @@ -81,6 +85,7 @@ class Project extends Base | ||
| 81 | 9 => '星链网站(2年版)', | 85 | 9 => '星链网站(2年版)', |
| 82 | 11 => '俄语标准版', | 86 | 11 => '俄语标准版', |
| 83 | 12 => '俄语商务版', | 87 | 12 => '俄语商务版', |
| 88 | + 13 => '体验版' | ||
| 84 | ]; | 89 | ]; |
| 85 | } | 90 | } |
| 86 | 91 |
app/Models/WebSetting/Translate.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :Translate.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/1/12 9:38 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\WebSetting; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class Translate extends Base | ||
| 15 | +{ | ||
| 16 | + protected $table = 'gl_translate'; | ||
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 19 | +} |
| @@ -102,11 +102,11 @@ class ProjectServer | @@ -102,11 +102,11 @@ class ProjectServer | ||
| 102 | * @time :2023/9/19 14:45 | 102 | * @time :2023/9/19 14:45 |
| 103 | */ | 103 | */ |
| 104 | public static function saveInitParam($project_id){ | 104 | public static function saveInitParam($project_id){ |
| 105 | -// self::initGroup($project_id); | 105 | + self::initGroup($project_id); |
| 106 | //初始化单页 | 106 | //初始化单页 |
| 107 | -// self::init404Page($project_id); | 107 | + self::init404Page($project_id); |
| 108 | //初始化模块数据 | 108 | //初始化模块数据 |
| 109 | -// self::initModule($project_id); | 109 | + self::initModule($project_id); |
| 110 | DB::disconnect('custom_mysql'); | 110 | DB::disconnect('custom_mysql'); |
| 111 | return true; | 111 | return true; |
| 112 | } | 112 | } |
| @@ -74,6 +74,8 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -74,6 +74,8 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 74 | Route::any('/del', [\App\Http\Controllers\Bside\News\NewsController::class, 'del'])->name('news_del'); | 74 | Route::any('/del', [\App\Http\Controllers\Bside\News\NewsController::class, 'del'])->name('news_del'); |
| 75 | Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status'); | 75 | Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status'); |
| 76 | Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort'); | 76 | Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort'); |
| 77 | + Route::any('/allSort', [\App\Http\Controllers\Bside\News\NewsController::class, 'allSort'])->name('news_allSort'); | ||
| 78 | + Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\News\NewsController::class, 'batchSetCategory'])->name('news_batchSetCategory'); | ||
| 77 | Route::any('/statusNum', [\App\Http\Controllers\Bside\News\NewsController::class, 'getStatusNumber'])->name('news_statusNum'); | 79 | Route::any('/statusNum', [\App\Http\Controllers\Bside\News\NewsController::class, 'getStatusNumber'])->name('news_statusNum'); |
| 78 | }); | 80 | }); |
| 79 | 81 | ||
| @@ -89,6 +91,8 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -89,6 +91,8 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 89 | Route::any('/del', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'del'])->name('blog_del'); | 91 | Route::any('/del', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'del'])->name('blog_del'); |
| 90 | Route::any('/status', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'status'])->name('blog_status'); | 92 | Route::any('/status', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'status'])->name('blog_status'); |
| 91 | Route::any('/sort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'sort'])->name('blog_sort'); | 93 | Route::any('/sort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'sort'])->name('blog_sort'); |
| 94 | + Route::any('/allSort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'allSort'])->name('blog_allSort'); | ||
| 95 | + Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'batchSetCategory'])->name('blog_batchSetCategory'); | ||
| 92 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum'); | 96 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum'); |
| 93 | //分类 | 97 | //分类 |
| 94 | Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists'); | 98 | Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists'); |
| @@ -172,7 +176,12 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -172,7 +176,12 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 172 | Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'save'])->name('web_proofreading_save'); | 176 | Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'save'])->name('web_proofreading_save'); |
| 173 | Route::any('/saveImage', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'saveImage'])->name('web_proofreading_saveImage'); | 177 | Route::any('/saveImage', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'saveImage'])->name('web_proofreading_saveImage'); |
| 174 | }); | 178 | }); |
| 175 | - | 179 | + //新版翻译校队 |
| 180 | + Route::prefix('translate_check')->group(function () {//languageList | ||
| 181 | + Route::any('/', [\App\Http\Controllers\Bside\Setting\TranslateController::class, 'lists'])->name('translate_check_lists'); | ||
| 182 | + Route::any('/imageList', [\App\Http\Controllers\Bside\Setting\TranslateController::class, 'imageList'])->name('translate_checkg_imageList'); | ||
| 183 | + Route::any('/save', [\App\Http\Controllers\Bside\Setting\TranslateController::class, 'save'])->name('translate_check_save'); | ||
| 184 | + }); | ||
| 176 | //seo设置 | 185 | //seo设置 |
| 177 | Route::prefix('seo')->group(function () { | 186 | Route::prefix('seo')->group(function () { |
| 178 | Route::any('/info', [\App\Http\Controllers\Bside\Setting\WebSettingSeoController::class, 'info'])->name('web_seo_info'); | 187 | Route::any('/info', [\App\Http\Controllers\Bside\Setting\WebSettingSeoController::class, 'info'])->name('web_seo_info'); |
| @@ -204,6 +213,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -204,6 +213,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 204 | Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save'); | 213 | Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save'); |
| 205 | Route::post('/editList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'editList'])->name('product_editList'); | 214 | Route::post('/editList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'editList'])->name('product_editList'); |
| 206 | Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort'); | 215 | Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort'); |
| 216 | + Route::post('/allSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'allSort'])->name('product_allSort'); | ||
| 207 | Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete'); | 217 | Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete'); |
| 208 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum'); | 218 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum'); |
| 209 | Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct'); | 219 | Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct'); |
-
请 注册 或 登录 后发表评论