作者 赵彬吉
@@ -90,13 +90,41 @@ class DomainInfo extends Command @@ -90,13 +90,41 @@ class DomainInfo extends Command
90 } 90 }
91 } 91 }
92 92
93 - //获取证书有效期并更新 93 + //获取主站证书有效期并更新
94 $ssl_time = $this->getDomainSslTime($v['domain']); 94 $ssl_time = $this->getDomainSslTime($v['domain']);
95 if ($ssl_time['from'] && $ssl_time['to']) { 95 if ($ssl_time['from'] && $ssl_time['to']) {
96 $v->certificate_start_time = $ssl_time['from']; 96 $v->certificate_start_time = $ssl_time['from'];
97 $v->certificate_end_time = $ssl_time['to']; 97 $v->certificate_end_time = $ssl_time['to'];
98 $v->save(); 98 $v->save();
99 } 99 }
  100 +
  101 + if ($v['amp_status'] == 1) {
  102 + $domain_array = parse_url($v['domain']);
  103 + $host = $domain_array['host'] ?? $domain_array['path'];
  104 + $host_array = explode('.', $host);
  105 + if (count($host_array) <= 2) {
  106 + array_unshift($host_array, 'm');
  107 + } else {
  108 + $host_array[0] = 'm';
  109 + }
  110 + $amp_domain = implode('.', $host_array);
  111 +
  112 + if ($servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) {
  113 + //过滤已解析到别的ip的AMP域名
  114 + if (!$this->check_cname($amp_domain, $servers_ip_info)) {
  115 + Log::channel('analyze_other')->error('AMP域名 [' . $amp_domain . '] 已解析到别的IP');
  116 + continue;
  117 + }
  118 + }
  119 +
  120 + //获取AMP站证书有效期并更新
  121 + $amp_ssl_time = $this->getDomainSslTime($amp_domain);
  122 + if ($amp_ssl_time['from'] && $amp_ssl_time['to']) {
  123 + $v->amp_certificate_start_time = $amp_ssl_time['from'];
  124 + $v->amp_certificate_end_time = $amp_ssl_time['to'];
  125 + $v->save();
  126 + }
  127 + }
100 } 128 }
101 } 129 }
102 130
@@ -18,55 +18,60 @@ class EmergencyRecords extends Command @@ -18,55 +18,60 @@ class EmergencyRecords extends Command
18 //类型,1受灾,2恢复 18 //类型,1受灾,2恢复
19 $type = $this->argument('type'); 19 $type = $this->argument('type');
20 20
21 - try {  
22 - //获取服务器的所有可用ip  
23 - $server_ip_model = new ServersIp();  
24 - $server_ip_list = $server_ip_model->where('servers_id', $server_id)->where('status', 0)->get();  
25 - if ($server_ip_list->count() > 0) {  
26 - foreach ($server_ip_list as $value) {  
27 - if (empty($value->ip) || empty($value->domain)) {  
28 - $this->output('ID ' . $value->id . ' 数据错误');  
29 - continue;  
30 - } 21 + //获取服务器的所有可用ip
  22 + $server_ip_model = new ServersIp();
  23 + $server_ip_list = $server_ip_model->where('servers_id', $server_id)->where('status', 0)->get();
  24 + if ($server_ip_list->count() > 0) {
  25 + foreach ($server_ip_list as $value) {
  26 + if (empty($value->ip) || empty($value->domain)) {
  27 + $this->output('ID ' . $value->id . ' 数据错误');
  28 + continue;
  29 + }
31 30
32 - //获取解析记录  
33 - $domain_array = explode('.', $value->domain);  
34 - $domain_rr = $domain_array[0]; 31 + //获取解析记录
  32 + $domain_array = explode('.', $value->domain);
  33 + $domain_rr = $domain_array[0];
  34 + try {
35 $record = AlibabaCloudService::describeDomainRecords('globalso.com', $domain_rr); 35 $record = AlibabaCloudService::describeDomainRecords('globalso.com', $domain_rr);
36 - $record_status_code = $record['statusCode'] ?? 0;  
37 - if ($record_status_code != 200) {  
38 - $this->output('获取主机记录 ' . $domain_rr . ' 解析数据失败');  
39 - continue;  
40 - }  
41 - $record_detail = $record['body']['DomainRecords']['Record'][0] ?? [];  
42 - if (!$record_detail) {  
43 - $this->output('主机记录 ' . $domain_rr . ' 解析数据不存在');  
44 - continue;  
45 - }  
46 -  
47 - //目标ip跟解析记录当前ip一样的数据,不用修改  
48 - $target_ip = $type == 1 ? '43.153.1.240' : $value->ip;  
49 - if ($target_ip == $record_detail['Value']) {  
50 - $this->output('主机记录 ' . $domain_rr . ' 的值已为 ' . $target_ip);  
51 - continue;  
52 - } 36 + } catch (\Exception $e) {
  37 + $this->output('主机记录 ' . $domain_rr . 'error:' . $e->getMessage());
  38 + continue;
  39 + }
  40 + $record_status_code = $record['statusCode'] ?? 0;
  41 + if ($record_status_code != 200) {
  42 + $this->output('获取主机记录 ' . $domain_rr . ' 解析数据失败');
  43 + continue;
  44 + }
  45 + $record_detail = $record['body']['DomainRecords']['Record'][0] ?? [];
  46 + if (!$record_detail) {
  47 + $this->output('主机记录 ' . $domain_rr . ' 解析数据不存在');
  48 + continue;
  49 + }
53 50
54 - //修改解析记录  
55 - $record_id = $record_detail['RecordId'];  
56 - $record_rr = $record_detail['RR'];  
57 - $record_type = $record_detail['Type']; 51 + //目标ip跟解析记录当前ip一样的数据,不用修改
  52 + $target_ip = $type == 1 ? '43.153.1.240' : $value->ip;
  53 + if ($target_ip == $record_detail['Value']) {
  54 + $this->output('主机记录 ' . $domain_rr . ' 的值已为 ' . $target_ip);
  55 + continue;
  56 + }
58 57
  58 + //修改解析记录
  59 + $record_id = $record_detail['RecordId'];
  60 + $record_rr = $record_detail['RR'];
  61 + $record_type = $record_detail['Type'];
  62 + try {
59 $record_edit = AlibabaCloudService::updateDomainRecord($record_id, $record_rr, $record_type, $target_ip); 63 $record_edit = AlibabaCloudService::updateDomainRecord($record_id, $record_rr, $record_type, $target_ip);
60 - $record_edit_status_code = $record_edit['statusCode'] ?? 0;  
61 - if ($record_edit_status_code == 200) {  
62 - $this->output('修改主机记录 ' . $record_rr . ' 的值为 ' . $target_ip . ' 成功');  
63 - } else {  
64 - $this->output('修改主机记录 ' . $record_rr . ' 的值为 ' . $target_ip . ' 失败');  
65 - } 64 + } catch (\Exception $e) {
  65 + $this->output('主机记录 ' . $domain_rr . 'error:' . $e->getMessage());
  66 + continue;
  67 + }
  68 + $record_edit_status_code = $record_edit['statusCode'] ?? 0;
  69 + if ($record_edit_status_code == 200) {
  70 + $this->output('修改主机记录 ' . $record_rr . ' 的值为 ' . $target_ip . ' 成功');
  71 + } else {
  72 + $this->output('修改主机记录 ' . $record_rr . ' 的值为 ' . $target_ip . ' 失败');
66 } 73 }
67 } 74 }
68 - } catch (\Exception $e) {  
69 - $this->output($e->getMessage());  
70 } 75 }
71 } 76 }
72 77
@@ -28,7 +28,7 @@ class RemainDay extends Command @@ -28,7 +28,7 @@ class RemainDay extends Command
28 * @var 按上线时间统计 28 * @var 按上线时间统计
29 */ 29 */
30 protected $projectId = [ 30 protected $projectId = [
31 - 1434,1812,276 31 + 1434,1812,276,596
32 ];//需要单独处理的项目 32 ];//需要单独处理的项目
33 33
34 /** 34 /**
@@ -166,7 +166,8 @@ class VideoTask extends Command @@ -166,7 +166,8 @@ class VideoTask extends Command
166 ], 166 ],
167 'task_id' => $task_id, 167 'task_id' => $task_id,
168 'callback_url' => env('APP_URL') . '/api/video_task_callback', 168 'callback_url' => env('APP_URL') . '/api/video_task_callback',
169 - 'is_ytb'=>false 169 + 'is_ytb'=>false,
  170 + 'other_language_subtitle'=>false
170 ]; 171 ];
171 $result = Http::post('http://216.250.255.116:7866/create_task', $data); 172 $result = Http::post('http://216.250.255.116:7866/create_task', $data);
172 $res_json = json_decode($result,true); 173 $res_json = json_decode($result,true);
@@ -161,28 +161,28 @@ class countProject extends Command @@ -161,28 +161,28 @@ class countProject extends Command
161 if($data[$v]['month_create_project_count'] != 0){ 161 if($data[$v]['month_create_project_count'] != 0){
162 $data[$v]['month_project_online_rate'] = round($data[$v]['month_project_go_online_count'] / $data[$v]['month_create_project_count'],2);//比例 162 $data[$v]['month_project_online_rate'] = round($data[$v]['month_project_go_online_count'] / $data[$v]['month_create_project_count'],2);//比例
163 } 163 }
164 - $data[$v]['count'] = $projectModel->counts(['delete_status'=>0]);//所有项目总数  
165 - $data[$v]['go_online_count'] = $projectModel->counts(['uptime'=>['!=',null],'delete_status'=>0]);//上线项目总数  
166 - $data[$v]['promotion_web_count'] = $projectModel->counts(['type'=>3,'delete_status'=>0,'created_at'=>['between',[$start_time,$end_time]]]);//推广项目总数  
167 - $data[$v]['create_web_count'] = $projectModel->counts(['type'=>2,'delete_status'=>0,'created_at'=>['between',[$start_time,$end_time]]]);//建站项目总数  
168 - $data[$v]['no_go_oline_count'] = $projectModel->counts(['uptime'=>null,'delete_status'=>0,'created_at'=>['between',[$start_time,$end_time]]]);//未上线项目数量  
169 - $data[$v]['delete_project_count'] = $projectModel->counts(['delete_status'=>1,'created_at'=>['between',[$start_time,$end_time]]]);//删除  
170 - $min_info = $projectModel->select('*')  
171 - ->selectRaw('DATEDIFF(STR_TO_DATE(uptime, "%Y-%m-%d"), STR_TO_DATE(created_at, "%Y-%m-%d")) AS diff')  
172 - ->whereNotNull('uptime') // 确保 uptime 字段不为空  
173 - ->where('created_at','<=',$end_time)  
174 - ->whereBetween('created_at', [$start_time,$end_time])  
175 - ->orderByRaw('diff ASC')  
176 - ->first();  
177 - $data[$v]['min_project_count'] = $min_info['diff'];  
178 - $max_info = $projectModel->select('*')  
179 - ->selectRaw('DATEDIFF(STR_TO_DATE(uptime, "%Y-%m-%d"), STR_TO_DATE(created_at, "%Y-%m-%d")) AS diff')  
180 - ->whereNotNull('uptime') // 确保 uptime 字段不为空  
181 - ->whereBetween('created_at', [$start_time,$end_time])  
182 - ->orderByRaw('diff DESC')  
183 - ->first();  
184 - $data[$v]['max_project_count'] = $max_info['diff'];  
185 - $data[$v]['average'] = ceil(($max_info['diff'] + $min_info['diff']) / 2); 164 + $data[$v]['count'] = $projectModel->counts(['delete_status'=>0]);//所有项目总数
  165 + $data[$v]['go_online_count'] = $projectModel->counts(['uptime'=>['!=',null],'delete_status'=>0]);//上线项目总数
  166 + $data[$v]['promotion_web_count'] = $projectModel->counts(['type'=>3,'delete_status'=>0,'created_at'=>['between',[$start_time,$end_time]]]);//推广项目总数
  167 + $data[$v]['create_web_count'] = $projectModel->counts(['type'=>2,'delete_status'=>0,'created_at'=>['between',[$start_time,$end_time]]]);//建站项目总数
  168 + $data[$v]['no_go_oline_count'] = $projectModel->counts(['uptime'=>null,'delete_status'=>0,'created_at'=>['between',[$start_time,$end_time]]]);//未上线项目数量
  169 + $data[$v]['delete_project_count'] = $projectModel->counts(['delete_status'=>1,'created_at'=>['between',[$start_time,$end_time]]]);//删除
  170 + $min_info = $projectModel->select('*')
  171 + ->selectRaw('DATEDIFF(STR_TO_DATE(uptime, "%Y-%m-%d"), STR_TO_DATE(created_at, "%Y-%m-%d")) AS diff')
  172 + ->whereNotNull('uptime') // 确保 uptime 字段不为空
  173 + ->where('created_at','<=',$end_time)
  174 + ->whereBetween('created_at', [$start_time,$end_time])
  175 + ->orderByRaw('diff ASC')
  176 + ->first();
  177 + $data[$v]['min_project_count'] = $min_info['diff'];
  178 + $max_info = $projectModel->select('*')
  179 + ->selectRaw('DATEDIFF(STR_TO_DATE(uptime, "%Y-%m-%d"), STR_TO_DATE(created_at, "%Y-%m-%d")) AS diff')
  180 + ->whereNotNull('uptime') // 确保 uptime 字段不为空
  181 + ->whereBetween('created_at', [$start_time,$end_time])
  182 + ->orderByRaw('diff DESC')
  183 + ->first();
  184 + $data[$v]['max_project_count'] = $max_info['diff'];
  185 + $data[$v]['average'] = ceil(($max_info['diff'] + $min_info['diff']) / 2);
186 } 186 }
187 return $data; 187 return $data;
188 } 188 }
@@ -68,7 +68,7 @@ class PackDirController extends BaseController @@ -68,7 +68,7 @@ class PackDirController extends BaseController
68 $projectModel = new Project(); 68 $projectModel = new Project();
69 $project_info = $projectModel->read(['id' => $this->param['project_id']], ['serve_id']); 69 $project_info = $projectModel->read(['id' => $this->param['project_id']], ['serve_id']);
70 if (!$project_info) { 70 if (!$project_info) {
71 - $this->fail('未查询到项目所属服务器信息'); 71 + $this->fail('未查询到项目信息');
72 } 72 }
73 $serverIpModel = new ServersIp(); 73 $serverIpModel = new ServersIp();
74 $server_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id']); 74 $server_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id']);
@@ -608,6 +608,14 @@ class ProjectController extends BaseController @@ -608,6 +608,14 @@ class ProjectController extends BaseController
608 */ 608 */
609 public function getManagerList(){ 609 public function getManagerList(){
610 $hrManagerModel = new ManageHr(); 610 $hrManagerModel = new ManageHr();
  611 + if(!isset($this->map['status'])){
  612 + $this->map['status'] = $hrManagerModel::STATUS_ONE;
  613 + }else{
  614 + if(!is_array($this->map['status'])){
  615 + $this->map['status'] = [$this->map['status']];
  616 + }
  617 + $this->map['status'] = ['in',$this->map['status']];
  618 + }
611 if(isset($this->map['entry_position']) && !empty($this->map['entry_position'])){ 619 if(isset($this->map['entry_position']) && !empty($this->map['entry_position'])){
612 $this->map['entry_position'] = ['in',$this->map['entry_position']]; 620 $this->map['entry_position'] = ['in',$this->map['entry_position']];
613 } 621 }
@@ -111,7 +111,7 @@ class RenewProjectController extends BaseController @@ -111,7 +111,7 @@ class RenewProjectController extends BaseController
111 if(!empty($this->map['title'])){ 111 if(!empty($this->map['title'])){
112 $this->map['title'] = ['like', '%'.$this->map['title'].'%']; 112 $this->map['title'] = ['like', '%'.$this->map['title'].'%'];
113 } 113 }
114 - $lists = $project->where($this->map)->with('payment')->with('deploy_build') 114 + $lists = $project->formatQuery($this->map)->with('payment')->with('deploy_build')
115 ->with('deploy_optimize')->with('online_check') 115 ->with('deploy_optimize')->with('online_check')
116 ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page); 116 ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page);
117 if(!empty($lists)){ 117 if(!empty($lists)){
@@ -167,7 +167,7 @@ class RenewProjectController extends BaseController @@ -167,7 +167,7 @@ class RenewProjectController extends BaseController
167 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, 167 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0,
168 'qa_status'=>$item['online_check']['qa_status'] ?? 0, 168 'qa_status'=>$item['online_check']['qa_status'] ?? 0,
169 'service_day'=>$item['remain_day'] ?? 0, 169 'service_day'=>$item['remain_day'] ?? 0,
170 - 'site_status'=>$item['site_status'], 170 + 'site_status'=>$item['site_status'] ?? 0,
171 ]; 171 ];
172 return $item; 172 return $item;
173 } 173 }
@@ -13,6 +13,7 @@ use App\Enums\Common\Code; @@ -13,6 +13,7 @@ use App\Enums\Common\Code;
13 use App\Helper\Arr; 13 use App\Helper\Arr;
14 use App\Http\Controllers\Bside\BaseController; 14 use App\Http\Controllers\Bside\BaseController;
15 use App\Models\Com\Notify; 15 use App\Models\Com\Notify;
  16 +use App\Models\Com\UpdateLog;
16 use App\Models\Com\UpdateNotify; 17 use App\Models\Com\UpdateNotify;
17 use App\Models\Com\UpdateProgress; 18 use App\Models\Com\UpdateProgress;
18 use App\Models\Devops\ServerConfig; 19 use App\Models\Devops\ServerConfig;
@@ -50,7 +51,7 @@ class CNoticeController extends BaseController @@ -50,7 +51,7 @@ class CNoticeController extends BaseController
50 $is_sitemap = intval($request->input('is_sitemap', 0)); 51 $is_sitemap = intval($request->input('is_sitemap', 0));
51 //获取项目所在服务器 52 //获取项目所在服务器
52 $project_model = new Project(); 53 $project_model = new Project();
53 - $project_info = $project_model->read(['id'=>$project_id],['serve_id']); 54 + $project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade']);
54 if(!$project_info){ 55 if(!$project_info){
55 $this->fail('未查询到项目数据'); 56 $this->fail('未查询到项目数据');
56 } 57 }
@@ -58,6 +59,14 @@ class CNoticeController extends BaseController @@ -58,6 +59,14 @@ class CNoticeController extends BaseController
58 $serve_ip_info = $serve_ip_model->read(['id'=>$project_info['serve_id']],['servers_id']); 59 $serve_ip_info = $serve_ip_model->read(['id'=>$project_info['serve_id']],['servers_id']);
59 $servers_id = $serve_ip_info ? $serve_ip_info['servers_id'] : 0; 60 $servers_id = $serve_ip_info ? $serve_ip_info['servers_id'] : 0;
60 61
  62 + //如果是升级项目,判断是否还有采集在进行中
  63 + if($project_info['is_upgrade'] == 1){
  64 + $collect_info = UpdateLog::getProjectUpdate($project_id);
  65 + if($collect_info == '采集中'){
  66 + $this->fail('当前升级项目还有页面正在采集,请采集完成之后再更新静态页面');
  67 + }
  68 + }
  69 +
61 if($servers_id == ServerConfig::SELF_SITE_ID){ 70 if($servers_id == ServerConfig::SELF_SITE_ID){
62 //自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库 71 //自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库
63 $domain_model = new DomainInfo(); 72 $domain_model = new DomainInfo();
@@ -96,7 +96,11 @@ class OperationHeartbeatController extends BaseController @@ -96,7 +96,11 @@ class OperationHeartbeatController extends BaseController
96 if($info['manager_id'] != 0){ 96 if($info['manager_id'] != 0){
97 $managerModel = new Manage(); 97 $managerModel = new Manage();
98 $managerInfo = $managerModel->read(['id'=>$info['manager_id']],['name']); 98 $managerInfo = $managerModel->read(['id'=>$info['manager_id']],['name']);
99 - $info['message'] = '此页面数据已有人在编辑,请勿重复操作!操作人ip:'.$info['ip'].'操作的管理员为:'.$managerInfo['name']; 99 + if(($info['ip'] == $this->request->ip()) && ($info['manager_id'] == $this->user['manager_id'])){
  100 + $info['status'] = 0;
  101 + }else{
  102 + $info['message'] = '此页面数据已有人在编辑,请勿重复操作!操作人ip:'.$info['ip'].'操作的管理员为:'.$managerInfo['name'];
  103 + }
100 }else{ 104 }else{
101 //账号密码登录 105 //账号密码登录
102 $userModel = new User(); 106 $userModel = new User();
@@ -71,7 +71,7 @@ class OnlineCheckLogic extends BaseLogic @@ -71,7 +71,7 @@ class OnlineCheckLogic extends BaseLogic
71 $this->param['type'] . '_mid' => $this->manager['id'], 71 $this->param['type'] . '_mid' => $this->manager['id'],
72 $this->param['type'] . '_check_time' => date('Y-m-d H:i:s'), 72 $this->param['type'] . '_check_time' => date('Y-m-d H:i:s'),
73 $this->param['type'] . '_status' => $this->param['status'], 73 $this->param['type'] . '_status' => $this->param['status'],
74 - 'remark' => $param['remark'] ??'', 74 + 'remark' => $this->param['remark'] ??'',
75 ]; 75 ];
76 return $this->model->edit($data,['id'=>$info['id']]); 76 return $this->model->edit($data,['id'=>$info['id']]);
77 } 77 }
@@ -162,7 +162,8 @@ class RenewLogic extends BaseLogic @@ -162,7 +162,8 @@ class RenewLogic extends BaseLogic
162 $project = new Project(); 162 $project = new Project();
163 return $project->edit([ 163 return $project->edit([
164 'extend_type'=>0, 164 'extend_type'=>0,
165 - 'type'=>$type 165 + 'type'=>$type,
  166 + 'site_status'=>0
166 ],[ 167 ],[
167 'id'=>$id 168 'id'=>$id
168 ]); 169 ]);
@@ -13,6 +13,7 @@ use App\Models\Template\BTemplateLog; @@ -13,6 +13,7 @@ use App\Models\Template\BTemplateLog;
13 use App\Models\Template\BTemplateMain; 13 use App\Models\Template\BTemplateMain;
14 use App\Models\Template\Setting; 14 use App\Models\Template\Setting;
15 use App\Models\Template\BTemplate; 15 use App\Models\Template\BTemplate;
  16 +use App\Models\Template\TemplateTypeMain;
16 17
17 class CustomTemplateLogic extends BaseLogic 18 class CustomTemplateLogic extends BaseLogic
18 { 19 {
@@ -179,10 +180,11 @@ class CustomTemplateLogic extends BaseLogic @@ -179,10 +180,11 @@ class CustomTemplateLogic extends BaseLogic
179 $this->fail('404页面已存在'); 180 $this->fail('404页面已存在');
180 } 181 }
181 if($this->param['url'] == 'search'){ 182 if($this->param['url'] == 'search'){
182 - $bTemplateMainModel = new BTemplateMain(); 183 + $bTemplateMainModel = new TemplateTypeMain();
183 $mainInfo = $bTemplateMainModel->read(['type'=>8]); 184 $mainInfo = $bTemplateMainModel->read(['type'=>8]);
184 if($mainInfo !== false){ 185 if($mainInfo !== false){
185 $this->param['html'] = $mainInfo['main_html']; 186 $this->param['html'] = $mainInfo['main_html'];
  187 + $this->param['html_style'] = "<style id='globalsojs-styles'></style>";
186 } 188 }
187 } 189 }
188 $this->param['project_id'] = $this->user['project_id']; 190 $this->param['project_id'] = $this->user['project_id'];
@@ -119,6 +119,7 @@ class Project extends Base @@ -119,6 +119,7 @@ class Project extends Base
119 12 => 'AI', 119 12 => 'AI',
120 13 => 'AI站群', 120 13 => 'AI站群',
121 14 => '未达标', 121 14 => '未达标',
  122 + 15 => 'AI案例',
122 ]; 123 ];
123 } 124 }
124 125