Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
16 个修改的文件
包含
130 行增加
和
508 行删除
| @@ -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 = 439; |
| 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) { |
| @@ -35,8 +35,8 @@ class UpgradeProjectCount extends Command | @@ -35,8 +35,8 @@ class UpgradeProjectCount extends Command | ||
| 35 | protected $description = '升级项目统计'; | 35 | protected $description = '升级项目统计'; |
| 36 | 36 | ||
| 37 | public function handle(){ | 37 | public function handle(){ |
| 38 | - $project_id = 555; | ||
| 39 | - $url = 'www.sincoherenaesthetics.com'; | 38 | + $project_id = 439; |
| 39 | + $url = 'www.cnzyl.com'; | ||
| 40 | ProjectServer::useProject($project_id); | 40 | ProjectServer::useProject($project_id); |
| 41 | $this->count($project_id,$url); | 41 | $this->count($project_id,$url); |
| 42 | 42 | ||
| @@ -67,6 +67,14 @@ class UpgradeProjectCount extends Command | @@ -67,6 +67,14 @@ class UpgradeProjectCount extends Command | ||
| 67 | $arr['month_total'] = 0; | 67 | $arr['month_total'] = 0; |
| 68 | if(isset($res['data']['count'])){ | 68 | if(isset($res['data']['count'])){ |
| 69 | $arr['month_total'] = $res['data']['count']; | 69 | $arr['month_total'] = $res['data']['count']; |
| 70 | + //获取上一个的count | ||
| 71 | + $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month')); | ||
| 72 | + $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]); | ||
| 73 | + if($previousInfo === false){ | ||
| 74 | + $arr['total'] = $arr['month_total']; | ||
| 75 | + }else{ | ||
| 76 | + $arr['total'] = $res['data']['count'] + ($previousInfo['total'] ?? 0); | ||
| 77 | + } | ||
| 70 | } | 78 | } |
| 71 | if(isset($res['data']['data'])){ | 79 | if(isset($res['data']['data'])){ |
| 72 | $arr['country'] = json_encode($res['data']['data']); | 80 | $arr['country'] = json_encode($res['data']['data']); |
| @@ -11,6 +11,7 @@ use App\Models\Project\Project; | @@ -11,6 +11,7 @@ use App\Models\Project\Project; | ||
| 11 | use App\Models\RankData\RankData as GoogleRankModel; | 11 | use App\Models\RankData\RankData as GoogleRankModel; |
| 12 | use App\Utils\LogUtils; | 12 | use App\Utils\LogUtils; |
| 13 | use Illuminate\Database\Eloquent\Model; | 13 | use Illuminate\Database\Eloquent\Model; |
| 14 | +use Illuminate\Support\Facades\Cache; | ||
| 14 | use Illuminate\Support\Facades\Log; | 15 | use Illuminate\Support\Facades\Log; |
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| @@ -46,7 +47,11 @@ class RankData extends BaseCommands | @@ -46,7 +47,11 @@ class RankData extends BaseCommands | ||
| 46 | $this->SyncApiNo(); | 47 | $this->SyncApiNo(); |
| 47 | 48 | ||
| 48 | //所有项目 今日是否达标 重置 | 49 | //所有项目 今日是否达标 重置 |
| 49 | - Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]); | 50 | + //有失败会重跑任务,导致达标又被重置 加缓存一天只重置一次 |
| 51 | + if(!Cache::get('clear_remain_today_'.date('Y-m-d'))){ | ||
| 52 | + Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]); | ||
| 53 | + Cache::set('clear_remain_today_'.date('Y-m-d'), 1, 24 * 3600); | ||
| 54 | + } | ||
| 50 | 55 | ||
| 51 | $error = 0; | 56 | $error = 0; |
| 52 | $api = new QuanqiusouApi(); | 57 | $api = new QuanqiusouApi(); |
| 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 | -} |
| @@ -236,19 +236,22 @@ class ProjectUpdate extends Command | @@ -236,19 +236,22 @@ class ProjectUpdate extends Command | ||
| 236 | if ($custom_types) { | 236 | if ($custom_types) { |
| 237 | $custom_model = new CustomModule(); | 237 | $custom_model = new CustomModule(); |
| 238 | foreach ($custom_types as $v_custom) { | 238 | foreach ($custom_types as $v_custom) { |
| 239 | - try { | ||
| 240 | - $custom_info = $custom_model->read(['route' => $v_custom]); | ||
| 241 | - if (!$custom_info) { | ||
| 242 | - $custom_model->add([ | ||
| 243 | - 'name' => $v_custom, | ||
| 244 | - 'project_id' => $project_id, | ||
| 245 | - 'route' => $v_custom | ||
| 246 | - ]); | 239 | + $log = UpdateLog::where('project_id', $project_id)->where('api_type', $v_custom)->first(); |
| 240 | + if (empty($log)) { | ||
| 241 | + try { | ||
| 242 | + $custom_info = $custom_model->read(['route' => $v_custom]); | ||
| 243 | + if (!$custom_info) { | ||
| 244 | + $custom_model->add([ | ||
| 245 | + 'name' => $v_custom, | ||
| 246 | + 'project_id' => $project_id, | ||
| 247 | + 'route' => $v_custom | ||
| 248 | + ]); | ||
| 249 | + } | ||
| 250 | + UpdateLog::createLog($project_id, $v_custom, $task->api_url); | ||
| 251 | + } catch (\Exception $e) { | ||
| 252 | + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; | ||
| 253 | + continue; | ||
| 247 | } | 254 | } |
| 248 | - UpdateLog::createLog($project_id, $v_custom, $task->api_url); | ||
| 249 | - } catch (\Exception $e) { | ||
| 250 | - echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; | ||
| 251 | - continue; | ||
| 252 | } | 255 | } |
| 253 | } | 256 | } |
| 254 | } | 257 | } |
| @@ -542,6 +545,20 @@ class ProjectUpdate extends Command | @@ -542,6 +545,20 @@ class ProjectUpdate extends Command | ||
| 542 | $data = curl_c($url); | 545 | $data = curl_c($url); |
| 543 | if (isset($data['code']) && $data['code'] == 200) { | 546 | if (isset($data['code']) && $data['code'] == 200) { |
| 544 | $category = $data['data']['category'] ?? []; | 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 | + } | ||
| 545 | $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); | 562 | $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); |
| 546 | 563 | ||
| 547 | $count = $data['data']['count'] ?? 0; | 564 | $count = $data['data']['count'] ?? 0; |
| @@ -564,6 +581,11 @@ class ProjectUpdate extends Command | @@ -564,6 +581,11 @@ class ProjectUpdate extends Command | ||
| 564 | if ($item['category'] ?? []) { | 581 | if ($item['category'] ?? []) { |
| 565 | $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]); | 582 | $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]); |
| 566 | $category_id = implode(',', array_column($category_arr, 'id')); | 583 | $category_id = implode(',', array_column($category_arr, 'id')); |
| 584 | + } else { | ||
| 585 | + $category_custom = $category_model->read(['route' => $custom_info['route']], 'id'); | ||
| 586 | + if ($category_custom) { | ||
| 587 | + $category_id = $category_custom['id']; | ||
| 588 | + } | ||
| 567 | } | 589 | } |
| 568 | //名称去掉特殊符号 | 590 | //名称去掉特殊符号 |
| 569 | $item['title'] = $this->special2str($item['title'] ?? ''); | 591 | $item['title'] = $this->special2str($item['title'] ?? ''); |
| @@ -17,6 +17,7 @@ use Illuminate\Console\Command; | @@ -17,6 +17,7 @@ use Illuminate\Console\Command; | ||
| 17 | use Illuminate\Support\Facades\Cache; | 17 | use Illuminate\Support\Facades\Cache; |
| 18 | use Illuminate\Support\Facades\DB; | 18 | use Illuminate\Support\Facades\DB; |
| 19 | use Illuminate\Support\Facades\Redis; | 19 | use Illuminate\Support\Facades\Redis; |
| 20 | +use Illuminate\Support\Str; | ||
| 20 | 21 | ||
| 21 | /** | 22 | /** |
| 22 | * 初始化项目 | 23 | * 初始化项目 |
| @@ -380,7 +381,14 @@ class UpdateSeoTdk extends Command | @@ -380,7 +381,14 @@ class UpdateSeoTdk extends Command | ||
| 380 | { | 381 | { |
| 381 | $text = Gpt::instance()->openai_chat_qqs($prompt); | 382 | $text = Gpt::instance()->openai_chat_qqs($prompt); |
| 382 | $text = Common::deal_keywords($text); | 383 | $text = Common::deal_keywords($text); |
| 383 | - return Common::deal_str($text); | 384 | + $text = Common::deal_str($text); |
| 385 | + | ||
| 386 | + //包含这写字 重新生成 | ||
| 387 | + if(Str::contains(Str::lower($text), ['[your brand]', '[brand name]'])){ | ||
| 388 | + return $this->ai_send($prompt); | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + return $text; | ||
| 384 | } | 392 | } |
| 385 | 393 | ||
| 386 | /** | 394 | /** |
| @@ -285,8 +285,9 @@ class WebTraffic extends Command | @@ -285,8 +285,9 @@ class WebTraffic extends Command | ||
| 285 | ->where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)->pluck('route','id')->toArray(); | 285 | ->where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)->pluck('route','id')->toArray(); |
| 286 | 286 | ||
| 287 | //已发布单页面 | 287 | //已发布单页面 |
| 288 | - $data['urls_page'] = DB::connection('custom_mysql')->table('gl_web_custom_template') | ||
| 289 | - ->where('project_id', $project_id)->where('status', BCustomTemplate::STATUS_ACTIVE)->pluck('url', 'id')->toArray(); | 288 | + $data['urls_page'] = []; |
| 289 | +// $data['urls_page'] = DB::connection('custom_mysql')->table('gl_web_custom_template') | ||
| 290 | +// ->where('project_id', $project_id)->where('url', '<>', '404')->where('status', BCustomTemplate::STATUS_ACTIVE)->pluck('url', 'id')->toArray(); | ||
| 290 | 291 | ||
| 291 | //已发布产品详情页 | 292 | //已发布产品详情页 |
| 292 | $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product') | 293 | $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product') |
| @@ -16,7 +16,7 @@ class Kernel extends ConsoleKernel | @@ -16,7 +16,7 @@ class Kernel extends ConsoleKernel | ||
| 16 | protected function schedule(Schedule $schedule) | 16 | protected function schedule(Schedule $schedule) |
| 17 | { | 17 | { |
| 18 | // $schedule->command('inspire')->hourly(); | 18 | // $schedule->command('inspire')->hourly(); |
| 19 | - $schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长 | 19 | + $schedule->command('remain_day')->dailyAt('08:00')->withoutOverlapping(1); // 项目剩余服务时长 |
| 20 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 | 20 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 |
| 21 | $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 | 21 | $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 |
| 22 | $schedule->command('rank_data_speed')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次 | 22 | $schedule->command('rank_data_speed')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次 |
| @@ -178,6 +178,7 @@ class ProjectController extends BaseController | @@ -178,6 +178,7 @@ class ProjectController extends BaseController | ||
| 178 | 'gl_project_deploy_optimize.domain AS domain', | 178 | 'gl_project_deploy_optimize.domain AS domain', |
| 179 | 'gl_project_deploy_optimize.quality_mid AS quality_mid', | 179 | 'gl_project_deploy_optimize.quality_mid AS quality_mid', |
| 180 | 'gl_project_deploy_optimize.design_mid AS design_mid', | 180 | 'gl_project_deploy_optimize.design_mid AS design_mid', |
| 181 | + 'gl_project_deploy_optimize.api_no AS api_no', | ||
| 181 | ]; | 182 | ]; |
| 182 | return $select; | 183 | return $select; |
| 183 | } | 184 | } |
| @@ -223,6 +223,16 @@ class RankDataController extends BaseController | @@ -223,6 +223,16 @@ class RankDataController extends BaseController | ||
| 223 | $data['position'] = $res['position']; | 223 | $data['position'] = $res['position']; |
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | + | ||
| 227 | + // 随机获取三个IP 并拼接上查询关键词 | ||
| 228 | + $urls = []; | ||
| 229 | + $ips = config('custom.search_ip'); | ||
| 230 | + $rand = array_rand($ips, 3); | ||
| 231 | + foreach ($rand as $val) { | ||
| 232 | + $rand_key = array_rand($ips[$val], 1); | ||
| 233 | + $urls[] = 'http://' . $ips[$val][$rand_key] . '/search/?q=' . $param['keyword']; | ||
| 234 | + } | ||
| 235 | + $data['urls'] = $urls; | ||
| 226 | $this->response('success',Code::SUCCESS,$data); | 236 | $this->response('success',Code::SUCCESS,$data); |
| 227 | } | 237 | } |
| 228 | } | 238 | } |
| @@ -44,7 +44,7 @@ class CountLogic extends BaseLogic | @@ -44,7 +44,7 @@ class CountLogic extends BaseLogic | ||
| 44 | //获取项目的剩余时长 | 44 | //获取项目的剩余时长 |
| 45 | $projectModel = new Project(); | 45 | $projectModel = new Project(); |
| 46 | $projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']); | 46 | $projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']); |
| 47 | - $info['service_day'] = $projectInfo['remain_day']; | 47 | + $info['service_day'] = $this->project['deploy_build']['service_duration'] - $projectInfo['finish_remain_day']; |
| 48 | $info['compliance_day'] = $projectInfo['finish_remain_day']; | 48 | $info['compliance_day'] = $projectInfo['finish_remain_day']; |
| 49 | return $this->success($info); | 49 | return $this->success($info); |
| 50 | } | 50 | } |
| @@ -468,7 +468,7 @@ class RankDataLogic extends BaseLogic | @@ -468,7 +468,7 @@ class RankDataLogic extends BaseLogic | ||
| 468 | 468 | ||
| 469 | //关键词达标天数 | 469 | //关键词达标天数 |
| 470 | $model->is_compliance = 0; | 470 | $model->is_compliance = 0; |
| 471 | - if($model->updated_date != date('Y-m-d')){ | 471 | + if($model->updated_date != date('Y-m-d') && !$lang){ |
| 472 | //保证关键词数 | 472 | //保证关键词数 |
| 473 | $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num'); | 473 | $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num'); |
| 474 | $type = Project::where('id', $project_id)->value('type'); | 474 | $type = Project::where('id', $project_id)->value('type'); |
| @@ -102,10 +102,9 @@ class ProjectServer | @@ -102,10 +102,9 @@ 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 | - $created_at = date('Y-m-d H:i:s'); | ||
| 106 | - self::initGroup($project_id,$created_at); | 105 | + self::initGroup($project_id); |
| 107 | //初始化单页 | 106 | //初始化单页 |
| 108 | - self::init404Page($project_id,$created_at); | 107 | + self::init404Page($project_id); |
| 109 | //初始化模块数据 | 108 | //初始化模块数据 |
| 110 | self::initModule($project_id); | 109 | self::initModule($project_id); |
| 111 | DB::disconnect('custom_mysql'); | 110 | DB::disconnect('custom_mysql'); |
| @@ -140,16 +139,17 @@ class ProjectServer | @@ -140,16 +139,17 @@ class ProjectServer | ||
| 140 | * @method :post | 139 | * @method :post |
| 141 | * @time :2023/12/29 9:30 | 140 | * @time :2023/12/29 9:30 |
| 142 | */ | 141 | */ |
| 143 | - public static function initGroup($project_id,$created_at){ | 142 | + public static function initGroup($project_id){ |
| 143 | + $time = date('Y-m-d H:i:s'); | ||
| 144 | $info = DB::connection('custom_mysql')->table('gl_web_nav')->first(); | 144 | $info = DB::connection('custom_mysql')->table('gl_web_nav')->first(); |
| 145 | if(empty($info)) { | 145 | if(empty($info)) { |
| 146 | $data = [ | 146 | $data = [ |
| 147 | - ['project_id' => $project_id, 'name' => 'Home', 'url' => 'Home', 'location' => 'header', 'group_id' => 1, 'created_at' => $created_at, 'updated_at' => $created_at], | ||
| 148 | - ['project_id' => $project_id, 'name' => 'Products', 'url' => 'Products', 'location' => 'header', 'group_id' => 1, 'created_at' => $created_at, 'updated_at' => $created_at], | ||
| 149 | - ['project_id' => $project_id, 'name' => 'News', 'url' => 'News', 'location' => 'header', 'group_id' => 1, 'created_at' => $created_at, 'updated_at' => $created_at], | ||
| 150 | - ['project_id' => $project_id, 'name' => 'ABOUT US', 'url' => 'about-us', 'location' => 'footer', 'group_id' => 2, 'created_at' => $created_at, 'updated_at' => $created_at], | ||
| 151 | - ['project_id' => $project_id, 'name' => 'Contact Us', 'url' => 'contact-us', 'location' => 'footer', 'group_id' => 2, 'created_at' => $created_at, 'updated_at' => $created_at], | ||
| 152 | - ['project_id' => $project_id, 'name' => 'FAQ', 'url' => 'faq', 'location' => 'footer', 'group_id' => 2, 'created_at' => $created_at, 'updated_at' => $created_at], | 147 | + ['project_id' => $project_id, 'name' => 'Home', 'url' => 'Home', 'location' => 'header', 'group_id' => 1, 'created_at' => $time, 'updated_at' => $time], |
| 148 | + ['project_id' => $project_id, 'name' => 'Products', 'url' => 'Products', 'location' => 'header', 'group_id' => 1, 'created_at' => $time, 'updated_at' => $time], | ||
| 149 | + ['project_id' => $project_id, 'name' => 'News', 'url' => 'News', 'location' => 'header', 'group_id' => 1, 'created_at' => $time, 'updated_at' => $time], | ||
| 150 | + ['project_id' => $project_id, 'name' => 'ABOUT US', 'url' => 'about-us', 'location' => 'footer', 'group_id' => 2, 'created_at' => $time, 'updated_at' => $time], | ||
| 151 | + ['project_id' => $project_id, 'name' => 'Contact Us', 'url' => 'contact-us', 'location' => 'footer', 'group_id' => 2, 'created_at' => $time, 'updated_at' => $time], | ||
| 152 | + ['project_id' => $project_id, 'name' => 'FAQ', 'url' => 'faq', 'location' => 'footer', 'group_id' => 2, 'created_at' => $time, 'updated_at' => $time], | ||
| 153 | ]; | 153 | ]; |
| 154 | DB::connection('custom_mysql')->table('gl_web_nav')->insert($data); | 154 | DB::connection('custom_mysql')->table('gl_web_nav')->insert($data); |
| 155 | } | 155 | } |
| @@ -157,8 +157,8 @@ class ProjectServer | @@ -157,8 +157,8 @@ class ProjectServer | ||
| 157 | $info = DB::connection('custom_mysql')->table('gl_web_nav_group')->first(); | 157 | $info = DB::connection('custom_mysql')->table('gl_web_nav_group')->first(); |
| 158 | if(empty($info)) { | 158 | if(empty($info)) { |
| 159 | $data = [ | 159 | $data = [ |
| 160 | - ['id' => 1, 'project_id' => $project_id, 'name' => '全局顶部菜单', 'created_at' => $created_at, 'updated_at' => $created_at], | ||
| 161 | - ['id' => 2, 'project_id' => $project_id, 'name' => '底部菜单', 'created_at' => $created_at, 'updated_at' => $created_at], | 160 | + ['id' => 1, 'project_id' => $project_id, 'name' => '全局顶部菜单', 'created_at' => $time, 'updated_at' => $time], |
| 161 | + ['id' => 2, 'project_id' => $project_id, 'name' => '底部菜单', 'created_at' => $time, 'updated_at' => $time], | ||
| 162 | ]; | 162 | ]; |
| 163 | DB::connection('custom_mysql')->table('gl_web_nav_group')->insert($data); | 163 | DB::connection('custom_mysql')->table('gl_web_nav_group')->insert($data); |
| 164 | } | 164 | } |
| @@ -172,7 +172,8 @@ class ProjectServer | @@ -172,7 +172,8 @@ class ProjectServer | ||
| 172 | * @method :post | 172 | * @method :post |
| 173 | * @time :2023/12/29 9:32 | 173 | * @time :2023/12/29 9:32 |
| 174 | */ | 174 | */ |
| 175 | - public function init404Page($project_id,$created_at){ | 175 | + public function init404Page($project_id){ |
| 176 | + $time = date('Y-m-d H:i:s'); | ||
| 176 | $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first(); | 177 | $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first(); |
| 177 | if(empty($info)) { | 178 | if(empty($info)) { |
| 178 | $main_404_html = '<main> | 179 | $main_404_html = '<main> |
| @@ -211,12 +212,12 @@ class ProjectServer | @@ -211,12 +212,12 @@ class ProjectServer | ||
| 211 | 'html_style' => '<style id="globalsojs-styles"></style>', | 212 | 'html_style' => '<style id="globalsojs-styles"></style>', |
| 212 | 'title' => '404-Page not found', | 213 | 'title' => '404-Page not found', |
| 213 | 'description' => 'Sorry. The page has either moved or cannot be found.', | 214 | 'description' => 'Sorry. The page has either moved or cannot be found.', |
| 214 | - 'created_at' => $created_at, 'updated_at' => $created_at]; | 215 | + 'created_at' => $time, 'updated_at' => $time]; |
| 215 | $id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data); | 216 | $id = DB::connection('custom_mysql')->table('gl_web_custom_template')->insertGetId($data); |
| 216 | //路由 | 217 | //路由 |
| 217 | $info = DB::connection('custom_mysql')->table('gl_route_map')->first(); | 218 | $info = DB::connection('custom_mysql')->table('gl_route_map')->first(); |
| 218 | if(empty($info)) { | 219 | if(empty($info)) { |
| 219 | - $data = ['project_id' => $project_id, 'source' => RouteMap::SOURCE_PAGE, 'source_id' => $id, 'route' => BCustomTemplate::NOT_FOUND_PAGE_URL, 'created_at' => $created_at, 'updated_at' => $created_at]; | 220 | + $data = ['project_id' => $project_id, 'source' => RouteMap::SOURCE_PAGE, 'source_id' => $id, 'route' => BCustomTemplate::NOT_FOUND_PAGE_URL, 'created_at' => $time, 'updated_at' => $time]; |
| 220 | DB::connection('custom_mysql')->table('gl_route_map')->insert($data); | 221 | DB::connection('custom_mysql')->table('gl_route_map')->insert($data); |
| 221 | } | 222 | } |
| 222 | } | 223 | } |
config/custom.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: zhl | ||
| 5 | + * Date: 2024/1/10 | ||
| 6 | + * Time: 10:59 | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +return [ | ||
| 10 | + // 搜索关键词使用的IP | ||
| 11 | + 'search_ip' => [ | ||
| 12 | + ["23.228.125.2", "23.228.125.3", "23.228.125.4", "23.228.125.5", "23.228.125.6", "23.228.125.7", "23.228.125.8", "23.228.125.9", "23.228.125.10", "23.228.125.11", "23.228.125.12", "23.228.125.13", "23.228.125.14"], | ||
| 13 | + ["104.148.17.98", "104.148.17.99", "104.148.17.100", "104.148.17.101", "104.148.17.102", "104.148.17.103", "104.148.17.104", "104.148.17.105", "104.148.17.106", "104.148.17.107", "104.148.17.108", "104.148.17.109", "104.148.17.110"], | ||
| 14 | + ["104.148.36.50", "104.148.36.51", "104.148.36.52", "104.148.36.53", "104.148.36.54", "104.148.36.55", "104.148.36.56", "104.148.36.57", "104.148.36.58", "104.148.36.59", "104.148.36.60", "104.148.36.61", "104.148.36.62"], | ||
| 15 | + ["157.52.236.34", "157.52.236.35", "157.52.236.36", "157.52.236.37", "157.52.236.38", "157.52.236.39", "157.52.236.40", "157.52.236.41", "157.52.236.42", "157.52.236.43", "157.52.236.44", "157.52.236.45", "157.52.236.46"], | ||
| 16 | + ["104.148.99.98", "104.148.99.99", "104.148.99.100", "104.148.99.101", "104.148.99.102", "104.148.99.103", "104.148.99.104", "104.148.99.105", "104.148.99.106", "104.148.99.107", "104.148.99.108", "104.148.99.109", "104.148.99.110"], | ||
| 17 | + ["23.228.118.210", "23.228.118.211", "23.228.118.212", "23.228.118.213", "23.228.118.214", "23.228.118.215", "23.228.118.216", "23.228.118.217", "23.228.118.218", "23.228.118.219", "23.228.118.220", "23.228.118.221", "23.228.118.222"], | ||
| 18 | + ["104.148.2.18", "104.148.2.19", "104.148.2.20", "104.148.2.21", "104.148.2.22", "104.148.2.23", "104.148.2.24", "104.148.2.25", "104.148.2.26", "104.148.2.27", "104.148.2.28", "104.148.2.29", "104.148.2.30"], | ||
| 19 | + ["104.148.80.114", "104.148.80.115", "104.148.80.116", "104.148.80.117", "104.148.80.118", "104.148.80.119", "104.148.80.120", "104.148.80.121", "104.148.80.122", "104.148.80.123", "104.148.80.124", "104.148.80.125", "104.148.80.126"], | ||
| 20 | + ["107.179.34.82", "107.179.34.83", "107.179.34.84", "107.179.34.85", "107.179.34.86", "107.179.34.87", "107.179.34.88", "107.179.34.89", "107.179.34.90", "107.179.34.91", "107.179.34.92", "107.179.34.93", "107.179.34.94"], | ||
| 21 | + ["107.179.73.82", "107.179.73.83", "107.179.73.84", "107.179.73.85", "107.179.73.86", "107.179.73.87", "107.179.73.88", "107.179.73.89", "107.179.73.90", "107.179.73.91", "107.179.73.92", "107.179.73.93", "107.179.73.94"], | ||
| 22 | + ["157.52.146.82", "157.52.146.83", "157.52.146.84", "157.52.146.85", "157.52.146.86", "157.52.146.87", "157.52.146.88", "157.52.146.89", "157.52.146.90", "157.52.146.91", "157.52.146.92", "157.52.146.93", "157.52.146.94"], | ||
| 23 | + ["104.223.166.226", "104.223.166.227", "104.223.166.228", "104.223.166.229", "104.223.166.230", "104.223.166.231", "104.223.166.232", "104.223.166.233", "104.223.166.234", "104.223.166.235", "104.223.166.236", "104.223.166.237", "104.223.166.238"], | ||
| 24 | + ["23.247.20.18", "23.247.20.19", "23.247.20.20", "23.247.20.21", "23.247.20.22", "23.247.20.23", "23.247.20.24", "23.247.20.25", "23.247.20.26", "23.247.20.27", "23.247.20.28", "23.247.20.29", "23.247.20.30"], | ||
| 25 | + ["134.73.134.226", "134.73.134.227", "134.73.134.228", "134.73.134.229", "134.73.134.230", "134.73.134.231", "134.73.134.232", "134.73.134.233", "134.73.134.234", "134.73.134.235", "134.73.134.236", "134.73.134.237", "134.73.134.238"], | ||
| 26 | + ["134.73.184.226", "134.73.184.227", "134.73.184.228", "134.73.184.229", "134.73.184.230", "134.73.184.231", "134.73.184.232", "134.73.184.233", "134.73.184.234", "134.73.184.235", "134.73.184.236", "134.73.184.237", "134.73.184.238"], | ||
| 27 | + ["134.73.149.98", "134.73.149.99", "134.73.149.100", "134.73.149.101", "134.73.149.102", "134.73.149.103", "134.73.149.104", "134.73.149.105", "134.73.149.106", "134.73.149.107", "134.73.149.108", "134.73.149.109", "134.73.149.110"] | ||
| 28 | + ] | ||
| 29 | +]; |
-
请 注册 或 登录 后发表评论