作者 Your Name
@@ -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');  
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(); 50 $serverIpModel = new ServersIp();
79 - $serverIpModel->insert($paramsIp); 51 + $lists = $serverIpModel->list();
  52 + foreach ($lists as $v){
  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 }
@@ -39,6 +39,7 @@ class ServersIpController extends BaseController @@ -39,6 +39,7 @@ class ServersIpController extends BaseController
39 } 39 }
40 $serversIpModel = new ServersIpModel(); 40 $serversIpModel = new ServersIpModel();
41 $this->map['total'] = ['<',$info['ip_total']]; 41 $this->map['total'] = ['<',$info['ip_total']];
  42 + $this->map['status'] = 0;
42 $data = $serversIpModel->list($this->map); 43 $data = $serversIpModel->list($this->map);
43 $this->response('success',Code::SUCCESS,$data); 44 $this->response('success',Code::SUCCESS,$data);
44 } 45 }
@@ -57,6 +58,7 @@ class ServersIpController extends BaseController @@ -57,6 +58,7 @@ class ServersIpController extends BaseController
57 'servers_id.required' => '服务器servers_id不能为空' 58 'servers_id.required' => '服务器servers_id不能为空'
58 ]); 59 ]);
59 $serversIpModel = new ServersIpModel(); 60 $serversIpModel = new ServersIpModel();
  61 + $this->map['status'] = 0;
60 $data = $serversIpModel->lists($this->map,$this->page,$this->row,$this->order); 62 $data = $serversIpModel->lists($this->map,$this->page,$this->row,$this->order);
61 $this->response('success',Code::SUCCESS,$data); 63 $this->response('success',Code::SUCCESS,$data);
62 } 64 }
@@ -68,14 +70,13 @@ class ServersIpController extends BaseController @@ -68,14 +70,13 @@ class ServersIpController extends BaseController
68 * @method :post 70 * @method :post
69 * @time :2024/6/25 14:52 71 * @time :2024/6/25 14:52
70 */ 72 */
71 - public function info(){ 73 + public function info(ServersIpLogic $serversIpLogic){
72 $this->request->validate([ 74 $this->request->validate([
73 'id'=>'required' 75 'id'=>'required'
74 ],[ 76 ],[
75 'id.required' => 'id不能为空' 77 'id.required' => 'id不能为空'
76 ]); 78 ]);
77 - $serversIpModel = new ServersIpModel();  
78 - $data = $serversIpModel->read(['id'=>$this->param['id']]); 79 + $data = $serversIpLogic->infoServersIp();
79 $this->response('success',Code::SUCCESS,$data); 80 $this->response('success',Code::SUCCESS,$data);
80 } 81 }
81 82
@@ -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
@@ -61,7 +61,7 @@ class ProductController extends BaseController @@ -61,7 +61,7 @@ class ProductController extends BaseController
61 foreach ($lists['list'] as $k=>$v){ 61 foreach ($lists['list'] as $k=>$v){
62 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);; 62 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);;
63 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); 63 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
64 - $v['keyword_id_text'] = mb_substr($this->keywordName($v['keyword_id'],$key_data), 0, 20, 'UTF-8').'...'; 64 + $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
65 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 65 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
66 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']); 66 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
67 $v = $this->getHandleFileImage($v); 67 $v = $this->getHandleFileImage($v);
@@ -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
@@ -83,12 +98,12 @@ class ServersIpLogic extends BaseLogic @@ -83,12 +98,12 @@ class ServersIpLogic extends BaseLogic
83 * @time :2024/6/27 13:55 98 * @time :2024/6/27 13:55
84 */ 99 */
85 public function batchDelServersIp(){ 100 public function batchDelServersIp(){
86 - foreach ($this->param['ids'] as $v){  
87 - $info = $this->model->read(['id'=>$v['id']],['total']); 101 + foreach ($this->param['ids'] as $id){
  102 + $info = $this->model->read(['id'=>$id],['total']);
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'=>$id]);
92 } 107 }
93 return $this->success(); 108 return $this->success();
94 } 109 }
@@ -8,6 +8,8 @@ use App\Jobs\EditAmpDomainBt; @@ -8,6 +8,8 @@ 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\Servers;
  12 +use App\Models\Devops\ServersIp;
11 use App\Models\Domain\DomainInfo; 13 use App\Models\Domain\DomainInfo;
12 use App\Models\Project\CountryCustom; 14 use App\Models\Project\CountryCustom;
13 use App\Models\Project\DeployOptimize; 15 use App\Models\Project\DeployOptimize;
@@ -258,11 +260,14 @@ class DomainInfoLogic extends BaseLogic @@ -258,11 +260,14 @@ class DomainInfoLogic extends BaseLogic
258 if($project_info === false){ 260 if($project_info === false){
259 $this->fail('获取项目数据失败'); 261 $this->fail('获取项目数据失败');
260 } 262 }
261 - $server_model = new ServerConfig();  
262 - $server_info = $server_model->read(['id'=>$project_info['serve_id']],['init_domain', 'host']);  
263 - if($server_info === false){ 263 + $serverIpModel = new ServersIp();
  264 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  265 + if($serversIpInfo === false){
264 $this->fail('获取服务器数据失败'); 266 $this->fail('获取服务器数据失败');
265 } 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']];
266 if($project_info['serve_id'] == 9){ 271 if($project_info['serve_id'] == 9){
267 $this->fail('请切换服务器,生成站点不能使用测试服务器'); 272 $this->fail('请切换服务器,生成站点不能使用测试服务器');
268 } 273 }
@@ -312,11 +317,9 @@ class DomainInfoLogic extends BaseLogic @@ -312,11 +317,9 @@ class DomainInfoLogic extends BaseLogic
312 $this->model->edit($data,['id'=>$this->param['id']]); 317 $this->model->edit($data,['id'=>$this->param['id']]);
313 //主站生成证书 318 //主站生成证书
314 EditDomainBt::dispatch($this->param['id']); 319 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站生成证书 320 //amp站生成证书
317 if($data['amp_status']){ 321 if($data['amp_status']){
318 EditAmpDomainBt::dispatch($this->param['id']); 322 EditAmpDomainBt::dispatch($this->param['id']);
319 -// $this->setAmpDomainSsl($server_info['init_domain'],$info['domain']);  
320 } 323 }
321 return $this->success(); 324 return $this->success();
322 } 325 }
@@ -339,7 +342,7 @@ class DomainInfoLogic extends BaseLogic @@ -339,7 +342,7 @@ class DomainInfoLogic extends BaseLogic
339 $output = explode(PHP_EOL, $process->getOutput()); 342 $output = explode(PHP_EOL, $process->getOutput());
340 foreach ($output as $line){ 343 foreach ($output as $line){
341 if($line){ 344 if($line){
342 - $checkA = strpos($line, $server_info['host']) !== false; 345 + $checkA = strpos($line, $server_info['ip']) !== false;
343 if($checkA){ 346 if($checkA){
344 return $domain; 347 return $domain;
345 } 348 }
@@ -352,7 +355,7 @@ class DomainInfoLogic extends BaseLogic @@ -352,7 +355,7 @@ class DomainInfoLogic extends BaseLogic
352 $output = explode(PHP_EOL, $process->getOutput()); 355 $output = explode(PHP_EOL, $process->getOutput());
353 foreach ($output as $line){ 356 foreach ($output as $line){
354 if($line){ 357 if($line){
355 - $checkCname = (strpos($line, $server_info['init_domain']) !== false); 358 + $checkCname = (strpos($line, $server_info['domain']) !== false);
356 if($checkCname){ 359 if($checkCname){
357 return $domain; 360 return $domain;
358 } 361 }
@@ -378,12 +381,14 @@ class DomainInfoLogic extends BaseLogic @@ -378,12 +381,14 @@ class DomainInfoLogic extends BaseLogic
378 $custom_model = new CountryCustom(); 381 $custom_model = new CountryCustom();
379 if($this->param['is_create']){ 382 if($this->param['is_create']){
380 //需要创建站点 383 //需要创建站点
381 - $server_model = new ServerConfig();  
382 - $server_info = $server_model->read(['id'=>$project_info['serve_id']],['init_domain', 'host']);  
383 - if($server_info === false){ 384 + $serverIpModel = new ServersIp();
  385 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  386 + if($serversIpInfo === false){
384 $this->fail('获取服务器数据失败'); 387 $this->fail('获取服务器数据失败');
385 } 388 }
386 - 389 + $serverModel = new Servers();
  390 + $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
  391 + $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
387 //域名是否都已经解析 392 //域名是否都已经解析
388 if(strpos($this->param['custom_domain'],'//') === false){ 393 if(strpos($this->param['custom_domain'],'//') === false){
389 $this->param['custom_domain'] = '//'.$this->param['custom_domain']; 394 $this->param['custom_domain'] = '//'.$this->param['custom_domain'];
@@ -419,9 +424,6 @@ class DomainInfoLogic extends BaseLogic @@ -419,9 +424,6 @@ class DomainInfoLogic extends BaseLogic
419 if($this->param['is_create']){ 424 if($this->param['is_create']){
420 //创建站点,设置证书 425 //创建站点,设置证书
421 EditCustomDomainBt::dispatch($id); 426 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 } 427 }
426 428
427 return $this->success(); 429 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,8 @@ @@ -3,6 +3,8 @@
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\Servers;
  7 +use App\Models\Devops\ServersIp;
6 use App\Models\Domain\DomainInfo; 8 use App\Models\Domain\DomainInfo;
7 use App\Models\Project\Project; 9 use App\Models\Project\Project;
8 use App\Utils\HttpUtils; 10 use App\Utils\HttpUtils;
@@ -51,16 +53,17 @@ class EditAmpDomainBt implements ShouldQueue @@ -51,16 +53,17 @@ class EditAmpDomainBt implements ShouldQueue
51 if ($project_info === false) { 53 if ($project_info === false) {
52 return $this->output($domain_info['domain'] . ':获取项目数据失败'); 54 return $this->output($domain_info['domain'] . ':获取项目数据失败');
53 } 55 }
54 -  
55 //获取服务器数据 56 //获取服务器数据
56 - $server_model = new ServerConfig();  
57 - $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);  
58 - if ($server_info === false) { 57 + $serverIpModel = new ServersIp();
  58 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  59 + if ($serversIpInfo === false) {
59 return $this->output($domain_info['domain'] . ':获取服务器数据失败'); 60 return $this->output($domain_info['domain'] . ':获取服务器数据失败');
60 } 61 }
61 - 62 + $serverModel = new Servers();
  63 + $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
  64 + $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
62 //编辑amp站 65 //编辑amp站
63 - $api_url_amp = 'http://' . $server_info['init_domain'] . '/api/createSiteAmp'; 66 + $api_url_amp = 'http://' . $server_info['domain'] . '/api/createSiteAmp';
64 $api_param_amp = [ 67 $api_param_amp = [
65 'domain' => $domain_info['domain'], 68 'domain' => $domain_info['domain'],
66 ]; 69 ];
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
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\Servers;
  7 +use App\Models\Devops\ServersIp;
6 use App\Models\Project\CountryCustom; 8 use App\Models\Project\CountryCustom;
7 use App\Models\Project\Project; 9 use App\Models\Project\Project;
8 use App\Utils\HttpUtils; 10 use App\Utils\HttpUtils;
@@ -51,14 +53,17 @@ class EditCustomDomainBt implements ShouldQueue @@ -51,14 +53,17 @@ class EditCustomDomainBt implements ShouldQueue
51 return $this->output($domain_info['custom_domain'] . ':获取项目数据失败'); 53 return $this->output($domain_info['custom_domain'] . ':获取项目数据失败');
52 } 54 }
53 //获取服务器数据 55 //获取服务器数据
54 - $server_model = new ServerConfig();  
55 - $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);  
56 - if ($server_info === false) { 56 + $serverIpModel = new ServersIp();
  57 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  58 + if ($serversIpInfo === false) {
57 return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败'); 59 return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败');
58 } 60 }
  61 + $serverModel = new Servers();
  62 + $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
  63 + $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
59 //编辑站点 64 //编辑站点
60 if ($domain_info['type'] == 2) { 65 if ($domain_info['type'] == 2) {
61 - $api_url = 'http://' . $server_info['init_domain'] . '/api/setSsl'; 66 + $api_url = 'http://' . $server_info['domain'] . '/api/setSsl';
62 $api_param = [ 67 $api_param = [
63 'domain' => $domain_info['custom_domain'], 68 'domain' => $domain_info['custom_domain'],
64 'private_key' => $domain_info['private_key'], 69 'private_key' => $domain_info['private_key'],
@@ -68,7 +73,7 @@ class EditCustomDomainBt implements ShouldQueue @@ -68,7 +73,7 @@ class EditCustomDomainBt implements ShouldQueue
68 'is_https' => 1 73 'is_https' => 1
69 ]; 74 ];
70 } else { 75 } else {
71 - $api_url = 'http://' . $server_info['init_domain'] . '/api/applySsl'; 76 + $api_url = 'http://' . $server_info['domain'] . '/api/applySsl';
72 $api_param = [ 77 $api_param = [
73 'domain' => $domain_info['custom_domain'], 78 'domain' => $domain_info['custom_domain'],
74 'rewrite' => [], 79 'rewrite' => [],
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
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\Servers;
  7 +use App\Models\Devops\ServersIp;
6 use App\Models\Domain\DomainInfo; 8 use App\Models\Domain\DomainInfo;
7 use App\Models\Project\Project; 9 use App\Models\Project\Project;
8 use App\Utils\HttpUtils; 10 use App\Utils\HttpUtils;
@@ -53,15 +55,17 @@ class EditDomainBt implements ShouldQueue @@ -53,15 +55,17 @@ class EditDomainBt implements ShouldQueue
53 } 55 }
54 56
55 //获取服务器数据 57 //获取服务器数据
56 - $server_model = new ServerConfig();  
57 - $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);  
58 - if ($server_info === false) { 58 + $serverIpModel = new ServersIp();
  59 + $serversIpInfo = $serverIpModel->read(['id'=>$project_info['serve_id']],['servers_id','ip']);
  60 + if ($serversIpInfo === false) {
59 return $this->output($domain_info['domain'] . ':获取服务器数据失败'); 61 return $this->output($domain_info['domain'] . ':获取服务器数据失败');
60 } 62 }
61 - 63 + $serverModel = new Servers();
  64 + $serverInfo = $serverModel->read(['id'=>$serversIpInfo['servers_id']],['init_domain']);
  65 + $server_info = ['domain'=>$serverInfo['init_domain'],'ip'=>$serversIpInfo['ip']];
62 //编辑主站 66 //编辑主站
63 if ($domain_info['type'] == 2) { 67 if ($domain_info['type'] == 2) {
64 - $api_url = 'http://' . $server_info['init_domain'] . '/api/setSsl'; 68 + $api_url = 'http://' . $server_info['domain'] . '/api/setSsl';
65 $api_param = [ 69 $api_param = [
66 'domain' => $domain_info['domain'], 70 'domain' => $domain_info['domain'],
67 'private_key' => $domain_info['private_key'], 71 'private_key' => $domain_info['private_key'],
@@ -71,7 +75,7 @@ class EditDomainBt implements ShouldQueue @@ -71,7 +75,7 @@ class EditDomainBt implements ShouldQueue
71 'is_https' => $domain_info['is_https'] 75 'is_https' => $domain_info['is_https']
72 ]; 76 ];
73 } else { 77 } else {
74 - $api_url = 'http://' . $server_info['init_domain'] . '/api/applySsl'; 78 + $api_url = 'http://' . $server_info['domain'] . '/api/applySsl';
75 $api_param = [ 79 $api_param = [
76 'domain' => $domain_info['domain'], 80 'domain' => $domain_info['domain'],
77 'rewrite' => $domain_info['extend_config'], 81 'rewrite' => $domain_info['extend_config'],