Merge remote-tracking branch 'origin/master' into zhl
正在显示
13 个修改的文件
包含
280 行增加
和
56 行删除
| @@ -7,6 +7,7 @@ use App\Models\ProjectAssociation\ProjectAssociation; | @@ -7,6 +7,7 @@ use App\Models\ProjectAssociation\ProjectAssociation; | ||
| 7 | use App\Services\CosService; | 7 | use App\Services\CosService; |
| 8 | use Barryvdh\DomPDF\Facade\Pdf; | 8 | use Barryvdh\DomPDF\Facade\Pdf; |
| 9 | use Illuminate\Console\Command; | 9 | use Illuminate\Console\Command; |
| 10 | +use Illuminate\Support\Facades\DB; | ||
| 10 | 11 | ||
| 11 | class GeneratePdfData extends Command | 12 | class GeneratePdfData extends Command |
| 12 | { | 13 | { |
| @@ -66,15 +67,22 @@ class GeneratePdfData extends Command | @@ -66,15 +67,22 @@ class GeneratePdfData extends Command | ||
| 66 | sleep(60); | 67 | sleep(60); |
| 67 | return 0; | 68 | return 0; |
| 68 | } | 69 | } |
| 69 | - $pdfFile = new PdfFile(); | ||
| 70 | - $bool = $pdfFile->saveData(['pid' => $list->id]); | ||
| 71 | - if (!$bool) { | ||
| 72 | - $this->error('生成v6绑定的aicc用户的pdf备用数据添加失败'); | ||
| 73 | - return 0; | 70 | + DB::beginTransaction(); |
| 71 | + try { | ||
| 72 | + $pdfFile = new PdfFile(); | ||
| 73 | + $bool = $pdfFile->saveData(['pid' => $list->id]); | ||
| 74 | + if (!$bool) { | ||
| 75 | + $this->error('生成v6绑定的aicc用户的pdf备用数据添加失败'); | ||
| 76 | + return 0; | ||
| 77 | + } | ||
| 78 | + $list->m_status = $month; | ||
| 79 | + $list->save(); | ||
| 80 | + DB::commit(); | ||
| 81 | + $this->info('生成v6绑定的aicc用户的pdf备用数据添加成功 - ' . $list->id); | ||
| 82 | + } catch (\Exception $exception) { | ||
| 83 | + DB::rollBack(); | ||
| 84 | + $this->error('生成v6绑定的aicc用户的pdf备用数据添加失败 - ' . $list->id); | ||
| 74 | } | 85 | } |
| 75 | - $list->m_status = $month; | ||
| 76 | - $list->save(); | ||
| 77 | - $this->info('生成v6绑定的aicc用户的pdf备用数据添加成功'); | ||
| 78 | return 0; | 86 | return 0; |
| 79 | } | 87 | } |
| 80 | } | 88 | } |
| @@ -5,9 +5,11 @@ namespace App\Console\Commands\GeneratePDF; | @@ -5,9 +5,11 @@ namespace App\Console\Commands\GeneratePDF; | ||
| 5 | use App\Models\File\PdfFile; | 5 | use App\Models\File\PdfFile; |
| 6 | use App\Models\ProjectAssociation\ProjectAssociation; | 6 | use App\Models\ProjectAssociation\ProjectAssociation; |
| 7 | use App\Services\CosService; | 7 | use App\Services\CosService; |
| 8 | +use App\Services\ProjectServer; | ||
| 8 | use Barryvdh\DomPDF\Facade\Pdf; | 9 | use Barryvdh\DomPDF\Facade\Pdf; |
| 9 | use Illuminate\Console\Command; | 10 | use Illuminate\Console\Command; |
| 10 | use Illuminate\Http\File; | 11 | use Illuminate\Http\File; |
| 12 | +use Illuminate\Support\Facades\DB; | ||
| 11 | 13 | ||
| 12 | class ProjectFilePDF extends Command | 14 | class ProjectFilePDF extends Command |
| 13 | { | 15 | { |
| @@ -48,7 +50,6 @@ class ProjectFilePDF extends Command | @@ -48,7 +50,6 @@ class ProjectFilePDF extends Command | ||
| 48 | 50 | ||
| 49 | public function handle() | 51 | public function handle() |
| 50 | { | 52 | { |
| 51 | - | ||
| 52 | // 开始时间 | 53 | // 开始时间 |
| 53 | $startTime = microtime(true); | 54 | $startTime = microtime(true); |
| 54 | 55 | ||
| @@ -105,8 +106,14 @@ class ProjectFilePDF extends Command | @@ -105,8 +106,14 @@ class ProjectFilePDF extends Command | ||
| 105 | $friend_id = $isExists->friend_id; | 106 | $friend_id = $isExists->friend_id; |
| 106 | // todo 根据项目查询数据 | 107 | // todo 根据项目查询数据 |
| 107 | $project_data = []; | 108 | $project_data = []; |
| 108 | - $html = $this->html($project_data); | ||
| 109 | - $filename = hash('md5', $this->time . '-' . $project_id . '-' . $friend_id . '-' . $user_id); | 109 | + //获取当前数据详情 |
| 110 | + $res = ProjectServer::useProject($project_id); | ||
| 111 | + if ($res) { | ||
| 112 | + $project_data = []; | ||
| 113 | + } | ||
| 114 | + DB::disconnect('custom_mysql'); | ||
| 115 | + $html = $this->html($project_data); | ||
| 116 | + $filename = hash('md5', $this->time . '-' . $project_id . '-' . $friend_id . '-' . $user_id); | ||
| 110 | 117 | ||
| 111 | if ($count == 2) { | 118 | if ($count == 2) { |
| 112 | $list->is_pdf = PdfFile::GENERATE_OTHER_PDF; | 119 | $list->is_pdf = PdfFile::GENERATE_OTHER_PDF; |
| @@ -169,7 +176,14 @@ class ProjectFilePDF extends Command | @@ -169,7 +176,14 @@ class ProjectFilePDF extends Command | ||
| 169 | */ | 176 | */ |
| 170 | protected function html($item) | 177 | protected function html($item) |
| 171 | { | 178 | { |
| 172 | - $font_path = storage_path('fonts\msyh.ttf'); | ||
| 173 | - return '<html><head><title>Laravel</title><meta http-equiv=\'Content-Type\' content=\'text/html; charset=utf-8\'/><style>body{ font-family: \'msyh\'; } @font-face { font-family: \'msyh\'; font-style: normal; font-weight: normal; src: url(' . $font_path . ') format(\'truetype\'); }</style></head><body><div class=\'container\'><div class=\'content\'><p style=\'font-family: msyh, DejaVu Sans,sans-serif;\'>献给母亲的爱</p><div style=\'font-family: msyh, DejaVu Sans,sans-serif;\' class=\'title\'>Laravel 5中文测试sdsd</div><div class=\'title\'>测试三askjdhfkjasdhf</div></div></div></body></html>'; | 179 | + $html = @file_get_contents(dirname(__FILE__) . '/pdf_template.html'); |
| 180 | + if (empty($html)) { | ||
| 181 | + return ''; | ||
| 182 | + } | ||
| 183 | + $rep = [ | ||
| 184 | + 'ENTRY_NAME' => '测试项目', | ||
| 185 | + 'NUMBER' => 1000, | ||
| 186 | + ]; | ||
| 187 | + return str_replace(array_keys($rep), array_values($rep), $html); | ||
| 174 | } | 188 | } |
| 175 | } | 189 | } |
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html lang="en"> | ||
| 3 | +<head> | ||
| 4 | + <meta charset="UTF-8"> | ||
| 5 | + <title>网站数据</title> | ||
| 6 | + <style> | ||
| 7 | + @font-face { | ||
| 8 | + font-family: 'msyh'; | ||
| 9 | + font-style: normal; | ||
| 10 | + font-weight: normal; | ||
| 11 | + src: url(../../../../storage/fonts/msyh.ttf) format('truetype'); | ||
| 12 | + } | ||
| 13 | + body { | ||
| 14 | + font-family: 'msyh'; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + </style> | ||
| 18 | +</head> | ||
| 19 | +<body> | ||
| 20 | + 项目名称:ENTRY_NAME<br> | ||
| 21 | + 数量:NUMBER | ||
| 22 | +</body> | ||
| 23 | +</html> |
| @@ -138,7 +138,7 @@ class HtmlCollect extends Command | @@ -138,7 +138,7 @@ class HtmlCollect extends Command | ||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | 140 | ||
| 141 | - $update_log = UpdateLog::where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first(); | 141 | + $update_log = UpdateLog::where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('updated_at', 'asc')->first(); |
| 142 | if (!$update_log) { | 142 | if (!$update_log) { |
| 143 | return false; | 143 | return false; |
| 144 | } | 144 | } |
| @@ -292,7 +292,7 @@ class ProjectUpdate extends Command | @@ -292,7 +292,7 @@ class ProjectUpdate extends Command | ||
| 292 | 'route' => $route | 292 | 'route' => $route |
| 293 | ]); | 293 | ]); |
| 294 | $this->set_map($route, RouteMap::SOURCE_PRODUCT, $id, $project_id); | 294 | $this->set_map($route, RouteMap::SOURCE_PRODUCT, $id, $project_id); |
| 295 | - CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT, $id, $link_type, $language_list, $page_list); | 295 | + CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT, $id, $domain_arr['host'], $link_type, $language_list, $page_list); |
| 296 | } else { | 296 | } else { |
| 297 | $id = $product['id']; | 297 | $id = $product['id']; |
| 298 | $model->edit([ | 298 | $model->edit([ |
| @@ -418,7 +418,7 @@ class ProjectUpdate extends Command | @@ -418,7 +418,7 @@ class ProjectUpdate extends Command | ||
| 418 | ]); | 418 | ]); |
| 419 | $this->set_map($route, $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id); | 419 | $this->set_map($route, $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id); |
| 420 | 420 | ||
| 421 | - CollectTask::_insert($item['url'], $project_id, $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $link_type, $language_list, $page_list); | 421 | + CollectTask::_insert($item['url'], $project_id, $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $domain_arr['host'], $link_type, $language_list, $page_list); |
| 422 | } else { | 422 | } else { |
| 423 | $id = $news['id']; | 423 | $id = $news['id']; |
| 424 | $model->edit([ | 424 | $model->edit([ |
| @@ -483,7 +483,7 @@ class ProjectUpdate extends Command | @@ -483,7 +483,7 @@ class ProjectUpdate extends Command | ||
| 483 | ]); | 483 | ]); |
| 484 | $this->set_map($route, RouteMap::SOURCE_PAGE, $id, $project_id); | 484 | $this->set_map($route, RouteMap::SOURCE_PAGE, $id, $project_id); |
| 485 | 485 | ||
| 486 | - CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PAGE, $id, $link_type, $language_list, $page_list); | 486 | + CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PAGE, $id, $domain_arr['host'], $link_type, $language_list, $page_list); |
| 487 | } else { | 487 | } else { |
| 488 | $id = $custom['id']; | 488 | $id = $custom['id']; |
| 489 | $model->edit([ | 489 | $model->edit([ |
| @@ -527,7 +527,7 @@ class ProjectUpdate extends Command | @@ -527,7 +527,7 @@ class ProjectUpdate extends Command | ||
| 527 | return $task_id; | 527 | return $task_id; |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | - $task_list = UpdateLog::where('status', UpdateLog::STATUS_UN)->orderBy('sort', 'asc')->orderBy('project_id', 'asc')->limit(20)->get(); | 530 | + $task_list = UpdateLog::where('status', UpdateLog::STATUS_UN)->orderBy('sort', 'asc')->orderBy('updated_at', 'asc')->limit(20)->get(); |
| 531 | if ($task_list->count() == 0) { | 531 | if ($task_list->count() == 0) { |
| 532 | return false; | 532 | return false; |
| 533 | } | 533 | } |
| @@ -689,8 +689,6 @@ class ProjectUpdate extends Command | @@ -689,8 +689,6 @@ class ProjectUpdate extends Command | ||
| 689 | $host = $arr['host'] ?? ''; | 689 | $host = $arr['host'] ?? ''; |
| 690 | $path = $arr['path'] ?? ''; | 690 | $path = $arr['path'] ?? ''; |
| 691 | 691 | ||
| 692 | - $url_complete = ($scheme ?: 'https') . '://' . $domain . $path; | ||
| 693 | - | ||
| 694 | if ( | 692 | if ( |
| 695 | (empty($scheme) || $scheme == 'https' || $scheme == 'http') | 693 | (empty($scheme) || $scheme == 'https' || $scheme == 'http') |
| 696 | && (empty($host) || (strpos($web_url_domain, $host) !== false) || (strpos($home_url, $host) !== false)) | 694 | && (empty($host) || (strpos($web_url_domain, $host) !== false) || (strpos($home_url, $host) !== false)) |
| @@ -698,6 +696,10 @@ class ProjectUpdate extends Command | @@ -698,6 +696,10 @@ class ProjectUpdate extends Command | ||
| 698 | ) { | 696 | ) { |
| 699 | $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); | 697 | $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); |
| 700 | if (!$source) { | 698 | if (!$source) { |
| 699 | + if (empty($scheme) && empty($host) && substr($path, 0, 1) != '/') { | ||
| 700 | + $path = '/' . $path; | ||
| 701 | + } | ||
| 702 | + $url_complete = ($scheme ?: 'https') . '://' . $domain . $path; | ||
| 701 | $new_url = CosService::uploadRemote($project_id, 'image_product', $url_complete); | 703 | $new_url = CosService::uploadRemote($project_id, 'image_product', $url_complete); |
| 702 | 704 | ||
| 703 | if ($new_url) { | 705 | if ($new_url) { |
| @@ -717,7 +719,7 @@ class ProjectUpdate extends Command | @@ -717,7 +719,7 @@ class ProjectUpdate extends Command | ||
| 717 | return getImageUrl($source['target']); | 719 | return getImageUrl($source['target']); |
| 718 | } | 720 | } |
| 719 | } else { | 721 | } else { |
| 720 | - return $url_complete; | 722 | + return ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path; |
| 721 | } | 723 | } |
| 722 | } | 724 | } |
| 723 | 725 |
| @@ -12,6 +12,8 @@ namespace App\Console\Commands; | @@ -12,6 +12,8 @@ namespace App\Console\Commands; | ||
| 12 | use App\Models\Blog\Blog; | 12 | use App\Models\Blog\Blog; |
| 13 | use App\Models\Blog\BlogCategory; | 13 | use App\Models\Blog\BlogCategory; |
| 14 | use App\Models\CustomModule\CustomModule; | 14 | use App\Models\CustomModule\CustomModule; |
| 15 | +use App\Models\CustomModule\CustomModuleCategory; | ||
| 16 | +use App\Models\CustomModule\CustomModuleContent; | ||
| 15 | use App\Models\News\News; | 17 | use App\Models\News\News; |
| 16 | use App\Models\News\NewsCategory; | 18 | use App\Models\News\NewsCategory; |
| 17 | use App\Models\Product\Category; | 19 | use App\Models\Product\Category; |
| @@ -57,31 +59,85 @@ class UpdateMainHtml extends Command | @@ -57,31 +59,85 @@ class UpdateMainHtml extends Command | ||
| 57 | */ | 59 | */ |
| 58 | public function handle(){ | 60 | public function handle(){ |
| 59 | $projectModel = new Project(); | 61 | $projectModel = new Project(); |
| 60 | - $list = $projectModel->list(['type'=>['!=',0]]); | 62 | + $list = $projectModel->list(['id'=>99]); |
| 61 | foreach ($list as $v){ | 63 | foreach ($list as $v){ |
| 62 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 64 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 63 | ProjectServer::useProject($v['id']); | 65 | ProjectServer::useProject($v['id']); |
| 64 | - $this->initModule($v['id']); | 66 | + $this->editRoute(); |
| 65 | DB::disconnect('custom_mysql'); | 67 | DB::disconnect('custom_mysql'); |
| 66 | } | 68 | } |
| 67 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 69 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 68 | } | 70 | } |
| 69 | 71 | ||
| 70 | - public function initModule($project_id){ | ||
| 71 | - $moduleModel = new CustomModule(); | ||
| 72 | - $info = $moduleModel->read(['route'=>'video']); | ||
| 73 | - if($info === false){ | ||
| 74 | - $info = $moduleModel->read(['name'=>'视频模块']); | ||
| 75 | - if($info === false){ | ||
| 76 | - $data = [ | ||
| 77 | - 'name'=>'视频模块', | ||
| 78 | - 'project_id'=>$project_id, | ||
| 79 | - 'route'=>'video', | ||
| 80 | - ]; | ||
| 81 | - $moduleModel->add($data); | ||
| 82 | - } | 72 | + /** |
| 73 | + * @remark :所有博客数据添加到自定义模块 | ||
| 74 | + * @name :setBlogCustom | ||
| 75 | + * @author :lyh | ||
| 76 | + * @method :post | ||
| 77 | + * @time :2024/1/5 10:21 | ||
| 78 | + */ | ||
| 79 | + public function setBlogCustom(){ | ||
| 80 | + $data = []; | ||
| 81 | + $blogCategoryModel = new BlogCategory(); | ||
| 82 | + $list = $blogCategoryModel->list(['status'=>0]); | ||
| 83 | + foreach ($list as $v){ | ||
| 84 | + echo date('Y-m-d H:i:s') . '博客分类id:'.$v['id'] . PHP_EOL; | ||
| 85 | + $data[] = [ | ||
| 86 | + 'name'=>$v['name'], | ||
| 87 | + 'route'=>$v['alias'], | ||
| 88 | + 'project_id'=>99, | ||
| 89 | + 'operator_id'=>366, | ||
| 90 | + 'seo_title'=>$v['seo_title'], | ||
| 91 | + 'seo_keywords'=>$v['seo_keywords'], | ||
| 92 | + 'seo_description'=>$v['seo_des'], | ||
| 93 | + 'created_at'=>$v['created_at'], | ||
| 94 | + 'updated_at'=>$v['updated_at'], | ||
| 95 | + 'module_id'=>7 | ||
| 96 | + ]; | ||
| 83 | } | 97 | } |
| 98 | + $cate = new CustomModuleCategory(); | ||
| 99 | + $cate->insert($data); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * @remark :所有博客数据添加到自定义模块 | ||
| 104 | + * @name :setBlogCustom | ||
| 105 | + * @author :lyh | ||
| 106 | + * @method :post | ||
| 107 | + * @time :2024/1/5 10:21 | ||
| 108 | + */ | ||
| 109 | + public function setBlogCustomContent(){ | ||
| 110 | + $data = []; | ||
| 111 | + $blogModel = new Blog(); | ||
| 112 | + $list = $blogModel->list(['status'=>1]); | ||
| 113 | + foreach ($list as $v){ | ||
| 114 | + echo date('Y-m-d H:i:s') . '博客分类id:'.$v['id'] . PHP_EOL; | ||
| 115 | + $data[] = [ | ||
| 116 | + 'name'=>$v['name'], | ||
| 117 | + 'content'=>$v['text'], | ||
| 118 | + 'remark'=>$v['remark'], | ||
| 119 | + 'route'=>$v['url'], | ||
| 120 | + 'image'=>$v['image'], | ||
| 121 | + 'project_id'=>99, | ||
| 122 | + 'operator_id'=>366, | ||
| 123 | + 'seo_title'=>$v['seo_title'], | ||
| 124 | + 'seo_keywords'=>$v['seo_keywords'], | ||
| 125 | + 'seo_description'=>$v['seo_description'], | ||
| 126 | + 'created_at'=>$v['created_at'], | ||
| 127 | + 'updated_at'=>$v['updated_at'], | ||
| 128 | + 'module_id'=>7, | ||
| 129 | + 'category_id'=>$v['category_id'] | ||
| 130 | + ]; | ||
| 131 | + } | ||
| 132 | + $content = new CustomModuleContent(); | ||
| 133 | + $content->insert($data); | ||
| 84 | return true; | 134 | return true; |
| 85 | } | 135 | } |
| 86 | 136 | ||
| 137 | + public function editRoute(){ | ||
| 138 | + $routeMap = new RouteMap(); | ||
| 139 | + $routeMap->edit(['source'=>RouteMap::SOURCE_MODULE,'blog'=>''],['source'=>'blog']); | ||
| 140 | + $routeMap->edit(['source'=>RouteMap::SOURCE_MODULE_CATE,'blog'=>''],['source'=>'blog_category']); | ||
| 141 | + return true; | ||
| 142 | + } | ||
| 87 | } | 143 | } |
| @@ -9,11 +9,8 @@ | @@ -9,11 +9,8 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Console\Commands; | 10 | namespace App\Console\Commands; |
| 11 | 11 | ||
| 12 | -use App\Models\Blog\Blog; | ||
| 13 | -use App\Models\Blog\BlogCategory; | ||
| 14 | -use App\Models\News\News; | ||
| 15 | -use App\Models\News\NewsCategory; | ||
| 16 | -use App\Models\Product\Category; | 12 | +use App\Helper\Arr; |
| 13 | +use App\Models\Product\CategoryRelated; | ||
| 17 | use App\Models\Product\Keyword; | 14 | use App\Models\Product\Keyword; |
| 18 | use App\Models\Product\Product; | 15 | use App\Models\Product\Product; |
| 19 | use App\Models\Project\Project; | 16 | use App\Models\Project\Project; |
| @@ -54,13 +51,14 @@ class UpdateRoute extends Command | @@ -54,13 +51,14 @@ class UpdateRoute extends Command | ||
| 54 | */ | 51 | */ |
| 55 | public function handle(){ | 52 | public function handle(){ |
| 56 | $projectModel = new Project(); | 53 | $projectModel = new Project(); |
| 57 | - $list = $projectModel->list(['id'=>['in',[627]]]); | 54 | + $list = $projectModel->list(['id'=>475]); |
| 58 | foreach ($list as $v){ | 55 | foreach ($list as $v){ |
| 59 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 56 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 60 | ProjectServer::useProject($v['id']); | 57 | ProjectServer::useProject($v['id']); |
| 61 | // $this->getProduct(); | 58 | // $this->getProduct(); |
| 62 | // $this->setProductKeyword(); | 59 | // $this->setProductKeyword(); |
| 63 | - $this->getRouteMap(); | 60 | +// $this->getRouteMap(); |
| 61 | + $this->getProductCategory(); | ||
| 64 | DB::disconnect('custom_mysql'); | 62 | DB::disconnect('custom_mysql'); |
| 65 | } | 63 | } |
| 66 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 64 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -157,6 +155,62 @@ class UpdateRoute extends Command | @@ -157,6 +155,62 @@ class UpdateRoute extends Command | ||
| 157 | } | 155 | } |
| 158 | 156 | ||
| 159 | /** | 157 | /** |
| 158 | + * @remark :更新产品关联表 | ||
| 159 | + * @name :getProductCategory | ||
| 160 | + * @author :lyh | ||
| 161 | + * @method :post | ||
| 162 | + * @time :2024/1/4 14:48 | ||
| 163 | + */ | ||
| 164 | + public function getProductCategory(){ | ||
| 165 | + $product = new Product(); | ||
| 166 | + $num = 30; | ||
| 167 | + while ($num > 0){ | ||
| 168 | + $list = $product->lists(['status'=>1],$num,1000); | ||
| 169 | + foreach ($list['list'] as $k => $v){ | ||
| 170 | + if(empty($v['category_id'])){ | ||
| 171 | + continue; | ||
| 172 | + } | ||
| 173 | + $category_ids = $v['category_id']; | ||
| 174 | + //产品分类关联 | ||
| 175 | + echo date('Y-m-d H:i:s') . '产品id--1:'.$v['id'] . PHP_EOL; | ||
| 176 | + $this->saveRelated($v['id'], $category_ids); | ||
| 177 | + echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; | ||
| 178 | + } | ||
| 179 | + $num--; | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + /** | ||
| 184 | + * 关联产品分类 | ||
| 185 | + * @param $product_id | ||
| 186 | + * @param $cate_ids | ||
| 187 | + * @author zbj | ||
| 188 | + * @date 2023/4/21 | ||
| 189 | + */ | ||
| 190 | + public function saveRelated($product_id, $cate_ids) | ||
| 191 | + { | ||
| 192 | + if(!is_array($cate_ids)){ | ||
| 193 | + $cate_ids = array_filter(Arr::splitFilterToArray($cate_ids), 'intval'); | ||
| 194 | + } | ||
| 195 | + //先删除 | ||
| 196 | + CategoryRelated::where('product_id', $product_id)->delete(); | ||
| 197 | + //批量保存 | ||
| 198 | + $data = []; | ||
| 199 | + if(!empty($cate_ids)){ | ||
| 200 | + foreach ($cate_ids as $cate_id){ | ||
| 201 | + $data[] = [ | ||
| 202 | + 'product_id' => $product_id, | ||
| 203 | + 'cate_id' => $cate_id, | ||
| 204 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 205 | + 'updated_at'=>date('Y-m-d H:i:s') | ||
| 206 | + ]; | ||
| 207 | + } | ||
| 208 | + CategoryRelated::insert($data); | ||
| 209 | + } | ||
| 210 | + return true; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + /** | ||
| 160 | * @remark :删除路由通知C端 | 214 | * @remark :删除路由通知C端 |
| 161 | * @name :curlDelRoute | 215 | * @name :curlDelRoute |
| 162 | * @author :lyh | 216 | * @author :lyh |
| @@ -171,5 +225,4 @@ class UpdateRoute extends Command | @@ -171,5 +225,4 @@ class UpdateRoute extends Command | ||
| 171 | return true; | 225 | return true; |
| 172 | } | 226 | } |
| 173 | 227 | ||
| 174 | - | ||
| 175 | } | 228 | } |
| @@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel | @@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel | ||
| 18 | // $schedule->command('inspire')->hourly(); | 18 | // $schedule->command('inspire')->hourly(); |
| 19 | $schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长 | 19 | $schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长 |
| 20 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 | 20 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 |
| 21 | - $schedule->command('rank_data')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 | 21 | + $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 |
| 22 | $schedule->command('rank_data_speed')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次 | 22 | $schedule->command('rank_data_speed')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次 |
| 23 | $schedule->command('rank_data_external_links')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次 | 23 | $schedule->command('rank_data_external_links')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次 |
| 24 | $schedule->command('rank_data_indexed_pages')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次 | 24 | $schedule->command('rank_data_indexed_pages')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次 |
| @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Aside\Com; | @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Aside\Com; | ||
| 12 | use App\Helper\Common; | 12 | use App\Helper\Common; |
| 13 | use App\Http\Controllers\Bside\BaseController; | 13 | use App\Http\Controllers\Bside\BaseController; |
| 14 | use App\Models\Com\UpdateLog; | 14 | use App\Models\Com\UpdateLog; |
| 15 | +use App\Models\Domain\DomainInfo; | ||
| 15 | use App\Models\Project\ProjectUpdateTdk; | 16 | use App\Models\Project\ProjectUpdateTdk; |
| 16 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| 17 | use Illuminate\Support\Facades\DB; | 18 | use Illuminate\Support\Facades\DB; |
| @@ -66,7 +67,7 @@ class UpdateController extends BaseController | @@ -66,7 +67,7 @@ class UpdateController extends BaseController | ||
| 66 | 67 | ||
| 67 | $project = ProjectServer::useProject($this->param['project_id']); | 68 | $project = ProjectServer::useProject($this->param['project_id']); |
| 68 | 69 | ||
| 69 | - if(!$project){ | 70 | + if (!$project) { |
| 70 | $this->fail('项目不存在'); | 71 | $this->fail('项目不存在'); |
| 71 | } | 72 | } |
| 72 | 73 | ||
| @@ -86,10 +87,13 @@ class UpdateController extends BaseController | @@ -86,10 +87,13 @@ class UpdateController extends BaseController | ||
| 86 | //关闭数据库 | 87 | //关闭数据库 |
| 87 | DB::disconnect('custom_mysql'); | 88 | DB::disconnect('custom_mysql'); |
| 88 | 89 | ||
| 90 | + //查看项目是否已上线 | ||
| 91 | + $domain_info = DomainInfo::where('project_id', $this->param['project_id'])->first(); | ||
| 92 | + | ||
| 89 | $update = ['collect_status' => 0]; | 93 | $update = ['collect_status' => 0]; |
| 90 | -// if ($this->param['type'] == 2) { | ||
| 91 | -// $update['status'] = 0; | ||
| 92 | -// } | 94 | + if ($this->param['type'] == 2 && !$domain_info) { |
| 95 | + $update['status'] = 0; | ||
| 96 | + } | ||
| 93 | 97 | ||
| 94 | UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update); | 98 | UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update); |
| 95 | 99 |
| @@ -85,7 +85,6 @@ class FileController | @@ -85,7 +85,6 @@ class FileController | ||
| 85 | 'file.required'=>'必须填写', | 85 | 'file.required'=>'必须填写', |
| 86 | ]); | 86 | ]); |
| 87 | $files = $this->request->file('file'); | 87 | $files = $this->request->file('file'); |
| 88 | - | ||
| 89 | if (empty($files)) { | 88 | if (empty($files)) { |
| 90 | $this->response('没有上传的文件!'); | 89 | $this->response('没有上传的文件!'); |
| 91 | } | 90 | } |
| @@ -306,6 +305,7 @@ class FileController | @@ -306,6 +305,7 @@ class FileController | ||
| 306 | public function setUrl(){ | 305 | public function setUrl(){ |
| 307 | //A端上传 | 306 | //A端上传 |
| 308 | if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ | 307 | if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ |
| 308 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export('进入222', true) . PHP_EOL, FILE_APPEND); | ||
| 309 | $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); | 309 | $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); |
| 310 | }else{ | 310 | }else{ |
| 311 | //B端上传,upload_method 为 1时 强制上传到本地 | 311 | //B端上传,upload_method 为 1时 强制上传到本地 |
| @@ -173,6 +173,7 @@ class BaseLogic extends Logic | @@ -173,6 +173,7 @@ class BaseLogic extends Logic | ||
| 173 | $data['project_id'] = $this->user['project_id']; | 173 | $data['project_id'] = $this->user['project_id']; |
| 174 | $str = http_build_query($data); | 174 | $str = http_build_query($data); |
| 175 | $url = $this->user['domain'].'api/delHtml/?'.$str; | 175 | $url = $this->user['domain'].'api/delHtml/?'.$str; |
| 176 | +// shell_exec($url); | ||
| 176 | curlGet($url); | 177 | curlGet($url); |
| 177 | return $this->success(); | 178 | return $this->success(); |
| 178 | } | 179 | } |
| @@ -17,7 +17,7 @@ class CollectTask extends Base | @@ -17,7 +17,7 @@ class CollectTask extends Base | ||
| 17 | const STATUS_COM = 2; | 17 | const STATUS_COM = 2; |
| 18 | const STATUS_FAIL = 3; | 18 | const STATUS_FAIL = 3; |
| 19 | 19 | ||
| 20 | - public static function _insert($url, $project_id, $source, $source_id, $link_type = 0, $language_list = [], $page_list = []) | 20 | + public static function _insert($url, $project_id, $source, $source_id, $domain, $link_type = 0, $language_list = [], $page_list = []) |
| 21 | { | 21 | { |
| 22 | if (!$url) { | 22 | if (!$url) { |
| 23 | return; | 23 | return; |
| @@ -36,19 +36,19 @@ class CollectTask extends Base | @@ -36,19 +36,19 @@ class CollectTask extends Base | ||
| 36 | $data = []; | 36 | $data = []; |
| 37 | $now = date('Y-m-d H:i:s'); | 37 | $now = date('Y-m-d H:i:s'); |
| 38 | if (!$task) { | 38 | if (!$task) { |
| 39 | - $data[] = [ | 39 | + $data[] = [ |
| 40 | 'project_id' => $project_id, | 40 | 'project_id' => $project_id, |
| 41 | 'source' => $source, | 41 | 'source' => $source, |
| 42 | 'source_id' => $source_id, | 42 | 'source_id' => $source_id, |
| 43 | - 'domain' => $url_arr['host'], | ||
| 44 | - 'route' => $url_arr['path'], | 43 | + 'domain' => $url_arr['host'] ?? $domain, |
| 44 | + 'route' => substr($url_arr['path'], 0, 1) == '/' ? $url_arr['path'] : '/' . $url_arr['path'], | ||
| 45 | 'language' => '', | 45 | 'language' => '', |
| 46 | 'created_at' => $now, | 46 | 'created_at' => $now, |
| 47 | 'updated_at' => $now, | 47 | 'updated_at' => $now, |
| 48 | ]; | 48 | ]; |
| 49 | 49 | ||
| 50 | if ($link_type > 0 && $language_list && in_array($url_arr['path'], $page_list)) { | 50 | if ($link_type > 0 && $language_list && in_array($url_arr['path'], $page_list)) { |
| 51 | - $domain_arr = explode('.', $url_arr['host']); | 51 | + $domain_arr = explode('.', $url_arr['host'] ?? $domain); |
| 52 | foreach ($language_list as $v_lan) { | 52 | foreach ($language_list as $v_lan) { |
| 53 | if ($link_type == 1) { | 53 | if ($link_type == 1) { |
| 54 | //二级域名 | 54 | //二级域名 |
| @@ -56,7 +56,7 @@ class CollectTask extends Base | @@ -56,7 +56,7 @@ class CollectTask extends Base | ||
| 56 | $new_domain = implode('.', $domain_arr); | 56 | $new_domain = implode('.', $domain_arr); |
| 57 | } else { | 57 | } else { |
| 58 | //二级目录 | 58 | //二级目录 |
| 59 | - $new_domain = $url_arr['host'] . '/' . $v_lan; | 59 | + $new_domain = $url_arr['host'] ?? $domain . '/' . $v_lan; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | $data[] = [ | 62 | $data[] = [ |
| @@ -7,7 +7,70 @@ use App\Models\Base; | @@ -7,7 +7,70 @@ use App\Models\Base; | ||
| 7 | use Illuminate\Database\Eloquent\SoftDeletes; | 7 | use Illuminate\Database\Eloquent\SoftDeletes; |
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | + * App\Models\Product\Product | ||
| 11 | + * | ||
| 10 | * @method static get() | 12 | * @method static get() |
| 13 | + * @property int $id | ||
| 14 | + * @property int $project_id | ||
| 15 | + * @property string $title | ||
| 16 | + * @property string $thumb 封面 | ||
| 17 | + * @property mixed|null $gallery 图集 | ||
| 18 | + * @property mixed|null $attrs 属性参数 | ||
| 19 | + * @property string|null $attr_id 通用参数 | ||
| 20 | + * @property string|null $category_id 分类 多个,号隔开 | ||
| 21 | + * @property string|null $keyword_id 关键词标签 多个,号隔开 | ||
| 22 | + * @property string|null $intro 简介 | ||
| 23 | + * @property string|null $content 详情 | ||
| 24 | + * @property mixed|null $describe 描述 | ||
| 25 | + * @property string $describe_id 通用描述 | ||
| 26 | + * @property mixed|null $seo_mate seo tdk | ||
| 27 | + * @property string $related_product_id 相关产品 多个,号隔开 | ||
| 28 | + * @property int $sort 排序 | ||
| 29 | + * @property int $status 状态 0草稿 1已上架 2已下架 | ||
| 30 | + * @property int $created_uid 创建者 | ||
| 31 | + * @property \Illuminate\Support\Carbon|null $created_at | ||
| 32 | + * @property \Illuminate\Support\Carbon|null $updated_at | ||
| 33 | + * @property \Illuminate\Support\Carbon|null $deleted_at | ||
| 34 | + * @property string|null $route 路由 | ||
| 35 | + * @property mixed|null $icon 图标 | ||
| 36 | + * @property string|null $product_type 产品类型:1,一般产品;2:推荐产品(recommend);3:热销产品(hot) | ||
| 37 | + * @property int $is_upgrade 0:6.0 1:4.0,5.0升级 | ||
| 38 | + * @property string|null $send_time 发布时间 | ||
| 39 | + * @property int|null $six_read 1:导入数据可按6.0显示 | ||
| 40 | + * @method \Illuminate\Database\Eloquent\Builder|Product newModelQuery() | ||
| 41 | + * @method \Illuminate\Database\Eloquent\Builder|Product newQuery() | ||
| 42 | + * @method \Illuminate\Database\Eloquent\Builder|Product onlyTrashed() | ||
| 43 | + * @method static \Illuminate\Database\Eloquent\Builder|Product query() | ||
| 44 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereAttrId($value) | ||
| 45 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereAttrs($value) | ||
| 46 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereCategoryId($value) | ||
| 47 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereContent($value) | ||
| 48 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereCreatedAt($value) | ||
| 49 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereCreatedUid($value) | ||
| 50 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereDeletedAt($value) | ||
| 51 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereDescribe($value) | ||
| 52 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereDescribeId($value) | ||
| 53 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereGallery($value) | ||
| 54 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereIcon($value) | ||
| 55 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereId($value) | ||
| 56 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereIntro($value) | ||
| 57 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereIsUpgrade($value) | ||
| 58 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereKeywordId($value) | ||
| 59 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereProductType($value) | ||
| 60 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereProjectId($value) | ||
| 61 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereRelatedProductId($value) | ||
| 62 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereRoute($value) | ||
| 63 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereSendTime($value) | ||
| 64 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereSeoMate($value) | ||
| 65 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereSixRead($value) | ||
| 66 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereSort($value) | ||
| 67 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereStatus($value) | ||
| 68 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereThumb($value) | ||
| 69 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereTitle($value) | ||
| 70 | + * @method \Illuminate\Database\Eloquent\Builder|Product whereUpdatedAt($value) | ||
| 71 | + * @method \Illuminate\Database\Eloquent\Builder|Product withTrashed() | ||
| 72 | + * @method \Illuminate\Database\Eloquent\Builder|Product withoutTrashed() | ||
| 73 | + * @mixin \Eloquent | ||
| 11 | */ | 74 | */ |
| 12 | class Product extends Base | 75 | class Product extends Base |
| 13 | { | 76 | { |
-
请 注册 或 登录 后发表评论