作者 lyh

修改脚本设置

@@ -47,36 +47,23 @@ class Demo extends Command @@ -47,36 +47,23 @@ class Demo extends Command
47 protected $description = 'demo'; 47 protected $description = 'demo';
48 48
49 public function handle(){ 49 public function handle(){
50 - $serverConfigModel = new ServerConfig();  
51 - $lists = $serverConfigModel->list(['type'=>1],'id',['*'],'asc'); 50 + $serverIpModel = new ServersIp();
  51 + $lists = $serverIpModel->list();
52 foreach ($lists as $v){ 52 foreach ($lists as $v){
53 - echo date('Y-m-d H:i:s') . 'title数据:'.$v['title'] . PHP_EOL;  
54 - $encrypt = new EncryptUtils();  
55 - $param = [  
56 - 'server_name'=>$v['title'],  
57 - 'being_number'=>$v['count'],  
58 - 'ip_total'=>1,  
59 - 'account'=>$encrypt->lock_url($v['user']),  
60 - 'password'=>$encrypt->lock_url($v['password']),  
61 - 'port'=>$encrypt->lock_url($v['port']),  
62 - 'bt_account'=>$v['bt_account'],  
63 - 'bt_password'=>$v['bt_password'],  
64 - 'service_type'=>$v['service_type'],  
65 - 'domain'=>'globalso.com',  
66 - ];  
67 - $serverModel = new Servers();  
68 - $server_id = $serverModel->addReturnId($param);  
69 - echo date('Y-m-d H:i:s') . 'server_id:'.$server_id . PHP_EOL;  
70 - $paramsIp = [  
71 - 'id'=>$v['id'],  
72 - 'ip'=>$v['host'],  
73 - 'servers_id'=>$server_id,  
74 - 'domain'=>$v['init_domain'],  
75 - 'created_at'=>date('Y-m-d H:i:s'),  
76 - 'updated_at'=>date('Y-m-d H:i:s')  
77 - ];  
78 - $serverIpModel = new ServersIp();  
79 - $serverIpModel->insert($paramsIp); 53 + $num = 0;
  54 + $str = '';
  55 + $projectModel = new Project();
  56 + $project_list = $projectModel->list(['serve_id'=>$v['id']],['id']);
  57 + if(!empty($project_list)){
  58 + foreach ($project_list as $value){
  59 + $str .= $value['id'].',';
  60 + $num++;
  61 + }
  62 + if(!empty($str)){
  63 + $str = ','.$str;
  64 + }
  65 + $serverIpModel->edit(['total'=>$num,'project_arr'=>$str],['id'=>$v['id']]);
  66 + }
80 } 67 }
81 return true; 68 return true;
82 } 69 }
@@ -53,109 +53,6 @@ class Temp extends Command @@ -53,109 +53,6 @@ class Temp extends Command
53 $this->output('end'); 53 $this->output('end');
54 } 54 }
55 55
56 -// public function handle()  
57 -// {  
58 -// $domain_model = new DomainInfo();  
59 -// $notify_model = new Notify();  
60 -// $project_model = new Project();  
61 -//  
62 -// $domain_list = $domain_model->list(['amp_status' => 1]);  
63 -// foreach ($domain_list as $info) {  
64 -// if ($info['project_id'] > 0) {  
65 -// $notify_info = $notify_model->read(['project_id' => $info['project_id'], 'type' => 3]);  
66 -// if (!$notify_info) {  
67 -//  
68 -// $domain_array = parse_url($info['domain']);  
69 -// $host = $domain_array['host'] ?? $domain_array['path'];  
70 -// $host_array = explode('.', $host);  
71 -// if (count($host_array) <= 2) {  
72 -// array_unshift($host_array, 'm');  
73 -// } else {  
74 -// $host_array[0] = 'm';  
75 -// }  
76 -// $amp_domain = implode('.', $host_array);  
77 -//  
78 -// $project_info = $project_model->read(['id' => $info['project_id']]);  
79 -//  
80 -// $notify_model->add([  
81 -// 'project_id' => $info['project_id'],  
82 -// 'type' => 3,  
83 -// 'data' => json_encode(['domain' => $amp_domain, 'url' => [], 'language' => []]),  
84 -// 'server_id' => $project_info['serve_id'],  
85 -// ]);  
86 -// }  
87 -// }  
88 -// }  
89 -// }  
90 -  
91 -// public function handle()  
92 -// {  
93 -// $domain_model = new DomainInfo();  
94 -// $server_model = new ServerConfig();  
95 -// $project_model = new Project();  
96 -//  
97 -// $domain_list = $domain_model->list(['domain' => ['like', 'www.%']], 'id', ['id', 'domain', 'project_id'], 'asc');  
98 -// foreach ($domain_list as $info) {  
99 -// $this->output('domain:' . $info['domain'] . ',开始');  
100 -//  
101 -// $project_info = $project_model->read(['id' => $info['project_id']], 'serve_id');  
102 -// if ($project_info === false) {  
103 -// $this->output('获取项目数据失败');  
104 -// continue;  
105 -// }  
106 -//  
107 -// $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);  
108 -// if ($server_info === false) {  
109 -// $this->output('获取服务器数据失败');  
110 -// continue;  
111 -// }  
112 -//  
113 -// $domain_array = parse_url($info['domain']);  
114 -// $host = $domain_array['host'] ?? $domain_array['path'];  
115 -// $host_array = explode('.', $host);  
116 -// if (count($host_array) <= 2) {  
117 -// array_unshift($host_array, 'm');  
118 -// } else {  
119 -// $host_array[0] = 'm';  
120 -// }  
121 -// $amp_domain = implode('.', $host_array);  
122 -// if (!$this->check_cname($amp_domain, $server_info)) {  
123 -// $this->output('AMP站点域名' . $amp_domain . '未解析至目标服务器');  
124 -// continue;  
125 -// }  
126 -//  
127 -// $api_url = 'http://' . $server_info['init_domain'] . '/api/createSiteAmp';  
128 -// $api_param = [  
129 -// 'domain' => $info['domain'],  
130 -// 'private_key' => '',  
131 -// 'cert' => ''  
132 -// ];  
133 -//  
134 -// try {  
135 -// $rs = HttpUtils::get($api_url, $api_param);  
136 -// $rs = json_decode($rs, true);  
137 -// if (isset($rs['status']) && $rs['status'] == 200) {  
138 -// $this->output('创建AMP站点成功');  
139 -// } else {  
140 -// $this->output($rs['message'] ?? '');  
141 -// continue;  
142 -// }  
143 -// } catch (\Exception | GuzzleException $e) {  
144 -// errorLog('创建AMP站点', $api_param, $e);  
145 -// $this->output('创建AMP站点失败');  
146 -// continue;  
147 -// }  
148 -//  
149 -// $data = [  
150 -// 'amp_status' => 1,  
151 -// 'amp_type' => 1,  
152 -// ];  
153 -// $domain_model->edit($data, ['id' => $info['id']]);  
154 -// }  
155 -//  
156 -// echo '成功' . PHP_EOL;  
157 -// }  
158 -  
159 public function check_cname($domain, $server_info) 56 public function check_cname($domain, $server_info)
160 { 57 {
161 $checkA = false; 58 $checkA = false;
@@ -166,7 +63,7 @@ class Temp extends Command @@ -166,7 +63,7 @@ class Temp extends Command
166 $output = explode(PHP_EOL, $process->getOutput()); 63 $output = explode(PHP_EOL, $process->getOutput());
167 foreach ($output as $line) { 64 foreach ($output as $line) {
168 if ($line) { 65 if ($line) {
169 - $checkA = strpos($line, $server_info['host']) !== false; 66 + $checkA = strpos($line, $server_info['ip']) !== false;
170 if ($checkA) { 67 if ($checkA) {
171 return $domain; 68 return $domain;
172 } 69 }
@@ -179,7 +76,7 @@ class Temp extends Command @@ -179,7 +76,7 @@ class Temp extends Command
179 $output = explode(PHP_EOL, $process->getOutput()); 76 $output = explode(PHP_EOL, $process->getOutput());
180 foreach ($output as $line) { 77 foreach ($output as $line) {
181 if ($line) { 78 if ($line) {
182 - $checkCname = (strpos($line, $server_info['init_domain']) !== false); 79 + $checkCname = (strpos($line, $server_info['domain']) !== false);
183 if ($checkCname) { 80 if ($checkCname) {
184 return $domain; 81 return $domain;
185 } 82 }
@@ -68,14 +68,13 @@ class ServersIpController extends BaseController @@ -68,14 +68,13 @@ class ServersIpController extends BaseController
68 * @method :post 68 * @method :post
69 * @time :2024/6/25 14:52 69 * @time :2024/6/25 14:52
70 */ 70 */
71 - public function info(){ 71 + public function info(ServersIpLogic $serversIpLogic){
72 $this->request->validate([ 72 $this->request->validate([
73 'id'=>'required' 73 'id'=>'required'
74 ],[ 74 ],[
75 'id.required' => 'id不能为空' 75 'id.required' => 'id不能为空'
76 ]); 76 ]);
77 - $serversIpModel = new ServersIpModel();  
78 - $data = $serversIpModel->read(['id'=>$this->param['id']]); 77 + $data = $serversIpLogic->infoServersIp();
79 $this->response('success',Code::SUCCESS,$data); 78 $this->response('success',Code::SUCCESS,$data);
80 } 79 }
81 80
@@ -602,19 +602,6 @@ class ProjectController extends BaseController @@ -602,19 +602,6 @@ class ProjectController extends BaseController
602 } 602 }
603 603
604 /** 604 /**
605 - * @remark :获取项目服务器与数据库列表  
606 - * @name :getServiceConfig  
607 - * @author :lyh  
608 - * @method :post  
609 - * @time :2023/8/14 10:23 todo::后面删除  
610 - */  
611 - public function getServiceConfig(){  
612 - $serviceConfigModel = new ServerConfig();  
613 - $list = $serviceConfigModel->list($this->param,'id',['id','type','title','count','init_domain','service_type']);  
614 - $this->response('success',Code::SUCCESS,$list);  
615 - }  
616 -  
617 - /**  
618 * @remark :获取域名列表 605 * @remark :获取域名列表
619 * @name :getDomain 606 * @name :getDomain
620 * @author :lyh 607 * @author :lyh
@@ -225,9 +225,12 @@ class CNoticeController extends BaseController @@ -225,9 +225,12 @@ class CNoticeController extends BaseController
225 $ids = explode(',',$info['country_lists']); 225 $ids = explode(',',$info['country_lists']);
226 } 226 }
227 $languageModel = new WebLanguage(); 227 $languageModel = new WebLanguage();
  228 + if(empty($ids)){
  229 + array_push($ids,1);
  230 + }
228 //根据排序查询选中的小语种 231 //根据排序查询选中的小语种
229 $lists = $languageModel->whereIn('id', $ids)->orderByRaw(DB::raw("FIND_IN_SET(id,'" . implode(',', $ids) . "'" . ')'))->get()->toArray(); 232 $lists = $languageModel->whereIn('id', $ids)->orderByRaw(DB::raw("FIND_IN_SET(id,'" . implode(',', $ids) . "'" . ')'))->get()->toArray();
230 -// $lists = $languageModel->list(['id'=>['in',$ids]]); 233 +
231 $this->response('success',Code::SUCCESS,$lists); 234 $this->response('success',Code::SUCCESS,$lists);
232 } 235 }
233 236
@@ -12,6 +12,7 @@ namespace App\Http\Logic\Aside\Devops; @@ -12,6 +12,7 @@ namespace App\Http\Logic\Aside\Devops;
12 use App\Http\Logic\Aside\BaseLogic; 12 use App\Http\Logic\Aside\BaseLogic;
13 use App\Models\Devops\Servers; 13 use App\Models\Devops\Servers;
14 use App\Models\Devops\ServersIp; 14 use App\Models\Devops\ServersIp;
  15 +use App\Models\Project\Project;
15 16
16 class ServersIpLogic extends BaseLogic 17 class ServersIpLogic extends BaseLogic
17 { 18 {
@@ -26,6 +27,20 @@ class ServersIpLogic extends BaseLogic @@ -26,6 +27,20 @@ class ServersIpLogic extends BaseLogic
26 } 27 }
27 28
28 /** 29 /**
  30 + * @remark :获取数据详情
  31 + * @name :infoServersIp
  32 + * @author :lyh
  33 + * @method :post
  34 + * @time :2024/6/27 15:52
  35 + */
  36 + public function infoServersIp(){
  37 + $info = $this->model->read(['id'=>$this->param['id']]);
  38 + $projectModel = new Project();
  39 + $info['project_title'] = $projectModel->formatQuery(['serve_id'=>$info['id']])->pluck('title')->toArray();
  40 + return $this->success($info);
  41 + }
  42 +
  43 + /**
29 * @remark :保存数据 44 * @remark :保存数据
30 * @name :saveServersIp 45 * @name :saveServersIp
31 * @author :lyh 46 * @author :lyh
@@ -88,7 +103,7 @@ class ServersIpLogic extends BaseLogic @@ -88,7 +103,7 @@ class ServersIpLogic extends BaseLogic
88 if($info['total'] != 0){ 103 if($info['total'] != 0){
89 continue; 104 continue;
90 } 105 }
91 - $this->model->del(['id'=>$v]); 106 + $this->model->edit(['status'=>1],['id'=>$v]);
92 } 107 }
93 return $this->success(); 108 return $this->success();
94 } 109 }
@@ -8,6 +8,7 @@ use App\Jobs\EditAmpDomainBt; @@ -8,6 +8,7 @@ use App\Jobs\EditAmpDomainBt;
8 use App\Jobs\EditCustomDomainBt; 8 use App\Jobs\EditCustomDomainBt;
9 use App\Jobs\EditDomainBt; 9 use App\Jobs\EditDomainBt;
10 use App\Models\Devops\ServerConfig; 10 use App\Models\Devops\ServerConfig;
  11 +use App\Models\Devops\ServersIp;
11 use App\Models\Domain\DomainInfo; 12 use App\Models\Domain\DomainInfo;
12 use App\Models\Project\CountryCustom; 13 use App\Models\Project\CountryCustom;
13 use App\Models\Project\DeployOptimize; 14 use App\Models\Project\DeployOptimize;
@@ -258,8 +259,8 @@ class DomainInfoLogic extends BaseLogic @@ -258,8 +259,8 @@ class DomainInfoLogic extends BaseLogic
258 if($project_info === false){ 259 if($project_info === false){
259 $this->fail('获取项目数据失败'); 260 $this->fail('获取项目数据失败');
260 } 261 }
261 - $server_model = new ServerConfig();  
262 - $server_info = $server_model->read(['id'=>$project_info['serve_id']],['init_domain', 'host']); 262 + $serverIpModel = new ServersIp();
  263 + $server_info = $serverIpModel->read(['id'=>$project_info['serve_id']],['domain', 'ip']);
263 if($server_info === false){ 264 if($server_info === false){
264 $this->fail('获取服务器数据失败'); 265 $this->fail('获取服务器数据失败');
265 } 266 }
@@ -312,11 +313,9 @@ class DomainInfoLogic extends BaseLogic @@ -312,11 +313,9 @@ class DomainInfoLogic extends BaseLogic
312 $this->model->edit($data,['id'=>$this->param['id']]); 313 $this->model->edit($data,['id'=>$this->param['id']]);
313 //主站生成证书 314 //主站生成证书
314 EditDomainBt::dispatch($this->param['id']); 315 EditDomainBt::dispatch($this->param['id']);
315 -// $this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? [],$this->param['is_https'] ?? 0);  
316 //amp站生成证书 316 //amp站生成证书
317 if($data['amp_status']){ 317 if($data['amp_status']){
318 EditAmpDomainBt::dispatch($this->param['id']); 318 EditAmpDomainBt::dispatch($this->param['id']);
319 -// $this->setAmpDomainSsl($server_info['init_domain'],$info['domain']);  
320 } 319 }
321 return $this->success(); 320 return $this->success();
322 } 321 }
@@ -339,7 +338,7 @@ class DomainInfoLogic extends BaseLogic @@ -339,7 +338,7 @@ class DomainInfoLogic extends BaseLogic
339 $output = explode(PHP_EOL, $process->getOutput()); 338 $output = explode(PHP_EOL, $process->getOutput());
340 foreach ($output as $line){ 339 foreach ($output as $line){
341 if($line){ 340 if($line){
342 - $checkA = strpos($line, $server_info['host']) !== false; 341 + $checkA = strpos($line, $server_info['ip']) !== false;
343 if($checkA){ 342 if($checkA){
344 return $domain; 343 return $domain;
345 } 344 }
@@ -352,7 +351,7 @@ class DomainInfoLogic extends BaseLogic @@ -352,7 +351,7 @@ class DomainInfoLogic extends BaseLogic
352 $output = explode(PHP_EOL, $process->getOutput()); 351 $output = explode(PHP_EOL, $process->getOutput());
353 foreach ($output as $line){ 352 foreach ($output as $line){
354 if($line){ 353 if($line){
355 - $checkCname = (strpos($line, $server_info['init_domain']) !== false); 354 + $checkCname = (strpos($line, $server_info['domain']) !== false);
356 if($checkCname){ 355 if($checkCname){
357 return $domain; 356 return $domain;
358 } 357 }
@@ -378,8 +377,8 @@ class DomainInfoLogic extends BaseLogic @@ -378,8 +377,8 @@ class DomainInfoLogic extends BaseLogic
378 $custom_model = new CountryCustom(); 377 $custom_model = new CountryCustom();
379 if($this->param['is_create']){ 378 if($this->param['is_create']){
380 //需要创建站点 379 //需要创建站点
381 - $server_model = new ServerConfig();  
382 - $server_info = $server_model->read(['id'=>$project_info['serve_id']],['init_domain', 'host']); 380 + $serverIpModel = new ServersIp();
  381 + $server_info = $serverIpModel->read(['id'=>$project_info['serve_id']],['domain', 'ip']);
383 if($server_info === false){ 382 if($server_info === false){
384 $this->fail('获取服务器数据失败'); 383 $this->fail('获取服务器数据失败');
385 } 384 }
@@ -419,9 +418,6 @@ class DomainInfoLogic extends BaseLogic @@ -419,9 +418,6 @@ class DomainInfoLogic extends BaseLogic
419 if($this->param['is_create']){ 418 if($this->param['is_create']){
420 //创建站点,设置证书 419 //创建站点,设置证书
421 EditCustomDomainBt::dispatch($id); 420 EditCustomDomainBt::dispatch($id);
422 -// $this->param['key'] = $this->param['private_key'] ?? '';  
423 -// $this->param['cert'] = $this->param['private_cert'] ?? '';  
424 -// $this->setDomainSsl($server_info['init_domain'],$this->param['custom_domain'],[],[],1);  
425 } 421 }
426 422
427 return $this->success(); 423 return $this->success();
@@ -10,7 +10,6 @@ use App\Helper\Arr; @@ -10,7 +10,6 @@ use App\Helper\Arr;
10 use App\Helper\Common; 10 use App\Helper\Common;
11 use App\Helper\FormGlobalsoApi; 11 use App\Helper\FormGlobalsoApi;
12 use App\Http\Logic\Aside\BaseLogic; 12 use App\Http\Logic\Aside\BaseLogic;
13 -use App\Http\Logic\Aside\Domain\DomainInfoLogic;  
14 use App\Jobs\CopyImageFileJob; 13 use App\Jobs\CopyImageFileJob;
15 use App\Jobs\CopyProjectJob; 14 use App\Jobs\CopyProjectJob;
16 use App\Models\Channel\Channel; 15 use App\Models\Channel\Channel;
@@ -18,7 +17,6 @@ use App\Models\Channel\User; @@ -18,7 +17,6 @@ use App\Models\Channel\User;
18 use App\Models\Channel\Zone; 17 use App\Models\Channel\Zone;
19 use App\Models\Com\NoticeLog; 18 use App\Models\Com\NoticeLog;
20 use App\Models\Com\UpdateLog; 19 use App\Models\Com\UpdateLog;
21 -use App\Models\Devops\ServerConfig;  
22 use App\Models\Devops\Servers; 20 use App\Models\Devops\Servers;
23 use App\Models\Devops\ServersIp; 21 use App\Models\Devops\ServersIp;
24 use App\Models\Domain\DomainInfo; 22 use App\Models\Domain\DomainInfo;
@@ -40,18 +38,14 @@ use App\Models\RankData\RankData; @@ -40,18 +38,14 @@ use App\Models\RankData\RankData;
40 use App\Models\RankData\RankWeek; 38 use App\Models\RankData\RankWeek;
41 use App\Models\RankData\RecommDomain; 39 use App\Models\RankData\RecommDomain;
42 use App\Models\RankData\Speed; 40 use App\Models\RankData\Speed;
43 -use App\Models\RouteMap\RouteMap;  
44 use App\Models\User\ProjectMenu; 41 use App\Models\User\ProjectMenu;
45 use App\Models\User\ProjectRole; 42 use App\Models\User\ProjectRole;
46 use App\Models\User\User as UserModel; 43 use App\Models\User\User as UserModel;
47 use App\Models\WebSetting\WebLanguage; 44 use App\Models\WebSetting\WebLanguage;
48 use App\Services\ProjectServer; 45 use App\Services\ProjectServer;
49 use App\Services\SyncService; 46 use App\Services\SyncService;
50 -use App\Utils\HttpUtils;  
51 use App\Utils\LogUtils; 47 use App\Utils\LogUtils;
52 -use GuzzleHttp\Exception\GuzzleException;  
53 use Illuminate\Support\Facades\Cache; 48 use Illuminate\Support\Facades\Cache;
54 -use Illuminate\Support\Facades\DB;  
55 use Illuminate\Support\Facades\Http; 49 use Illuminate\Support\Facades\Http;
56 50
57 /** 51 /**
@@ -130,10 +124,10 @@ class ProjectLogic extends BaseLogic @@ -130,10 +124,10 @@ class ProjectLogic extends BaseLogic
130 public function getInitDomain($serve_id = ''){ 124 public function getInitDomain($serve_id = ''){
131 $domain = ''; 125 $domain = '';
132 if(!empty($serve_id)){ 126 if(!empty($serve_id)){
133 - $serveModel = new ServerConfig();  
134 - $info = $serveModel->read(['id'=>$serve_id]); 127 + $serverIpModel = new ServersIp();
  128 + $info = $serverIpModel->read(['id'=>$serve_id]);
135 if($info !== false){ 129 if($info !== false){
136 - $domain = $info['init_domain']; 130 + $domain = $info['domain'];
137 } 131 }
138 } 132 }
139 return $this->success(['domain'=>$domain]); 133 return $this->success(['domain'=>$domain]);
@@ -709,37 +703,6 @@ class ProjectLogic extends BaseLogic @@ -709,37 +703,6 @@ class ProjectLogic extends BaseLogic
709 } 703 }
710 704
711 /** 705 /**
712 - * 创建站点  
713 - * @param $param  
714 - * @throws AsideGlobalException  
715 - * @author Akun  
716 - * @date 2023/10/17 10:04  
717 - */  
718 - public function createSite($param){  
719 - if(isset($param['serve_id']) && $param['serve_id'] && isset($param['deploy_optimize']['domain']) && $param['deploy_optimize']['domain']){  
720 - $server_model = new ServerConfig();  
721 - $server_info = $server_model->read(['id'=>$param['serve_id']],['init_domain','host']);  
722 -  
723 - $domain_model = new DomainInfo();  
724 - $domain_info = $domain_model->read(['id'=>$param['deploy_optimize']['domain']],'domain');  
725 -  
726 - if($server_info && $domain_info){  
727 - //验证解析  
728 - if (!empty($domain_info['domain']) && !DomainInfoLogic::instance()->check_cname($domain_info['domain'], $server_info)) {  
729 - throw new AsideGlobalException(Code::SYSTEM_ERROR,'域名' . $domain_info['domain'] . '未解析至目标服务器');  
730 - }  
731 - $api_url = 'http://'.$server_info['init_domain'].'/api/createSite';  
732 - $api_param = ['domain'=>$domain_info['domain']];  
733 - try {  
734 - HttpUtils::get($api_url, $api_param);  
735 - } catch (\Exception | GuzzleException $e) {  
736 - errorLog('创建站点', $api_param, $e);  
737 - }  
738 - }  
739 - }  
740 - }  
741 -  
742 - /**  
743 * @remark :复制项目 706 * @remark :复制项目
744 * @name :copyProject 707 * @name :copyProject
745 * @author :lyh 708 * @author :lyh
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Jobs; 3 namespace App\Jobs;
4 4
5 use App\Models\Devops\ServerConfig; 5 use App\Models\Devops\ServerConfig;
  6 +use App\Models\Devops\ServersIp;
6 use App\Models\Domain\DomainInfo; 7 use App\Models\Domain\DomainInfo;
7 use App\Models\Project\Project; 8 use App\Models\Project\Project;
8 use App\Utils\HttpUtils; 9 use App\Utils\HttpUtils;
@@ -51,16 +52,14 @@ class EditAmpDomainBt implements ShouldQueue @@ -51,16 +52,14 @@ class EditAmpDomainBt implements ShouldQueue
51 if ($project_info === false) { 52 if ($project_info === false) {
52 return $this->output($domain_info['domain'] . ':获取项目数据失败'); 53 return $this->output($domain_info['domain'] . ':获取项目数据失败');
53 } 54 }
54 -  
55 //获取服务器数据 55 //获取服务器数据
56 - $server_model = new ServerConfig();  
57 - $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']); 56 + $serverIpModel = new ServersIp();
  57 + $server_info = $serverIpModel->read(['id'=>$project_info['serve_id']],['domain', 'ip']);
58 if ($server_info === false) { 58 if ($server_info === false) {
59 return $this->output($domain_info['domain'] . ':获取服务器数据失败'); 59 return $this->output($domain_info['domain'] . ':获取服务器数据失败');
60 } 60 }
61 -  
62 //编辑amp站 61 //编辑amp站
63 - $api_url_amp = 'http://' . $server_info['init_domain'] . '/api/createSiteAmp'; 62 + $api_url_amp = 'http://' . $server_info['domain'] . '/api/createSiteAmp';
64 $api_param_amp = [ 63 $api_param_amp = [
65 'domain' => $domain_info['domain'], 64 'domain' => $domain_info['domain'],
66 ]; 65 ];
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Jobs; 3 namespace App\Jobs;
4 4
5 use App\Models\Devops\ServerConfig; 5 use App\Models\Devops\ServerConfig;
  6 +use App\Models\Devops\ServersIp;
6 use App\Models\Project\CountryCustom; 7 use App\Models\Project\CountryCustom;
7 use App\Models\Project\Project; 8 use App\Models\Project\Project;
8 use App\Utils\HttpUtils; 9 use App\Utils\HttpUtils;
@@ -51,14 +52,14 @@ class EditCustomDomainBt implements ShouldQueue @@ -51,14 +52,14 @@ class EditCustomDomainBt implements ShouldQueue
51 return $this->output($domain_info['custom_domain'] . ':获取项目数据失败'); 52 return $this->output($domain_info['custom_domain'] . ':获取项目数据失败');
52 } 53 }
53 //获取服务器数据 54 //获取服务器数据
54 - $server_model = new ServerConfig();  
55 - $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']); 55 + $serverIpModel = new ServersIp();
  56 + $server_info = $serverIpModel->read(['id'=>$project_info['serve_id']],['domain', 'ip']);
56 if ($server_info === false) { 57 if ($server_info === false) {
57 return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败'); 58 return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败');
58 } 59 }
59 //编辑站点 60 //编辑站点
60 if ($domain_info['type'] == 2) { 61 if ($domain_info['type'] == 2) {
61 - $api_url = 'http://' . $server_info['init_domain'] . '/api/setSsl'; 62 + $api_url = 'http://' . $server_info['domain'] . '/api/setSsl';
62 $api_param = [ 63 $api_param = [
63 'domain' => $domain_info['custom_domain'], 64 'domain' => $domain_info['custom_domain'],
64 'private_key' => $domain_info['private_key'], 65 'private_key' => $domain_info['private_key'],
@@ -68,7 +69,7 @@ class EditCustomDomainBt implements ShouldQueue @@ -68,7 +69,7 @@ class EditCustomDomainBt implements ShouldQueue
68 'is_https' => 1 69 'is_https' => 1
69 ]; 70 ];
70 } else { 71 } else {
71 - $api_url = 'http://' . $server_info['init_domain'] . '/api/applySsl'; 72 + $api_url = 'http://' . $server_info['domain'] . '/api/applySsl';
72 $api_param = [ 73 $api_param = [
73 'domain' => $domain_info['custom_domain'], 74 'domain' => $domain_info['custom_domain'],
74 'rewrite' => [], 75 'rewrite' => [],
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Jobs; 3 namespace App\Jobs;
4 4
5 use App\Models\Devops\ServerConfig; 5 use App\Models\Devops\ServerConfig;
  6 +use App\Models\Devops\ServersIp;
6 use App\Models\Domain\DomainInfo; 7 use App\Models\Domain\DomainInfo;
7 use App\Models\Project\Project; 8 use App\Models\Project\Project;
8 use App\Utils\HttpUtils; 9 use App\Utils\HttpUtils;
@@ -53,15 +54,15 @@ class EditDomainBt implements ShouldQueue @@ -53,15 +54,15 @@ class EditDomainBt implements ShouldQueue
53 } 54 }
54 55
55 //获取服务器数据 56 //获取服务器数据
56 - $server_model = new ServerConfig();  
57 - $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']); 57 + $serverIpModel = new ServersIp();
  58 + $server_info = $serverIpModel->read(['id'=>$project_info['serve_id']],['domain', 'ip']);
58 if ($server_info === false) { 59 if ($server_info === false) {
59 return $this->output($domain_info['domain'] . ':获取服务器数据失败'); 60 return $this->output($domain_info['domain'] . ':获取服务器数据失败');
60 } 61 }
61 62
62 //编辑主站 63 //编辑主站
63 if ($domain_info['type'] == 2) { 64 if ($domain_info['type'] == 2) {
64 - $api_url = 'http://' . $server_info['init_domain'] . '/api/setSsl'; 65 + $api_url = 'http://' . $server_info['domain'] . '/api/setSsl';
65 $api_param = [ 66 $api_param = [
66 'domain' => $domain_info['domain'], 67 'domain' => $domain_info['domain'],
67 'private_key' => $domain_info['private_key'], 68 'private_key' => $domain_info['private_key'],
@@ -71,7 +72,7 @@ class EditDomainBt implements ShouldQueue @@ -71,7 +72,7 @@ class EditDomainBt implements ShouldQueue
71 'is_https' => $domain_info['is_https'] 72 'is_https' => $domain_info['is_https']
72 ]; 73 ];
73 } else { 74 } else {
74 - $api_url = 'http://' . $server_info['init_domain'] . '/api/applySsl'; 75 + $api_url = 'http://' . $server_info['domain'] . '/api/applySsl';
75 $api_param = [ 76 $api_param = [
76 'domain' => $domain_info['domain'], 77 'domain' => $domain_info['domain'],
77 'rewrite' => $domain_info['extend_config'], 78 'rewrite' => $domain_info['extend_config'],