Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
9 个修改的文件
包含
406 行增加
和
201 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\GeneratePDF; | ||
| 4 | + | ||
| 5 | +use App\Models\File\PdfFile; | ||
| 6 | +use App\Models\ProjectAssociation\ProjectAssociation; | ||
| 7 | +use App\Services\CosService; | ||
| 8 | +use Barryvdh\DomPDF\Facade\Pdf; | ||
| 9 | +use Illuminate\Console\Command; | ||
| 10 | + | ||
| 11 | +class GeneratePdfData extends Command | ||
| 12 | +{ | ||
| 13 | +// use CmdSignal; | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * The name and signature of the console command. | ||
| 17 | + * | ||
| 18 | + * @var string | ||
| 19 | + */ | ||
| 20 | + protected $signature = 'generate_pdf_data'; | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * The console command description. | ||
| 24 | + * | ||
| 25 | + * @var string | ||
| 26 | + */ | ||
| 27 | + protected $description = '生成v6绑定的aicc用户的pdf备用数据'; | ||
| 28 | + | ||
| 29 | + // 最大支持5个进程 | ||
| 30 | + public $maxRunNumber = 50; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * Create a new command instance. | ||
| 34 | + * | ||
| 35 | + * @return void | ||
| 36 | + */ | ||
| 37 | + public function __construct() | ||
| 38 | + { | ||
| 39 | + parent::__construct(); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public function handle() | ||
| 43 | + { | ||
| 44 | + return $this->main(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * @return int | ||
| 49 | + */ | ||
| 50 | + public function start(): int | ||
| 51 | + { | ||
| 52 | + return $this->main(); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * @return int | ||
| 57 | + */ | ||
| 58 | + protected function main() | ||
| 59 | + { | ||
| 60 | + $month = date('m'); | ||
| 61 | + $list = ProjectAssociation::query()->whereStatus(ProjectAssociation::STATUS_NORMAL) | ||
| 62 | + ->where('m_status', '!=', $month)->first(); | ||
| 63 | + | ||
| 64 | + if (is_null($list)) { | ||
| 65 | + $this->error('没有任务,等待中'); | ||
| 66 | + sleep(60); | ||
| 67 | + return 0; | ||
| 68 | + } | ||
| 69 | + $pdfFile = new PdfFile(); | ||
| 70 | + $bool = $pdfFile->saveData(['pid' => $list->id]); | ||
| 71 | + if (!$bool) { | ||
| 72 | + $this->error('生成v6绑定的aicc用户的pdf备用数据添加失败'); | ||
| 73 | + return 0; | ||
| 74 | + } | ||
| 75 | + $list->m_status = $month; | ||
| 76 | + $list->save(); | ||
| 77 | + $this->info('生成v6绑定的aicc用户的pdf备用数据添加成功'); | ||
| 78 | + return 0; | ||
| 79 | + } | ||
| 80 | +} |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -namespace App\Console\Commands; | 3 | +namespace App\Console\Commands\GeneratePDF; |
| 4 | 4 | ||
| 5 | -use App\Http\Controllers\File\FileController; | ||
| 6 | -use App\Models\File\DataFile; | 5 | +use App\Models\File\PdfFile; |
| 7 | use App\Models\ProjectAssociation\ProjectAssociation; | 6 | use App\Models\ProjectAssociation\ProjectAssociation; |
| 8 | use App\Services\CosService; | 7 | use App\Services\CosService; |
| 9 | use Barryvdh\DomPDF\Facade\Pdf; | 8 | use Barryvdh\DomPDF\Facade\Pdf; |
| @@ -12,7 +11,7 @@ use Illuminate\Http\File; | @@ -12,7 +11,7 @@ use Illuminate\Http\File; | ||
| 12 | 11 | ||
| 13 | class ProjectFilePDF extends Command | 12 | class ProjectFilePDF extends Command |
| 14 | { | 13 | { |
| 15 | - use CmdSignal; | 14 | +// use CmdSignal; |
| 16 | 15 | ||
| 17 | /** | 16 | /** |
| 18 | * The name and signature of the console command. | 17 | * The name and signature of the console command. |
| @@ -28,14 +27,8 @@ class ProjectFilePDF extends Command | @@ -28,14 +27,8 @@ class ProjectFilePDF extends Command | ||
| 28 | */ | 27 | */ |
| 29 | protected $description = '网站项目数据,生成PDF文件'; | 28 | protected $description = '网站项目数据,生成PDF文件'; |
| 30 | 29 | ||
| 31 | - protected $ProjectAssociation; | ||
| 32 | - | ||
| 33 | - protected $DataFile; | ||
| 34 | - | ||
| 35 | protected $time; | 30 | protected $time; |
| 36 | 31 | ||
| 37 | - protected $fileController; | ||
| 38 | - | ||
| 39 | protected $CosService; | 32 | protected $CosService; |
| 40 | 33 | ||
| 41 | // 最大支持5个进程 | 34 | // 最大支持5个进程 |
| @@ -48,71 +41,89 @@ class ProjectFilePDF extends Command | @@ -48,71 +41,89 @@ class ProjectFilePDF extends Command | ||
| 48 | */ | 41 | */ |
| 49 | public function __construct() | 42 | public function __construct() |
| 50 | { | 43 | { |
| 51 | - $this->ProjectAssociation = new ProjectAssociation(); | ||
| 52 | - $this->DataFile = new DataFile(); | ||
| 53 | $this->time = date("Y-m"); | 44 | $this->time = date("Y-m"); |
| 54 | - $this->fileController = new FileController(); | ||
| 55 | $this->CosService = new CosService(); | 45 | $this->CosService = new CosService(); |
| 56 | parent::__construct(); | 46 | parent::__construct(); |
| 57 | } | 47 | } |
| 58 | 48 | ||
| 59 | -// public function handle() | ||
| 60 | -// { | ||
| 61 | -// $project_data = []; | ||
| 62 | -// $html = $this->html($project_data); | ||
| 63 | -// $filename = hash('md5', $this->time . '-' . '$project_id' . '-' . '$friend_id' . '-' . '$user_id'); | ||
| 64 | -// $this->savePDF($html, $filename); | ||
| 65 | -//// $this->testStreamPdf($html, $filename); | ||
| 66 | -//// $file_path = $this->savePDF2($html, $filename); | ||
| 67 | -// return 0; | ||
| 68 | -// } | 49 | + public function handle() |
| 50 | + { | ||
| 51 | + // 开始时间 | ||
| 52 | + $startTime = microtime(true); | ||
| 53 | + $html = $this->html([]); | ||
| 54 | + $filename = hash('md5', $this->time . '-' . random_int(100000, 999999)); | ||
| 55 | + $this->savePDF($html, $filename); | ||
| 56 | + | ||
| 57 | + // 结束时间 | ||
| 58 | + $endTime = microtime(true); | ||
| 59 | + | ||
| 60 | + // 计算执行时间 | ||
| 61 | + $executionTime = ($endTime - $startTime); | ||
| 62 | + | ||
| 63 | + // 输出执行时间 | ||
| 64 | + var_dump("程序执行时间: " . $executionTime . " 秒"); | ||
| 65 | +// return $this->main(); | ||
| 66 | + } | ||
| 69 | 67 | ||
| 68 | + /** | ||
| 69 | + * @return int | ||
| 70 | + */ | ||
| 70 | public function start(): int | 71 | public function start(): int |
| 71 | { | 72 | { |
| 72 | - # 0 - 未生成 | ||
| 73 | - # 1 - 已生成 | ||
| 74 | - # 2 - 其它问题 | ||
| 75 | - $is_pdf = 0; | ||
| 76 | - $lists = $this->ProjectAssociation::query()->where('is_pdf', $is_pdf) | ||
| 77 | - ->where('project_id', '!=', 0) | ||
| 78 | - ->where('friend_id', '!=', 0) | ||
| 79 | - ->where('user_id', '!=', 0) | ||
| 80 | - ->where('created_at', 'like', $this->time . '%')->first(); | ||
| 81 | - | ||
| 82 | - if (is_null($lists)) { | ||
| 83 | - $this->debug_echo('没有任务,等待中'); | ||
| 84 | - sleep(30); | 73 | + return $this->main(); |
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @return int | ||
| 78 | + */ | ||
| 79 | + protected function main() | ||
| 80 | + { | ||
| 81 | + $list = PdfFile::query()->whereIsPdf(PdfFile::GENERATE_NOT_PDF)->first(); | ||
| 82 | + | ||
| 83 | + if (is_null($list)) { | ||
| 84 | + $this->error('没有任务,等待中'); | ||
| 85 | + sleep(60); | ||
| 86 | + return 0; | ||
| 87 | + } | ||
| 88 | + $pid = $list->pid; | ||
| 89 | + if (empty($pid)) { | ||
| 90 | + $this->error('数据错误'); | ||
| 91 | + return 0; | ||
| 92 | + } | ||
| 93 | + $isExists = ProjectAssociation::query()->whereId($pid)->whereStatus(ProjectAssociation::STATUS_NORMAL)->first(); | ||
| 94 | + if (is_null($isExists)) { | ||
| 95 | + $this->error('数据已被禁用 —— ' . $pid); | ||
| 85 | return 0; | 96 | return 0; |
| 86 | } | 97 | } |
| 87 | - $key = $this->signature . '-' . $lists->id; | ||
| 88 | - $count = redis_get($key); | ||
| 89 | 98 | ||
| 90 | - $project_id = $lists->project_id; | ||
| 91 | - $user_id = $lists->user_id; | ||
| 92 | - $friend_id = $lists->friend_id; | 99 | + $key = 'generate_pdf_' . $list->id; |
| 100 | + $count = (int)redis_get($key) ?: 0; | ||
| 101 | + $project_id = $isExists->project_id; | ||
| 102 | + $user_id = $isExists->user_id; | ||
| 103 | + $friend_id = $isExists->friend_id; | ||
| 93 | // todo 根据项目查询数据 | 104 | // todo 根据项目查询数据 |
| 94 | $project_data = []; | 105 | $project_data = []; |
| 95 | $html = $this->html($project_data); | 106 | $html = $this->html($project_data); |
| 96 | $filename = hash('md5', $this->time . '-' . $project_id . '-' . $friend_id . '-' . $user_id); | 107 | $filename = hash('md5', $this->time . '-' . $project_id . '-' . $friend_id . '-' . $user_id); |
| 97 | 108 | ||
| 98 | - $file_path = $this->savePDF($html, $filename); | ||
| 99 | - if (empty($file_path)) { | ||
| 100 | - $this->debug_echo('pdf生成失败!'); | 109 | + if ($count == 2) { |
| 110 | + $list->is_pdf = PdfFile::GENERATE_OTHER_PDF; | ||
| 111 | + $list->save(); | ||
| 112 | + $this->error('项目文件数据保存失败! - 其他原因 - ' . $key); | ||
| 101 | return 0; | 113 | return 0; |
| 102 | } | 114 | } |
| 103 | - $isRes = $this->DataFile->saveData(compact('project_id', 'user_id', 'friend_id', 'file_path') + ['time' => $this->time]); | ||
| 104 | - if (!$isRes) { | ||
| 105 | - if ($count == 2) { | ||
| 106 | - $lists->is_pdf = 2; | ||
| 107 | - $lists->save(); | ||
| 108 | - $this->debug_echo('项目文件数据保存失败! - 其他原因 - ' . $key); | ||
| 109 | - } else { | 115 | + |
| 116 | + $file_path = $this->savePDF($html, $filename); | ||
| 117 | + if (empty($file_path)) { | ||
| 110 | redis_set($key, $count + 1); | 118 | redis_set($key, $count + 1); |
| 111 | - $this->debug_echo('项目文件数据保存失败! - ' . $key); | ||
| 112 | - } | 119 | + $this->error('pdf生成失败!'); |
| 120 | + return 0; | ||
| 113 | } | 121 | } |
| 114 | - $lists->is_pdf = 1; | ||
| 115 | - $lists->save(); | 122 | + |
| 123 | + // 保存文件路径 | ||
| 124 | + $list->file_path = $file_path; | ||
| 125 | + $list->is_pdf = PdfFile::GENERATE_PDF; | ||
| 126 | + $list->save(); | ||
| 116 | $this->info('项目文件数据保存成功!'); | 127 | $this->info('项目文件数据保存成功!'); |
| 117 | return 0; | 128 | return 0; |
| 118 | } | 129 | } |
| @@ -131,18 +142,22 @@ class ProjectFilePDF extends Command | @@ -131,18 +142,22 @@ class ProjectFilePDF extends Command | ||
| 131 | } | 142 | } |
| 132 | // 指定保存路径和文件名 | 143 | // 指定保存路径和文件名 |
| 133 | $savePath = $pdf_path . $filename . '.pdf'; | 144 | $savePath = $pdf_path . $filename . '.pdf'; |
| 145 | + | ||
| 134 | if (file_exists($savePath)) { | 146 | if (file_exists($savePath)) { |
| 135 | echo '文件已经存在'; | 147 | echo '文件已经存在'; |
| 136 | return 0; | 148 | return 0; |
| 137 | } | 149 | } |
| 138 | 150 | ||
| 151 | + $path = '/PDF/' . $this->time; | ||
| 139 | $pdf = PDF::loadHTML($html); | 152 | $pdf = PDF::loadHTML($html); |
| 140 | - $pdf->save($savePath); | ||
| 141 | 153 | ||
| 142 | - $path = '/V6/PDF/' . $this->time; | ||
| 143 | - // 创建一个文件实例 | ||
| 144 | - $file = new File($savePath); | ||
| 145 | - return $this->CosService->uploadFile($file, $path, $filename . '.pdf'); | 154 | + // 获取二进制文件 |
| 155 | + $binary = $pdf->output(['compres' => 0]); | ||
| 156 | + // 将文件保存到本地 | ||
| 157 | +// $pdf->save($savePath); | ||
| 158 | +// $binary = new File($savePath); | ||
| 159 | + | ||
| 160 | + return $this->CosService->uploadFile($binary, $path, $filename . '.pdf', true); | ||
| 146 | } | 161 | } |
| 147 | 162 | ||
| 148 | /** | 163 | /** |
| @@ -153,6 +168,6 @@ class ProjectFilePDF extends Command | @@ -153,6 +168,6 @@ class ProjectFilePDF extends Command | ||
| 153 | protected function html($item) | 168 | protected function html($item) |
| 154 | { | 169 | { |
| 155 | $font_path = storage_path('fonts\msyh.ttf'); | 170 | $font_path = storage_path('fonts\msyh.ttf'); |
| 156 | - 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中文测试</div><div class=\'title\'>测试三askjdhfkjasdhf</div></div></div></body></html>'; | 171 | + 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>'; |
| 157 | } | 172 | } |
| 158 | } | 173 | } |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -namespace App\Console\Commands; | 3 | +namespace App\Console\Commands\GeneratePDF; |
| 4 | 4 | ||
| 5 | -use App\Models\File\DataFile; | 5 | +use App\Models\File\PdfFile; |
| 6 | +use App\Models\ProjectAssociation\ProjectAssociation; | ||
| 6 | use Illuminate\Console\Command; | 7 | use Illuminate\Console\Command; |
| 7 | 8 | ||
| 8 | -class WebsiteData extends Command | 9 | +class PushAiccData extends Command |
| 9 | { | 10 | { |
| 10 | - use CmdSignal; | 11 | +// use CmdSignal; |
| 11 | 12 | ||
| 12 | /** | 13 | /** |
| 13 | * The name and signature of the console command. | 14 | * The name and signature of the console command. |
| 14 | * | 15 | * |
| 15 | * @var string | 16 | * @var string |
| 16 | */ | 17 | */ |
| 17 | - protected $signature = 'website_data'; | 18 | + protected $signature = 'push_data_to_aicc'; |
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| 20 | * The console command description. | 21 | * The console command description. |
| @@ -39,41 +40,65 @@ class WebsiteData extends Command | @@ -39,41 +40,65 @@ class WebsiteData extends Command | ||
| 39 | parent::__construct(); | 40 | parent::__construct(); |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 43 | + | ||
| 44 | + public function handle() | ||
| 45 | + { | ||
| 46 | + return $this->main(); | ||
| 47 | + } | ||
| 48 | + | ||
| 42 | public function start(): int | 49 | public function start(): int |
| 43 | { | 50 | { |
| 44 | - # 0 - 未推送 | ||
| 45 | - # 1 - 已推送 | ||
| 46 | - # 2 - 其他问题 | ||
| 47 | - $status = 0; | ||
| 48 | - $lists = DataFile::query()->where('status', $status) | ||
| 49 | - ->where('created_at', 'like', $this->time . '%')->first(); | ||
| 50 | - if (is_null($lists)) { | ||
| 51 | - $this->debug_echo('没有任务,等待中'); | ||
| 52 | - sleep(30); | 51 | + return $this->main(); |
| 52 | + } | ||
| 53 | + | ||
| 54 | + protected function main() | ||
| 55 | + { | ||
| 56 | + $list = PdfFile::query()->whereIsPdf(PdfFile::GENERATE_PUSH)->whereIsPush(PdfFile::GENERATE_NOT_PUSH)->first(); | ||
| 57 | + if (is_null($list)) { | ||
| 58 | + $this->error('向AICC推送 - 没有任务,等待中'); | ||
| 59 | + sleep(60); | ||
| 53 | return 0; | 60 | return 0; |
| 54 | } | 61 | } |
| 55 | 62 | ||
| 56 | - $key = $this->signature . '-' . $lists->id; | ||
| 57 | - $count = redis_get($key); | ||
| 58 | - $data = $lists; | 63 | + $pid = $list->pid; |
| 64 | + if (empty($pid)) { | ||
| 65 | + $this->error('向AICC推送数据错误'); | ||
| 66 | + return 0; | ||
| 67 | + } | ||
| 68 | + $isExists = ProjectAssociation::query()->whereId($pid)->whereStatus(ProjectAssociation::STATUS_NORMAL)->first(); | ||
| 69 | + if (is_null($isExists)) { | ||
| 70 | + $this->error('向AICC推送数据已被禁用 —— ' . $pid); | ||
| 71 | + return 0; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + $key = 'push_data_to_aicc_' . $list->id; | ||
| 75 | + $count = (int)redis_get($key) ?: 0; | ||
| 76 | + | ||
| 77 | + $data = $list->toArray(); | ||
| 78 | + $data['project_id'] = $isExists->project_id; | ||
| 79 | + $data['friend_id'] = $isExists->friend_id; | ||
| 80 | + $data['user_id'] = $isExists->user_id; | ||
| 81 | + | ||
| 59 | $url = env('AICC_URL'); | 82 | $url = env('AICC_URL'); |
| 60 | $msg = http_post($url, json_encode(compact('data'))); | 83 | $msg = http_post($url, json_encode(compact('data'))); |
| 61 | $status_code = 0; | 84 | $status_code = 0; |
| 62 | if ($msg) { | 85 | if ($msg) { |
| 63 | $status_code = (int)$msg['status']; | 86 | $status_code = (int)$msg['status']; |
| 64 | } | 87 | } |
| 65 | - if ($status_code != 200) { | ||
| 66 | if ($count == 2) { | 88 | if ($count == 2) { |
| 67 | - $lists->status = 2; | ||
| 68 | - $lists->save(); | 89 | + $list->is_push = PdfFile::GENERATE_OTHER_PUSH; |
| 90 | + $list->save(); | ||
| 69 | $this->debug_echo('项目文件数据保存失败! - 其他原因 - ' . $key); | 91 | $this->debug_echo('项目文件数据保存失败! - 其他原因 - ' . $key); |
| 70 | - } else { | 92 | + return 0; |
| 93 | + } | ||
| 94 | + | ||
| 95 | + if ($status_code != 200) { | ||
| 71 | redis_set($key, $count + 1); | 96 | redis_set($key, $count + 1); |
| 72 | $this->debug_echo('项目文件数据保存失败! - ' . $key); | 97 | $this->debug_echo('项目文件数据保存失败! - ' . $key); |
| 98 | + return 0; | ||
| 73 | } | 99 | } |
| 74 | - } | ||
| 75 | - $lists->status = 1; | ||
| 76 | - $lists->save(); | 100 | + $list->is_push = PdfFile::GENERATE_PUSH; |
| 101 | + $list->save(); | ||
| 77 | $this->info('项目文件数据保存成功!'); | 102 | $this->info('项目文件数据保存成功!'); |
| 78 | return 0; | 103 | return 0; |
| 79 | } | 104 | } |
| @@ -41,28 +41,60 @@ class HtmlCustomCollect extends Command | @@ -41,28 +41,60 @@ class HtmlCustomCollect extends Command | ||
| 41 | { | 41 | { |
| 42 | ini_set('memory_limit', '512M'); | 42 | ini_set('memory_limit', '512M'); |
| 43 | 43 | ||
| 44 | - $project_id = 517; | ||
| 45 | - $project_site = 'v6-1gee9.globalso.site'; | 44 | +// $project_id = 437; |
| 45 | +// $project_site = 'v6-1500k.globalso.site'; | ||
| 46 | +// $pages = [ | ||
| 47 | +// 'https://www.tourletent.com/project/b300-glamping-tent-in-china/', | ||
| 48 | +// 'https://www.tourletent.com/project/lotus-bell-tent-in-australia/', | ||
| 49 | +// 'https://www.tourletent.com/project/luxury-resort-in-china/', | ||
| 50 | +// 'https://www.tourletent.com/project/canvas-safari-tent-inthailand/', | ||
| 51 | +// 'https://www.tourletent.com/project/safari-tent-for-m8-in-mexcio/', | ||
| 52 | +// 'https://www.tourletent.com/project/9m-pvc-dome-tent-in-canada/', | ||
| 53 | +// 'https://www.tourletent.com/project/c900-hotel-tent-in-korea/', | ||
| 54 | +// 'https://www.tourletent.com/project/safari-tent-in-guizhou/', | ||
| 55 | +// 'https://www.tourletent.com/project/dome-tent-in-austin/', | ||
| 56 | +// 'https://www.tourletent.com/project/safari-tent-in-italy/', | ||
| 57 | +// 'https://www.tourletent.com/project/glass-igloo-in-china/', | ||
| 58 | +// 'https://www.tourletent.com/project/tree-house-in-sichuan/' | ||
| 59 | +// ]; | ||
| 60 | + | ||
| 61 | +// $project_id = 517; | ||
| 62 | +// $project_site = 'v6-1gee9.globalso.site'; | ||
| 63 | +// $pages = [ | ||
| 64 | +// 'https://www.beifa.group/help/send-results/', | ||
| 65 | +// 'https://www.beifa.group/help/terms-of-use/', | ||
| 66 | +// 'https://www.beifa.group/help/position-3/', | ||
| 67 | +// 'https://www.beifa.group/help/position-2/', | ||
| 68 | +// 'https://www.beifa.group/help/position-1/', | ||
| 69 | +// 'https://www.beifa.group/help/social-media/', | ||
| 70 | +// 'https://www.beifa.group/help/globle-exibition-2/', | ||
| 71 | +// 'https://www.beifa.group/help/job/', | ||
| 72 | +// 'https://www.beifa.group/help/vr/', | ||
| 73 | +// 'https://www.beifa.group/help/on-live-video/', | ||
| 74 | +// 'https://www.beifa.group/help/honor/', | ||
| 75 | +// 'https://www.beifa.group/help/certification/', | ||
| 76 | +// 'https://www.beifa.group/help/quanity-control/', | ||
| 77 | +// 'https://www.beifa.group/help/testing-center/', | ||
| 78 | +// 'https://www.beifa.group/help/rd/', | ||
| 79 | +// 'https://www.beifa.group/help/design-trend/', | ||
| 80 | +// 'https://www.beifa.group/help/partner/', | ||
| 81 | +// 'https://www.beifa.group/help/social-responsibility/', | ||
| 82 | +// 'https://www.beifa.group/help/contact/', | ||
| 83 | +// ]; | ||
| 84 | + | ||
| 85 | + $project_id = 546; | ||
| 86 | + $project_site = 'v6-kx260.globalso.site'; | ||
| 46 | $pages = [ | 87 | $pages = [ |
| 47 | - 'https://www.beifa.group/help/send-results/', | ||
| 48 | - 'https://www.beifa.group/help/terms-of-use/', | ||
| 49 | - 'https://www.beifa.group/help/position-3/', | ||
| 50 | - 'https://www.beifa.group/help/position-2/', | ||
| 51 | - 'https://www.beifa.group/help/position-1/', | ||
| 52 | - 'https://www.beifa.group/help/social-media/', | ||
| 53 | - 'https://www.beifa.group/help/globle-exibition-2/', | ||
| 54 | - 'https://www.beifa.group/help/job/', | ||
| 55 | - 'https://www.beifa.group/help/vr/', | ||
| 56 | - 'https://www.beifa.group/help/on-live-video/', | ||
| 57 | - 'https://www.beifa.group/help/honor/', | ||
| 58 | - 'https://www.beifa.group/help/certification/', | ||
| 59 | - 'https://www.beifa.group/help/quanity-control/', | ||
| 60 | - 'https://www.beifa.group/help/testing-center/', | ||
| 61 | - 'https://www.beifa.group/help/rd/', | ||
| 62 | - 'https://www.beifa.group/help/design-trend/', | ||
| 63 | - 'https://www.beifa.group/help/partner/', | ||
| 64 | - 'https://www.beifa.group/help/social-responsibility/', | ||
| 65 | - 'https://www.beifa.group/help/contact/', | 88 | + 'https://www.grechofiberglass.com/success_stories/', |
| 89 | + 'https://www.grechofiberglass.com/success_stories/achieving-transformative-improvements-for-polyurethane-exterior-insulation-panels-in-france/', | ||
| 90 | + 'https://www.grechofiberglass.com/success_stories/grechos-fiberglass-rebar-revolutionizing-canadian-construction-projects-with-unparalleled-quality/', | ||
| 91 | + 'https://www.grechofiberglass.com/success_stories/customer-from-the-uk-purchases-fiberglass-coated-mats-for-plasterboards-from-grecho/', | ||
| 92 | + 'https://www.grechofiberglass.com/success_stories/supplying-carbon-fiber-to-australian-surfboard-manufacturer/', | ||
| 93 | + 'https://www.grechofiberglass.com/success_stories/300g-chopped-strand-mat-for-composite-slates-shipped-to-malaysia/', | ||
| 94 | + 'https://www.grechofiberglass.com/success_stories/fiberglass-roving-for-pipewater-tank-shipped-to-russia/', | ||
| 95 | + 'https://www.grechofiberglass.com/success_stories/fiberglass-fleece-for-acoustic-ceiling-shipped-to-russia/', | ||
| 96 | + 'https://www.grechofiberglass.com/success_stories/600g-fiberglass-aluminum-foil-cloth-shipped-to-australia-for-pipe-heat-shielding/', | ||
| 97 | + 'https://www.grechofiberglass.com/success_stories/shipping-our-first-truck-of-fiberglass-tissue-in-2022/', | ||
| 66 | ]; | 98 | ]; |
| 67 | 99 | ||
| 68 | // $project_id = 586; | 100 | // $project_id = 586; |
| @@ -78,6 +110,36 @@ class HtmlCustomCollect extends Command | @@ -78,6 +110,36 @@ class HtmlCustomCollect extends Command | ||
| 78 | // 'https://www.citymax-group.com/case/field-experiment-crop-lettuce/', | 110 | // 'https://www.citymax-group.com/case/field-experiment-crop-lettuce/', |
| 79 | // ]; | 111 | // ]; |
| 80 | 112 | ||
| 113 | +// $project_id = 626; | ||
| 114 | +// $project_site = 'v6-m342g.globalso.site'; | ||
| 115 | +// $pages = [ | ||
| 116 | +// 'https://www.lecusostreetlight.com/project_catalog/project/', | ||
| 117 | +// 'https://www.lecusostreetlight.com/project_catalog/project/page/2/', | ||
| 118 | +// 'https://www.lecusostreetlight.com/project/560pcs-250w-smart-led-street-light-in-manila-city-philippines/', | ||
| 119 | +// 'https://www.lecusostreetlight.com/project/3200pcs-8m-150w-solar-street-light-in-cebu-philippines/', | ||
| 120 | +// 'https://lecusostreetlight.com/project/170pcs-100w-split-lithium-battery-solar-street-light-in-tanzania/', | ||
| 121 | +// 'https://www.lecusostreetlight.com/project/250pcs-40w-sl-series-solar-street-light-in-kuwait/', | ||
| 122 | +// 'https://www.lecusostreetlight.com/project/272pcs-8m-80w-solar-street-light-in-tanzania/', | ||
| 123 | +// 'https://www.lecusostreetlight.com/project/185pcs-10m-120w-highway-solar-street-light-in-jordan/', | ||
| 124 | +// 'https://www.lecusostreetlight.com/project/270pcs-9m-patterned-decorative-light-pole-with-150w-led-cobra-light-in-cambodia/', | ||
| 125 | +// 'https://www.lecusostreetlight.com/project/48pcs-5m-24w-decorative-aluminium-pole-in-dubai-uae/', | ||
| 126 | +// 'https://www.lecusostreetlight.com/project/105pcs-9m-100w-led-street-light-in-sri-lanka/', | ||
| 127 | +// 'https://www.lecusostreetlight.com/project/45pcs-6m-hot-dip-galvanized-double-arm-street-light-pole-in-dubai-uae/', | ||
| 128 | +// 'https://www.lecusostreetlight.com/project/356pcs-8m-100w-solar-street-light-in-ethiopia/', | ||
| 129 | +// 'https://www.lecusostreetlight.com/project/52pcs-6m-30w-solar-led-street-light-with-gel-battery-in-poland/', | ||
| 130 | +// 'https://www.lecusostreetlight.com/project/225pcs-6m-80w-solar-street-light-in-vietnam/', | ||
| 131 | +// 'https://www.lecusostreetlight.com/project/450pcs-7m-60w-double-arm-solar-light-in-nigeria/', | ||
| 132 | +// 'https://www.lecusostreetlight.com/project/100pcs-6m-50w-led-street-light-in-maldives/', | ||
| 133 | +// 'https://www.lecusostreetlight.com/project/202pcs-6m-40w-3000k-solar-street-light-in-manila-philippines/', | ||
| 134 | +// 'https://www.lecusostreetlight.com/project/245pcs-120w-smart-led-street-light-in-bangkok-thailand/', | ||
| 135 | +// 'https://www.lecusostreetlight.com/project/170pcs-7m-50w-all-in-one-solar-light-in-davao-philippines/', | ||
| 136 | +// 'https://www.lecusostreetlight.com/project/80pcs-9m-150w-led-street-light-in-iraq/', | ||
| 137 | +// 'https://www.lecusostreetlight.com/project/252pcs-6m-40w-separate-solar-street-light-with-lithium-battery-in-thailand/', | ||
| 138 | +// 'https://www.lecusostreetlight.com/project/198pcs-8m-80w-zc-series-all-in-two-solar-light-in-philippines/', | ||
| 139 | +// 'https://www.lecusostreetlight.com/project/5m-30w-morden-led-garden-light-in-russian/', | ||
| 140 | +// 'https://www.lecusostreetlight.com/project/135pcs-all-in-one-solar-street-light-in-uae-dubai-park/' | ||
| 141 | +// ]; | ||
| 142 | + | ||
| 81 | // $project_id = 633; | 143 | // $project_id = 633; |
| 82 | // $project_site = 'v6-ke5nz.globalso.site'; | 144 | // $project_site = 'v6-ke5nz.globalso.site'; |
| 83 | // $pages = [ | 145 | // $pages = [ |
| @@ -117,53 +179,6 @@ class HtmlCustomCollect extends Command | @@ -117,53 +179,6 @@ class HtmlCustomCollect extends Command | ||
| 117 | // 'https://www.mach-sales.com/case/cooperation-win-win-and-starting-anew-sumec-creates-a-new-sample-of-strong-enterprise-cooperation/' | 179 | // 'https://www.mach-sales.com/case/cooperation-win-win-and-starting-anew-sumec-creates-a-new-sample-of-strong-enterprise-cooperation/' |
| 118 | // ]; | 180 | // ]; |
| 119 | 181 | ||
| 120 | -// $project_id = 437; | ||
| 121 | -// $project_site = 'v6-1500k.globalso.site'; | ||
| 122 | -// $pages = [ | ||
| 123 | -// 'https://www.tourletent.com/project/b300-glamping-tent-in-china/', | ||
| 124 | -// 'https://www.tourletent.com/project/lotus-bell-tent-in-australia/', | ||
| 125 | -// 'https://www.tourletent.com/project/luxury-resort-in-china/', | ||
| 126 | -// 'https://www.tourletent.com/project/canvas-safari-tent-inthailand/', | ||
| 127 | -// 'https://www.tourletent.com/project/safari-tent-for-m8-in-mexcio/', | ||
| 128 | -// 'https://www.tourletent.com/project/9m-pvc-dome-tent-in-canada/', | ||
| 129 | -// 'https://www.tourletent.com/project/c900-hotel-tent-in-korea/', | ||
| 130 | -// 'https://www.tourletent.com/project/safari-tent-in-guizhou/', | ||
| 131 | -// 'https://www.tourletent.com/project/dome-tent-in-austin/', | ||
| 132 | -// 'https://www.tourletent.com/project/safari-tent-in-italy/', | ||
| 133 | -// 'https://www.tourletent.com/project/glass-igloo-in-china/', | ||
| 134 | -// 'https://www.tourletent.com/project/tree-house-in-sichuan/' | ||
| 135 | -// ]; | ||
| 136 | - | ||
| 137 | -// $project_id = 626; | ||
| 138 | -// $project_site = 'v6-m342g.globalso.site'; | ||
| 139 | -// $pages = [ | ||
| 140 | -// 'https://www.lecusostreetlight.com/project_catalog/project/', | ||
| 141 | -// 'https://www.lecusostreetlight.com/project_catalog/project/page/2/', | ||
| 142 | -// 'https://www.lecusostreetlight.com/project/560pcs-250w-smart-led-street-light-in-manila-city-philippines/', | ||
| 143 | -// 'https://www.lecusostreetlight.com/project/3200pcs-8m-150w-solar-street-light-in-cebu-philippines/', | ||
| 144 | -// 'https://lecusostreetlight.com/project/170pcs-100w-split-lithium-battery-solar-street-light-in-tanzania/', | ||
| 145 | -// 'https://www.lecusostreetlight.com/project/250pcs-40w-sl-series-solar-street-light-in-kuwait/', | ||
| 146 | -// 'https://www.lecusostreetlight.com/project/272pcs-8m-80w-solar-street-light-in-tanzania/', | ||
| 147 | -// 'https://www.lecusostreetlight.com/project/185pcs-10m-120w-highway-solar-street-light-in-jordan/', | ||
| 148 | -// 'https://www.lecusostreetlight.com/project/270pcs-9m-patterned-decorative-light-pole-with-150w-led-cobra-light-in-cambodia/', | ||
| 149 | -// 'https://www.lecusostreetlight.com/project/48pcs-5m-24w-decorative-aluminium-pole-in-dubai-uae/', | ||
| 150 | -// 'https://www.lecusostreetlight.com/project/105pcs-9m-100w-led-street-light-in-sri-lanka/', | ||
| 151 | -// 'https://www.lecusostreetlight.com/project/45pcs-6m-hot-dip-galvanized-double-arm-street-light-pole-in-dubai-uae/', | ||
| 152 | -// 'https://www.lecusostreetlight.com/project/356pcs-8m-100w-solar-street-light-in-ethiopia/', | ||
| 153 | -// 'https://www.lecusostreetlight.com/project/52pcs-6m-30w-solar-led-street-light-with-gel-battery-in-poland/', | ||
| 154 | -// 'https://www.lecusostreetlight.com/project/225pcs-6m-80w-solar-street-light-in-vietnam/', | ||
| 155 | -// 'https://www.lecusostreetlight.com/project/450pcs-7m-60w-double-arm-solar-light-in-nigeria/', | ||
| 156 | -// 'https://www.lecusostreetlight.com/project/100pcs-6m-50w-led-street-light-in-maldives/', | ||
| 157 | -// 'https://www.lecusostreetlight.com/project/202pcs-6m-40w-3000k-solar-street-light-in-manila-philippines/', | ||
| 158 | -// 'https://www.lecusostreetlight.com/project/245pcs-120w-smart-led-street-light-in-bangkok-thailand/', | ||
| 159 | -// 'https://www.lecusostreetlight.com/project/170pcs-7m-50w-all-in-one-solar-light-in-davao-philippines/', | ||
| 160 | -// 'https://www.lecusostreetlight.com/project/80pcs-9m-150w-led-street-light-in-iraq/', | ||
| 161 | -// 'https://www.lecusostreetlight.com/project/252pcs-6m-40w-separate-solar-street-light-with-lithium-battery-in-thailand/', | ||
| 162 | -// 'https://www.lecusostreetlight.com/project/198pcs-8m-80w-zc-series-all-in-two-solar-light-in-philippines/', | ||
| 163 | -// 'https://www.lecusostreetlight.com/project/5m-30w-morden-led-garden-light-in-russian/', | ||
| 164 | -// 'https://www.lecusostreetlight.com/project/135pcs-all-in-one-solar-street-light-in-uae-dubai-park/' | ||
| 165 | -// ]; | ||
| 166 | - | ||
| 167 | foreach ($pages as $page) { | 182 | foreach ($pages as $page) { |
| 168 | $this->start_collect(urldecode($page), $project_id, $project_site); | 183 | $this->start_collect(urldecode($page), $project_id, $project_site); |
| 169 | } | 184 | } |
| @@ -213,8 +228,19 @@ class HtmlCustomCollect extends Command | @@ -213,8 +228,19 @@ class HtmlCustomCollect extends Command | ||
| 213 | $html = str_replace($old_info['home_url'], $project_site, $html); | 228 | $html = str_replace($old_info['home_url'], $project_site, $html); |
| 214 | 229 | ||
| 215 | //暂时隐藏小语种 | 230 | //暂时隐藏小语种 |
| 216 | - $html = str_replace('<div class="change-language ensemble">', '<div class="change-language ensemble" style="display: none">', $html); | ||
| 217 | - $html = str_replace('<div class="language_more">', '<div class="language_more" style="display: none">', $html); | 231 | +// $html = str_replace('<div class="change-language ensemble">', '<div class="change-language ensemble" style="display: none">', $html); |
| 232 | +// $html = str_replace('<div class="language_more">', '<div class="language_more" style="display: none">', $html); | ||
| 233 | + | ||
| 234 | + //处理搜索 | ||
| 235 | + preg_match_all('/<form\s+[^>]*?action\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_search); | ||
| 236 | + $search = $result_search[2] ?? []; | ||
| 237 | + foreach ($search as $vc) { | ||
| 238 | + if((strpos($vc,'search.php') !== false) || (strpos($vc,'index.php') !== false)){ | ||
| 239 | + $html = str_replace($vc,'/search/',$html); | ||
| 240 | + } | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + //增加统计代码 | ||
| 218 | $html = str_replace('</body>', '<script src="https://ecdn6.globalso.com/public/customerVisit.min.js\"></script></body>', $html); | 244 | $html = str_replace('</body>', '<script src="https://ecdn6.globalso.com/public/customerVisit.min.js\"></script></body>', $html); |
| 219 | 245 | ||
| 220 | //html写入文件 | 246 | //html写入文件 |
app/Models/File/DataFile.php
已删除
100644 → 0
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Models\File; | ||
| 4 | - | ||
| 5 | -use App\Models\Base; | ||
| 6 | - | ||
| 7 | -class DataFile extends Base | ||
| 8 | -{ | ||
| 9 | - protected $table = 'gl_data_file'; | ||
| 10 | - | ||
| 11 | - public function saveData(array $data): bool | ||
| 12 | - { | ||
| 13 | - # v6项目ID | ||
| 14 | - $project_id = (int)$data['project_id'] ?? 0; | ||
| 15 | - $isRes = self::query()->where('project_id', $project_id)->where('created_at', 'like', $data['time'] . '%')->first(); | ||
| 16 | - if (!$isRes) { | ||
| 17 | - $isRes = new self(); | ||
| 18 | - $isRes->project_id = $project_id; | ||
| 19 | - # AICC用户ID | ||
| 20 | - $isRes->user_id = $data['user_id']; | ||
| 21 | - # 第三方朋友ID | ||
| 22 | - $isRes->friend_id = $data['friend_id']; | ||
| 23 | - # 生成文件路径 | ||
| 24 | - $isRes->file_path = $data['file_path']; | ||
| 25 | - } | ||
| 26 | - return $isRes->save(); | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - /** | ||
| 30 | - * @param int $page | ||
| 31 | - * @param int $perPage | ||
| 32 | - * @return array | ||
| 33 | - */ | ||
| 34 | - public function allData(int $page = 1, int $perPage = 15) | ||
| 35 | - { | ||
| 36 | - $lists = self::query()->paginate($perPage, ['*'], 'page', $page); | ||
| 37 | - $items = $lists->Items(); | ||
| 38 | - $totalPage = $lists->lastPage(); | ||
| 39 | - $total = $lists->total(); | ||
| 40 | - $currentPage = $lists->currentPage(); | ||
| 41 | - return compact('total', 'items', 'totalPage', 'currentPage'); | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | -} |
app/Models/File/PdfFile.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\File; | ||
| 4 | + | ||
| 5 | +use App\Models\Base; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * App\Models\File\PdfFile | ||
| 9 | + * | ||
| 10 | + * @property int $id | ||
| 11 | + * @property int $pid AICC用户ID | ||
| 12 | + * @property string $file_path 生成文件路径 | ||
| 13 | + * @property int $is_pdf 0 - 未生成 1 - 已生成 2 - 其它问题 | ||
| 14 | + * @property int|null $is_push 0 - 未推送 1 - 已推送 2 - 其他问题 | ||
| 15 | + * @property \Illuminate\Support\Carbon|null $created_at | ||
| 16 | + * @property \Illuminate\Support\Carbon|null $updated_at | ||
| 17 | + * @method \Illuminate\Database\Eloquent\Builder|PdfFile newModelQuery() | ||
| 18 | + * @method \Illuminate\Database\Eloquent\Builder|PdfFile newQuery() | ||
| 19 | + * @method static \Illuminate\Database\Eloquent\Builder|PdfFile query() | ||
| 20 | + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereCreatedAt($value) | ||
| 21 | + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereFilePath($value) | ||
| 22 | + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereId($value) | ||
| 23 | + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereIsPdf($value) | ||
| 24 | + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereIsPush($value) | ||
| 25 | + * @method \Illuminate\Database\Eloquent\Builder|PdfFile wherePid($value) | ||
| 26 | + * @method \Illuminate\Database\Eloquent\Builder|PdfFile whereUpdatedAt($value) | ||
| 27 | + * @mixin \Eloquent | ||
| 28 | + */ | ||
| 29 | +class PdfFile extends Base | ||
| 30 | +{ | ||
| 31 | + protected $table = 'gl_pdf_file'; | ||
| 32 | + | ||
| 33 | + /** @var int PDF - 未生成 */ | ||
| 34 | + const GENERATE_NOT_PDF = 0; | ||
| 35 | + | ||
| 36 | + /** @var int PDF - 已生成 */ | ||
| 37 | + const GENERATE_PDF = 1; | ||
| 38 | + | ||
| 39 | + /** @var int PDF - 其它问题 */ | ||
| 40 | + const GENERATE_OTHER_PDF = 2; | ||
| 41 | + | ||
| 42 | + /** @var int AICC - 未推送 */ | ||
| 43 | + const GENERATE_NOT_PUSH = 0; | ||
| 44 | + /** @var int AICC - 已推送 */ | ||
| 45 | + const GENERATE_PUSH = 1; | ||
| 46 | + /** @var int AICC - 其他问题 */ | ||
| 47 | + const GENERATE_OTHER_PUSH = 2; | ||
| 48 | + | ||
| 49 | + public function saveData(array $data): bool | ||
| 50 | + { | ||
| 51 | + # v6项目ID | ||
| 52 | + $pid = (int)$data['pid'] ?? 0; | ||
| 53 | + $time = $data['time'] ?? date('Y-m-d'); | ||
| 54 | + $isRes = self::query()->wherePid($pid)->where('created_at', 'like', $time . '%')->first(); | ||
| 55 | + if (!$isRes) { | ||
| 56 | + $isRes = new self(); | ||
| 57 | + $isRes->pid = $pid; | ||
| 58 | + # 生成文件路径 | ||
| 59 | + $isRes->file_path = $data['file_path'] ?? ''; | ||
| 60 | + } | ||
| 61 | + return $isRes->save(); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | +} |
| @@ -5,10 +5,47 @@ namespace App\Models\ProjectAssociation; | @@ -5,10 +5,47 @@ namespace App\Models\ProjectAssociation; | ||
| 5 | use Illuminate\Database\Eloquent\Builder; | 5 | use Illuminate\Database\Eloquent\Builder; |
| 6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
| 7 | 7 | ||
| 8 | +/** | ||
| 9 | + * App\Models\ProjectAssociation\ProjectAssociation | ||
| 10 | + * | ||
| 11 | + * @property int $id | ||
| 12 | + * @property int $project_id V6项目ID | ||
| 13 | + * @property int $friend_id AICC朋友ID | ||
| 14 | + * @property int $user_id AICC用户ID | ||
| 15 | + * @property string|null $nickname AICC朋友昵称 | ||
| 16 | + * @property string|null $user_name AICC用户姓名 | ||
| 17 | + * @property string|null $image AICC朋友头像 | ||
| 18 | + * @property int|null $status 1 - 正常, 0 - 禁用 | ||
| 19 | + * @property int|null $m_status 统计当月是否生成数据 | ||
| 20 | + * @property \Illuminate\Support\Carbon|null $created_at | ||
| 21 | + * @property \Illuminate\Support\Carbon|null $updated_at | ||
| 22 | + * @method Builder|ProjectAssociation newModelQuery() | ||
| 23 | + * @method Builder|ProjectAssociation newQuery() | ||
| 24 | + * @method static Builder|ProjectAssociation query() | ||
| 25 | + * @method Builder|ProjectAssociation whereCreatedAt($value) | ||
| 26 | + * @method Builder|ProjectAssociation whereFriendId($value) | ||
| 27 | + * @method Builder|ProjectAssociation whereId($value) | ||
| 28 | + * @method Builder|ProjectAssociation whereImage($value) | ||
| 29 | + * @method Builder|ProjectAssociation whereMStatus($value) | ||
| 30 | + * @method Builder|ProjectAssociation whereNickname($value) | ||
| 31 | + * @method Builder|ProjectAssociation whereProjectId($value) | ||
| 32 | + * @method Builder|ProjectAssociation whereStatus($value) | ||
| 33 | + * @method Builder|ProjectAssociation whereUpdatedAt($value) | ||
| 34 | + * @method Builder|ProjectAssociation whereUserId($value) | ||
| 35 | + * @method Builder|ProjectAssociation whereUserName($value) | ||
| 36 | + * @mixin \Eloquent | ||
| 37 | + */ | ||
| 8 | class ProjectAssociation extends Model | 38 | class ProjectAssociation extends Model |
| 9 | { | 39 | { |
| 40 | + | ||
| 10 | protected $table = 'gl_project_association'; | 41 | protected $table = 'gl_project_association'; |
| 11 | 42 | ||
| 43 | + /** @var int 数据状态 - 正常 */ | ||
| 44 | + const STATUS_NORMAL = 1; | ||
| 45 | + | ||
| 46 | + /** @var int 数据状态 - 禁用 */ | ||
| 47 | + const STATUS_DISABLED = 0; | ||
| 48 | + | ||
| 12 | /** | 49 | /** |
| 13 | * 保存|修改数据 | 50 | * 保存|修改数据 |
| 14 | * @param array $data | 51 | * @param array $data |
| @@ -21,7 +21,7 @@ class CosService | @@ -21,7 +21,7 @@ class CosService | ||
| 21 | * @method :post | 21 | * @method :post |
| 22 | * @time :2023/7/19 15:28 | 22 | * @time :2023/7/19 15:28 |
| 23 | */ | 23 | */ |
| 24 | - public function uploadFile(&$files,$path,$filename) | 24 | + public function uploadFile(&$files,$path,$filename, $binary = false) |
| 25 | { | 25 | { |
| 26 | $cos = config('filesystems.disks.cos'); | 26 | $cos = config('filesystems.disks.cos'); |
| 27 | $cosClient = new Client([ | 27 | $cosClient = new Client([ |
| @@ -32,10 +32,11 @@ class CosService | @@ -32,10 +32,11 @@ class CosService | ||
| 32 | ], | 32 | ], |
| 33 | ]); | 33 | ]); |
| 34 | $key = $path.'/'.$filename; | 34 | $key = $path.'/'.$filename; |
| 35 | + $Body = $binary ? $files : fopen($files->getRealPath(), 'r'); | ||
| 35 | $cosClient->putObject([ | 36 | $cosClient->putObject([ |
| 36 | 'Bucket' => $cos['bucket'], | 37 | 'Bucket' => $cos['bucket'], |
| 37 | 'Key' => $key, | 38 | 'Key' => $key, |
| 38 | - 'Body' => fopen($files->getRealPath(), 'r'), | 39 | + 'Body' => $Body, |
| 39 | ]); | 40 | ]); |
| 40 | return $key; | 41 | return $key; |
| 41 | } | 42 | } |
| @@ -23,6 +23,7 @@ | @@ -23,6 +23,7 @@ | ||
| 23 | "swooletw/laravel-swoole": "^2.13" | 23 | "swooletw/laravel-swoole": "^2.13" |
| 24 | }, | 24 | }, |
| 25 | "require-dev": { | 25 | "require-dev": { |
| 26 | + "barryvdh/laravel-ide-helper": "^2.13", | ||
| 26 | "facade/ignition": "^2.5", | 27 | "facade/ignition": "^2.5", |
| 27 | "fakerphp/faker": "^1.9.1", | 28 | "fakerphp/faker": "^1.9.1", |
| 28 | "laravel/sail": "^1.0.1", | 29 | "laravel/sail": "^1.0.1", |
-
请 注册 或 登录 后发表评论