Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
7 个修改的文件
包含
47 行增加
和
45 行删除
| @@ -3,11 +3,10 @@ | @@ -3,11 +3,10 @@ | ||
| 3 | namespace App\Console\Commands; | 3 | namespace App\Console\Commands; |
| 4 | 4 | ||
| 5 | use App\Http\Controllers\File\FileController; | 5 | use App\Http\Controllers\File\FileController; |
| 6 | -use App\Models\ProjectAssociation\ProjectAssociation; | ||
| 7 | use App\Models\File\DataFile; | 6 | use App\Models\File\DataFile; |
| 7 | +use App\Models\ProjectAssociation\ProjectAssociation; | ||
| 8 | use App\Services\CosService; | 8 | use App\Services\CosService; |
| 9 | -use Dompdf\Dompdf; | ||
| 10 | -use Dompdf\Options; | 9 | +use Barryvdh\DomPDF\Facade\Pdf; |
| 11 | use Illuminate\Console\Command; | 10 | use Illuminate\Console\Command; |
| 12 | use Illuminate\Http\File; | 11 | use Illuminate\Http\File; |
| 13 | 12 | ||
| @@ -57,6 +56,17 @@ class ProjectFilePDF extends Command | @@ -57,6 +56,17 @@ class ProjectFilePDF extends Command | ||
| 57 | parent::__construct(); | 56 | parent::__construct(); |
| 58 | } | 57 | } |
| 59 | 58 | ||
| 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 | +// } | ||
| 69 | + | ||
| 60 | public function start(): int | 70 | public function start(): int |
| 61 | { | 71 | { |
| 62 | # 0 - 未生成 | 72 | # 0 - 未生成 |
| @@ -115,37 +125,21 @@ class ProjectFilePDF extends Command | @@ -115,37 +125,21 @@ class ProjectFilePDF extends Command | ||
| 115 | */ | 125 | */ |
| 116 | public function savePDF($html, $filename) | 126 | public function savePDF($html, $filename) |
| 117 | { | 127 | { |
| 118 | - | ||
| 119 | $pdf_path = public_path('PDF/'); | 128 | $pdf_path = public_path('PDF/'); |
| 120 | if (!file_exists($pdf_path)) { | 129 | if (!file_exists($pdf_path)) { |
| 121 | mkdir($pdf_path, 0777, true); | 130 | mkdir($pdf_path, 0777, true); |
| 122 | } | 131 | } |
| 123 | - | ||
| 124 | // 指定保存路径和文件名 | 132 | // 指定保存路径和文件名 |
| 125 | $savePath = $pdf_path . $filename . '.pdf'; | 133 | $savePath = $pdf_path . $filename . '.pdf'; |
| 126 | if (file_exists($savePath)) { | 134 | if (file_exists($savePath)) { |
| 127 | echo '文件已经存在'; | 135 | echo '文件已经存在'; |
| 128 | -// return 0; | 136 | + return 0; |
| 129 | } | 137 | } |
| 130 | - // todo 生成中文有问题 | ||
| 131 | - # 实例化并使用dompdf类 | ||
| 132 | -// $options = new Options(); | ||
| 133 | -// $options->setDefaultFont('arial'); | ||
| 134 | -// $dompdf = new Dompdf($options); | ||
| 135 | - $dompdf = new Dompdf(); | ||
| 136 | - $dompdf->loadHtml($html); | ||
| 137 | - #(可选)设置纸张大小和方向 | ||
| 138 | - $dompdf->setPaper('A4', 'landscape'); | ||
| 139 | - | ||
| 140 | - # 将HTML渲染为PDF | ||
| 141 | - $dompdf->render(); | ||
| 142 | - | ||
| 143 | - // 获取PDF内容 | ||
| 144 | - $pdfContent = $dompdf->output(); | ||
| 145 | - $path = '/V6/PDF/' . $this->time; | ||
| 146 | - | ||
| 147 | - // 将PDF内容保存到文件 | ||
| 148 | - @file_put_contents($savePath, $pdfContent); | 138 | + |
| 139 | + $pdf = PDF::loadHTML($html); | ||
| 140 | + $pdf->save($savePath); | ||
| 141 | + | ||
| 142 | + $path = '/V6/PDF/' . $this->time; | ||
| 149 | // 创建一个文件实例 | 143 | // 创建一个文件实例 |
| 150 | $file = new File($savePath); | 144 | $file = new File($savePath); |
| 151 | return $this->CosService->uploadFile($file, $path, $filename . '.pdf'); | 145 | return $this->CosService->uploadFile($file, $path, $filename . '.pdf'); |
| @@ -158,12 +152,7 @@ class ProjectFilePDF extends Command | @@ -158,12 +152,7 @@ class ProjectFilePDF extends Command | ||
| 158 | */ | 152 | */ |
| 159 | protected function html($item) | 153 | protected function html($item) |
| 160 | { | 154 | { |
| 161 | - $html = '<html>'; | ||
| 162 | - $html .= '<body style="font-family:arial">'; | ||
| 163 | - $html .= '<h1>Hello, World!</h1>'; | ||
| 164 | - $html .= '<p>中文内容ffffff</p>'; | ||
| 165 | - $html .= '</body>'; | ||
| 166 | - $html .= '</html>'; | ||
| 167 | - return $html; | 155 | + $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>'; | ||
| 168 | } | 157 | } |
| 169 | } | 158 | } |
| @@ -40,9 +40,7 @@ class ProjectReset extends Command | @@ -40,9 +40,7 @@ class ProjectReset extends Command | ||
| 40 | //关闭数据库 | 40 | //关闭数据库 |
| 41 | DB::disconnect('custom_mysql'); | 41 | DB::disconnect('custom_mysql'); |
| 42 | 42 | ||
| 43 | - UpdateLog::where('project_id', $project_id)->update(['status' => 0]); | ||
| 44 | - | ||
| 45 | - UpdateLog::where('project_id', $project_id)->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update(['collect_status' => 0]); | 43 | + UpdateLog::where('project_id', $project_id)->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update(['status' => 0, 'collect_status' => 0]); |
| 46 | 44 | ||
| 47 | echo $project_id . ',重置成功' . PHP_EOL; | 45 | echo $project_id . ',重置成功' . PHP_EOL; |
| 48 | } | 46 | } |
| @@ -252,7 +252,7 @@ class ProjectUpdate extends Command | @@ -252,7 +252,7 @@ class ProjectUpdate extends Command | ||
| 252 | $gallery = []; | 252 | $gallery = []; |
| 253 | if ($item['images'] ?? []) { | 253 | if ($item['images'] ?? []) { |
| 254 | foreach ($item['images'] as $k_img => $img) { | 254 | foreach ($item['images'] as $k_img => $img) { |
| 255 | - $gallery[] = ['alt' => '这是一张产品图', 'url' => $this->source_download($img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)]; | 255 | + $gallery[] = ['alt' => 'This is a product picture', 'url' => $this->source_download($img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)]; |
| 256 | } | 256 | } |
| 257 | } | 257 | } |
| 258 | //分类 | 258 | //分类 |
| @@ -292,6 +292,19 @@ class ProjectUpdate extends Command | @@ -292,6 +292,19 @@ class ProjectUpdate extends Command | ||
| 292 | echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; | 292 | echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; |
| 293 | continue; | 293 | continue; |
| 294 | } | 294 | } |
| 295 | + } else { | ||
| 296 | + $gallery = []; | ||
| 297 | + if ($item['images'] ?? []) { | ||
| 298 | + foreach ($item['images'] as $k_img => $img) { | ||
| 299 | + $gallery[] = ['alt' => 'This is a product picture', 'url' => $this->source_download($img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)]; | ||
| 300 | + } | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + $edit = [ | ||
| 304 | + 'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '', | ||
| 305 | + 'gallery' => Arr::a2s($gallery) | ||
| 306 | + ]; | ||
| 307 | + $model->edit($edit, ['id' => $product['id']]); | ||
| 295 | } | 308 | } |
| 296 | } | 309 | } |
| 297 | } | 310 | } |
| @@ -595,7 +608,7 @@ class ProjectUpdate extends Command | @@ -595,7 +608,7 @@ class ProjectUpdate extends Command | ||
| 595 | if ($source == RouteMap::SOURCE_NEWS) { | 608 | if ($source == RouteMap::SOURCE_NEWS) { |
| 596 | $route_map->path = RouteMap::SOURCE_NEWS; | 609 | $route_map->path = RouteMap::SOURCE_NEWS; |
| 597 | } elseif ($source == RouteMap::SOURCE_BLOG) { | 610 | } elseif ($source == RouteMap::SOURCE_BLOG) { |
| 598 | - $route_map->path = RouteMap::SOURCE_BLOG.'s'; | 611 | + $route_map->path = RouteMap::SOURCE_BLOG . 's'; |
| 599 | } | 612 | } |
| 600 | 613 | ||
| 601 | $route_map->save(); | 614 | $route_map->save(); |
| @@ -38,8 +38,8 @@ class Kernel extends ConsoleKernel | @@ -38,8 +38,8 @@ class Kernel extends ConsoleKernel | ||
| 38 | $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息 | 38 | $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息 |
| 39 | // $schedule->command('update_progress')->everyThirtyMinutes()->withoutOverlapping(1);//监控更新 | 39 | // $schedule->command('update_progress')->everyThirtyMinutes()->withoutOverlapping(1);//监控更新 |
| 40 | $schedule->command('update_seo_tdk_crontab')->dailyAt('00:00')->withoutOverlapping(1); //更新上线项目TDK | 40 | $schedule->command('update_seo_tdk_crontab')->dailyAt('00:00')->withoutOverlapping(1); //更新上线项目TDK |
| 41 | - $schedule->command('website_data')->dailyAt('01:00')->withoutOverlapping(1); // 向AICC推送数据 | ||
| 42 | - $schedule->command('project_file_pdf')->dailyAt('00:00')->withoutOverlapping(1); // 网站项目数据,生成PDF文件 | 41 | +// $schedule->command('website_data')->dailyAt('01:00')->withoutOverlapping(1); // 向AICC推送数据 |
| 42 | +// $schedule->command('project_file_pdf')->dailyAt('00:00')->withoutOverlapping(1); // 网站项目数据,生成PDF文件 | ||
| 43 | $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 | 43 | $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 |
| 44 | } | 44 | } |
| 45 | 45 |
| @@ -635,7 +635,7 @@ class ProductLogic extends BaseLogic | @@ -635,7 +635,7 @@ class ProductLogic extends BaseLogic | ||
| 635 | $one_img = check_remote_url_down($v_img,$project_id,$domain); | 635 | $one_img = check_remote_url_down($v_img,$project_id,$domain); |
| 636 | if($one_img){ | 636 | if($one_img){ |
| 637 | $one_gallery = [ | 637 | $one_gallery = [ |
| 638 | - 'alt' => '这是一张产品图', | 638 | + 'alt' => '', |
| 639 | 'url' => $one_img | 639 | 'url' => $one_img |
| 640 | ]; | 640 | ]; |
| 641 | 641 |
| @@ -5,10 +5,10 @@ | @@ -5,10 +5,10 @@ | ||
| 5 | "keywords": ["framework", "laravel"], | 5 | "keywords": ["framework", "laravel"], |
| 6 | "license": "MIT", | 6 | "license": "MIT", |
| 7 | "require": { | 7 | "require": { |
| 8 | + "barryvdh/laravel-dompdf": "^2.0", | ||
| 8 | "bensampo/laravel-enum": "^4.2", | 9 | "bensampo/laravel-enum": "^4.2", |
| 9 | "beyondcode/laravel-websockets": "^1.14", | 10 | "beyondcode/laravel-websockets": "^1.14", |
| 10 | "doctrine/dbal": "^3.6", | 11 | "doctrine/dbal": "^3.6", |
| 11 | - "dompdf/dompdf": "^2.0", | ||
| 12 | "fruitcake/laravel-cors": "^2.0", | 12 | "fruitcake/laravel-cors": "^2.0", |
| 13 | "guzzlehttp/guzzle": "^7.0.1", | 13 | "guzzlehttp/guzzle": "^7.0.1", |
| 14 | "hashids/hashids": "^4.1", | 14 | "hashids/hashids": "^4.1", |
| @@ -19,11 +19,10 @@ | @@ -19,11 +19,10 @@ | ||
| 19 | "mongodb/mongodb": "^1.6", | 19 | "mongodb/mongodb": "^1.6", |
| 20 | "mrgoon/aliyun-sms": "^2.0", | 20 | "mrgoon/aliyun-sms": "^2.0", |
| 21 | "phpoffice/phpspreadsheet": "^1.28", | 21 | "phpoffice/phpspreadsheet": "^1.28", |
| 22 | - "swooletw/laravel-swoole": "^2.13", | ||
| 23 | - "qcloud/cos-sdk-v5": "^v2.6.6" | 22 | + "qcloud/cos-sdk-v5": "^v2.6.6", |
| 23 | + "swooletw/laravel-swoole": "^2.13" | ||
| 24 | }, | 24 | }, |
| 25 | "require-dev": { | 25 | "require-dev": { |
| 26 | - "barryvdh/laravel-ide-helper": "^2.13", | ||
| 27 | "facade/ignition": "^2.5", | 26 | "facade/ignition": "^2.5", |
| 28 | "fakerphp/faker": "^1.9.1", | 27 | "fakerphp/faker": "^1.9.1", |
| 29 | "laravel/sail": "^1.0.1", | 28 | "laravel/sail": "^1.0.1", |
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | use App\Http\Controllers\Aside; | 6 | use App\Http\Controllers\Aside; |
| 7 | +use App\Http\Controllers\Bside\ProjectAssociation\ProjectAssociationController; | ||
| 7 | use Illuminate\Support\Facades\Route; | 8 | use Illuminate\Support\Facades\Route; |
| 8 | 9 | ||
| 9 | 10 | ||
| @@ -13,7 +14,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -13,7 +14,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 13 | Route::any('/editPassword', [Aside\Com\IndexController::class, 'editPassword'])->name('admin.editPassword.white'); | 14 | Route::any('/editPassword', [Aside\Com\IndexController::class, 'editPassword'])->name('admin.editPassword.white'); |
| 14 | Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white'); | 15 | Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white'); |
| 15 | Route::any('/getAccessAddress', [Aside\LoginController::class, 'getAccessAddress'])->name('admin.getAccessAddress');//获取B端地址 | 16 | Route::any('/getAccessAddress', [Aside\LoginController::class, 'getAccessAddress'])->name('admin.getAccessAddress');//获取B端地址 |
| 16 | - Route::post('/aicc/wechat', [\App\Http\Controllers\Bside\ProjectAssociation\ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat'); | 17 | + |
| 17 | //会员相关 | 18 | //会员相关 |
| 18 | Route::prefix('user')->group(function () { | 19 | Route::prefix('user')->group(function () { |
| 19 | //会员管理 | 20 | //会员管理 |
| @@ -70,6 +71,8 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -70,6 +71,8 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 70 | Route::any('/del', [Aside\Ai\AiCommandController::class, 'del'])->name('admin.ai_del'); | 71 | Route::any('/del', [Aside\Ai\AiCommandController::class, 'del'])->name('admin.ai_del'); |
| 71 | //发送记录 | 72 | //发送记录 |
| 72 | Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists'); | 73 | Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists'); |
| 74 | + // 绑定AICC微信应用 | ||
| 75 | + Route::post('/wechat', [ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat'); | ||
| 73 | }); | 76 | }); |
| 74 | //特殊模块权限设置 | 77 | //特殊模块权限设置 |
| 75 | Route::prefix('special')->group(function () { | 78 | Route::prefix('special')->group(function () { |
-
请 注册 或 登录 后发表评论