作者 lyh

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

... ... @@ -3,11 +3,10 @@
namespace App\Console\Commands;
use App\Http\Controllers\File\FileController;
use App\Models\ProjectAssociation\ProjectAssociation;
use App\Models\File\DataFile;
use App\Models\ProjectAssociation\ProjectAssociation;
use App\Services\CosService;
use Dompdf\Dompdf;
use Dompdf\Options;
use Barryvdh\DomPDF\Facade\Pdf;
use Illuminate\Console\Command;
use Illuminate\Http\File;
... ... @@ -57,6 +56,17 @@ class ProjectFilePDF extends Command
parent::__construct();
}
// public function handle()
// {
// $project_data = [];
// $html = $this->html($project_data);
// $filename = hash('md5', $this->time . '-' . '$project_id' . '-' . '$friend_id' . '-' . '$user_id');
// $this->savePDF($html, $filename);
//// $this->testStreamPdf($html, $filename);
//// $file_path = $this->savePDF2($html, $filename);
// return 0;
// }
public function start(): int
{
# 0 - 未生成
... ... @@ -115,37 +125,21 @@ class ProjectFilePDF extends Command
*/
public function savePDF($html, $filename)
{
$pdf_path = public_path('PDF/');
if (!file_exists($pdf_path)) {
mkdir($pdf_path, 0777, true);
}
// 指定保存路径和文件名
$savePath = $pdf_path . $filename . '.pdf';
if (file_exists($savePath)) {
echo '文件已经存在';
// return 0;
return 0;
}
// todo 生成中文有问题
# 实例化并使用dompdf类
// $options = new Options();
// $options->setDefaultFont('arial');
// $dompdf = new Dompdf($options);
$dompdf = new Dompdf();
$dompdf->loadHtml($html);
#(可选)设置纸张大小和方向
$dompdf->setPaper('A4', 'landscape');
# 将HTML渲染为PDF
$dompdf->render();
// 获取PDF内容
$pdfContent = $dompdf->output();
$path = '/V6/PDF/' . $this->time;
// 将PDF内容保存到文件
@file_put_contents($savePath, $pdfContent);
$pdf = PDF::loadHTML($html);
$pdf->save($savePath);
$path = '/V6/PDF/' . $this->time;
// 创建一个文件实例
$file = new File($savePath);
return $this->CosService->uploadFile($file, $path, $filename . '.pdf');
... ... @@ -158,12 +152,7 @@ class ProjectFilePDF extends Command
*/
protected function html($item)
{
$html = '<html>';
$html .= '<body style="font-family:arial">';
$html .= '<h1>Hello, World!</h1>';
$html .= '<p>中文内容ffffff</p>';
$html .= '</body>';
$html .= '</html>';
return $html;
$font_path = storage_path('fonts\msyh.ttf');
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>';
}
}
... ...
... ... @@ -40,9 +40,7 @@ class ProjectReset extends Command
//关闭数据库
DB::disconnect('custom_mysql');
UpdateLog::where('project_id', $project_id)->update(['status' => 0]);
UpdateLog::where('project_id', $project_id)->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update(['collect_status' => 0]);
UpdateLog::where('project_id', $project_id)->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update(['status' => 0, 'collect_status' => 0]);
echo $project_id . ',重置成功' . PHP_EOL;
}
... ...
... ... @@ -252,7 +252,7 @@ class ProjectUpdate extends Command
$gallery = [];
if ($item['images'] ?? []) {
foreach ($item['images'] as $k_img => $img) {
$gallery[] = ['alt' => '这是一张产品图', 'url' => $this->source_download($img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)];
$gallery[] = ['alt' => 'This is a product picture', 'url' => $this->source_download($img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)];
}
}
//分类
... ... @@ -292,6 +292,19 @@ class ProjectUpdate extends Command
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
continue;
}
} else {
$gallery = [];
if ($item['images'] ?? []) {
foreach ($item['images'] as $k_img => $img) {
$gallery[] = ['alt' => 'This is a product picture', 'url' => $this->source_download($img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)];
}
}
$edit = [
'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
'gallery' => Arr::a2s($gallery)
];
$model->edit($edit, ['id' => $product['id']]);
}
}
}
... ... @@ -595,7 +608,7 @@ class ProjectUpdate extends Command
if ($source == RouteMap::SOURCE_NEWS) {
$route_map->path = RouteMap::SOURCE_NEWS;
} elseif ($source == RouteMap::SOURCE_BLOG) {
$route_map->path = RouteMap::SOURCE_BLOG.'s';
$route_map->path = RouteMap::SOURCE_BLOG . 's';
}
$route_map->save();
... ...
... ... @@ -38,8 +38,8 @@ class Kernel extends ConsoleKernel
$schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息
// $schedule->command('update_progress')->everyThirtyMinutes()->withoutOverlapping(1);//监控更新
$schedule->command('update_seo_tdk_crontab')->dailyAt('00:00')->withoutOverlapping(1); //更新上线项目TDK
$schedule->command('website_data')->dailyAt('01:00')->withoutOverlapping(1); // 向AICC推送数据
$schedule->command('project_file_pdf')->dailyAt('00:00')->withoutOverlapping(1); // 网站项目数据,生成PDF文件
// $schedule->command('website_data')->dailyAt('01:00')->withoutOverlapping(1); // 向AICC推送数据
// $schedule->command('project_file_pdf')->dailyAt('00:00')->withoutOverlapping(1); // 网站项目数据,生成PDF文件
$schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
}
... ...
... ... @@ -635,7 +635,7 @@ class ProductLogic extends BaseLogic
$one_img = check_remote_url_down($v_img,$project_id,$domain);
if($one_img){
$one_gallery = [
'alt' => '这是一张产品图',
'alt' => '',
'url' => $one_img
];
... ...
... ... @@ -5,10 +5,10 @@
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"barryvdh/laravel-dompdf": "^2.0",
"bensampo/laravel-enum": "^4.2",
"beyondcode/laravel-websockets": "^1.14",
"doctrine/dbal": "^3.6",
"dompdf/dompdf": "^2.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"hashids/hashids": "^4.1",
... ... @@ -19,11 +19,10 @@
"mongodb/mongodb": "^1.6",
"mrgoon/aliyun-sms": "^2.0",
"phpoffice/phpspreadsheet": "^1.28",
"swooletw/laravel-swoole": "^2.13",
"qcloud/cos-sdk-v5": "^v2.6.6"
"qcloud/cos-sdk-v5": "^v2.6.6",
"swooletw/laravel-swoole": "^2.13"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.13",
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
... ...
... ... @@ -4,6 +4,7 @@
*/
use App\Http\Controllers\Aside;
use App\Http\Controllers\Bside\ProjectAssociation\ProjectAssociationController;
use Illuminate\Support\Facades\Route;
... ... @@ -13,7 +14,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/editPassword', [Aside\Com\IndexController::class, 'editPassword'])->name('admin.editPassword.white');
Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white');
Route::any('/getAccessAddress', [Aside\LoginController::class, 'getAccessAddress'])->name('admin.getAccessAddress');//获取B端地址
Route::post('/aicc/wechat', [\App\Http\Controllers\Bside\ProjectAssociation\ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat');
//会员相关
Route::prefix('user')->group(function () {
//会员管理
... ... @@ -70,6 +71,8 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/del', [Aside\Ai\AiCommandController::class, 'del'])->name('admin.ai_del');
//发送记录
Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists');
// 绑定AICC微信应用
Route::post('/wechat', [ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat');
});
//特殊模块权限设置
Route::prefix('special')->group(function () {
... ...