Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
7 个修改的文件
包含
76 行增加
和
10 行删除
| @@ -38,6 +38,7 @@ class SyncFile extends Command | @@ -38,6 +38,7 @@ class SyncFile extends Command | ||
| 38 | echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL; | 38 | echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL; |
| 39 | $errorFileModel->edit(['status'=>1],['id'=>$v['id']]); | 39 | $errorFileModel->edit(['status'=>1],['id'=>$v['id']]); |
| 40 | } | 40 | } |
| 41 | + gc_collect_cycles(); | ||
| 41 | } | 42 | } |
| 42 | echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL; | 43 | echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL; |
| 43 | return true; | 44 | return true; |
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Http\Controllers\Api; | 3 | namespace App\Http\Controllers\Api; |
| 4 | 4 | ||
| 5 | +use App\Exceptions\InquiryFilterException; | ||
| 5 | use App\Models\Visit\SyncSubmitTask; | 6 | use App\Models\Visit\SyncSubmitTask; |
| 6 | use App\Services\CosService; | 7 | use App\Services\CosService; |
| 7 | use Illuminate\Http\Request; | 8 | use Illuminate\Http\Request; |
| @@ -26,10 +27,14 @@ class SelfSiteController extends BaseController | @@ -26,10 +27,14 @@ class SelfSiteController extends BaseController | ||
| 26 | $traffic = $request->input('traffic', SyncSubmitTask::TRAFFIC_DEFAULT);//是否引流 | 27 | $traffic = $request->input('traffic', SyncSubmitTask::TRAFFIC_DEFAULT);//是否引流 |
| 27 | $files = $request->input('files', []);//文件 | 28 | $files = $request->input('files', []);//文件 |
| 28 | 29 | ||
| 29 | - if (empty($data)) { | 30 | + if (empty($data) || empty($domain)) { |
| 30 | return $this->error('参数错误'); | 31 | return $this->error('参数错误'); |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 34 | + if (!in_array($type, [SyncSubmitTask::TYPE_VISIT, SyncSubmitTask::TYPE_INQUIRY])) { | ||
| 35 | + return $this->error('类型错误'); | ||
| 36 | + } | ||
| 37 | + | ||
| 33 | if (!empty($files)) { | 38 | if (!empty($files)) { |
| 34 | try { | 39 | try { |
| 35 | foreach ($files as $key => $file) { | 40 | foreach ($files as $key => $file) { |
| @@ -42,6 +47,8 @@ class SelfSiteController extends BaseController | @@ -42,6 +47,8 @@ class SelfSiteController extends BaseController | ||
| 42 | 'original_name' => $fileinfo['name'], | 47 | 'original_name' => $fileinfo['name'], |
| 43 | ]; | 48 | ]; |
| 44 | } | 49 | } |
| 50 | + } catch (InquiryFilterException $e) { | ||
| 51 | + return $this->error($e->getMessage()); | ||
| 45 | } catch (\Exception $e) { | 52 | } catch (\Exception $e) { |
| 46 | return $this->error('File upload fail'); | 53 | return $this->error('File upload fail'); |
| 47 | } | 54 | } |
| @@ -61,6 +61,7 @@ class ProjectController extends BaseController | @@ -61,6 +61,7 @@ class ProjectController extends BaseController | ||
| 61 | ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') | 61 | ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') |
| 62 | ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') | 62 | ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') |
| 63 | ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id') | 63 | ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id') |
| 64 | + ->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id') | ||
| 64 | ->where('gl_project.delete_status',Project::TYPE_ZERO) | 65 | ->where('gl_project.delete_status',Project::TYPE_ZERO) |
| 65 | ->where('gl_project.extend_type',Project::TYPE_ZERO); | 66 | ->where('gl_project.extend_type',Project::TYPE_ZERO); |
| 66 | $query = $this->searchParam($query); | 67 | $query = $this->searchParam($query); |
| @@ -115,6 +116,7 @@ class ProjectController extends BaseController | @@ -115,6 +116,7 @@ class ProjectController extends BaseController | ||
| 115 | 'gl_project_deploy_optimize.quality_mid AS quality_mid', | 116 | 'gl_project_deploy_optimize.quality_mid AS quality_mid', |
| 116 | 'gl_project_deploy_optimize.design_mid AS design_mid', | 117 | 'gl_project_deploy_optimize.design_mid AS design_mid', |
| 117 | 'gl_project_deploy_optimize.api_no AS api_no', | 118 | 'gl_project_deploy_optimize.api_no AS api_no', |
| 119 | + 'gl_web_setting_template.template_id AS template_id', | ||
| 118 | ]; | 120 | ]; |
| 119 | return $select; | 121 | return $select; |
| 120 | } | 122 | } |
| @@ -6,6 +6,8 @@ use App\Enums\Common\Code; | @@ -6,6 +6,8 @@ use App\Enums\Common\Code; | ||
| 6 | use App\Helper\Translate; | 6 | use App\Helper\Translate; |
| 7 | use App\Http\Controllers\Controller; | 7 | use App\Http\Controllers\Controller; |
| 8 | use App\Http\Controllers\type; | 8 | use App\Http\Controllers\type; |
| 9 | +use App\Jobs\CopyProjectJob; | ||
| 10 | +use App\Jobs\SyncImageFileJob; | ||
| 9 | use App\Models\File\ErrorFile; | 11 | use App\Models\File\ErrorFile; |
| 10 | use App\Models\File\Image as ImageModel; | 12 | use App\Models\File\Image as ImageModel; |
| 11 | use App\Models\Project\Project; | 13 | use App\Models\Project\Project; |
| @@ -262,14 +264,14 @@ class ImageController extends Controller | @@ -262,14 +264,14 @@ class ImageController extends Controller | ||
| 262 | * @time :2024/4/8 11:10 | 264 | * @time :2024/4/8 11:10 |
| 263 | */ | 265 | */ |
| 264 | public function synchronizationImage($fileName){ | 266 | public function synchronizationImage($fileName){ |
| 265 | - //同步到大文件 | ||
| 266 | - $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0); | ||
| 267 | - $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; | ||
| 268 | - $code = shell_exec($cmd); | ||
| 269 | - if(200 != (int)$code){ | ||
| 270 | - $errorFileModel = new ErrorFile(); | ||
| 271 | - $errorFileModel->add(['path'=>$this->path.'/'.$fileName]); | ||
| 272 | - } | 267 | + SyncImageFileJob::dispatch(['path'=>$this->path,'name'=>$fileName]); |
| 268 | +// $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0); | ||
| 269 | +// $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; | ||
| 270 | +// $code = shell_exec($cmd); | ||
| 271 | +// if(200 != (int)$code){ | ||
| 272 | +// $errorFileModel = new ErrorFile(); | ||
| 273 | +// $errorFileModel->add(['path'=>$this->path.'/'.$fileName]); | ||
| 274 | +// } | ||
| 273 | return true; | 275 | return true; |
| 274 | } | 276 | } |
| 275 | 277 |
app/Jobs/SyncImageFileJob.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Jobs; | ||
| 4 | + | ||
| 5 | +use App\Events\CopyImageFile; | ||
| 6 | +use App\Models\File\ErrorFile; | ||
| 7 | +use App\Models\File\File as FileModel; | ||
| 8 | +use App\Models\File\Image as ImageModel; | ||
| 9 | +use App\Services\AmazonS3Service; | ||
| 10 | +use Illuminate\Bus\Queueable; | ||
| 11 | +use Illuminate\Contracts\Queue\ShouldQueue; | ||
| 12 | +use Illuminate\Foundation\Bus\Dispatchable; | ||
| 13 | +use Illuminate\Queue\InteractsWithQueue; | ||
| 14 | +use Illuminate\Queue\SerializesModels; | ||
| 15 | + | ||
| 16 | +class SyncImageFileJob implements ShouldQueue | ||
| 17 | +{ | ||
| 18 | + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | ||
| 19 | + public $tries = 3; // 可配置任务重试次数 | ||
| 20 | + | ||
| 21 | + protected $param; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * Create a new job instance. | ||
| 25 | + * | ||
| 26 | + * @param CopyImageFile $event | ||
| 27 | + * @return void | ||
| 28 | + */ | ||
| 29 | + public function __construct($data) | ||
| 30 | + { | ||
| 31 | + $this->param = $data; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * Execute the job. | ||
| 36 | + * | ||
| 37 | + * @return void | ||
| 38 | + */ | ||
| 39 | + public function handle() | ||
| 40 | + { | ||
| 41 | + $file_path = getImageUrl($this->param['path'].'/'.$this->param['name'], 0); | ||
| 42 | + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php'; | ||
| 43 | + $code = shell_exec($cmd); | ||
| 44 | + if(200 != (int)$code){ | ||
| 45 | + $errorFileModel = new ErrorFile(); | ||
| 46 | + $errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]); | ||
| 47 | + } | ||
| 48 | + return true; | ||
| 49 | + } | ||
| 50 | +} |
| @@ -60,6 +60,10 @@ class RouteMap extends Base | @@ -60,6 +60,10 @@ class RouteMap extends Base | ||
| 60 | } | 60 | } |
| 61 | $i=1; | 61 | $i=1; |
| 62 | $sign = generateRoute($title); | 62 | $sign = generateRoute($title); |
| 63 | + $length = strlen($sign); | ||
| 64 | + if($length > 100){ | ||
| 65 | + $sign = trim(mb_substr($sign, 0, 100, 'UTF-8'),'-'); | ||
| 66 | + } | ||
| 63 | $info = self::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first(); | 67 | $info = self::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first(); |
| 64 | $suffix = ''; | 68 | $suffix = ''; |
| 65 | if(empty($info)){ | 69 | if(empty($info)){ |
| @@ -21,7 +21,7 @@ class Visit extends Base | @@ -21,7 +21,7 @@ class Visit extends Base | ||
| 21 | //连接数据库 | 21 | //连接数据库 |
| 22 | protected $connection = 'custom_mysql'; | 22 | protected $connection = 'custom_mysql'; |
| 23 | protected $appends = ['device_text']; | 23 | protected $appends = ['device_text']; |
| 24 | - protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at']; | 24 | + protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','is_inquiry','original_id','updated_date', 'created_at']; |
| 25 | 25 | ||
| 26 | const DEVICE_PC = 1; | 26 | const DEVICE_PC = 1; |
| 27 | const DEVICE_MOBILE = 2; | 27 | const DEVICE_MOBILE = 2; |
-
请 注册 或 登录 后发表评论