作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !2717
... ... @@ -33,13 +33,15 @@ class ThumbProjectImage extends Command
//指定项目
$this->output('project_id:' . $project_id . ' | start');
ProjectServer::useProject($project_id);
$project_info = ProjectServer::useProject($project_id);
Product::select(['id', 'thumb'])->chunk(100, function ($products) {
if ($project_info) {
$thumb_w = $project_info->deploy_build->thumb_w ?? 0;
Product::select(['id', 'thumb'])->chunk(100, function ($products) use ($thumb_w) {
foreach ($products as $product) {
$thumb = $product->thumb;
if (isset($thumb['url']) && $thumb['url']) {
$thumb['url'] = thumbImageByUrl($thumb['url']);
$thumb['url'] = thumbImageByUrl($thumb['url'], $thumb_w);
$product->timestamps = false;
$product->thumb = Arr::a2s($thumb);
$product->save();
... ... @@ -48,6 +50,7 @@ class ThumbProjectImage extends Command
});
DB::disconnect('custom_mysql');
}
$this->output('project_id:' . $project_id . ' | end');
} else {
... ... @@ -59,13 +62,15 @@ class ThumbProjectImage extends Command
$this->output('project_id:' . $project_id . ' | start');
ProjectServer::useProject($project_id);
$project_info = ProjectServer::useProject($project_id);
Product::select(['id', 'thumb'])->chunk(100, function ($products) {
if ($project_info) {
$thumb_w = $project_info->deploy_build->thumb_w ?? 0;
Product::select(['id', 'thumb'])->chunk(100, function ($products) use ($thumb_w) {
foreach ($products as $product) {
$thumb = $product->thumb;
if (isset($thumb['url']) && $thumb['url']) {
$thumb['url'] = thumbImageByUrl($thumb['url']);
$thumb['url'] = thumbImageByUrl($thumb['url'], $thumb_w);
$product->timestamps = false;
$product->thumb = Arr::a2s($thumb);
$product->save();
... ... @@ -74,6 +79,7 @@ class ThumbProjectImage extends Command
});
DB::disconnect('custom_mysql');
}
$this->output('project_id:' . $project_id . ' | end');
}
... ...
... ... @@ -1482,6 +1482,10 @@ function thumbImageByUrl($url, $width = 360)
return $url;
}
if ($width == 0) {
return $url;
}
if (strpos($url, '_thumb') !== false) {
return $url;
}
... ... @@ -1521,7 +1525,7 @@ function thumbImageByUrl($url, $width = 360)
return $url;
}
if(!function_exists('httpGetSsl')){
if (!function_exists('httpGetSsl')) {
/**
* 获取通配符证书
* @param $domain
... ... @@ -1529,15 +1533,16 @@ if(!function_exists('httpGetSsl')){
* @author Akun
* @date 2025/04/21 16:51
*/
function httpGetSsl($domain){
function httpGetSsl($domain)
{
$header = array(
"Accept:application/json",
"Content-Type:application/json;charset=utf-8",
"X-CmerApi-Host:".env('GET_SSL_HOST'),
"Apikey:".env('GET_SSL_KEY'),
"X-CmerApi-Host:" . env('GET_SSL_HOST'),
"Apikey:" . env('GET_SSL_KEY'),
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, env('GET_SSL_URL').'?domain='.$domain);
curl_setopt($ch, CURLOPT_URL, env('GET_SSL_URL') . '?domain=' . $domain);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
... ...