Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
36 个修改的文件
包含
566 行增加
和
61 行删除
| @@ -15,6 +15,7 @@ use App\Models\Project\CountryCustom; | @@ -15,6 +15,7 @@ use App\Models\Project\CountryCustom; | ||
| 15 | use App\Models\Project\Project; | 15 | use App\Models\Project\Project; |
| 16 | use Illuminate\Console\Command; | 16 | use Illuminate\Console\Command; |
| 17 | use App\Models\Domain\DomainInfo as DomainInfoModel; | 17 | use App\Models\Domain\DomainInfo as DomainInfoModel; |
| 18 | +use Symfony\Component\Process\Process; | ||
| 18 | 19 | ||
| 19 | class DomainInfo extends Command | 20 | class DomainInfo extends Command |
| 20 | { | 21 | { |
| @@ -86,6 +87,7 @@ class DomainInfo extends Command | @@ -86,6 +87,7 @@ class DomainInfo extends Command | ||
| 86 | { | 87 | { |
| 87 | $domainModel = new DomainInfoModel(); | 88 | $domainModel = new DomainInfoModel(); |
| 88 | $projectModel = new Project(); | 89 | $projectModel = new Project(); |
| 90 | + $serverIpModel = new ServersIp(); | ||
| 89 | $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 | 91 | $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 |
| 90 | $list = $domainModel->where('status', '=', 1)->where(function ($query) use ($end_day) { | 92 | $list = $domainModel->where('status', '=', 1)->where(function ($query) use ($end_day) { |
| 91 | $query->whereNull('certificate_end_time')->orWhere('certificate_end_time', '<', $end_day); | 93 | $query->whereNull('certificate_end_time')->orWhere('certificate_end_time', '<', $end_day); |
| @@ -100,9 +102,8 @@ class DomainInfo extends Command | @@ -100,9 +102,8 @@ class DomainInfo extends Command | ||
| 100 | 102 | ||
| 101 | $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']); | 103 | $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']); |
| 102 | if ($v['type'] == 1 && $ssl['to'] < $end_day && $project_info) { | 104 | if ($v['type'] == 1 && $ssl['to'] < $end_day && $project_info) { |
| 103 | - $serverIpModel = new ServersIp(); | ||
| 104 | - $servers_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id']); | ||
| 105 | - if ($servers_ip_info && $servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) { | 105 | + $servers_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id', 'ip', 'domain']); |
| 106 | + if ($servers_ip_info && $servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID && $this->check_cname($v['domain'], $servers_ip_info)) { | ||
| 106 | //非自建站项目,申请免费证书 | 107 | //非自建站项目,申请免费证书 |
| 107 | $this->updatePrivate($v); | 108 | $this->updatePrivate($v); |
| 108 | 109 | ||
| @@ -126,6 +127,7 @@ class DomainInfo extends Command | @@ -126,6 +127,7 @@ class DomainInfo extends Command | ||
| 126 | { | 127 | { |
| 127 | $domainModel = new DomainInfoModel(); | 128 | $domainModel = new DomainInfoModel(); |
| 128 | $projectModel = new Project(); | 129 | $projectModel = new Project(); |
| 130 | + $serverIpModel = new ServersIp(); | ||
| 129 | $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 | 131 | $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 |
| 130 | $list = $domainModel->where('status', '=', 1)->where('amp_status', 1)->where(function ($query) use ($end_day) { | 132 | $list = $domainModel->where('status', '=', 1)->where('amp_status', 1)->where(function ($query) use ($end_day) { |
| 131 | $query->whereNull('amp_certificate_end_time')->orWhere('amp_certificate_end_time', '<', $end_day); | 133 | $query->whereNull('amp_certificate_end_time')->orWhere('amp_certificate_end_time', '<', $end_day); |
| @@ -149,15 +151,14 @@ class DomainInfo extends Command | @@ -149,15 +151,14 @@ class DomainInfo extends Command | ||
| 149 | 151 | ||
| 150 | $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']); | 152 | $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']); |
| 151 | if ($v['amp_type'] == 1 && $ssl['to'] < $end_day && $project_info) { | 153 | if ($v['amp_type'] == 1 && $ssl['to'] < $end_day && $project_info) { |
| 152 | - $serverIpModel = new ServersIp(); | ||
| 153 | - $servers_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id']); | ||
| 154 | - if ($servers_ip_info && $servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) { | 154 | + $servers_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id', 'ip', 'domain']); |
| 155 | + if ($servers_ip_info && $servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID && $this->check_cname($amp_domain, $servers_ip_info)) { | ||
| 155 | //非自建站项目,申请免费证书 | 156 | //非自建站项目,申请免费证书 |
| 156 | $this->updateAmpPrivate($v); | 157 | $this->updateAmpPrivate($v); |
| 157 | 158 | ||
| 158 | - $ssl_new = $this->updateDomainSsl($v['domain']); | ||
| 159 | - $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from']; | ||
| 160 | - $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to']; | 159 | + $ssl_new = $this->updateDomainSsl($amp_domain); |
| 160 | + $ssl_new['from'] && $data['amp_certificate_start_time'] = $ssl_new['from']; | ||
| 161 | + $ssl_new['to'] && $data['amp_certificate_end_time'] = $ssl_new['to']; | ||
| 161 | } | 162 | } |
| 162 | } | 163 | } |
| 163 | 164 | ||
| @@ -173,6 +174,8 @@ class DomainInfo extends Command | @@ -173,6 +174,8 @@ class DomainInfo extends Command | ||
| 173 | public function startUpdateCustomCert() | 174 | public function startUpdateCustomCert() |
| 174 | { | 175 | { |
| 175 | $customModel = new CountryCustom(); | 176 | $customModel = new CountryCustom(); |
| 177 | + $projectModel = new Project(); | ||
| 178 | + $serverIpModel = new ServersIp(); | ||
| 176 | $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 | 179 | $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 |
| 177 | $list = $customModel->where('status', 1)->where('is_create', 1)->where(function ($query) use ($end_day) { | 180 | $list = $customModel->where('status', 1)->where('is_create', 1)->where(function ($query) use ($end_day) { |
| 178 | $query->whereNull('certificate_end_time')->orWhere('certificate_end_time', '<', $end_day); | 181 | $query->whereNull('certificate_end_time')->orWhere('certificate_end_time', '<', $end_day); |
| @@ -184,7 +187,10 @@ class DomainInfo extends Command | @@ -184,7 +187,10 @@ class DomainInfo extends Command | ||
| 184 | $ssl['from'] && $data['certificate_start_time'] = $ssl['from']; | 187 | $ssl['from'] && $data['certificate_start_time'] = $ssl['from']; |
| 185 | $ssl['to'] && $data['certificate_end_time'] = $ssl['to']; | 188 | $ssl['to'] && $data['certificate_end_time'] = $ssl['to']; |
| 186 | 189 | ||
| 187 | - if ($v['type'] == 1 && $ssl['to'] < $end_day) { | 190 | + $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']); |
| 191 | + if ($v['type'] == 1 && $ssl['to'] < $end_day && $project_info) { | ||
| 192 | + $servers_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id', 'ip', 'domain']); | ||
| 193 | + if ($servers_ip_info && $servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID && $this->check_cname($v['custom_domain'], $servers_ip_info)) { | ||
| 188 | //申请免费证书 | 194 | //申请免费证书 |
| 189 | $this->updateCustomPrivate($v['custom_domain']); | 195 | $this->updateCustomPrivate($v['custom_domain']); |
| 190 | 196 | ||
| @@ -192,6 +198,7 @@ class DomainInfo extends Command | @@ -192,6 +198,7 @@ class DomainInfo extends Command | ||
| 192 | $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from']; | 198 | $ssl_new['from'] && $data['certificate_start_time'] = $ssl_new['from']; |
| 193 | $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to']; | 199 | $ssl_new['to'] && $data['certificate_end_time'] = $ssl_new['to']; |
| 194 | } | 200 | } |
| 201 | + } | ||
| 195 | 202 | ||
| 196 | $customModel->edit($data, ['id' => $v['id']]); | 203 | $customModel->edit($data, ['id' => $v['id']]); |
| 197 | } | 204 | } |
| @@ -336,4 +343,41 @@ class DomainInfo extends Command | @@ -336,4 +343,41 @@ class DomainInfo extends Command | ||
| 336 | } | 343 | } |
| 337 | return ['start' => $start, 'end' => $end]; | 344 | return ['start' => $start, 'end' => $end]; |
| 338 | } | 345 | } |
| 346 | + | ||
| 347 | + /** | ||
| 348 | + * 验证是否cname或者A记录解析到目标服务器 | ||
| 349 | + * @param $domain | ||
| 350 | + * @param $server_info | ||
| 351 | + * @return mixed | ||
| 352 | + * @author zbj | ||
| 353 | + * @date 2023/11/13 | ||
| 354 | + */ | ||
| 355 | + public function check_cname($domain, $server_info) | ||
| 356 | + { | ||
| 357 | + $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 358 | + $process->run(); | ||
| 359 | + $output = explode(PHP_EOL, $process->getOutput()); | ||
| 360 | + foreach ($output as $line) { | ||
| 361 | + if ($line) { | ||
| 362 | + $checkA = strpos($line, $server_info['ip']) !== false; | ||
| 363 | + if ($checkA) { | ||
| 364 | + return $domain; | ||
| 365 | + } | ||
| 366 | + } | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + //是否cname | ||
| 370 | + $process = new Process(['nslookup', '-qt=cname', $domain]); | ||
| 371 | + $process->run(); | ||
| 372 | + $output = explode(PHP_EOL, $process->getOutput()); | ||
| 373 | + foreach ($output as $line) { | ||
| 374 | + if ($line) { | ||
| 375 | + $checkCname = (strpos($line, $server_info['domain']) !== false); | ||
| 376 | + if ($checkCname) { | ||
| 377 | + return $domain; | ||
| 378 | + } | ||
| 379 | + } | ||
| 380 | + } | ||
| 381 | + return false; | ||
| 382 | + } | ||
| 339 | } | 383 | } |
| @@ -6,6 +6,7 @@ use App\Models\Project\DeployOptimize; | @@ -6,6 +6,7 @@ use App\Models\Project\DeployOptimize; | ||
| 6 | use App\Models\Project\OnlineCheck; | 6 | use App\Models\Project\OnlineCheck; |
| 7 | use App\Models\Project\Project; | 7 | use App\Models\Project\Project; |
| 8 | use Illuminate\Console\Command; | 8 | use Illuminate\Console\Command; |
| 9 | +use App\Models\Domain\DomainInfo as DomainInfoModel; | ||
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| 11 | * 剩余服务时长 | 12 | * 剩余服务时长 |
| @@ -76,6 +77,13 @@ class RemainDay extends Command | @@ -76,6 +77,13 @@ class RemainDay extends Command | ||
| 76 | $item->remain_day = $remain_day > 0 ? $remain_day : 0; | 77 | $item->remain_day = $remain_day > 0 ? $remain_day : 0; |
| 77 | if($item->remain_day == 0){ | 78 | if($item->remain_day == 0){ |
| 78 | $item->extend_type = Project::TYPE_FIVE; | 79 | $item->extend_type = Project::TYPE_FIVE; |
| 80 | + $item->site_status = Project::TYPE_ONE;//关闭站点 | ||
| 81 | + //TODO::未续费网站禁止登录及通知C端禁止网站 | ||
| 82 | + $domainModel = new DomainInfoModel(); | ||
| 83 | + $domainInfos = $domainModel->read(['project_id'=>$item->id]); | ||
| 84 | + if($domainInfos !== false){ | ||
| 85 | + curl_get('https://'.$domainInfos['domain'].'/api/stop_or_start_website/'); | ||
| 86 | + } | ||
| 79 | } | 87 | } |
| 80 | $item->save(); | 88 | $item->save(); |
| 81 | } | 89 | } |
| @@ -187,6 +187,7 @@ class SyncProject extends Command | @@ -187,6 +187,7 @@ class SyncProject extends Command | ||
| 187 | 'lead_name' => $param['principal_name'], | 187 | 'lead_name' => $param['principal_name'], |
| 188 | 'mobile' => $param['principal_mobile'], | 188 | 'mobile' => $param['principal_mobile'], |
| 189 | 'mysql_id'=>Project::MYSQL_ID, | 189 | 'mysql_id'=>Project::MYSQL_ID, |
| 190 | + 'serve_id'=>9, | ||
| 190 | 'qq' => $param['customer_qq'], | 191 | 'qq' => $param['customer_qq'], |
| 191 | 'channel' => Channel::getProjectChannel($param['company_id'], $param['username_sales']), | 192 | 'channel' => Channel::getProjectChannel($param['company_id'], $param['username_sales']), |
| 192 | 'requirement' => $param['remark'], | 193 | 'requirement' => $param['remark'], |
| @@ -90,7 +90,7 @@ class RecommendedSuppliers extends Command | @@ -90,7 +90,7 @@ class RecommendedSuppliers extends Command | ||
| 90 | ]; | 90 | ]; |
| 91 | $res = http_post($url,json_encode($param)); | 91 | $res = http_post($url,json_encode($param)); |
| 92 | echo date('Y-m-d H:i:s') . json_encode($res) . PHP_EOL; | 92 | echo date('Y-m-d H:i:s') . json_encode($res) . PHP_EOL; |
| 93 | - if(!empty($res) && $res['code'] == 200 && !empty($res['data'])){ | 93 | + if(!empty($res) && isset($res['code']) && $res['code'] == 200 && !empty($res['data'])){ |
| 94 | //保存多条数据 | 94 | //保存多条数据 |
| 95 | $saveData = [ | 95 | $saveData = [ |
| 96 | 'project_id'=>$project_id, | 96 | 'project_id'=>$project_id, |
| @@ -115,8 +115,6 @@ class RecommendedSuppliers extends Command | @@ -115,8 +115,6 @@ class RecommendedSuppliers extends Command | ||
| 115 | * @time :2024/7/1 18:07 | 115 | * @time :2024/7/1 18:07 |
| 116 | */ | 116 | */ |
| 117 | public function getKeywords($project_id){ | 117 | public function getKeywords($project_id){ |
| 118 | - $keywordModel = new Keyword(); | ||
| 119 | - $keywordModel-> | ||
| 120 | $info = Keyword::inRandomOrder()->first(); | 118 | $info = Keyword::inRandomOrder()->first(); |
| 121 | $keywordInfo = $this->getPurchaser($info->title,$project_id); | 119 | $keywordInfo = $this->getPurchaser($info->title,$project_id); |
| 122 | if($keywordInfo !== false){ | 120 | if($keywordInfo !== false){ |
| @@ -8,8 +8,11 @@ | @@ -8,8 +8,11 @@ | ||
| 8 | namespace App\Console\Commands\Test; | 8 | namespace App\Console\Commands\Test; |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | +use App\Helper\Arr; | ||
| 12 | +use App\Models\Blog\Blog; | ||
| 11 | use App\Models\Com\KeywordVideoTask; | 13 | use App\Models\Com\KeywordVideoTask; |
| 12 | use App\Models\Com\KeywordVideoTaskLog; | 14 | use App\Models\Com\KeywordVideoTaskLog; |
| 15 | +use App\Models\CustomModule\CustomModuleContent; | ||
| 13 | use App\Models\Devops\ServerConfig; | 16 | use App\Models\Devops\ServerConfig; |
| 14 | use App\Models\Devops\Servers; | 17 | use App\Models\Devops\Servers; |
| 15 | use App\Models\Devops\ServersIp; | 18 | use App\Models\Devops\ServersIp; |
| @@ -21,8 +24,10 @@ use App\Models\Product\Keyword; | @@ -21,8 +24,10 @@ use App\Models\Product\Keyword; | ||
| 21 | use App\Models\Product\Product; | 24 | use App\Models\Product\Product; |
| 22 | use App\Models\Project\DeployOptimize; | 25 | use App\Models\Project\DeployOptimize; |
| 23 | use App\Models\Project\MinorLanguages; | 26 | use App\Models\Project\MinorLanguages; |
| 27 | +use App\Models\Project\PageSetting; | ||
| 24 | use App\Models\Project\Project; | 28 | use App\Models\Project\Project; |
| 25 | use App\Models\Purchaser\PurchaserInfo; | 29 | use App\Models\Purchaser\PurchaserInfo; |
| 30 | +use App\Models\RouteMap\RouteMap; | ||
| 26 | use App\Services\AmazonS3Service; | 31 | use App\Services\AmazonS3Service; |
| 27 | use App\Services\ProjectServer; | 32 | use App\Services\ProjectServer; |
| 28 | use App\Utils\EncryptUtils; | 33 | use App\Utils\EncryptUtils; |
| @@ -48,7 +53,106 @@ class Demo extends Command | @@ -48,7 +53,106 @@ class Demo extends Command | ||
| 48 | protected $description = 'demo'; | 53 | protected $description = 'demo'; |
| 49 | 54 | ||
| 50 | public function handle(){ | 55 | public function handle(){ |
| 51 | - $this->synchronizationFile('/upload/m/file/2024-07/tongli-haiyuan-keywords.pdf'); | 56 | + $pageSettingModel = new PageSetting(); |
| 57 | + $pageList = $pageSettingModel->list(); | ||
| 58 | + foreach ($pageList as $v){ | ||
| 59 | + ProjectServer::useProject($v['project_id']); | ||
| 60 | + if($v['product_list'] == 1){ | ||
| 61 | + $param = [ | ||
| 62 | + 'name'=>'产品列表', | ||
| 63 | + 'source'=>2, | ||
| 64 | + 'is_list'=>1, | ||
| 65 | + 'is_custom'=>0, | ||
| 66 | + 'header_status'=>1, | ||
| 67 | + 'footer_status'=>1, | ||
| 68 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 69 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 70 | + ]; | ||
| 71 | + DB::connection('custom_mysql')->table('gl_project_com_config')->insert($param); | ||
| 72 | + } | ||
| 73 | + if($v['product_details'] == 1){ | ||
| 74 | + $param = [ | ||
| 75 | + 'name'=>'产品详情', | ||
| 76 | + 'source'=>2, | ||
| 77 | + 'is_list'=>0, | ||
| 78 | + 'is_custom'=>0, | ||
| 79 | + 'header_status'=>1, | ||
| 80 | + 'footer_status'=>1, | ||
| 81 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 82 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 83 | + ]; | ||
| 84 | + DB::connection('custom_mysql')->table('gl_project_com_config')->insert($param); | ||
| 85 | + } | ||
| 86 | + if($v['page_list'] == 1){ | ||
| 87 | + $param = [ | ||
| 88 | + 'name'=>'单页面', | ||
| 89 | + 'source'=>9, | ||
| 90 | + 'is_list'=>0, | ||
| 91 | + 'is_custom'=>0, | ||
| 92 | + 'header_status'=>1, | ||
| 93 | + 'footer_status'=>1, | ||
| 94 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 95 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 96 | + ]; | ||
| 97 | + DB::connection('custom_mysql')->table('gl_project_com_config')->insert($param); | ||
| 98 | + } | ||
| 99 | + if($v['blog_list'] == 1){ | ||
| 100 | + $param = [ | ||
| 101 | + 'name'=>'博客列表', | ||
| 102 | + 'source'=>3, | ||
| 103 | + 'is_list'=>1, | ||
| 104 | + 'is_custom'=>0, | ||
| 105 | + 'header_status'=>1, | ||
| 106 | + 'footer_status'=>1, | ||
| 107 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 108 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 109 | + ]; | ||
| 110 | + DB::connection('custom_mysql')->table('gl_project_com_config')->insert($param); | ||
| 111 | + } | ||
| 112 | + if($v['blog_details'] == 1){ | ||
| 113 | + $param = [ | ||
| 114 | + 'name'=>'博客详情', | ||
| 115 | + 'source'=>3, | ||
| 116 | + 'is_list'=>0, | ||
| 117 | + 'is_custom'=>0, | ||
| 118 | + 'header_status'=>1, | ||
| 119 | + 'footer_status'=>1, | ||
| 120 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 121 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 122 | + ]; | ||
| 123 | + DB::connection('custom_mysql')->table('gl_project_com_config')->insert($param); | ||
| 124 | + } | ||
| 125 | + if($v['news_list'] == 1){ | ||
| 126 | + $param = [ | ||
| 127 | + 'name'=>'新闻列表', | ||
| 128 | + 'source'=>4, | ||
| 129 | + 'is_list'=>1, | ||
| 130 | + 'is_custom'=>0, | ||
| 131 | + 'header_status'=>1, | ||
| 132 | + 'footer_status'=>1, | ||
| 133 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 134 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 135 | + ]; | ||
| 136 | + DB::connection('custom_mysql')->table('gl_project_com_config')->insert($param); | ||
| 137 | + } | ||
| 138 | + if($v['news_details'] == 1){ | ||
| 139 | + $param = [ | ||
| 140 | + 'name'=>'新闻详情', | ||
| 141 | + 'source'=>4, | ||
| 142 | + 'is_list'=>0, | ||
| 143 | + 'is_custom'=>0, | ||
| 144 | + 'header_status'=>1, | ||
| 145 | + 'footer_status'=>1, | ||
| 146 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 147 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 148 | + ]; | ||
| 149 | + DB::connection('custom_mysql')->table('gl_project_com_config')->insert($param); | ||
| 150 | + } | ||
| 151 | + DB::disconnect('custom_mysql'); | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + | ||
| 155 | + | ||
| 52 | } | 156 | } |
| 53 | 157 | ||
| 54 | public function synchronizationFile($path_name){ | 158 | public function synchronizationFile($path_name){ |
| @@ -9,10 +9,13 @@ | @@ -9,10 +9,13 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Console\Commands\Test; | 10 | namespace App\Console\Commands\Test; |
| 11 | 11 | ||
| 12 | +use App\Models\Project\Project; | ||
| 12 | use App\Models\Template\BTemplateCom; | 13 | use App\Models\Template\BTemplateCom; |
| 13 | use App\Models\Template\BTemplateCommon; | 14 | use App\Models\Template\BTemplateCommon; |
| 14 | use App\Models\Template\Setting; | 15 | use App\Models\Template\Setting; |
| 16 | +use App\Services\ProjectServer; | ||
| 15 | use Illuminate\Console\Command; | 17 | use Illuminate\Console\Command; |
| 18 | +use Illuminate\Support\Facades\DB; | ||
| 16 | 19 | ||
| 17 | /** | 20 | /** |
| 18 | * @remark :头部底部分开 脚本数据 | 21 | * @remark :头部底部分开 脚本数据 |
| @@ -49,7 +52,8 @@ class HeaderFooter extends Command | @@ -49,7 +52,8 @@ class HeaderFooter extends Command | ||
| 49 | foreach ($list as $v){ | 52 | foreach ($list as $v){ |
| 50 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 53 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 51 | ProjectServer::useProject($v['id']); | 54 | ProjectServer::useProject($v['id']); |
| 52 | - DB::table('gl_web_template_com')->truncate(); | 55 | + $templateComModel = new BTemplateCom(); |
| 56 | + $templateComModel->truncate(); | ||
| 53 | $this->saveTemplateCom($v['id']); | 57 | $this->saveTemplateCom($v['id']); |
| 54 | DB::disconnect('custom_mysql'); | 58 | DB::disconnect('custom_mysql'); |
| 55 | } | 59 | } |
| @@ -442,8 +442,8 @@ class HtmlCollect extends Command | @@ -442,8 +442,8 @@ class HtmlCollect extends Command | ||
| 442 | foreach ($source as $vs) { | 442 | foreach ($source as $vs) { |
| 443 | 443 | ||
| 444 | if ($vs['download']) { | 444 | if ($vs['download']) { |
| 445 | - if ($project_id == 1355 && in_array(substr($vs['url_complete'], -3), ['pdf', 'zip', 'rar', '.gz'])) { | ||
| 446 | - //项目id为1355的项目,可下载类资源要保持原名称,做特殊处理 | 445 | + if (in_array(substr($vs['url_complete'], -3), ['pdf', 'zip', 'rar', '.gz'])) { |
| 446 | + //可下载类资源要保持原名称 | ||
| 447 | $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete'], '', '', 1); | 447 | $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete'], '', '', 1); |
| 448 | } else { | 448 | } else { |
| 449 | $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete']); | 449 | $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete']); |
| @@ -14,6 +14,7 @@ use App\Http\Controllers\Aside\BaseController; | @@ -14,6 +14,7 @@ use App\Http\Controllers\Aside\BaseController; | ||
| 14 | use App\Http\Logic\Aside\Devops\ServersLogic; | 14 | use App\Http\Logic\Aside\Devops\ServersLogic; |
| 15 | use App\Models\Devops\Servers as ServersModel; | 15 | use App\Models\Devops\Servers as ServersModel; |
| 16 | use App\Models\Devops\ServersIp; | 16 | use App\Models\Devops\ServersIp; |
| 17 | +use App\Models\Project\Project; | ||
| 17 | 18 | ||
| 18 | class ServersController extends BaseController | 19 | class ServersController extends BaseController |
| 19 | { | 20 | { |
| @@ -46,6 +47,18 @@ class ServersController extends BaseController | @@ -46,6 +47,18 @@ class ServersController extends BaseController | ||
| 46 | if(isset($this->map['server_name']) && !empty($this->map['server_name'])){ | 47 | if(isset($this->map['server_name']) && !empty($this->map['server_name'])){ |
| 47 | $this->map['server_name'] = ['like','%'.$this->map['server_name'].'%']; | 48 | $this->map['server_name'] = ['like','%'.$this->map['server_name'].'%']; |
| 48 | } | 49 | } |
| 50 | + if(isset($this->map['project_name']) && !empty($this->map['project_name'])){ | ||
| 51 | + $projectModel = new Project(); | ||
| 52 | + $projectInfo = $projectModel->read(['title'=>['like','%'.$this->map['project_name'].'%']],['id','serve_id']); | ||
| 53 | + if($projectInfo !== false){ | ||
| 54 | + $serversIpModel = new ServersIp(); | ||
| 55 | + $ipInfo = $serversIpModel->read(['id'=>$projectInfo['serve_id']],['servers_id']); | ||
| 56 | + if($ipInfo !== false){ | ||
| 57 | + $this->map['id'] = $ipInfo['servers_id']; | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + unset($this->map['project_name']); | ||
| 61 | + } | ||
| 49 | $serversModel = new ServersModel(); | 62 | $serversModel = new ServersModel(); |
| 50 | $data = $serversModel->lists($this->map,$this->page,$this->row,$this->order); | 63 | $data = $serversModel->lists($this->map,$this->page,$this->row,$this->order); |
| 51 | $this->response('success',Code::SUCCESS,$data); | 64 | $this->response('success',Code::SUCCESS,$data); |
| @@ -39,7 +39,7 @@ class ServersIpController extends BaseController | @@ -39,7 +39,7 @@ class ServersIpController extends BaseController | ||
| 39 | } | 39 | } |
| 40 | $serversIpModel = new ServersIpModel(); | 40 | $serversIpModel = new ServersIpModel(); |
| 41 | $this->map['status'] = 0; | 41 | $this->map['status'] = 0; |
| 42 | - $data = $serversIpModel->list($this->map); | 42 | + $data = $serversIpModel->list($this->map,'total',['*'],'asc'); |
| 43 | foreach ($data as $k => $v){ | 43 | foreach ($data as $k => $v){ |
| 44 | $v['is_optional'] = 0;//是否可选择 | 44 | $v['is_optional'] = 0;//是否可选择 |
| 45 | if($v['total'] >= $info['ip_total']){ | 45 | if($v['total'] >= $info['ip_total']){ |
| @@ -169,12 +169,15 @@ class ServersIpController extends BaseController | @@ -169,12 +169,15 @@ class ServersIpController extends BaseController | ||
| 169 | $info = $serverModel->read(['id'=>$this->map['servers_id']]); | 169 | $info = $serverModel->read(['id'=>$this->map['servers_id']]); |
| 170 | $data = []; | 170 | $data = []; |
| 171 | $serversIpModel = new ServersIpModel(); | 171 | $serversIpModel = new ServersIpModel(); |
| 172 | + $this->map['status'] = 0; | ||
| 172 | $list = $serversIpModel->list($this->map); | 173 | $list = $serversIpModel->list($this->map); |
| 174 | + if(!empty($list)){ | ||
| 173 | foreach ($list as $v){ | 175 | foreach ($list as $v){ |
| 174 | $position = strpos($v['domain'], '.'); | 176 | $position = strpos($v['domain'], '.'); |
| 175 | $result = substr($v['domain'], 0, $position); | 177 | $result = substr($v['domain'], 0, $position); |
| 176 | $data[] = ['记录类型'=>'A','主机记录'=>$result,'解析线路'=>'默认','记录值'=>$v['ip'],'MAX优先级'=>'','TTL值'=>600,'状态(暂停/启用)'=>'启用','备注'=>$info['server_name']]; | 178 | $data[] = ['记录类型'=>'A','主机记录'=>$result,'解析线路'=>'默认','记录值'=>$v['ip'],'MAX优先级'=>'','TTL值'=>600,'状态(暂停/启用)'=>'启用','备注'=>$info['server_name']]; |
| 177 | } | 179 | } |
| 180 | + } | ||
| 178 | $this->response('success',Code::SUCCESS,$data); | 181 | $this->response('success',Code::SUCCESS,$data); |
| 179 | } | 182 | } |
| 180 | } | 183 | } |
| @@ -174,6 +174,7 @@ class OptimizeController extends BaseController | @@ -174,6 +174,7 @@ class OptimizeController extends BaseController | ||
| 174 | 'gl_project.is_translate AS is_translate', | 174 | 'gl_project.is_translate AS is_translate', |
| 175 | 'gl_project.is_translate_tag AS is_translate_tag', | 175 | 'gl_project.is_translate_tag AS is_translate_tag', |
| 176 | 'gl_project.is_upgrade AS is_upgrade', | 176 | 'gl_project.is_upgrade AS is_upgrade', |
| 177 | + 'gl_project.site_status AS site_status', | ||
| 177 | 'gl_project_online_check.id AS online_check_id', | 178 | 'gl_project_online_check.id AS online_check_id', |
| 178 | 'gl_project_online_check.question AS question', | 179 | 'gl_project_online_check.question AS question', |
| 179 | 'gl_project_online_check.go_question AS go_question', | 180 | 'gl_project_online_check.go_question AS go_question', |
| @@ -220,6 +221,9 @@ class OptimizeController extends BaseController | @@ -220,6 +221,9 @@ class OptimizeController extends BaseController | ||
| 220 | if(isset($this->map['title']) && !empty($this->map['title'])){ | 221 | if(isset($this->map['title']) && !empty($this->map['title'])){ |
| 221 | $query = $query->where('gl_project.title','like','%'.$this->map['title'].'%'); | 222 | $query = $query->where('gl_project.title','like','%'.$this->map['title'].'%'); |
| 222 | } | 223 | } |
| 224 | + if(isset($this->map['site_status'])){ | ||
| 225 | + $query = $query->where('gl_project.site_status',$this->map['site_status']); | ||
| 226 | + } | ||
| 223 | if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){ | 227 | if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){ |
| 224 | $query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']); | 228 | $query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']); |
| 225 | } | 229 | } |
| @@ -21,6 +21,7 @@ use App\Models\Com\City; | @@ -21,6 +21,7 @@ use App\Models\Com\City; | ||
| 21 | use App\Models\Com\UpdateLog; | 21 | use App\Models\Com\UpdateLog; |
| 22 | use App\Models\Devops\ServerConfig; | 22 | use App\Models\Devops\ServerConfig; |
| 23 | use App\Models\Domain\DomainInfo; | 23 | use App\Models\Domain\DomainInfo; |
| 24 | +use App\Models\Domain\DomainInfo as DomainInfoModel; | ||
| 24 | use App\Models\HomeCount\Count; | 25 | use App\Models\HomeCount\Count; |
| 25 | use App\Models\Inquiry\InquirySet; | 26 | use App\Models\Inquiry\InquirySet; |
| 26 | use App\Models\Manage\BelongingGroup; | 27 | use App\Models\Manage\BelongingGroup; |
| @@ -92,6 +93,7 @@ class ProjectController extends BaseController | @@ -92,6 +93,7 @@ class ProjectController extends BaseController | ||
| 92 | 'gl_project.is_upgrade AS is_upgrade', | 93 | 'gl_project.is_upgrade AS is_upgrade', |
| 93 | 'gl_project.created_at AS created_at', | 94 | 'gl_project.created_at AS created_at', |
| 94 | 'gl_project.cooperate_date AS cooperate_date', | 95 | 'gl_project.cooperate_date AS cooperate_date', |
| 96 | + 'gl_project.site_status AS site_status', | ||
| 95 | 'gl_project_online_check.id AS online_check_id', | 97 | 'gl_project_online_check.id AS online_check_id', |
| 96 | 'gl_project_online_check.question AS question', | 98 | 'gl_project_online_check.question AS question', |
| 97 | 'gl_project_online_check.optimist_status AS optimist_status', | 99 | 'gl_project_online_check.optimist_status AS optimist_status', |
| @@ -273,6 +275,12 @@ class ProjectController extends BaseController | @@ -273,6 +275,12 @@ class ProjectController extends BaseController | ||
| 273 | if(isset($this->map['optimize_optimist_mid'])){ | 275 | if(isset($this->map['optimize_optimist_mid'])){ |
| 274 | $query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimize_optimist_mid']); | 276 | $query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimize_optimist_mid']); |
| 275 | } | 277 | } |
| 278 | + if(isset($this->map['plan'])){ | ||
| 279 | + $query = $query->where('gl_project_deploy_build.plan',$this->map['plan']); | ||
| 280 | + } | ||
| 281 | + if(isset($this->map['site_status'])){ | ||
| 282 | + $query = $query->where('gl_project.site_status',$this->map['site_status']); | ||
| 283 | + } | ||
| 276 | return $query; | 284 | return $query; |
| 277 | } | 285 | } |
| 278 | 286 | ||
| @@ -1047,4 +1055,32 @@ class ProjectController extends BaseController | @@ -1047,4 +1055,32 @@ class ProjectController extends BaseController | ||
| 1047 | $deployBuildModel->edit(['is_participle'=>$this->param['is_participle']],['project_id'=>$this->param['project_id']]); | 1055 | $deployBuildModel->edit(['is_participle'=>$this->param['is_participle']],['project_id'=>$this->param['project_id']]); |
| 1048 | $this->response('success'); | 1056 | $this->response('success'); |
| 1049 | } | 1057 | } |
| 1058 | + | ||
| 1059 | + /** | ||
| 1060 | + * @remark :(on/off)站点 | ||
| 1061 | + * @param : site_status(站点状态0/1:开启/关闭),id(项目id) | ||
| 1062 | + * @name :saveSiteStatus | ||
| 1063 | + * @author :lyh | ||
| 1064 | + * @method :post | ||
| 1065 | + * @time :2024/7/29 17:12 | ||
| 1066 | + */ | ||
| 1067 | + public function saveSiteStatus(){ | ||
| 1068 | + $projectModel = new Project(); | ||
| 1069 | + $this->request->validate([ | ||
| 1070 | + 'project_id'=>'required', | ||
| 1071 | + 'site_status'=>'required' | ||
| 1072 | + ],[ | ||
| 1073 | + 'project_id.required' => '项目id不能为空', | ||
| 1074 | + 'site_status.required' => '状态不能为空', | ||
| 1075 | + ]); | ||
| 1076 | + $projectModel->edit(['site_status'=>$this->map['site_status']],['id'=>$this->param['project_id']]); | ||
| 1077 | + //TODO::通知C端 | ||
| 1078 | + $domainModel = new DomainInfoModel(); | ||
| 1079 | + $domainInfo = $domainModel->read(['project_id'=>$this->param['project_id']]); | ||
| 1080 | + if($domainInfo !== false){ | ||
| 1081 | + $rs = curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website/'); | ||
| 1082 | + @file_put_contents(storage_path('logs/site_status.log'), var_export('通知C端on/off'.$domainInfo['domain'].'.返回结果:'.json_encode($rs), true) . PHP_EOL, FILE_APPEND); | ||
| 1083 | + } | ||
| 1084 | + $this->response('success'); | ||
| 1085 | + } | ||
| 1050 | } | 1086 | } |
| @@ -108,7 +108,9 @@ class RenewProjectController extends BaseController | @@ -108,7 +108,9 @@ class RenewProjectController extends BaseController | ||
| 108 | */ | 108 | */ |
| 109 | public function notHaveRenewItems(Project $project){ | 109 | public function notHaveRenewItems(Project $project){ |
| 110 | $this->map['extend_type'] = $project::TYPE_FIVE;//未续费网站 if(!empty($param['search']) && !empty($param['search_type'])){ | 110 | $this->map['extend_type'] = $project::TYPE_FIVE;//未续费网站 if(!empty($param['search']) && !empty($param['search_type'])){ |
| 111 | - $this->map['title'] = ['like', '%'.$this->map['title'].'title']; | 111 | + if(!empty($this->map['title'])){ |
| 112 | + $this->map['title'] = ['like', '%'.$this->map['title'].'%']; | ||
| 113 | + } | ||
| 112 | $lists = $project->where($this->map)->with('payment')->with('deploy_build') | 114 | $lists = $project->where($this->map)->with('payment')->with('deploy_build') |
| 113 | ->with('deploy_optimize')->with('online_check') | 115 | ->with('deploy_optimize')->with('online_check') |
| 114 | ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page); | 116 | ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page); |
| @@ -165,6 +167,7 @@ class RenewProjectController extends BaseController | @@ -165,6 +167,7 @@ class RenewProjectController extends BaseController | ||
| 165 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, | 167 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, |
| 166 | 'qa_status'=>$item['online_check']['qa_status'] ?? 0, | 168 | 'qa_status'=>$item['online_check']['qa_status'] ?? 0, |
| 167 | 'service_day'=>$item['remain_day'] ?? 0, | 169 | 'service_day'=>$item['remain_day'] ?? 0, |
| 170 | + 'site_status'=>$item['site_status'], | ||
| 168 | ]; | 171 | ]; |
| 169 | return $item; | 172 | return $item; |
| 170 | } | 173 | } |
| @@ -48,7 +48,6 @@ class CNoticeController extends BaseController | @@ -48,7 +48,6 @@ class CNoticeController extends BaseController | ||
| 48 | $url = $request->input('url', []); | 48 | $url = $request->input('url', []); |
| 49 | $language = $request->input('language', []); | 49 | $language = $request->input('language', []); |
| 50 | $is_sitemap = intval($request->input('is_sitemap', 0)); | 50 | $is_sitemap = intval($request->input('is_sitemap', 0)); |
| 51 | - | ||
| 52 | //获取项目所在服务器 | 51 | //获取项目所在服务器 |
| 53 | $project_model = new Project(); | 52 | $project_model = new Project(); |
| 54 | $project_info = $project_model->read(['id'=>$project_id],['serve_id']); | 53 | $project_info = $project_model->read(['id'=>$project_id],['serve_id']); |
| @@ -106,8 +105,10 @@ class CNoticeController extends BaseController | @@ -106,8 +105,10 @@ class CNoticeController extends BaseController | ||
| 106 | 'is_sitemap' => $is_sitemap | 105 | 'is_sitemap' => $is_sitemap |
| 107 | ]; | 106 | ]; |
| 108 | http_post($c_url, json_encode($param)); | 107 | http_post($c_url, json_encode($param)); |
| 108 | +// $shell = 'curl -X POST ' . escapeshellarg($c_url) . ' -H "Content-Type: application/json"' . | ||
| 109 | +// ' -d ' . escapeshellarg(json_encode($param)) . ' > /dev/null 2>&1 &'; | ||
| 110 | +// shell_exec($shell); | ||
| 109 | } | 111 | } |
| 110 | - | ||
| 111 | $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!'); | 112 | $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!'); |
| 112 | } | 113 | } |
| 113 | 114 |
| @@ -159,6 +159,7 @@ class ProductController extends BaseController | @@ -159,6 +159,7 @@ class ProductController extends BaseController | ||
| 159 | $query = $query->whereIn('id',$product_id_arr); | 159 | $query = $query->whereIn('id',$product_id_arr); |
| 160 | } | 160 | } |
| 161 | if(isset($this->map['title']) && !empty($this->map['title'])){ | 161 | if(isset($this->map['title']) && !empty($this->map['title'])){ |
| 162 | + $this->map['title'] = str_replace('+',' ',$this->map['title']); | ||
| 162 | $query = $query->where('title','like','%'.$this->map['title'].'%'); | 163 | $query = $query->where('title','like','%'.$this->map['title'].'%'); |
| 163 | } | 164 | } |
| 164 | if(isset($this->map['status'])){ | 165 | if(isset($this->map['status'])){ |
| @@ -220,7 +220,7 @@ class RankDataController extends BaseController | @@ -220,7 +220,7 @@ class RankDataController extends BaseController | ||
| 220 | $res = HttpUtils::get('http://rank.waimaoq.com/luminati_rank', $param); | 220 | $res = HttpUtils::get('http://rank.waimaoq.com/luminati_rank', $param); |
| 221 | if ($res) { | 221 | if ($res) { |
| 222 | $res = Arr::s2a($res); | 222 | $res = Arr::s2a($res); |
| 223 | - $data['position'] = $res['position']; | 223 | + $data['position'] = $res['position'] ?? ''; |
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | 226 |
| @@ -60,9 +60,9 @@ class TranslateController extends BaseController | @@ -60,9 +60,9 @@ class TranslateController extends BaseController | ||
| 60 | 'language_id.required' => 'language_id不能为空', | 60 | 'language_id.required' => 'language_id不能为空', |
| 61 | ]); | 61 | ]); |
| 62 | $this->map['type'] = 1; | 62 | $this->map['type'] = 1; |
| 63 | - $data = $translate->list($this->map); | 63 | + $data = $translate->formatQuery($this->map)->with('translate_data')->get()->toArray(); |
| 64 | foreach ($data as $k=>$v){ | 64 | foreach ($data as $k=>$v){ |
| 65 | - $v['data'] = json_decode($v['data']); | 65 | + $v['data'] = json_decode($v['translate_data']['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); |
| 66 | $data[$k] = $v; | 66 | $data[$k] = $v; |
| 67 | } | 67 | } |
| 68 | $this->response('success',Code::SUCCESS,$data); | 68 | $this->response('success',Code::SUCCESS,$data); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BProjectIsComController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/1 14:24 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Bside\Template; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Bside\BaseController; | ||
| 14 | +use App\Http\Logic\Bside\BTemplate\BProjectIsComLogic; | ||
| 15 | + | ||
| 16 | +class BProjectIsComController extends BaseController | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @remark :获取头部底部配置 | ||
| 20 | + * @name :getIsComConfig | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2024/8/1 15:08 | ||
| 24 | + */ | ||
| 25 | + public function getIsComConfig(BProjectIsComLogic $logic){ | ||
| 26 | + $data = $logic->getIsComConfig(); | ||
| 27 | + $this->response('success',Code::SUCCESS,$data); | ||
| 28 | + } | ||
| 29 | +} |
| @@ -31,6 +31,23 @@ class BTemplateController extends BaseController | @@ -31,6 +31,23 @@ class BTemplateController extends BaseController | ||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | + * @remark :获取数据详情 | ||
| 35 | + * @name :templateInfo | ||
| 36 | + * @author :lyh | ||
| 37 | + * @method :post | ||
| 38 | + * @time :2024/7/31 14:27 | ||
| 39 | + */ | ||
| 40 | + public function publicInfo(BTemplateLogic $BTemplateLogic){ | ||
| 41 | + $this->request->validate([ | ||
| 42 | + 'id'=>'required', | ||
| 43 | + ],[ | ||
| 44 | + 'id.required' => 'id不能为空', | ||
| 45 | + ]); | ||
| 46 | + $info = $BTemplateLogic->getPublicTemplateInfo(); | ||
| 47 | + $this->response('success',Code::SUCCESS,$info); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 34 | * @remark :获取用户模版id | 51 | * @remark :获取用户模版id |
| 35 | * @name :getUserTemplate | 52 | * @name :getUserTemplate |
| 36 | * @author :lyh | 53 | * @author :lyh |
| @@ -74,7 +74,7 @@ class BTemplateLogController extends BaseController | @@ -74,7 +74,7 @@ class BTemplateLogController extends BaseController | ||
| 74 | $this->response('请先选择模版',Code::SYSTEM_ERROR); | 74 | $this->response('请先选择模版',Code::SYSTEM_ERROR); |
| 75 | } | 75 | } |
| 76 | $this->map = ['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'is_custom'=>$is_custom,'template_id'=>$settingInfo['template_id']]; | 76 | $this->map = ['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'is_custom'=>$is_custom,'template_id'=>$settingInfo['template_id']]; |
| 77 | - $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']); | 77 | + $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','source_id','created_at','updated_at']); |
| 78 | if(!empty($lists['list'])){ | 78 | if(!empty($lists['list'])){ |
| 79 | $templateModel = new Template(); | 79 | $templateModel = new Template(); |
| 80 | $userModel = new User(); | 80 | $userModel = new User(); |
| @@ -93,9 +93,11 @@ class CustomModuleLogic extends BaseLogic | @@ -93,9 +93,11 @@ class CustomModuleLogic extends BaseLogic | ||
| 93 | 'name'=>$this->param['route'], | 93 | 'name'=>$this->param['route'], |
| 94 | 'module_id'=>$id, | 94 | 'module_id'=>$id, |
| 95 | 'project_id'=>$this->param['project_id'], | 95 | 'project_id'=>$this->param['project_id'], |
| 96 | - 'route'=>RouteMap::setRoute($this->param['route'],RouteMap::SOURCE_MODULE_CATE,$id,$this->param['project_id']) | 96 | + 'route'=>$this->param['route'] |
| 97 | ]; | 97 | ]; |
| 98 | - $customModuleCateModel->add($data); | 98 | + $cateId = $customModuleCateModel->addReturnId($data); |
| 99 | + $route = RouteMap::setRoute($this->param['route'],RouteMap::SOURCE_MODULE_CATE,$cateId,$this->param['project_id']); | ||
| 100 | + $customModuleCateModel->edit(['route'=>$route],['id'=>$cateId]); | ||
| 99 | } | 101 | } |
| 100 | return $this->success(); | 102 | return $this->success(); |
| 101 | } | 103 | } |
| @@ -82,6 +82,13 @@ class ServersIpLogic extends BaseLogic | @@ -82,6 +82,13 @@ class ServersIpLogic extends BaseLogic | ||
| 82 | if(empty($v)){ | 82 | if(empty($v)){ |
| 83 | continue; | 83 | continue; |
| 84 | } | 84 | } |
| 85 | + $ipInfo = $this->model->read(['ip'=>$v]); | ||
| 86 | + if($ipInfo !== false){ | ||
| 87 | + if($ipInfo['status'] == 1){ | ||
| 88 | + $this->model->edit(['status'=>0],['id'=>$ipInfo['id']]); | ||
| 89 | + } | ||
| 90 | + continue; | ||
| 91 | + } | ||
| 85 | $param = [ | 92 | $param = [ |
| 86 | 'ip'=>$v, | 93 | 'ip'=>$v, |
| 87 | 'domain'=>ip_to_unique_string($v).'.'.$info['domain'], | 94 | 'domain'=>ip_to_unique_string($v).'.'.$info['domain'], |
| @@ -261,26 +261,23 @@ class DomainInfoLogic extends BaseLogic | @@ -261,26 +261,23 @@ class DomainInfoLogic extends BaseLogic | ||
| 261 | $this->fail('获取项目数据失败'); | 261 | $this->fail('获取项目数据失败'); |
| 262 | } | 262 | } |
| 263 | $serverIpModel = new ServersIp(); | 263 | $serverIpModel = new ServersIp(); |
| 264 | - $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']); | 264 | + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip','domain']); |
| 265 | if($serversIpInfo === false){ | 265 | if($serversIpInfo === false){ |
| 266 | $this->fail('获取服务器数据失败'); | 266 | $this->fail('获取服务器数据失败'); |
| 267 | } | 267 | } |
| 268 | - $serverModel = new Servers(); | ||
| 269 | - $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']); | ||
| 270 | - $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']]; | ||
| 271 | - if($serversIpInfo['servers_id'] == 7){ | 268 | + if($serversIpInfo['servers_id'] == ServerConfig::SELF_TEST_ID){ |
| 272 | $this->fail('请切换服务器,生成站点不能使用测试服务器'); | 269 | $this->fail('请切换服务器,生成站点不能使用测试服务器'); |
| 273 | } | 270 | } |
| 274 | if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){ | 271 | if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){ |
| 275 | - $this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0,],['id'=>$this->param['id']]); | 272 | + $this->model->edit(['amp_status' => $this->param['amp_status'] ?? 0],['id'=>$this->param['id']]); |
| 276 | $this->fail('自建站服务器无法生成站点'); | 273 | $this->fail('自建站服务器无法生成站点'); |
| 277 | } | 274 | } |
| 278 | //域名是否都已经解析 | 275 | //域名是否都已经解析 |
| 279 | - if(!empty($info['domain']) && !$this->check_cname($info['domain'], $server_info)){ | 276 | + if(!empty($info['domain']) && !$this->check_cname($info['domain'], $serversIpInfo)){ |
| 280 | $this->fail('域名' . $info['domain'] . '未解析至目标服务器'); | 277 | $this->fail('域名' . $info['domain'] . '未解析至目标服务器'); |
| 281 | } | 278 | } |
| 282 | foreach ($this->param['other_domain']??[] as $other_domain){ | 279 | foreach ($this->param['other_domain']??[] as $other_domain){ |
| 283 | - if($other_domain && !$this->check_cname($other_domain, $server_info)){ | 280 | + if($other_domain && !$this->check_cname($other_domain, $serversIpInfo)){ |
| 284 | $this->fail('域名' . $other_domain . '未解析至目标服务器'); | 281 | $this->fail('域名' . $other_domain . '未解析至目标服务器'); |
| 285 | } | 282 | } |
| 286 | } | 283 | } |
| @@ -296,7 +293,7 @@ class DomainInfoLogic extends BaseLogic | @@ -296,7 +293,7 @@ class DomainInfoLogic extends BaseLogic | ||
| 296 | $host_array[0] = 'm'; | 293 | $host_array[0] = 'm'; |
| 297 | } | 294 | } |
| 298 | $amp_domain = implode('.',$host_array); | 295 | $amp_domain = implode('.',$host_array); |
| 299 | - if(!$this->check_cname($amp_domain, $server_info)){ | 296 | + if(!$this->check_cname($amp_domain, $serversIpInfo)){ |
| 300 | $this->fail('AMP站点域名' . $amp_domain . '未解析至目标服务器'); | 297 | $this->fail('AMP站点域名' . $amp_domain . '未解析至目标服务器'); |
| 301 | } | 298 | } |
| 302 | } | 299 | } |
| @@ -385,14 +382,11 @@ class DomainInfoLogic extends BaseLogic | @@ -385,14 +382,11 @@ class DomainInfoLogic extends BaseLogic | ||
| 385 | if($this->param['is_create']){ | 382 | if($this->param['is_create']){ |
| 386 | //需要创建站点 | 383 | //需要创建站点 |
| 387 | $serverIpModel = new ServersIp(); | 384 | $serverIpModel = new ServersIp(); |
| 388 | - $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']); | 385 | + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip','domain']); |
| 389 | if($serversIpInfo === false){ | 386 | if($serversIpInfo === false){ |
| 390 | $this->fail('获取服务器数据失败'); | 387 | $this->fail('获取服务器数据失败'); |
| 391 | } | 388 | } |
| 392 | - $serverModel = new Servers(); | ||
| 393 | - $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']); | ||
| 394 | - $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']]; | ||
| 395 | - if($serversIpInfo['servers_id'] == 7){ | 389 | + if($serversIpInfo['servers_id'] == ServerConfig::SELF_TEST_ID){ |
| 396 | $this->fail('请切换服务器,生成站点不能使用测试服务器'); | 390 | $this->fail('请切换服务器,生成站点不能使用测试服务器'); |
| 397 | } | 391 | } |
| 398 | if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){ | 392 | if($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID){ |
| @@ -412,7 +406,7 @@ class DomainInfoLogic extends BaseLogic | @@ -412,7 +406,7 @@ class DomainInfoLogic extends BaseLogic | ||
| 412 | if($has_info && ($has_info['project_id'] != $project_id || $has_info['language_id'] != $this->param['language_id'])){ | 406 | if($has_info && ($has_info['project_id'] != $project_id || $has_info['language_id'] != $this->param['language_id'])){ |
| 413 | $this->fail('自定义域名已被使用'); | 407 | $this->fail('自定义域名已被使用'); |
| 414 | } | 408 | } |
| 415 | - if(!$this->check_cname($this->param['custom_domain'], $server_info)){ | 409 | + if(!$this->check_cname($this->param['custom_domain'], $serversIpInfo)){ |
| 416 | $this->fail('域名' . $this->param['custom_domain'] . '未解析至目标服务器'); | 410 | $this->fail('域名' . $this->param['custom_domain'] . '未解析至目标服务器'); |
| 417 | } | 411 | } |
| 418 | }else{ | 412 | }else{ |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BProjectIsComLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/1 14:25 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Bside\BTemplate; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 13 | +use App\Models\CustomModule\CustomModule; | ||
| 14 | +use App\Models\IsCom\ProjectIsCom; | ||
| 15 | +use App\Models\Template\BTemplate; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :独立头部——底部设置 | ||
| 19 | + * @name :BProjectIsComLogic | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2024/8/1 14:43 | ||
| 23 | + */ | ||
| 24 | +class BProjectIsComLogic extends BaseLogic | ||
| 25 | +{ | ||
| 26 | + /** | ||
| 27 | + * 初始化数据 | ||
| 28 | + */ | ||
| 29 | + public function __construct() | ||
| 30 | + { | ||
| 31 | + parent::__construct(); | ||
| 32 | + $this->model = new ProjectIsCom(); | ||
| 33 | + $this->param = $this->requestAll; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + const PUB_STATUS = 0;//公共 | ||
| 37 | + const PRO_STATUS = 1;//獨立 | ||
| 38 | + const IS_LIST = 1; | ||
| 39 | + const IS_DETAIL = 0; | ||
| 40 | + const IS_NO_CUSTOM = 0; | ||
| 41 | + const IS_CUSTOM = 1;//扩展模块 | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * @remark :获取初始数据 | ||
| 45 | + * @name :getIsComSetting | ||
| 46 | + * @author :lyh | ||
| 47 | + * @method :post | ||
| 48 | + * @time :2024/8/1 15:02 | ||
| 49 | + */ | ||
| 50 | + public function getIsComConfig(){ | ||
| 51 | + $data = []; | ||
| 52 | + $data = $this->initParamData($data); | ||
| 53 | + $data = $this->initPageParamData($data); | ||
| 54 | + $data = $this->initCustomData($data); | ||
| 55 | + return $this->success($data); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * @remark :(独立头底)初始数据 | ||
| 61 | + * @name :initializedData | ||
| 62 | + * @author :lyh | ||
| 63 | + * @method :post | ||
| 64 | + * @time :2024/8/1 11:52 | ||
| 65 | + */ | ||
| 66 | + public function initParamData(&$data){ | ||
| 67 | + //默认模块 | ||
| 68 | + $initParam = $this->model->initParam; | ||
| 69 | + foreach ($initParam as $pKey => $pValue){ | ||
| 70 | + $is_list = [self::IS_LIST,self::IS_DETAIL]; | ||
| 71 | + foreach ($is_list as $isValue){ | ||
| 72 | + //查询当前数据是否已保存 | ||
| 73 | + $info = $this->read(['source'=>$pValue,'is_list'=>$isValue,'is_custom'=>BTemplate::IS_NO_CUSTOM],['name','source','is_list','is_custom','header_status','footer_status']); | ||
| 74 | + if($info !== false){ | ||
| 75 | + $data[] = $info; | ||
| 76 | + }else{ | ||
| 77 | + $data[] = [ | ||
| 78 | + 'name'=>$pKey.($isValue == 0 ? '详情' : '列表'), | ||
| 79 | + 'source'=>$pValue, | ||
| 80 | + 'is_list'=>$isValue, | ||
| 81 | + 'is_custom'=>self::IS_NO_CUSTOM, | ||
| 82 | + 'header_status'=>self::PUB_STATUS, | ||
| 83 | + 'footer_status'=>self::PUB_STATUS, | ||
| 84 | + ]; | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + return $this->success($data); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * @remark :单页面初始化 | ||
| 93 | + * @name :initPageParamData | ||
| 94 | + * @author :lyh | ||
| 95 | + * @method :post | ||
| 96 | + * @time :2024/8/1 14:37 | ||
| 97 | + */ | ||
| 98 | + public function initPageParamData(&$data){ | ||
| 99 | + $initPageParam = $this->model->initPageParam; | ||
| 100 | + foreach($initPageParam as $key => $value){ | ||
| 101 | + $info = $this->read(['source'=>$value,'is_list'=>self::IS_DETAIL,'is_custom'=>BTemplate::IS_NO_CUSTOM],['name','source','is_list','is_custom','header_status','footer_status']); | ||
| 102 | + if($info !== false){ | ||
| 103 | + $data[] = $info; | ||
| 104 | + }else{ | ||
| 105 | + $data[] = [ | ||
| 106 | + 'name'=>$key, | ||
| 107 | + 'source'=>$value, | ||
| 108 | + 'is_list'=>self::IS_DETAIL, | ||
| 109 | + 'is_custom'=>self::IS_NO_CUSTOM, | ||
| 110 | + 'header_status'=>self::PUB_STATUS, | ||
| 111 | + 'footer_status'=>self::PUB_STATUS, | ||
| 112 | + ]; | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + return $this->success($data); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * @remark :获取扩展模块初始数据 | ||
| 120 | + * @name :initCustomData | ||
| 121 | + * @author :lyh | ||
| 122 | + * @method :post | ||
| 123 | + * @time :2024/8/1 14:42 | ||
| 124 | + */ | ||
| 125 | + public function initCustomData(&$data){ | ||
| 126 | + $customModel = new CustomModule(); | ||
| 127 | + $customList = $customModel->list(['status'=>0]); | ||
| 128 | + $is_list = [self::IS_LIST,self::IS_DETAIL]; | ||
| 129 | + foreach($customList as $value){ | ||
| 130 | + foreach ($is_list as $isValue){ | ||
| 131 | + $info = $this->model->read(['source'=>$value['id'],'is_list'=>$isValue,'is_custom'=>BTemplate::IS_CUSTOM],['id','name','source','is_list','is_custom','header_status','footer_status']); | ||
| 132 | + if($info !== false){ | ||
| 133 | + $data[] = $info; | ||
| 134 | + }else{ | ||
| 135 | + $data[] = [ | ||
| 136 | + 'name'=>$value['name'].($isValue == self::IS_DETAIL ? '详情' : '列表'), | ||
| 137 | + 'source'=>$value['id'], | ||
| 138 | + 'is_list'=>$isValue, | ||
| 139 | + 'is_custom'=>self::IS_CUSTOM, | ||
| 140 | + 'header_status'=>self::PUB_STATUS, | ||
| 141 | + 'footer_status'=>self::PUB_STATUS, | ||
| 142 | + ]; | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + return $this->success($data); | ||
| 147 | + } | ||
| 148 | +} |
| @@ -52,6 +52,19 @@ class BTemplateLogic extends BaseLogic | @@ -52,6 +52,19 @@ class BTemplateLogic extends BaseLogic | ||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | /** | 54 | /** |
| 55 | + * @remark :获取模版详情 | ||
| 56 | + * @name :getPublicTemplateInfo | ||
| 57 | + * @author :lyh | ||
| 58 | + * @method :post | ||
| 59 | + * @time :2024/7/31 14:31 | ||
| 60 | + */ | ||
| 61 | + public function getPublicTemplateInfo(){ | ||
| 62 | + $templateModel = new Template(); | ||
| 63 | + $info = $templateModel->read($this->param); | ||
| 64 | + return $this->success($info); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 55 | * @remark :获取可视化html | 68 | * @remark :获取可视化html |
| 56 | * @name :getTemplateHtml | 69 | * @name :getTemplateHtml |
| 57 | * @author :lyh | 70 | * @author :lyh |
| @@ -126,7 +126,9 @@ class CustomTemplateLogic extends BaseLogic | @@ -126,7 +126,9 @@ class CustomTemplateLogic extends BaseLogic | ||
| 126 | if($bSettingInfo === false){ | 126 | if($bSettingInfo === false){ |
| 127 | $this->fail('请先选择模版'); | 127 | $this->fail('请先选择模版'); |
| 128 | } | 128 | } |
| 129 | + if(!isset($this->param['template_status'])){//代表直接替换模版 不更新头部底部 | ||
| 129 | $this->saveCommonTemplate($html,$bSettingInfo['template_id']); | 130 | $this->saveCommonTemplate($html,$bSettingInfo['template_id']); |
| 131 | + } | ||
| 130 | $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'); | 132 | $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'); |
| 131 | $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | 133 | $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); |
| 132 | } | 134 | } |
| @@ -193,8 +193,11 @@ class BlogLogic extends BaseLogic | @@ -193,8 +193,11 @@ class BlogLogic extends BaseLogic | ||
| 193 | * @time :2023/10/20 9:02 | 193 | * @time :2023/10/20 9:02 |
| 194 | */ | 194 | */ |
| 195 | public function getCategory($category){ | 195 | public function getCategory($category){ |
| 196 | + if(empty($category)){ | ||
| 197 | + return ''; | ||
| 198 | + } | ||
| 196 | $str = implode(',',$category); | 199 | $str = implode(',',$category); |
| 197 | - return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; | 200 | + return !empty(trim(trim($str,','),',')) ? ','.trim(trim($str,','),',').',' : ''; |
| 198 | } | 201 | } |
| 199 | 202 | ||
| 200 | /** | 203 | /** |
| @@ -213,7 +213,7 @@ class NewsLogic extends BaseLogic | @@ -213,7 +213,7 @@ class NewsLogic extends BaseLogic | ||
| 213 | */ | 213 | */ |
| 214 | public function getCategory($category){ | 214 | public function getCategory($category){ |
| 215 | $str = implode(',',$category); | 215 | $str = implode(',',$category); |
| 216 | - return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; | 216 | + return !empty(trim(trim($str,','),',')) ? ','.trim(trim($str,','),',').',' : ''; |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | /** | 219 | /** |
| @@ -156,6 +156,9 @@ class UserLoginLogic | @@ -156,6 +156,9 @@ class UserLoginLogic | ||
| 156 | */ | 156 | */ |
| 157 | public function autoAssembleParam($info){ | 157 | public function autoAssembleParam($info){ |
| 158 | $project = $this->getProjectInfo($info['project_id']); | 158 | $project = $this->getProjectInfo($info['project_id']); |
| 159 | + if($project['site_status'] != 0){//关闭站点 | ||
| 160 | + $this->fail('当前网站已过期,请联系管理员及时续费。'); | ||
| 161 | + } | ||
| 159 | $info['title'] = $project['title'] ?? ''; | 162 | $info['title'] = $project['title'] ?? ''; |
| 160 | $info['company'] = $project['company'] ?? ''; | 163 | $info['company'] = $project['company'] ?? ''; |
| 161 | $info['from_order_id'] = $project['from_order_id'] ?? ''; | 164 | $info['from_order_id'] = $project['from_order_id'] ?? ''; |
| @@ -257,6 +260,9 @@ class UserLoginLogic | @@ -257,6 +260,9 @@ class UserLoginLogic | ||
| 257 | $info = $this->model->read(['mobile'=>$mobile,'project_id'=>$project_id],['id','mobile','status','role_id','token','name','wechat','project_id']); | 260 | $info = $this->model->read(['mobile'=>$mobile,'project_id'=>$project_id],['id','mobile','status','role_id','token','name','wechat','project_id']); |
| 258 | //获取项目详情 | 261 | //获取项目详情 |
| 259 | $project = $this->getProjectInfo($project_id); | 262 | $project = $this->getProjectInfo($project_id); |
| 263 | + if($project['site_status'] != 0){//关闭站点 | ||
| 264 | + $this->fail('当前网站已过期,请联系管理员及时续费。'); | ||
| 265 | + } | ||
| 260 | $info['title'] = $project['title'] ?? ''; | 266 | $info['title'] = $project['title'] ?? ''; |
| 261 | $info['company'] = $project['company'] ?? ''; | 267 | $info['company'] = $project['company'] ?? ''; |
| 262 | $info['from_order_id'] = $project['from_order_id'] ?? ''; | 268 | $info['from_order_id'] = $project['from_order_id'] ?? ''; |
| @@ -53,17 +53,21 @@ class EditAmpDomainBt implements ShouldQueue | @@ -53,17 +53,21 @@ class EditAmpDomainBt implements ShouldQueue | ||
| 53 | if ($project_info === false) { | 53 | if ($project_info === false) { |
| 54 | return $this->output($domain_info['domain'] . ':获取项目数据失败'); | 54 | return $this->output($domain_info['domain'] . ':获取项目数据失败'); |
| 55 | } | 55 | } |
| 56 | + | ||
| 56 | //获取服务器数据 | 57 | //获取服务器数据 |
| 57 | $serverIpModel = new ServersIp(); | 58 | $serverIpModel = new ServersIp(); |
| 58 | - $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']); | 59 | + $serversIpInfo = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id']); |
| 59 | if ($serversIpInfo === false) { | 60 | if ($serversIpInfo === false) { |
| 60 | return $this->output($domain_info['domain'] . ':获取服务器数据失败'); | 61 | return $this->output($domain_info['domain'] . ':获取服务器数据失败'); |
| 61 | } | 62 | } |
| 62 | $serverModel = new Servers(); | 63 | $serverModel = new Servers(); |
| 63 | - $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']); | ||
| 64 | - $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']]; | 64 | + $serverInfo = $serverModel->read(['id' => $serversIpInfo['servers_id']], ['init_domain']); |
| 65 | + if ($serverInfo === false) { | ||
| 66 | + return $this->output($domain_info['domain'] . ':获取服务器数据失败'); | ||
| 67 | + } | ||
| 68 | + | ||
| 65 | //编辑amp站 | 69 | //编辑amp站 |
| 66 | - $api_url_amp = 'http://' . $server_info['domain'] . '/api/createSiteAmp'; | 70 | + $api_url_amp = 'http://' . $serverInfo['init_domain'] . '/api/createSiteAmp'; |
| 67 | $api_param_amp = [ | 71 | $api_param_amp = [ |
| 68 | 'domain' => $domain_info['domain'], | 72 | 'domain' => $domain_info['domain'], |
| 69 | 'not_allow_country' => $domain_info['not_allow_country'], | 73 | 'not_allow_country' => $domain_info['not_allow_country'], |
| @@ -46,24 +46,26 @@ class EditCustomDomainBt implements ShouldQueue | @@ -46,24 +46,26 @@ class EditCustomDomainBt implements ShouldQueue | ||
| 46 | if ($domain_info === false) { | 46 | if ($domain_info === false) { |
| 47 | return $this->output($domain_info['custom_domain'] . ':获取域名数据失败'); | 47 | return $this->output($domain_info['custom_domain'] . ':获取域名数据失败'); |
| 48 | } | 48 | } |
| 49 | + | ||
| 49 | //获取项目数据 | 50 | //获取项目数据 |
| 50 | $project_model = new Project(); | 51 | $project_model = new Project(); |
| 51 | $project_info = $project_model->read(['id' => $domain_info['project_id']], 'serve_id'); | 52 | $project_info = $project_model->read(['id' => $domain_info['project_id']], 'serve_id'); |
| 52 | if ($project_info === false) { | 53 | if ($project_info === false) { |
| 53 | return $this->output($domain_info['custom_domain'] . ':获取项目数据失败'); | 54 | return $this->output($domain_info['custom_domain'] . ':获取项目数据失败'); |
| 54 | } | 55 | } |
| 56 | + | ||
| 55 | //获取服务器数据 | 57 | //获取服务器数据 |
| 56 | $serverIpModel = new ServersIp(); | 58 | $serverIpModel = new ServersIp(); |
| 57 | - $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']); | 59 | + $serversIpInfo = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id']); |
| 58 | if ($serversIpInfo === false) { | 60 | if ($serversIpInfo === false) { |
| 59 | return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败'); | 61 | return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败'); |
| 60 | } | 62 | } |
| 61 | $serverModel = new Servers(); | 63 | $serverModel = new Servers(); |
| 62 | - $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']); | ||
| 63 | - $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']]; | 64 | + $serverInfo = $serverModel->read(['id' => $serversIpInfo['servers_id']], ['init_domain']); |
| 65 | + | ||
| 64 | //编辑站点 | 66 | //编辑站点 |
| 65 | if ($domain_info['type'] == 2) { | 67 | if ($domain_info['type'] == 2) { |
| 66 | - $api_url = 'http://' . $server_info['domain'] . '/api/setSsl'; | 68 | + $api_url = 'http://' . $serverInfo['init_domain'] . '/api/setSsl'; |
| 67 | $api_param = [ | 69 | $api_param = [ |
| 68 | 'domain' => $domain_info['custom_domain'], | 70 | 'domain' => $domain_info['custom_domain'], |
| 69 | 'private_key' => $domain_info['private_key'], | 71 | 'private_key' => $domain_info['private_key'], |
| @@ -73,7 +75,7 @@ class EditCustomDomainBt implements ShouldQueue | @@ -73,7 +75,7 @@ class EditCustomDomainBt implements ShouldQueue | ||
| 73 | 'is_https' => 1 | 75 | 'is_https' => 1 |
| 74 | ]; | 76 | ]; |
| 75 | } else { | 77 | } else { |
| 76 | - $api_url = 'http://' . $server_info['domain'] . '/api/applySsl'; | 78 | + $api_url = 'http://' . $serverInfo['init_domain'] . '/api/applySsl'; |
| 77 | $api_param = [ | 79 | $api_param = [ |
| 78 | 'domain' => $domain_info['custom_domain'], | 80 | 'domain' => $domain_info['custom_domain'], |
| 79 | 'rewrite' => [], | 81 | 'rewrite' => [], |
| @@ -56,16 +56,19 @@ class EditDomainBt implements ShouldQueue | @@ -56,16 +56,19 @@ class EditDomainBt implements ShouldQueue | ||
| 56 | 56 | ||
| 57 | //获取服务器数据 | 57 | //获取服务器数据 |
| 58 | $serverIpModel = new ServersIp(); | 58 | $serverIpModel = new ServersIp(); |
| 59 | - $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']); | 59 | + $serversIpInfo = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id']); |
| 60 | if ($serversIpInfo === false) { | 60 | if ($serversIpInfo === false) { |
| 61 | return $this->output($domain_info['domain'] . ':获取服务器数据失败'); | 61 | return $this->output($domain_info['domain'] . ':获取服务器数据失败'); |
| 62 | } | 62 | } |
| 63 | $serverModel = new Servers(); | 63 | $serverModel = new Servers(); |
| 64 | - $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']); | ||
| 65 | - $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']]; | 64 | + $serverInfo = $serverModel->read(['id' => $serversIpInfo['servers_id']], ['init_domain']); |
| 65 | + if ($serverInfo === false) { | ||
| 66 | + return $this->output($domain_info['domain'] . ':获取服务器数据失败'); | ||
| 67 | + } | ||
| 68 | + | ||
| 66 | //编辑主站 | 69 | //编辑主站 |
| 67 | if ($domain_info['type'] == 2) { | 70 | if ($domain_info['type'] == 2) { |
| 68 | - $api_url = 'http://' . $server_info['domain'] . '/api/setSsl'; | 71 | + $api_url = 'http://' . $serverInfo['init_domain'] . '/api/setSsl'; |
| 69 | $api_param = [ | 72 | $api_param = [ |
| 70 | 'domain' => $domain_info['domain'], | 73 | 'domain' => $domain_info['domain'], |
| 71 | 'private_key' => $domain_info['private_key'], | 74 | 'private_key' => $domain_info['private_key'], |
| @@ -78,7 +81,7 @@ class EditDomainBt implements ShouldQueue | @@ -78,7 +81,7 @@ class EditDomainBt implements ShouldQueue | ||
| 78 | 'is_redirect' => $domain_info['is_redirect'] | 81 | 'is_redirect' => $domain_info['is_redirect'] |
| 79 | ]; | 82 | ]; |
| 80 | } else { | 83 | } else { |
| 81 | - $api_url = 'http://' . $server_info['domain'] . '/api/applySsl'; | 84 | + $api_url = 'http://' . $serverInfo['init_domain'] . '/api/applySsl'; |
| 82 | $api_param = [ | 85 | $api_param = [ |
| 83 | 'domain' => $domain_info['domain'], | 86 | 'domain' => $domain_info['domain'], |
| 84 | 'rewrite' => $domain_info['extend_config'], | 87 | 'rewrite' => $domain_info['extend_config'], |
| @@ -35,6 +35,7 @@ class ServerConfig extends Base | @@ -35,6 +35,7 @@ class ServerConfig extends Base | ||
| 35 | const STATUS_ONE = 1; | 35 | const STATUS_ONE = 1; |
| 36 | 36 | ||
| 37 | const SELF_SITE_ID = 6;//自建站服务器ID | 37 | const SELF_SITE_ID = 6;//自建站服务器ID |
| 38 | + const SELF_TEST_ID = 7;//测试服务器ID | ||
| 38 | 39 | ||
| 39 | /** | 40 | /** |
| 40 | * @remark :获取数据用户名解密 | 41 | * @remark :获取数据用户名解密 |
app/Models/IsCom/ProjectIsCom.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ProjectIsCom.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/8/1 11:50 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\IsCom; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | +use App\Models\Project\Project; | ||
| 14 | +use App\Models\Template\BTemplate; | ||
| 15 | +use App\Models\Template\Template; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :是否为独立头部+底部 | ||
| 19 | + * @name :ProjectIsCom | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2024/8/1 11:51 | ||
| 23 | + */ | ||
| 24 | +class ProjectIsCom extends Base | ||
| 25 | +{ | ||
| 26 | + protected $table = 'gl_project_com_config'; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * @name :(包含详情页+列表页) | ||
| 30 | + * @var array | ||
| 31 | + */ | ||
| 32 | + public $initParam = [ | ||
| 33 | + '首页'=>BTemplate::SOURCE_HOME, | ||
| 34 | + '产品'=>BTemplate::SOURCE_PRODUCT, | ||
| 35 | + '博客'=>BTemplate::SOURCE_BLOG, | ||
| 36 | + '新闻'=>BTemplate::SOURCE_NEWS, | ||
| 37 | + ]; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * @name : 单一界面 | ||
| 41 | + * @var array | ||
| 42 | + */ | ||
| 43 | + public $initPageParam = [ | ||
| 44 | + '单页面'=>BTemplate::SOURCE_PAGE, | ||
| 45 | + ]; | ||
| 46 | + | ||
| 47 | +} |
| @@ -23,6 +23,8 @@ class BTemplate extends Base | @@ -23,6 +23,8 @@ class BTemplate extends Base | ||
| 23 | 23 | ||
| 24 | const SOURCE_NEWS = 4;//新闻详情页 | 24 | const SOURCE_NEWS = 4;//新闻详情页 |
| 25 | const SOURCE_KEYWORD = 5;//聚合页 | 25 | const SOURCE_KEYWORD = 5;//聚合页 |
| 26 | + | ||
| 27 | + const SOURCE_PAGE = 6;//单页面 | ||
| 26 | const SOURCE_CUSTOM = 7;//自定义模块 | 28 | const SOURCE_CUSTOM = 7;//自定义模块 |
| 27 | 29 | ||
| 28 | /** | 30 | /** |
| @@ -34,8 +36,8 @@ class BTemplate extends Base | @@ -34,8 +36,8 @@ class BTemplate extends Base | ||
| 34 | * 公共头部底部连接部分 | 36 | * 公共头部底部连接部分 |
| 35 | */ | 37 | */ |
| 36 | const COMMON_HEAD = 1;//公共头部 | 38 | const COMMON_HEAD = 1;//公共头部 |
| 37 | - const COMMON_FOOTER = 2;//公共头部 | ||
| 38 | - const COMMON_OTHER = 3;//公共头部 | 39 | + const COMMON_FOOTER = 2;//公共底部 |
| 40 | + const COMMON_OTHER = 3;//公共other | ||
| 39 | /** | 41 | /** |
| 40 | * 独立头部类型 | 42 | * 独立头部类型 |
| 41 | */ | 43 | */ |
| @@ -190,7 +190,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -190,7 +190,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 190 | Route::any('/saveWebTrafficConfig', [Aside\Project\ProjectController::class, 'saveWebTrafficConfig'])->name('admin.project_web_traffic_config_save');//保存引流配置 | 190 | Route::any('/saveWebTrafficConfig', [Aside\Project\ProjectController::class, 'saveWebTrafficConfig'])->name('admin.project_web_traffic_config_save');//保存引流配置 |
| 191 | Route::any('/updateProjectManager', [Aside\Project\ProjectController::class, 'updateProjectManager'])->name('admin.project_updateProjectManager');//更改项目人员配置 | 191 | Route::any('/updateProjectManager', [Aside\Project\ProjectController::class, 'updateProjectManager'])->name('admin.project_updateProjectManager');//更改项目人员配置 |
| 192 | Route::any('/setIsParticiple', [Aside\Project\ProjectController::class, 'setIsParticiple'])->name('admin.project_setIsParticiple');//开启/关闭分词 | 192 | Route::any('/setIsParticiple', [Aside\Project\ProjectController::class, 'setIsParticiple'])->name('admin.project_setIsParticiple');//开启/关闭分词 |
| 193 | - | 193 | + Route::any('/saveSiteStatus', [Aside\Project\ProjectController::class, 'saveSiteStatus'])->name('admin.project_saveSiteStatus'); |
| 194 | //获取关键词前缀和后缀 | 194 | //获取关键词前缀和后缀 |
| 195 | Route::prefix('keyword')->group(function () { | 195 | Route::prefix('keyword')->group(function () { |
| 196 | Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); | 196 | Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); |
| @@ -356,6 +356,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -356,6 +356,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 356 | Route::prefix('template')->group(function () { | 356 | Route::prefix('template')->group(function () { |
| 357 | //获取所有公共主题模版 | 357 | //获取所有公共主题模版 |
| 358 | Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists'); | 358 | Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists'); |
| 359 | + Route::any('/publicInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicInfo'])->name('template_publicInfo'); | ||
| 359 | //获取选中的主题模版 | 360 | //获取选中的主题模版 |
| 360 | Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate'); | 361 | Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate'); |
| 361 | Route::any('/getTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTemplate'])->name('template_getTemplate'); | 362 | Route::any('/getTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTemplate'])->name('template_getTemplate'); |
| @@ -553,6 +554,10 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -553,6 +554,10 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 553 | Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'save'])->name('template_label_save'); | 554 | Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'save'])->name('template_label_save'); |
| 554 | Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'del'])->name('template_label_del'); | 555 | Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'del'])->name('template_label_del'); |
| 555 | }); | 556 | }); |
| 557 | + //设置公共头部+底部配置 | ||
| 558 | + Route::prefix('com_config')->group(function () { | ||
| 559 | + Route::any('/getIsComConfig', [\App\Http\Controllers\Bside\Template\BProjectIsComController::class, 'getIsComConfig'])->name('template_label_getUserLists'); | ||
| 560 | + }); | ||
| 556 | }); | 561 | }); |
| 557 | //无需登录验证的路由组 | 562 | //无需登录验证的路由组 |
| 558 | Route::group([], function () { | 563 | Route::group([], function () { |
-
请 注册 或 登录 后发表评论