Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
7 个修改的文件
包含
153 行增加
和
46 行删除
| @@ -31,14 +31,72 @@ class Temp extends Command | @@ -31,14 +31,72 @@ class Temp extends Command | ||
| 31 | * | 31 | * |
| 32 | * @var string | 32 | * @var string |
| 33 | */ | 33 | */ |
| 34 | - protected $description = '临时脚本'; | 34 | + protected $description = '临时脚本(akun)'; |
| 35 | + | ||
| 36 | + public function handle() | ||
| 37 | + { | ||
| 38 | + $this->relation_all_keywords(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 转移灾备服务器后,判断项目是否正常访问 | ||
| 43 | + * @author Akun | ||
| 44 | + * @date 2024/12/11 10:15 | ||
| 45 | + */ | ||
| 46 | + public function check_zb_complete_project_site() | ||
| 47 | + { | ||
| 48 | + $server_id = 15; | ||
| 49 | + $server_name = '美服1'; | ||
| 50 | + | ||
| 51 | + $server_ip_model = new ServersIp(); | ||
| 52 | + | ||
| 53 | + $server_ip_ids = $server_ip_model->where('servers_id', $server_id)->get()->pluck('id')->toArray(); | ||
| 54 | + | ||
| 55 | + $project_list = Project::select(['id', 'serve_id', 'title'])->whereIn('serve_id', $server_ip_ids)->get(); | ||
| 56 | + | ||
| 57 | + $domain_model = new DomainInfo(); | ||
| 58 | + $data = []; | ||
| 59 | + foreach ($project_list as $value) { | ||
| 60 | + $domain_info = $domain_model->read(['project_id' => $value->id, 'status' => 1], ['id', 'domain']); | ||
| 61 | + if (!$domain_info) { | ||
| 62 | + //过滤未绑定正式域名的项目 | ||
| 63 | + continue; | ||
| 64 | + } | ||
| 65 | + $domain = $domain_info['domain']; | ||
| 66 | + | ||
| 67 | + $check = dns_get_record($domain, DNS_A); | ||
| 68 | + $ip = $check[0]['ip'] ?? ''; | ||
| 69 | + $host = $check[0]['host'] ?? ''; | ||
| 70 | + $code = check_curl_status($domain); | ||
| 71 | + $data[] = [ | ||
| 72 | + $value->id, | ||
| 73 | + $value->title, | ||
| 74 | + $domain, | ||
| 75 | + $host, | ||
| 76 | + $ip, | ||
| 77 | + $code | ||
| 78 | + ]; | ||
| 79 | + } | ||
| 80 | + $map = ['项目id', '名称', '域名', 'CNAME', 'IP', '站点状态']; | ||
| 81 | + if ($data) { | ||
| 82 | + $table = new BatchExportService($server_name . '站点解析情况及访问状态'); | ||
| 83 | + $file = $table->head($map)->data($data)->save(); | ||
| 84 | + if (!$file) { | ||
| 85 | + $this->output('文件生成失败,请重试'); | ||
| 86 | + } else { | ||
| 87 | + $this->output('export success'); | ||
| 88 | + } | ||
| 89 | + } else { | ||
| 90 | + $this->output('no data'); | ||
| 91 | + } | ||
| 92 | + } | ||
| 35 | 93 | ||
| 36 | /** | 94 | /** |
| 37 | * 检查服务器上没有解析cname的项目 | 95 | * 检查服务器上没有解析cname的项目 |
| 38 | * @author Akun | 96 | * @author Akun |
| 39 | * @date 2024/12/11 10:15 | 97 | * @date 2024/12/11 10:15 |
| 40 | */ | 98 | */ |
| 41 | - public function handle7() | 99 | + public function check_no_cname_projects() |
| 42 | { | 100 | { |
| 43 | $server_id = 15; | 101 | $server_id = 15; |
| 44 | $server_name = '美服1'; | 102 | $server_name = '美服1'; |
| @@ -90,7 +148,7 @@ class Temp extends Command | @@ -90,7 +148,7 @@ class Temp extends Command | ||
| 90 | * @author Akun | 148 | * @author Akun |
| 91 | * @date 2024/12/10 10:43 | 149 | * @date 2024/12/10 10:43 |
| 92 | */ | 150 | */ |
| 93 | - public function handle6() | 151 | + public function wx_tg_projects() |
| 94 | { | 152 | { |
| 95 | //获取所有组内推广项目 | 153 | //获取所有组内推广项目 |
| 96 | $leader_mid = 16; | 154 | $leader_mid = 16; |
| @@ -178,9 +236,9 @@ class Temp extends Command | @@ -178,9 +236,9 @@ class Temp extends Command | ||
| 178 | * @author Akun | 236 | * @author Akun |
| 179 | * @date 2024/11/18 15:07 | 237 | * @date 2024/11/18 15:07 |
| 180 | */ | 238 | */ |
| 181 | - public function handle() | 239 | + public function relation_all_keywords() |
| 182 | { | 240 | { |
| 183 | - $projects = Project::where('id', 874)->select(['id'])->orderBy('id', 'asc')->get(); | 241 | + $projects = Project::select(['id'])->orderBy('id', 'asc')->get(); |
| 184 | foreach ($projects as $project) { | 242 | foreach ($projects as $project) { |
| 185 | ProjectServer::useProject($project->id); | 243 | ProjectServer::useProject($project->id); |
| 186 | 244 | ||
| @@ -204,7 +262,7 @@ class Temp extends Command | @@ -204,7 +262,7 @@ class Temp extends Command | ||
| 204 | * @author Akun | 262 | * @author Akun |
| 205 | * @date 2024/10/30 15:37 | 263 | * @date 2024/10/30 15:37 |
| 206 | */ | 264 | */ |
| 207 | - public function handle4() | 265 | + public function keywords_first_word() |
| 208 | { | 266 | { |
| 209 | $projects = Project::select(['id'])->orderBy('id', 'asc')->get(); | 267 | $projects = Project::select(['id'])->orderBy('id', 'asc')->get(); |
| 210 | foreach ($projects as $project) { | 268 | foreach ($projects as $project) { |
| @@ -279,7 +337,7 @@ class Temp extends Command | @@ -279,7 +337,7 @@ class Temp extends Command | ||
| 279 | * @author Akun | 337 | * @author Akun |
| 280 | * @date 2024/09/30 17:01 | 338 | * @date 2024/09/30 17:01 |
| 281 | */ | 339 | */ |
| 282 | - public function handle3() | 340 | + public function get_all_projects_by_server() |
| 283 | { | 341 | { |
| 284 | $server_id = 1; | 342 | $server_id = 1; |
| 285 | 343 | ||
| @@ -325,7 +383,7 @@ class Temp extends Command | @@ -325,7 +383,7 @@ class Temp extends Command | ||
| 325 | * @author Akun | 383 | * @author Akun |
| 326 | * @date 2024/09/26 10:48 | 384 | * @date 2024/09/26 10:48 |
| 327 | */ | 385 | */ |
| 328 | - public function handle2() | 386 | + public function check_no_server_projects() |
| 329 | { | 387 | { |
| 330 | $server_id = 15; | 388 | $server_id = 15; |
| 331 | 389 | ||
| @@ -377,7 +435,7 @@ class Temp extends Command | @@ -377,7 +435,7 @@ class Temp extends Command | ||
| 377 | * @author Akun | 435 | * @author Akun |
| 378 | * @date 2024/09/26 10:48 | 436 | * @date 2024/09/26 10:48 |
| 379 | */ | 437 | */ |
| 380 | - public function handle1() | 438 | + public function create_all_amp_notify() |
| 381 | { | 439 | { |
| 382 | $notify_model = new Notify(); | 440 | $notify_model = new Notify(); |
| 383 | $project_model = new Project(); | 441 | $project_model = new Project(); |
| @@ -40,7 +40,7 @@ class UpdateBuildConfiguration extends Command | @@ -40,7 +40,7 @@ class UpdateBuildConfiguration extends Command | ||
| 40 | * @method :post | 40 | * @method :post |
| 41 | * @time :2024/12/11 11:49 | 41 | * @time :2024/12/11 11:49 |
| 42 | */ | 42 | */ |
| 43 | - public function handle(){ | 43 | + public function handles(){ |
| 44 | //查询当前的所有项目都开启可视化 | 44 | //查询当前的所有项目都开启可视化 |
| 45 | $buildModel = new DeployBuild(); | 45 | $buildModel = new DeployBuild(); |
| 46 | $lists = $buildModel->list(); | 46 | $lists = $buildModel->list(); |
| @@ -59,9 +59,9 @@ class UpdateBuildConfiguration extends Command | @@ -59,9 +59,9 @@ class UpdateBuildConfiguration extends Command | ||
| 59 | * @method :post | 59 | * @method :post |
| 60 | * @time :2024/12/11 14:33 | 60 | * @time :2024/12/11 14:33 |
| 61 | */ | 61 | */ |
| 62 | - public function handles(){ | 62 | + public function handle(){ |
| 63 | $projectModel = new Project(); | 63 | $projectModel = new Project(); |
| 64 | - $list = $projectModel->list(['delete_status'=>0]); | 64 | + $list = $projectModel->list(['delete_status'=>0,'id'=>['>',1671]],'id',['id'],'asc'); |
| 65 | foreach ($list as $k => $v){ | 65 | foreach ($list as $k => $v){ |
| 66 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 66 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 67 | ProjectServer::useProject($v['id']); | 67 | ProjectServer::useProject($v['id']); |
| @@ -79,21 +79,48 @@ class UpdateBuildConfiguration extends Command | @@ -79,21 +79,48 @@ class UpdateBuildConfiguration extends Command | ||
| 79 | * @time :2024/12/11 14:40 | 79 | * @time :2024/12/11 14:40 |
| 80 | */ | 80 | */ |
| 81 | public function getProduct(){ | 81 | public function getProduct(){ |
| 82 | + Detail::truncate(); | ||
| 82 | $productModel = new Product(); | 83 | $productModel = new Product(); |
| 83 | - $lists = $productModel->list(); | ||
| 84 | - $detailModel = new Detail(); | ||
| 85 | - foreach ($lists as $k => $v){ | ||
| 86 | - echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; | ||
| 87 | - $data = [ | ||
| 88 | - 'product_id'=>$v['id'], | ||
| 89 | - 'column_id'=>1, | ||
| 90 | - 'text_type'=>1, | ||
| 91 | - 'title'=>'', | ||
| 92 | - 'sort'=>1, | ||
| 93 | - 'content'=>$v['describe'] | ||
| 94 | - ]; | ||
| 95 | - $detailModel->add($data); | 84 | + $page = 1; |
| 85 | + while (true){ | ||
| 86 | + $lists = $productModel->lists([],$page,50,['id','describe']); | ||
| 87 | + $detailModel = new Detail(); | ||
| 88 | + if(!empty($lists['list'])){ | ||
| 89 | + foreach ($lists['list'] as $k => $v){ | ||
| 90 | + echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; | ||
| 91 | + if(empty($v['describe'])){ | ||
| 92 | + continue; | ||
| 93 | + } | ||
| 94 | + foreach ($v['describe'] as $key => $value){ | ||
| 95 | + if(isset($value['title']) && ($value['title'] == null)){ | ||
| 96 | + $value['title'] = ''; | ||
| 97 | + } | ||
| 98 | + if(isset($value['text']) && ($value['text'] == null)){ | ||
| 99 | + $value['text'] = ''; | ||
| 100 | + } | ||
| 101 | + if(empty($value['text'])){ | ||
| 102 | + continue; | ||
| 103 | + } | ||
| 104 | + $data = [ | ||
| 105 | + 'product_id'=>$v['id'], | ||
| 106 | + 'column_id'=>1, | ||
| 107 | + 'text_type'=>1, | ||
| 108 | + 'title'=>$value['title'] ?? '', | ||
| 109 | + 'sort'=>1, | ||
| 110 | + 'content'=>json_encode(['content'=>$value['text'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), | ||
| 111 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 112 | + 'updated_at'=>date('Y-m-d H:i:s') | ||
| 113 | + ]; | ||
| 114 | + $detailModel->insert($data); | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + }else{ | ||
| 118 | + break; | ||
| 119 | + return false; | ||
| 120 | + } | ||
| 121 | + $page++; | ||
| 96 | } | 122 | } |
| 123 | + return true; | ||
| 97 | } | 124 | } |
| 98 | 125 | ||
| 99 | } | 126 | } |
| @@ -108,18 +108,4 @@ class UpdateKeyword extends Command | @@ -108,18 +108,4 @@ class UpdateKeyword extends Command | ||
| 108 | return true; | 108 | return true; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | - /** | ||
| 112 | - * @remark :更新产品关键词 | ||
| 113 | - * @name :updatedProductKeyword | ||
| 114 | - * @author :lyh | ||
| 115 | - * @method :post | ||
| 116 | - * @time :2024/11/27 14:26 | ||
| 117 | - */ | ||
| 118 | - public function updatedProductKeyword(){ | ||
| 119 | - $productModel = new Product(); | ||
| 120 | - $lists = $productModel->list(); | ||
| 121 | - foreach ($lists as $k => $v){ | ||
| 122 | - | ||
| 123 | - } | ||
| 124 | - } | ||
| 125 | } | 111 | } |
| @@ -1001,6 +1001,40 @@ if (!function_exists('check_domain_record')) { | @@ -1001,6 +1001,40 @@ if (!function_exists('check_domain_record')) { | ||
| 1001 | } | 1001 | } |
| 1002 | } | 1002 | } |
| 1003 | 1003 | ||
| 1004 | +if (!function_exists('check_curl_status')) { | ||
| 1005 | + /** | ||
| 1006 | + * 获取域名访问状态码 | ||
| 1007 | + * @param $url | ||
| 1008 | + * @return int | ||
| 1009 | + * @author Akun | ||
| 1010 | + * @date 2024/12/12 15:52 | ||
| 1011 | + */ | ||
| 1012 | + function check_curl_status($url){ | ||
| 1013 | + $header = array( | ||
| 1014 | + 'Expect:', | ||
| 1015 | + 'Content-Type: application/json; charset=utf-8' | ||
| 1016 | + ); | ||
| 1017 | + $ch = curl_init($url); | ||
| 1018 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
| 1019 | + curl_setopt($ch, CURLOPT_HEADER, false); | ||
| 1020 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | ||
| 1021 | + curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'); | ||
| 1022 | + curl_setopt($ch, CURLOPT_AUTOREFERER, true); | ||
| 1023 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); | ||
| 1024 | + curl_setopt($ch, CURLOPT_TIMEOUT, 120); | ||
| 1025 | + curl_setopt($ch, CURLOPT_MAXREDIRS, 10); | ||
| 1026 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
| 1027 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | ||
| 1028 | + curl_setopt($ch, CURLOPT_SSLVERSION, 'all'); | ||
| 1029 | + curl_setopt($ch, CURLOPT_HTTPHEADER, $header); | ||
| 1030 | + curl_exec($ch); | ||
| 1031 | + $http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE); | ||
| 1032 | + curl_close($ch); | ||
| 1033 | + | ||
| 1034 | + return $http_code; | ||
| 1035 | + } | ||
| 1036 | +} | ||
| 1037 | + | ||
| 1004 | /** | 1038 | /** |
| 1005 | * 邮箱脱敏 | 1039 | * 邮箱脱敏 |
| 1006 | * @author zbj | 1040 | * @author zbj |
| @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\Product\KeywordLogic; | @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\Product\KeywordLogic; | ||
| 8 | use App\Http\Requests\Bside\Product\KeywordRequest; | 8 | use App\Http\Requests\Bside\Product\KeywordRequest; |
| 9 | use App\Models\Product\Keyword; | 9 | use App\Models\Product\Keyword; |
| 10 | use App\Models\Product\KeywordPage; | 10 | use App\Models\Product\KeywordPage; |
| 11 | +use App\Models\Product\KeywordRelated; | ||
| 11 | use App\Models\Product\Product; | 12 | use App\Models\Product\Product; |
| 12 | use App\Rules\Ids; | 13 | use App\Rules\Ids; |
| 13 | use Illuminate\Http\Request; | 14 | use Illuminate\Http\Request; |
| @@ -35,7 +36,7 @@ class KeywordController extends BaseController | @@ -35,7 +36,7 @@ class KeywordController extends BaseController | ||
| 35 | $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed); | 36 | $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed); |
| 36 | if(!empty($data)){ | 37 | if(!empty($data)){ |
| 37 | foreach ($data['list'] as &$v){ | 38 | foreach ($data['list'] as &$v){ |
| 38 | - $v['product_num'] = Product::where('keyword_id','like' ,'%,'.$v['id'].',%')->count(); | 39 | + $v['product_num'] = KeywordRelated::where('keyword_id',$v['id'])->count(); |
| 39 | if(!empty($v['seo_title']) || !empty($v['seo_keywords']) || !empty($v['seo_description'])){ | 40 | if(!empty($v['seo_title']) || !empty($v['seo_keywords']) || !empty($v['seo_description'])){ |
| 40 | $v['tdk'] = 1; | 41 | $v['tdk'] = 1; |
| 41 | }else{ | 42 | }else{ |
| @@ -208,8 +208,11 @@ class ProductLogic extends BaseLogic | @@ -208,8 +208,11 @@ class ProductLogic extends BaseLogic | ||
| 208 | public function editList(){ | 208 | public function editList(){ |
| 209 | $category_ids = $this->param['category_id']; | 209 | $category_ids = $this->param['category_id']; |
| 210 | $this->param['category_id'] = $this->handleListCategory($this->param['category_id']); | 210 | $this->param['category_id'] = $this->handleListCategory($this->param['category_id']); |
| 211 | - $keyword_arr = $this->param['keyword_id']; | ||
| 212 | - $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); | 211 | + $keyword_arr = $this->saveKeyword($this->param['keyword_id']); |
| 212 | + $this->param['keyword_id'] = ''; | ||
| 213 | + if(!empty($keyword_arr)){ | ||
| 214 | + $this->param['keyword_id'] = ','.implode(',',$keyword_arr).','; | ||
| 215 | + } | ||
| 213 | if(isset($this->param['gallery']) && !empty($this->param['gallery'])){ | 216 | if(isset($this->param['gallery']) && !empty($this->param['gallery'])){ |
| 214 | foreach ($this->param['gallery'] as $k => $v){ | 217 | foreach ($this->param['gallery'] as $k => $v){ |
| 215 | $v['url'] = str_replace_url($v['url']); | 218 | $v['url'] = str_replace_url($v['url']); |
| @@ -242,7 +245,7 @@ class ProductLogic extends BaseLogic | @@ -242,7 +245,7 @@ class ProductLogic extends BaseLogic | ||
| 242 | * @time :2023/10/26 9:51 | 245 | * @time :2023/10/26 9:51 |
| 243 | */ | 246 | */ |
| 244 | public function saveKeyword($keyword){ | 247 | public function saveKeyword($keyword){ |
| 245 | - $str = ''; | 248 | + $arr = []; |
| 246 | if(isset($keyword) && !empty($keyword)){ | 249 | if(isset($keyword) && !empty($keyword)){ |
| 247 | $arr = []; | 250 | $arr = []; |
| 248 | $keywordModel = new Keyword(); | 251 | $keywordModel = new Keyword(); |
| @@ -267,9 +270,8 @@ class ProductLogic extends BaseLogic | @@ -267,9 +270,8 @@ class ProductLogic extends BaseLogic | ||
| 267 | $arr[] = $info['id']; | 270 | $arr[] = $info['id']; |
| 268 | } | 271 | } |
| 269 | } | 272 | } |
| 270 | - $str = ','.implode(',',$arr).','; | ||
| 271 | } | 273 | } |
| 272 | - return $str; | 274 | + return $arr; |
| 273 | } | 275 | } |
| 274 | 276 | ||
| 275 | /** | 277 | /** |
| @@ -267,7 +267,6 @@ class UserLoginLogic | @@ -267,7 +267,6 @@ class UserLoginLogic | ||
| 267 | $info['uptime'] = $project['uptime']; | 267 | $info['uptime'] = $project['uptime']; |
| 268 | $info['is_update_language'] = $project['is_update_language']; | 268 | $info['is_update_language'] = $project['is_update_language']; |
| 269 | $info['is_watermark'] = $project['is_watermark']; | 269 | $info['is_watermark'] = $project['is_watermark']; |
| 270 | - $project['deploy_build']['configuration']['is_product'] = $project['deploy_build']['configuration']['is_news'] = $project['deploy_build']['configuration']['is_blogs'] = $project['deploy_build']['configuration']['is_module'] = "1"; | ||
| 271 | $info['configuration'] = $project['deploy_build']['configuration']; | 270 | $info['configuration'] = $project['deploy_build']['configuration']; |
| 272 | $info['project_type'] = $project['type']; | 271 | $info['project_type'] = $project['type']; |
| 273 | $info['storage_type'] = $project['storage_type']; | 272 | $info['storage_type'] = $project['storage_type']; |
-
请 注册 或 登录 后发表评论