作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -38,6 +38,7 @@ class SyncFile extends Command
echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
$errorFileModel->edit(['status'=>1],['id'=>$v['id']]);
}
gc_collect_cycles();
}
echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL;
return true;
... ...
... ... @@ -315,7 +315,10 @@ class WebTraffic extends Command
$startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
$query->where('pdo.start_date', '<', $startTime);
}
})->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->get();
})->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])
->forPage($page, 500)
->orderBy('project_id')
->get();
//其他地方在引流的域名
$other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
$data = [];
... ... @@ -405,6 +408,9 @@ class WebTraffic extends Command
$query->whereNotIn('ip_area', $main_countries);
}
})->inRandomOrder()->first();
if(!$ipdata){
continue;
}
$ipdata = (array)$ipdata ?: [];
$ipdata['diff'] = $time_zones[$ipdata['ip_area']];
$data[] = $ipdata;
... ...
... ... @@ -348,7 +348,7 @@ class WebTrafficRussia extends Command
$startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
$query->where('pdo.start_date', '<', $startTime);
}
})->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->get();
})->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->orderBy('project_id')->get();
//其他地方在引流的域名
$other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
$data = [];
... ... @@ -454,6 +454,9 @@ class WebTrafficRussia extends Command
}
$ip_area = $this->get_rand($project_country);
$res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first();
if(!$res){
continue;
}
$res = (array)$res ?: [];
$res['diff'] = $time_zones[$res['ip_area']];
$data[] = $res;
... ...
... ... @@ -329,7 +329,7 @@ class WebTrafficRussiaSpecial extends Command
->where('gl_project.is_upgrade', 0) //非升级项目
->where('gl_project.main_lang_id', $ru_lang_id)// 俄语站
->whereIn('gl_project.id', array_keys($projects))
->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->get();
->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->orderBy('project_id')->get();
//其他地方在引流的域名
// $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
$other = [];
... ... @@ -445,6 +445,9 @@ class WebTrafficRussiaSpecial extends Command
}
$ip_area = $this->get_rand($project_country);
$res = DB::table('gl_xunpan_ipdata')->where('ip_area', $ip_area)->inRandomOrder()->first();
if(!$res){
continue;
}
$res = (array)$res ?: [];
$res['diff'] = $time_zones[$res['ip_area']];
$data[] = $res;
... ...
... ... @@ -295,7 +295,7 @@ class WebTrafficSpecial extends Command
->where('gl_project.is_upgrade', 0) //非升级项目
->where('gl_project.main_lang_id', '<>', $ru_lang_id) //非俄语站
->whereIn('gl_project.id', array_keys($projects))
->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->get();
->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->orderBy('project_id')->get();
//其他地方在引流的域名
// $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
$other = [];
... ... @@ -395,6 +395,9 @@ class WebTrafficSpecial extends Command
$query->whereNotIn('ip_area', $main_countries);
}
})->inRandomOrder()->first();
if(!$ipdata){
continue;
}
$ipdata = (array)$ipdata ?: [];
$ipdata['diff'] = $time_zones[$ipdata['ip_area']];
$data[] = $ipdata;
... ...
... ... @@ -61,6 +61,7 @@ class ProjectController extends BaseController
->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id')
->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id')
->where('gl_project.delete_status',Project::TYPE_ZERO)
->where('gl_project.extend_type',Project::TYPE_ZERO);
$query = $this->searchParam($query);
... ... @@ -115,6 +116,7 @@ class ProjectController extends BaseController
'gl_project_deploy_optimize.quality_mid AS quality_mid',
'gl_project_deploy_optimize.design_mid AS design_mid',
'gl_project_deploy_optimize.api_no AS api_no',
'gl_web_setting_template.template_id AS template_id',
];
return $select;
}
... ...
... ... @@ -6,6 +6,8 @@ use App\Enums\Common\Code;
use App\Helper\Translate;
use App\Http\Controllers\Controller;
use App\Http\Controllers\type;
use App\Jobs\CopyProjectJob;
use App\Jobs\SyncImageFileJob;
use App\Models\File\ErrorFile;
use App\Models\File\Image as ImageModel;
use App\Models\Project\Project;
... ... @@ -262,14 +264,14 @@ class ImageController extends Controller
* @time :2024/4/8 11:10
*/
public function synchronizationImage($fileName){
//同步到大文件
$file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
$code = shell_exec($cmd);
if(200 != (int)$code){
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->path.'/'.$fileName]);
}
SyncImageFileJob::dispatch(['path'=>$this->path,'name'=>$fileName]);
// $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
// $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
// $code = shell_exec($cmd);
// if(200 != (int)$code){
// $errorFileModel = new ErrorFile();
// $errorFileModel->add(['path'=>$this->path.'/'.$fileName]);
// }
return true;
}
... ...
<?php
namespace App\Jobs;
use App\Events\CopyImageFile;
use App\Models\File\ErrorFile;
use App\Models\File\File as FileModel;
use App\Models\File\Image as ImageModel;
use App\Services\AmazonS3Service;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class SyncImageFileJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $tries = 3; // 可配置任务重试次数
protected $param;
/**
* Create a new job instance.
*
* @param CopyImageFile $event
* @return void
*/
public function __construct($data)
{
$this->param = $data;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$file_path = getImageUrl($this->param['path'].'/'.$this->param['name'], 0);
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php';
$code = shell_exec($cmd);
if(200 != (int)$code){
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
}
return true;
}
}
... ...
... ... @@ -60,6 +60,10 @@ class RouteMap extends Base
}
$i=1;
$sign = generateRoute($title);
$length = strlen($sign);
if($length > 100){
$sign = trim(mb_substr($sign, 0, 100, 'UTF-8'),'-');
}
$info = self::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first();
$suffix = '';
if(empty($info)){
... ...