作者 赵彬吉
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AiDomainTask.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/6/19 10:53
  8 + */
  9 +
  10 +namespace App\Console\Commands\Ai;
  11 +
  12 +use App\Models\Domain\DomainInfo;
  13 +use Illuminate\Console\Command;
  14 +
  15 +/**
  16 + * @remark :拉取项目Ai域名
  17 + * @name :AiDomainTask
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2025/6/19 10:54
  21 + */
  22 +class AiDomainTask extends Command
  23 +{
  24 + /**
  25 + * The name and signature of the console command.
  26 + *
  27 + * @var string
  28 + */
  29 + protected $signature = 'ai_domain';
  30 +
  31 + /**
  32 + * The console command description.
  33 + *
  34 + * @var string
  35 + */
  36 + protected $description = '获取对应域名的ai复制站域名';
  37 +
  38 + public $url = 'https://www.cmer.site/api/globalso_site';
  39 +
  40 + /**
  41 + * @remark :执行方法
  42 + * @name :handle
  43 + * @author :lyh
  44 + * @method :post
  45 + * @time :2025/6/19 11:32
  46 + */
  47 + public function handle(){
  48 + $pageSize = 300;
  49 + $page = 1;
  50 + $res = http_get($this->url.'?pagesize='.$pageSize.'&page='.$page);
  51 + if($res['status'] != 200){
  52 + echo date('Y-m-d H:i:s').'请求失败,状态码错误'.PHP_EOL;
  53 + return false;
  54 + }
  55 + if(empty($res['data']['data'])){
  56 + echo date('Y-m-d H:i:s').'请求失败,未拉取到数据'.PHP_EOL;
  57 + return false;
  58 + }
  59 + $data = $res['data']['data'];
  60 + while($page <= $res['data']['last_page']){
  61 + $res = http_get($this->url.'?pagesize='.$pageSize.'&page='.$page);
  62 + if($res['status'] != 200){
  63 + echo date('Y-m-d H:i:s').'第'.$page.'请求失败,未拉取到数据'.PHP_EOL;
  64 + return false;
  65 + }
  66 + $data = array_values(array_merge($data,$res['data']['data']));
  67 + $page++;
  68 + }
  69 + //处理数据
  70 + $this->handleData($data);
  71 + echo 'end'.PHP_EOL;
  72 + return true;
  73 + }
  74 +
  75 + /**
  76 + * @remark :处理数据
  77 + * @name :handleData
  78 + * @author :lyh
  79 + * @method :post
  80 + * @time :2025/6/19 11:21
  81 + */
  82 + public function handleData($data){
  83 + $domainInfoModel = new DomainInfo();
  84 + foreach ($data as $item){
  85 + $info = $domainInfoModel->read(['domain'=>$item['domain']],'id');
  86 + if($info === false){
  87 + $info = $domainInfoModel->read(['domain'=>$item['globalso_domain']],'id');
  88 + if($info !== false){
  89 + $domainInfoModel->edit(['ai_domain'=>$item['domain']],['id'=>$info['id']]);
  90 + }
  91 + }else{
  92 + $domainInfoModel->edit(['ai_domain'=>$item['globalso_domain']],['id'=>$info['id']]);
  93 + }
  94 + }
  95 + return true;
  96 + }
  97 +}
@@ -58,28 +58,7 @@ class lyhDemo extends Command @@ -58,28 +58,7 @@ class lyhDemo extends Command
58 protected $description = '更新路由'; 58 protected $description = '更新路由';
59 59
60 public function handle(){ 60 public function handle(){
61 - $projectModel = new Project();  
62 - $buildModel = new DeployBuild();  
63 - $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'is_upgrade'=>0,'id'=>['<',1659],'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id','notice_order_id']);  
64 - foreach ($lists as $item){  
65 - echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;  
66 - try {  
67 - if(!empty($item['notice_order_id'])){  
68 - $api = new OaGlobalsoApi();  
69 - $data = $api->order_info($item['notice_order_id']);  
70 - if(!empty($data)){  
71 - if(isset($data['data']['ads_price'])){  
72 - echo '奖励金额:'.$data['data']['ads_price'].PHP_EOL;  
73 - $buildModel->edit(['ads_price'=>$data['data']['ads_price'] ?? 0],['project_id'=>$item['id']]);  
74 - }  
75 - }  
76 - }  
77 - }catch (\Exception $e){  
78 - continue;  
79 - }  
80 - DB::disconnect('custom_mysql');  
81 - }  
82 - echo date('Y-m-d H:i:s') . '结束。。。' . PHP_EOL; 61 +
83 } 62 }
84 63
85 public function _actionTemplateMain(){ 64 public function _actionTemplateMain(){
@@ -183,6 +183,7 @@ class CountAllProject extends Command @@ -183,6 +183,7 @@ class CountAllProject extends Command
183 } 183 }
184 } 184 }
185 $channel = Channel::getChannelText($v['channel']['user_id'] ?? 0); 185 $channel = Channel::getChannelText($v['channel']['user_id'] ?? 0);
  186 + $plan = Project::planMap();
186 $data[] = [ 187 $data[] = [
187 'project_id'=>$v['id'], 188 'project_id'=>$v['id'],
188 'version'=>1,//代表6.0 189 'version'=>1,//代表6.0
@@ -196,7 +197,7 @@ class CountAllProject extends Command @@ -196,7 +197,7 @@ class CountAllProject extends Command
196 'keywords_num'=>$v['key'], 197 'keywords_num'=>$v['key'],
197 'service_num'=>$v['day'], 198 'service_num'=>$v['day'],
198 'production_num'=>intval(abs((empty($v['uptime']) ? time() : strtotime($v['uptime'])) - strtotime($v['created_at'])) / 86400), 199 'production_num'=>intval(abs((empty($v['uptime']) ? time() : strtotime($v['uptime'])) - strtotime($v['created_at'])) / 86400),
199 - 'plan'=>Project::planMap()[$v['plan']], 200 + 'plan'=>$plan[$v['plan']] ?? '无版本信息',
200 'status'=>$type, 201 'status'=>$type,
201 'category'=>$category, 202 'category'=>$category,
202 'is_admin5' => 6, 203 'is_admin5' => 6,
@@ -51,11 +51,12 @@ class GeneratePage extends Command @@ -51,11 +51,12 @@ class GeneratePage extends Command
51 { 51 {
52 $noticeModel = new NoticeLog(); 52 $noticeModel = new NoticeLog();
53 while (true){ 53 while (true){
54 - $noticeInfo = $noticeModel->read(['status'=>0,'type'=>$noticeModel::GENERATE_PAGE,'start_at'=>['<=',date('Y-m-d H:i:s')]]); 54 + $task_id = $this->getTaskId();
55 if (empty($noticeInfo)) { 55 if (empty($noticeInfo)) {
56 sleep(10); 56 sleep(10);
57 continue; 57 continue;
58 } 58 }
  59 + $noticeInfo = $noticeModel->read(['id'=>$task_id]);
59 try { 60 try {
60 $this->output(' taskID: ' . $noticeInfo['id'] . ' start'); 61 $this->output(' taskID: ' . $noticeInfo['id'] . ' start');
61 $notice_data = json_decode($noticeInfo['data'],true); 62 $notice_data = json_decode($noticeInfo['data'],true);
@@ -80,6 +81,28 @@ class GeneratePage extends Command @@ -80,6 +81,28 @@ class GeneratePage extends Command
80 return true; 81 return true;
81 } 82 }
82 83
  84 + /**
  85 + * @remark :获取任务id
  86 + * @name :getTaskId
  87 + * @author :lyh
  88 + * @method :post
  89 + * @time :2025/6/19 10:02
  90 + */
  91 + public function getTaskId()
  92 + {
  93 + $task_id = Redis::rpop('generate_page_id');
  94 + if (empty($task_id)) {
  95 + $noticeModel = new NoticeLog();
  96 + $ids = $noticeModel->selectField(['status'=>0],'id');
  97 + if(!empty($ids)){
  98 + foreach ($ids as $id) {
  99 + Redis::lpush('generate_page_id', $id);
  100 + }
  101 + }
  102 + $task_id = Redis::rpop('generate_page_id');
  103 + }
  104 + return $task_id;
  105 + }
83 106
84 /** 107 /**
85 * 输出message 108 * 输出message
@@ -43,7 +43,7 @@ class Temp extends Command @@ -43,7 +43,7 @@ class Temp extends Command
43 43
44 public function handle() 44 public function handle()
45 { 45 {
46 - $this->specialImport(); 46 + $this->check_no_cname_projects();
47 } 47 }
48 48
49 /** 49 /**
@@ -1012,8 +1012,8 @@ class Temp extends Command @@ -1012,8 +1012,8 @@ class Temp extends Command
1012 */ 1012 */
1013 public function check_no_cname_projects() 1013 public function check_no_cname_projects()
1014 { 1014 {
1015 - $server_id = 1;  
1016 - $server_name = '硅谷云服务器'; 1015 + $server_id = 20;
  1016 + $server_name = '建站服务器01';
1017 1017
1018 $server_ip_model = new ServersIp(); 1018 $server_ip_model = new ServersIp();
1019 1019
@@ -1031,7 +1031,13 @@ class Temp extends Command @@ -1031,7 +1031,13 @@ class Temp extends Command
1031 } 1031 }
1032 $domain = $domain_info['domain']; 1032 $domain = $domain_info['domain'];
1033 1033
  1034 + $check = [];
  1035 + try {
1034 $check = dns_get_record($domain, DNS_A); 1036 $check = dns_get_record($domain, DNS_A);
  1037 + } catch (\Exception $e) {
  1038 + $this->output($domain . ' | ' . $e->getMessage());
  1039 + }
  1040 +
1035 $ip = $check[0]['ip'] ?? ''; 1041 $ip = $check[0]['ip'] ?? '';
1036 $host = $check[0]['host'] ?? ''; 1042 $host = $check[0]['host'] ?? '';
1037 if (strpos($host, 'globalso.com') === false) { 1043 if (strpos($host, 'globalso.com') === false) {
@@ -61,7 +61,7 @@ if (!function_exists('http_post')) { @@ -61,7 +61,7 @@ if (!function_exists('http_post')) {
61 * @param type $url 61 * @param type $url
62 * @param type $post_data 62 * @param type $post_data
63 */ 63 */
64 - function http_post($url, $post_data, $header = [],$is_json = true) 64 + function http_post($url, $post_data, $header = [],$is_json = true,$timeout = 60)
65 { 65 {
66 if (empty($header)) { 66 if (empty($header)) {
67 $header = array( 67 $header = array(
@@ -73,6 +73,7 @@ if (!function_exists('http_post')) { @@ -73,6 +73,7 @@ if (!function_exists('http_post')) {
73 curl_setopt($ch, CURLOPT_URL, $url); 73 curl_setopt($ch, CURLOPT_URL, $url);
74 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 74 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
75 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 75 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  76 + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
76 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 77 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
77 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 78 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
78 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); 79 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
@@ -234,6 +234,7 @@ class OptimizeController extends BaseController @@ -234,6 +234,7 @@ class OptimizeController extends BaseController
234 'gl_project_deploy_optimize.first_compliance_time AS first_compliance_time', 234 'gl_project_deploy_optimize.first_compliance_time AS first_compliance_time',
235 'gl_domain_info.amp_status AS amp_status', 235 'gl_domain_info.amp_status AS amp_status',
236 'gl_domain_info.domain AS domain', 236 'gl_domain_info.domain AS domain',
  237 + 'gl_domain_info.ai_domain AS ai_domain',
237 ]; 238 ];
238 return $select; 239 return $select;
239 } 240 }
@@ -262,6 +263,9 @@ class OptimizeController extends BaseController @@ -262,6 +263,9 @@ class OptimizeController extends BaseController
262 if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){ 263 if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){
263 $query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']); 264 $query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']);
264 } 265 }
  266 + if(isset($this->map['ai_domain']) && !empty($this->map['ai_domain'])){
  267 + $query = $query->whereNotNull('gl_domain_info.ai_domain');
  268 + }
265 if(isset($this->map['amp_status'])){ 269 if(isset($this->map['amp_status'])){
266 $query = $query->where('gl_domain_info.amp_status',$this->map['amp_status']); 270 $query = $query->where('gl_domain_info.amp_status',$this->map['amp_status']);
267 } 271 }
@@ -123,7 +123,7 @@ class ProjectController extends BaseController @@ -123,7 +123,7 @@ class ProjectController extends BaseController
123 'gl_project_deploy_optimize.design_mid AS design_mid', 123 'gl_project_deploy_optimize.design_mid AS design_mid',
124 'gl_project_deploy_optimize.api_no AS api_no', 124 'gl_project_deploy_optimize.api_no AS api_no',
125 'gl_web_setting_template.template_id AS template_id', 125 'gl_web_setting_template.template_id AS template_id',
126 - 'gl_project_association.friend_id as friend_id' 126 + 'gl_project_association.friend_id as friend_id',
127 ]; 127 ];
128 return $select; 128 return $select;
129 } 129 }
@@ -174,7 +174,7 @@ class ProjectController extends BaseController @@ -174,7 +174,7 @@ class ProjectController extends BaseController
174 */ 174 */
175 public function searchType(&$query){ 175 public function searchType(&$query){
176 if(isset($this->map['type'])){ 176 if(isset($this->map['type'])){
177 - $query->where('gl_project.extend_type', '!=' ,5); 177 + $query->where('gl_project.extend_type', '!=' ,5)->where('gl_project.extend_type', '!=' ,8);
178 if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])){ 178 if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])){
179 $query->where('gl_project.type', $this->map['type']); 179 $query->where('gl_project.type', $this->map['type']);
180 } elseif ($this->map['type'] == 8){ 180 } elseif ($this->map['type'] == 8){
@@ -301,9 +301,12 @@ class CNoticeController extends BaseController @@ -301,9 +301,12 @@ class CNoticeController extends BaseController
301 'language'=> $language, 301 'language'=> $language,
302 'is_sitemap' => $is_sitemap 302 'is_sitemap' => $is_sitemap
303 ]; 303 ];
304 -// http_post($c_url, json_encode($c_param)); 304 + try {
  305 + http_post($c_url, json_encode($c_param));
  306 + }catch (\Exception $e){
305 NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$c_url,'c_params'=>$c_param])); 307 NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$c_url,'c_params'=>$c_param]));
306 } 308 }
  309 + }
307 $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!'); 310 $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!');
308 } 311 }
309 312
@@ -70,7 +70,7 @@ class LoginLogic extends BaseLogic @@ -70,7 +70,7 @@ class LoginLogic extends BaseLogic
70 // Cache::pull(Common::MANAGE_TOKEN . $manage['token']); 70 // Cache::pull(Common::MANAGE_TOKEN . $manage['token']);
71 // } 71 // }
72 //生成新token 72 //生成新token
73 - $token = md5(uniqid().$manage['id']); 73 + $token = $manage['id'].'_a'.md5(uniqid().$manage['id']);
74 unset($manage['password']); 74 unset($manage['password']);
75 //更新用户信息 75 //更新用户信息
76 $manage->token = $token; 76 $manage->token = $token;
@@ -90,7 +90,7 @@ class UserLoginLogic @@ -90,7 +90,7 @@ class UserLoginLogic
90 Cache::pull($info['token']); 90 Cache::pull($info['token']);
91 } 91 }
92 //生成新token 92 //生成新token
93 - $token = md5(uniqid().$info['id']); 93 + $token = $info['id'].'_b'.md5(uniqid().$info['id']);
94 //存储缓存 94 //存储缓存
95 $info['token'] = $token; 95 $info['token'] = $token;
96 Cache::add($token,$info,3600 * 12); 96 Cache::add($token,$info,3600 * 12);
@@ -27,6 +27,7 @@ class AutoPullNotify extends Base @@ -27,6 +27,7 @@ class AutoPullNotify extends Base
27 24 => '白帽专属服务器02', 27 24 => '白帽专属服务器02',
28 23 => '西班牙服务器', 28 23 => '西班牙服务器',
29 6 => '自建站服务器群', 29 6 => '自建站服务器群',
  30 + 27 => '硅谷建站服务器03',
30 ]; 31 ];
31 } 32 }
32 33