Merge remote-tracking branch 'origin/master' into akun
正在显示
12 个修改的文件
包含
282 行增加
和
47 行删除
| @@ -14,6 +14,8 @@ use App\Models\File\File as FileModel; | @@ -14,6 +14,8 @@ use App\Models\File\File as FileModel; | ||
| 14 | use App\Models\File\Image; | 14 | use App\Models\File\Image; |
| 15 | use App\Models\File\Image as ImageModel; | 15 | use App\Models\File\Image as ImageModel; |
| 16 | use App\Models\Product\Keyword; | 16 | use App\Models\Product\Keyword; |
| 17 | +use App\Models\Project\DeployOptimize; | ||
| 18 | +use App\Models\Project\MinorLanguages; | ||
| 17 | use App\Models\Project\Project; | 19 | use App\Models\Project\Project; |
| 18 | use App\Services\AmazonS3Service; | 20 | use App\Services\AmazonS3Service; |
| 19 | use App\Services\ProjectServer; | 21 | use App\Services\ProjectServer; |
| @@ -138,14 +140,4 @@ class Demo extends Command | @@ -138,14 +140,4 @@ class Demo extends Command | ||
| 138 | // } | 140 | // } |
| 139 | // return true; | 141 | // return true; |
| 140 | // } | 142 | // } |
| 141 | - | ||
| 142 | - public function handle(){ | ||
| 143 | - $keywordModel = new KeywordVideoTask(); | ||
| 144 | - $lists = $keywordModel->list(['keywords'=>['!=',null]]); | ||
| 145 | - foreach ($lists as $v){ | ||
| 146 | - $keywords = str_replace(["\r\n", "\r", "\n"], ',', $v['keywords']); | ||
| 147 | - $keywordModel->edit(['keywords'=>$keywords],['id'=>$v['id']]); | ||
| 148 | - } | ||
| 149 | - return true; | ||
| 150 | - } | ||
| 151 | } | 143 | } |
| @@ -56,6 +56,13 @@ class HeaderFooter extends Command | @@ -56,6 +56,13 @@ class HeaderFooter extends Command | ||
| 56 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 56 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | + /** | ||
| 60 | + * @remark :头部底部分开脚本 | ||
| 61 | + * @name :saveTemplateCom | ||
| 62 | + * @author :lyh | ||
| 63 | + * @method :post | ||
| 64 | + * @time :2024/6/17 14:46 | ||
| 65 | + */ | ||
| 59 | public function saveTemplateCom($project_id){ | 66 | public function saveTemplateCom($project_id){ |
| 60 | //获取当前项目选择的模版 | 67 | //获取当前项目选择的模版 |
| 61 | $settingModel = new Setting(); | 68 | $settingModel = new Setting(); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ProductFileUpload.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/6/18 15:43 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\Test; | ||
| 11 | + | ||
| 12 | +use App\Models\File\File; | ||
| 13 | +use App\Models\Product\Product; | ||
| 14 | +use App\Services\ProjectServer; | ||
| 15 | +use Illuminate\Console\Command; | ||
| 16 | +use Illuminate\Support\Facades\DB; | ||
| 17 | + | ||
| 18 | +class ProductFileUpload extends Command | ||
| 19 | +{ | ||
| 20 | + /** | ||
| 21 | + * The name and signature of the console command. | ||
| 22 | + * | ||
| 23 | + * @var string | ||
| 24 | + */ | ||
| 25 | + protected $signature = 'files_upload {project_id}'; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * The console command description. | ||
| 29 | + * | ||
| 30 | + * @var string | ||
| 31 | + */ | ||
| 32 | + protected $description = '重新上传文件获取文件后缀'; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * @remark : | ||
| 36 | + * @name :handle | ||
| 37 | + * @author :lyh | ||
| 38 | + * @method :post | ||
| 39 | + * @time :2024/6/18 15:46 | ||
| 40 | + */ | ||
| 41 | + public function handle(){ | ||
| 42 | + $project_id = $this->argument('project_id'); | ||
| 43 | + ProjectServer::useProject($project_id); | ||
| 44 | + $productModel = new Product(); | ||
| 45 | + $lists = $productModel->list(['status'=>1,'id'=>['<=',106]]); | ||
| 46 | + foreach ($lists as $k => $v){ | ||
| 47 | + if(!empty($v['files']) && !empty($v['files']['url'])){ | ||
| 48 | + $url = str_replace_url($v['files']['url']); | ||
| 49 | + //获取当前图片的原名称 | ||
| 50 | + $files = new File(); | ||
| 51 | + $fileInfo = $files->read(['path'=>$url,'project_id'=>$project_id]); | ||
| 52 | + if($fileInfo === false){ | ||
| 53 | + continue; | ||
| 54 | + } | ||
| 55 | + $newName = $fileInfo['name']; | ||
| 56 | + $code = $this->synchronizationFile($url,$newName); | ||
| 57 | + if((int)$code == 200){ | ||
| 58 | + echo date('Y-m-d H:i:s') . '编辑的path为:'. $url .',主键id:'. $v['id'] . PHP_EOL; | ||
| 59 | + $v['files']['url'] = preg_replace('#/[^/]*$#', '/', $url).$newName; | ||
| 60 | + $productModel->edit(['files'=>json_encode($v['files'])],['id'=>$v['id']]); | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + DB::disconnect('custom_mysql'); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * @remark :指定同步文件到獨立177服務器 | ||
| 69 | + * @name :synchronizationFile | ||
| 70 | + * @author :lyh | ||
| 71 | + * @method :post | ||
| 72 | + * @time :2024/4/8 11:10 | ||
| 73 | + */ | ||
| 74 | + public function synchronizationFile($path_name,$newName){ | ||
| 75 | + //同步到大文件 | ||
| 76 | + $file_path = config('filesystems.disks.cos')['cdn1'].$path_name; | ||
| 77 | + echo date('Y-m-d H:i:s') . '编辑的path为:'. $file_path. PHP_EOL; | ||
| 78 | + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME); | ||
| 79 | + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" -F "file_name='.$newName.'" https://v6-file.globalso.com/fileUploads.php'; | ||
| 80 | + return shell_exec($cmd); | ||
| 81 | + } | ||
| 82 | +} |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :SyncProjectFile.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/6/18 14:53 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\Test; | ||
| 11 | + | ||
| 12 | +use App\Models\File\ErrorFile; | ||
| 13 | +use App\Models\File\File; | ||
| 14 | +use Illuminate\Console\Command; | ||
| 15 | + | ||
| 16 | +class SyncProjectFile extends Command | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * The name and signature of the console command. | ||
| 20 | + * | ||
| 21 | + * @var string | ||
| 22 | + */ | ||
| 23 | + protected $signature = 'sync_project_file {project_id}'; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * The console command description. | ||
| 27 | + * | ||
| 28 | + * @var string | ||
| 29 | + */ | ||
| 30 | + protected $description = '同步图片与文件'; | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + public function handle(){ | ||
| 34 | + $project_id = $this->argument('project_id'); | ||
| 35 | + $fileModel = new File(); | ||
| 36 | + $lists = $fileModel->list(['project_id'=>$project_id]);//未同步成功的图片及文件 | ||
| 37 | + foreach ($lists as $k => $v){ | ||
| 38 | + if(strpos($v['path'], '/181/') !== false ){ | ||
| 39 | + $code = $this->synchronizationFiles($v['path']); | ||
| 40 | + }else{ | ||
| 41 | + $code = $this->synchronizationFile($v['path']); | ||
| 42 | + } | ||
| 43 | + if((int)$code == 200){ | ||
| 44 | + echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL; | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL; | ||
| 48 | + return true; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * @remark :指定同步文件到獨立177服務器 | ||
| 53 | + * @name :synchronizationFile | ||
| 54 | + * @author :lyh | ||
| 55 | + * @method :post | ||
| 56 | + * @time :2024/4/8 11:10 | ||
| 57 | + */ | ||
| 58 | + public function synchronizationFile($path_name){ | ||
| 59 | + //同步到大文件 | ||
| 60 | + $file_path = config('filesystems.disks.cos')['cdn1'].$path_name; | ||
| 61 | + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME); | ||
| 62 | + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php'; | ||
| 63 | + return shell_exec($cmd); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + public function synchronizationFiles($path_name){ | ||
| 68 | + //同步到大文件 | ||
| 69 | + $file_path = config('filesystems.disks.s3')['cdn'].$path_name; | ||
| 70 | + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME); | ||
| 71 | + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php'; | ||
| 72 | + return shell_exec($cmd); | ||
| 73 | + } | ||
| 74 | +} |
| @@ -105,6 +105,7 @@ class ProjectController extends BaseController | @@ -105,6 +105,7 @@ class ProjectController extends BaseController | ||
| 105 | 'gl_project_deploy_build.tech_mid AS tech_mid', | 105 | 'gl_project_deploy_build.tech_mid AS tech_mid', |
| 106 | 'gl_project_deploy_build.test_domain AS test_domain', | 106 | 'gl_project_deploy_build.test_domain AS test_domain', |
| 107 | 'gl_project_deploy_build.plan AS plan', | 107 | 'gl_project_deploy_build.plan AS plan', |
| 108 | + 'gl_project_deploy_build.is_participle AS is_participle', | ||
| 108 | 'gl_project_deploy_optimize.dept_id AS optimize_dept_id', | 109 | 'gl_project_deploy_optimize.dept_id AS optimize_dept_id', |
| 109 | 'gl_project_deploy_optimize.manager_mid AS optimize_manager_mid', | 110 | 'gl_project_deploy_optimize.manager_mid AS optimize_manager_mid', |
| 110 | 'gl_project_deploy_optimize.optimist_mid AS optimize_optimist_mid', | 111 | 'gl_project_deploy_optimize.optimist_mid AS optimize_optimist_mid', |
| @@ -367,7 +368,6 @@ class ProjectController extends BaseController | @@ -367,7 +368,6 @@ class ProjectController extends BaseController | ||
| 367 | $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); | 368 | $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); |
| 368 | $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); | 369 | $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); |
| 369 | $item['collect_time'] = $item['is_upgrade'] ? UpdateLog::getProjectUpdate($item['id']) : ''; | 370 | $item['collect_time'] = $item['is_upgrade'] ? UpdateLog::getProjectUpdate($item['id']) : ''; |
| 370 | - | ||
| 371 | return $item; | 371 | return $item; |
| 372 | } | 372 | } |
| 373 | 373 | ||
| @@ -389,6 +389,23 @@ class ProjectController extends BaseController | @@ -389,6 +389,23 @@ class ProjectController extends BaseController | ||
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | /** | 391 | /** |
| 392 | + * @remark :逻辑删除 | ||
| 393 | + * @name :deleteMinorLanguages | ||
| 394 | + * @author :lyh | ||
| 395 | + * @method :post | ||
| 396 | + * @time :2024/6/18 11:53 | ||
| 397 | + */ | ||
| 398 | + public function deleteMinorLanguages(ProjectLogic $logic){ | ||
| 399 | + $this->request->validate([ | ||
| 400 | + 'id'=>'required' | ||
| 401 | + ],[ | ||
| 402 | + 'id.required' => 'ID不能为空' | ||
| 403 | + ]); | ||
| 404 | + $data = $logic->deleteMinorLanguages(); | ||
| 405 | + $this->response('success',Code::SUCCESS,$data); | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + /** | ||
| 392 | * @remark :保存数据 | 409 | * @remark :保存数据 |
| 393 | * @name :save | 410 | * @name :save |
| 394 | * @author :lyh | 411 | * @author :lyh |
| @@ -1007,4 +1024,23 @@ class ProjectController extends BaseController | @@ -1007,4 +1024,23 @@ class ProjectController extends BaseController | ||
| 1007 | $this->response('success'); | 1024 | $this->response('success'); |
| 1008 | } | 1025 | } |
| 1009 | 1026 | ||
| 1027 | + /** | ||
| 1028 | + * @remark :开启与关闭分词搜索 | ||
| 1029 | + * @name :setIsParticiple | ||
| 1030 | + * @author :lyh | ||
| 1031 | + * @method :post | ||
| 1032 | + * @time :2024/6/19 10:07 | ||
| 1033 | + */ | ||
| 1034 | + public function setIsParticiple(){ | ||
| 1035 | + $this->request->validate([ | ||
| 1036 | + 'project_id'=>'required', | ||
| 1037 | + 'is_participle'=>'required' | ||
| 1038 | + ],[ | ||
| 1039 | + 'project_id.required' => '项目id不能为空', | ||
| 1040 | + 'is_participle.required' => '项目id不能为空', | ||
| 1041 | + ]); | ||
| 1042 | + $deployBuildModel = new DeployBuild(); | ||
| 1043 | + $deployBuildModel->edit(['is_participle'=>$this->param['is_participle']],['project_id'=>$this->param['project_id']]); | ||
| 1044 | + $this->response('success'); | ||
| 1045 | + } | ||
| 1010 | } | 1046 | } |
| @@ -343,11 +343,11 @@ class FileController | @@ -343,11 +343,11 @@ class FileController | ||
| 343 | $this->response('指定文件不存在!', Code::USER_ERROR); | 343 | $this->response('指定文件不存在!', Code::USER_ERROR); |
| 344 | } | 344 | } |
| 345 | $fileUrl = getFileUrl($info['path'],$info['is_cos']); | 345 | $fileUrl = getFileUrl($info['path'],$info['is_cos']); |
| 346 | -// $fileName = basename($fileUrl); // 要保存的文件名 | ||
| 347 | // 设置响应头 | 346 | // 设置响应头 |
| 348 | header('Content-Description: File Transfer'); | 347 | header('Content-Description: File Transfer'); |
| 349 | header('Content-Type: application/octet-stream'); | 348 | header('Content-Type: application/octet-stream'); |
| 350 | - header('Content-Disposition: attachment; filename="' . !empty($info['name']) ? $info['name'] : '未命名'.basename($info['path']) . '"'); | 349 | + $name = !empty($info['name']) ? $info['name'] : '未命名'.basename($info['path']); |
| 350 | + header('Content-Disposition: attachment; filename="'.$name.'"'); | ||
| 351 | // 下载文件 | 351 | // 下载文件 |
| 352 | readfile($fileUrl); | 352 | readfile($fileUrl); |
| 353 | } | 353 | } |
| @@ -290,14 +290,10 @@ class ImageController extends Controller | @@ -290,14 +290,10 @@ class ImageController extends Controller | ||
| 290 | 'name'=>$name, | 290 | 'name'=>$name, |
| 291 | 'en_name'=>$fileName | 291 | 'en_name'=>$fileName |
| 292 | ]; | 292 | ]; |
| 293 | - $imageModel = new ImageModel(); | ||
| 294 | - $info = $imageModel->read(['hash'=>$hash,'project_id'=>$this->cache['project_id'] ?? 0]); | ||
| 295 | - if($info === false){ | ||
| 296 | $rs = $imageModel->add($data); | 293 | $rs = $imageModel->add($data); |
| 297 | if ($rs === false) { | 294 | if ($rs === false) { |
| 298 | return $this->response('添加失败', Code::USER_ERROR); | 295 | return $this->response('添加失败', Code::USER_ERROR); |
| 299 | } | 296 | } |
| 300 | - } | ||
| 301 | return true; | 297 | return true; |
| 302 | } | 298 | } |
| 303 | 299 | ||
| @@ -335,7 +331,7 @@ class ImageController extends Controller | @@ -335,7 +331,7 @@ class ImageController extends Controller | ||
| 335 | } | 331 | } |
| 336 | $image_hash = $imageModel->read($param); | 332 | $image_hash = $imageModel->read($param); |
| 337 | if($image_hash !== false){ | 333 | if($image_hash !== false){ |
| 338 | - $data[] = $this->responseData($image_hash['path']); | 334 | + $data[] = $this->responseData($image_hash['path'],$image_hash['name']); |
| 339 | continue; | 335 | continue; |
| 340 | } | 336 | } |
| 341 | $image_type = $file->getClientOriginalExtension(); | 337 | $image_type = $file->getClientOriginalExtension(); |
| @@ -77,7 +77,6 @@ class ProjectLogic extends BaseLogic | @@ -77,7 +77,6 @@ class ProjectLogic extends BaseLogic | ||
| 77 | public function getProjectInfo($id){ | 77 | public function getProjectInfo($id){ |
| 78 | $info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check', 'project_after','inquiry_filter_config','web_traffic_config'])->where(['id'=>$id])->first()->toArray(); | 78 | $info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check', 'project_after','inquiry_filter_config','web_traffic_config'])->where(['id'=>$id])->first()->toArray(); |
| 79 | $info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0); | 79 | $info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0); |
| 80 | - $info['deploy_optimize']['minor_keywords'] = !empty($info['deploy_optimize']['minor_keywords']) ? json_decode($info['deploy_optimize']['minor_keywords']) : []; | ||
| 81 | $info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain']; | 80 | $info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain']; |
| 82 | if($info['extend_type'] != 0){ | 81 | if($info['extend_type'] != 0){ |
| 83 | $info['type'] = $info['extend_type']; | 82 | $info['type'] = $info['extend_type']; |
| @@ -99,12 +98,27 @@ class ProjectLogic extends BaseLogic | @@ -99,12 +98,27 @@ class ProjectLogic extends BaseLogic | ||
| 99 | if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){ | 98 | if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){ |
| 100 | $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']); | 99 | $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']); |
| 101 | } | 100 | } |
| 101 | + //获取小语种 | ||
| 102 | + $info['minor_languages'] = $this->getProjectMinorLanguages($id); | ||
| 102 | //升级项目采集完成时间 | 103 | //升级项目采集完成时间 |
| 103 | $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : ''; | 104 | $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : ''; |
| 104 | return $this->success($info); | 105 | return $this->success($info); |
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | /** | 108 | /** |
| 109 | + * @remark :获取当前项目的小语种配置 | ||
| 110 | + * @name :getProjectMinorLanguages | ||
| 111 | + * @author :lyh | ||
| 112 | + * @method :post | ||
| 113 | + * @time :2024/6/18 11:05 | ||
| 114 | + */ | ||
| 115 | + public function getProjectMinorLanguages($project_id){ | ||
| 116 | + $projectMinorLanguagesModel = new MinorLanguages(); | ||
| 117 | + $lists = $projectMinorLanguagesModel->list(['project_id'=>$project_id,'is_delete'=>0]); | ||
| 118 | + return $this->success($lists); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + /** | ||
| 108 | * @remark :获取初始域名 | 122 | * @remark :获取初始域名 |
| 109 | * @name :getInitDomain | 123 | * @name :getInitDomain |
| 110 | * @author :lyh | 124 | * @author :lyh |
| @@ -149,8 +163,11 @@ class ProjectLogic extends BaseLogic | @@ -149,8 +163,11 @@ class ProjectLogic extends BaseLogic | ||
| 149 | $this->saveProjectDeployOptimize($this->param['deploy_optimize']); | 163 | $this->saveProjectDeployOptimize($this->param['deploy_optimize']); |
| 150 | //保存售后信息 | 164 | //保存售后信息 |
| 151 | $this->saveProjectAfter($this->param['project_after']); | 165 | $this->saveProjectAfter($this->param['project_after']); |
| 152 | - $this->saveMinorLanguages($this->param['deploy_optimize']['minor_languages'] ?? []); | 166 | + //单独保存小语种配置 |
| 167 | + $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']); | ||
| 168 | + //同步图片文件 | ||
| 153 | $this->syncImageFile($this->param['project_location'],$this->param['id']); | 169 | $this->syncImageFile($this->param['project_location'],$this->param['id']); |
| 170 | + //同步信息表 | ||
| 154 | (new SyncService())->projectAcceptAddress($this->param['id']); | 171 | (new SyncService())->projectAcceptAddress($this->param['id']); |
| 155 | } | 172 | } |
| 156 | // DB::commit(); | 173 | // DB::commit(); |
| @@ -161,6 +178,13 @@ class ProjectLogic extends BaseLogic | @@ -161,6 +178,13 @@ class ProjectLogic extends BaseLogic | ||
| 161 | return $this->success(); | 178 | return $this->success(); |
| 162 | } | 179 | } |
| 163 | 180 | ||
| 181 | + /** | ||
| 182 | + * @remark :危险项目同步图片与文件 | ||
| 183 | + * @name :syncImageFile | ||
| 184 | + * @author :lyh | ||
| 185 | + * @method :post | ||
| 186 | + * @time :2024/6/18 10:51 | ||
| 187 | + */ | ||
| 164 | public function syncImageFile($location,$project_id){ | 188 | public function syncImageFile($location,$project_id){ |
| 165 | if($location == 1){ | 189 | if($location == 1){ |
| 166 | CopyImageFileJob::dispatch(['project_id'=>$project_id]); | 190 | CopyImageFileJob::dispatch(['project_id'=>$project_id]); |
| @@ -176,6 +200,8 @@ class ProjectLogic extends BaseLogic | @@ -176,6 +200,8 @@ class ProjectLogic extends BaseLogic | ||
| 176 | * @time :2023/8/30 12:14 | 200 | * @time :2023/8/30 12:14 |
| 177 | */ | 201 | */ |
| 178 | public function saveProject($param){ | 202 | public function saveProject($param){ |
| 203 | +// unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'], | ||
| 204 | +// $param['online_check'],$param['project_after'],$param['inquiry_filter_config'],$param['minor_languages']); | ||
| 179 | if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){ | 205 | if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){ |
| 180 | $param['uptime'] = date('Y-m-d H:i:s'); | 206 | $param['uptime'] = date('Y-m-d H:i:s'); |
| 181 | } | 207 | } |
| @@ -207,8 +233,6 @@ class ProjectLogic extends BaseLogic | @@ -207,8 +233,6 @@ class ProjectLogic extends BaseLogic | ||
| 207 | } | 233 | } |
| 208 | $param['remain_day'] = $param['deploy_build']['service_duration'] - $param['finish_remain_day']; | 234 | $param['remain_day'] = $param['deploy_build']['service_duration'] - $param['finish_remain_day']; |
| 209 | $param['remain_day'] = ($param['remain_day'] > 0) ? $param['remain_day'] : 0; | 235 | $param['remain_day'] = ($param['remain_day'] > 0) ? $param['remain_day'] : 0; |
| 210 | - unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'], | ||
| 211 | - $param['online_check'],$param['project_after'],$param['inquiry_filter_config'],$param['minor_language']); | ||
| 212 | //文件上传默认值 | 236 | //文件上传默认值 |
| 213 | if($param['is_upload_manage']){ | 237 | if($param['is_upload_manage']){ |
| 214 | $param['upload_config'] = [ | 238 | $param['upload_config'] = [ |
| @@ -278,9 +302,7 @@ class ProjectLogic extends BaseLogic | @@ -278,9 +302,7 @@ class ProjectLogic extends BaseLogic | ||
| 278 | //更改域名 | 302 | //更改域名 |
| 279 | $this->editDomainStatus($deploy_optimize['domain'],$deploy_optimize['project_id']); | 303 | $this->editDomainStatus($deploy_optimize['domain'],$deploy_optimize['project_id']); |
| 280 | } | 304 | } |
| 281 | - $deploy_optimize['minor_languages'] = Arr::a2s($deploy_optimize['minor_languages'] ?? []); | ||
| 282 | $deploy_optimize['g_top_plan'] = Arr::a2s($deploy_optimize['g_top_plan'] ?? []); | 305 | $deploy_optimize['g_top_plan'] = Arr::a2s($deploy_optimize['g_top_plan'] ?? []); |
| 283 | - $deploy_optimize['minor_keywords'] = Arr::a2s(!empty($deploy_optimize['minor_keywords']) ? $deploy_optimize['minor_keywords'] : []); | ||
| 284 | $deploy_optimize['special'] = !empty($deploy_optimize['special']) ? ','.trim($deploy_optimize['special'],',').',' : ''; | 306 | $deploy_optimize['special'] = !empty($deploy_optimize['special']) ? ','.trim($deploy_optimize['special'],',').',' : ''; |
| 285 | //是否更新了api_no | 307 | //是否更新了api_no |
| 286 | $api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no'); | 308 | $api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no'); |
| @@ -324,30 +346,41 @@ class ProjectLogic extends BaseLogic | @@ -324,30 +346,41 @@ class ProjectLogic extends BaseLogic | ||
| 324 | * @method :post | 346 | * @method :post |
| 325 | * @time :2023/8/30 13:57 | 347 | * @time :2023/8/30 13:57 |
| 326 | */ | 348 | */ |
| 327 | - protected function saveMinorLanguages($minor_language){ | 349 | + protected function saveMinorLanguages($minor_language,$project_id){ |
| 328 | $data = []; | 350 | $data = []; |
| 329 | - //查询数据是否存在 | ||
| 330 | $languageModel = new MinorLanguages(); | 351 | $languageModel = new MinorLanguages(); |
| 331 | - $languageModel->del(['project_id'=>$this->param['id']]); | ||
| 332 | if(!empty($minor_language)){ | 352 | if(!empty($minor_language)){ |
| 333 | $webLanguageModel = new WebLanguage(); | 353 | $webLanguageModel = new WebLanguage(); |
| 334 | $result = []; | 354 | $result = []; |
| 335 | - foreach ($minor_language as $k => $v){ | 355 | + foreach ($minor_language as $v){ |
| 336 | if(!empty($v['lang'])){ | 356 | if(!empty($v['lang'])){ |
| 337 | $zh = $webLanguageModel->read(['short'=>$v['lang']],['chinese']); | 357 | $zh = $webLanguageModel->read(['short'=>$v['lang']],['chinese']); |
| 338 | - if(empty($zh)){ | 358 | + if($zh === false){ |
| 339 | continue; | 359 | continue; |
| 340 | } | 360 | } |
| 361 | + $info = $languageModel->read(['lang'=>$v['lang'],'project_id'=>$project_id]); | ||
| 362 | + if($info === false){ | ||
| 341 | //获取小语种达标天数 | 363 | //获取小语种达标天数 |
| 342 | $result['language'] = $zh['chinese']; | 364 | $result['language'] = $zh['chinese']; |
| 343 | $result['lang'] = $v['lang']; | 365 | $result['lang'] = $v['lang']; |
| 344 | $result['created_at'] = date('Y-m-d H:i:s'); | 366 | $result['created_at'] = date('Y-m-d H:i:s'); |
| 345 | $result['updated_at'] = date('Y-m-d H:i:s'); | 367 | $result['updated_at'] = date('Y-m-d H:i:s'); |
| 346 | - $result['project_id'] = $this->param['id']; | ||
| 347 | - $result['service_day'] = $v['service_day']; | ||
| 348 | - $result['type'] = $v['type']; | ||
| 349 | - $result['keywords'] = $v['keywords']; | 368 | + $result['project_id'] = $project_id; |
| 369 | + $result['service_day'] = $v['service_day'] ?? 50; | ||
| 370 | + $result['type'] = $v['type'] ?? 0; | ||
| 371 | + $result['keywords'] = $v['keywords'] ?? 50; | ||
| 372 | + $result['minor_keywords'] = $v['minor_keywords'] ?? ''; | ||
| 350 | $data[] = $result; | 373 | $data[] = $result; |
| 374 | + }else{ | ||
| 375 | + $editParam = [ | ||
| 376 | + 'service_day'=>$v['service_day'], | ||
| 377 | + 'type'=>$v['type'], | ||
| 378 | + 'keywords'=>$v['keywords'], | ||
| 379 | + 'minor_keywords'=>$v['minor_keywords'] ?? '', | ||
| 380 | + 'is_delete'=>0 | ||
| 381 | + ]; | ||
| 382 | + $languageModel->edit($editParam,['id'=>$info['id']]); | ||
| 383 | + } | ||
| 351 | } | 384 | } |
| 352 | } | 385 | } |
| 353 | if(!empty($data)){ | 386 | if(!empty($data)){ |
| @@ -358,6 +391,18 @@ class ProjectLogic extends BaseLogic | @@ -358,6 +391,18 @@ class ProjectLogic extends BaseLogic | ||
| 358 | } | 391 | } |
| 359 | 392 | ||
| 360 | /** | 393 | /** |
| 394 | + * @remark :删除小语种(主键id) | ||
| 395 | + * @name :deleteMinorLanguages | ||
| 396 | + * @author :lyh | ||
| 397 | + * @method :post | ||
| 398 | + * @time :2024/6/18 11:32 | ||
| 399 | + */ | ||
| 400 | + public function deleteMinorLanguages(){ | ||
| 401 | + $languageModel = new MinorLanguages(); | ||
| 402 | + return $languageModel->edit(['is_delete'=>1],['id'=>$this->param['id']]); | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + /** | ||
| 361 | * @remark :创建初始数据 | 406 | * @remark :创建初始数据 |
| 362 | * @name :createProjectData | 407 | * @name :createProjectData |
| 363 | * @author :lyh | 408 | * @author :lyh |
| @@ -284,11 +284,11 @@ class ProductLogic extends BaseLogic | @@ -284,11 +284,11 @@ class ProductLogic extends BaseLogic | ||
| 284 | $param['thumb'] = Arr::a2s([]); | 284 | $param['thumb'] = Arr::a2s([]); |
| 285 | $param['gallery'] = Arr::a2s([]); | 285 | $param['gallery'] = Arr::a2s([]); |
| 286 | } | 286 | } |
| 287 | - if(isset($param['files']) && !empty($param['files'])){ | 287 | + if(isset($param['files'])){ |
| 288 | $param['files']['url'] = str_replace_url($param['files']['url'] ?? ''); | 288 | $param['files']['url'] = str_replace_url($param['files']['url'] ?? ''); |
| 289 | $param['files'] = Arr::a2s($param['files'] ?? []); | 289 | $param['files'] = Arr::a2s($param['files'] ?? []); |
| 290 | }else{ | 290 | }else{ |
| 291 | - $param['files'] = Arr::a2s([]); | 291 | + $param['files'] = null; |
| 292 | } | 292 | } |
| 293 | if(isset($param['video'])){ | 293 | if(isset($param['video'])){ |
| 294 | $param['video']['url'] = str_replace_url($param['video']['url']); | 294 | $param['video']['url'] = str_replace_url($param['video']['url']); |
| @@ -95,7 +95,7 @@ class Base extends Model | @@ -95,7 +95,7 @@ class Base extends Model | ||
| 95 | * @time :2023/8/21 17:18 | 95 | * @time :2023/8/21 17:18 |
| 96 | */ | 96 | */ |
| 97 | public function add($data){ | 97 | public function add($data){ |
| 98 | - $data = $this->filterRequestData($data,$this->table); | 98 | + $data = $this->filterRequestData($data); |
| 99 | $data['created_at'] = date('Y-m-d H:i:s'); | 99 | $data['created_at'] = date('Y-m-d H:i:s'); |
| 100 | $data['updated_at'] = $data['created_at']; | 100 | $data['updated_at'] = $data['created_at']; |
| 101 | return $this->insert($data); | 101 | return $this->insert($data); |
| @@ -109,7 +109,7 @@ class Base extends Model | @@ -109,7 +109,7 @@ class Base extends Model | ||
| 109 | * @time :2023/8/21 17:17 | 109 | * @time :2023/8/21 17:17 |
| 110 | */ | 110 | */ |
| 111 | public function addReturnId($data){ | 111 | public function addReturnId($data){ |
| 112 | - $data = $this->filterRequestData($data,$this->table); | 112 | + $data = $this->filterRequestData($data); |
| 113 | $data['created_at'] = date('Y-m-d H:i:s'); | 113 | $data['created_at'] = date('Y-m-d H:i:s'); |
| 114 | $data['updated_at'] = $data['created_at']; | 114 | $data['updated_at'] = $data['created_at']; |
| 115 | return $this->insertGetId($data); | 115 | return $this->insertGetId($data); |
| @@ -126,7 +126,7 @@ class Base extends Model | @@ -126,7 +126,7 @@ class Base extends Model | ||
| 126 | if(isset($data['id']) && !empty($data['id'])){ | 126 | if(isset($data['id']) && !empty($data['id'])){ |
| 127 | unset($data['id']); | 127 | unset($data['id']); |
| 128 | } | 128 | } |
| 129 | - $data = $this->filterRequestData($data,$this->table); | 129 | + $data = $this->filterRequestData($data); |
| 130 | $query = $this->formatQuery($condition); | 130 | $query = $this->formatQuery($condition); |
| 131 | $data['updated_at'] = date('Y-m-d H:i:s'); | 131 | $data['updated_at'] = date('Y-m-d H:i:s'); |
| 132 | return $query->update($data); | 132 | return $query->update($data); |
| @@ -261,10 +261,10 @@ class Base extends Model | @@ -261,10 +261,10 @@ class Base extends Model | ||
| 261 | * @method :post | 261 | * @method :post |
| 262 | * @time :2024/6/14 10:49 | 262 | * @time :2024/6/14 10:49 |
| 263 | */ | 263 | */ |
| 264 | - public function filterRequestData(array $data, $table) | 264 | + public function filterRequestData(array $data) |
| 265 | { | 265 | { |
| 266 | // 获取表的字段列表 | 266 | // 获取表的字段列表 |
| 267 | - $columns = Schema::connection($this->connection)->getColumnListing($table); | 267 | + $columns = Schema::connection($this->connection)->getColumnListing($this->table); |
| 268 | // 过滤数据 | 268 | // 过滤数据 |
| 269 | return array_filter($data, function ($key) use ($columns) { | 269 | return array_filter($data, function ($key) use ($columns) { |
| 270 | return in_array($key, $columns); | 270 | return in_array($key, $columns); |
| @@ -12,13 +12,13 @@ class DeployOptimize extends Base | @@ -12,13 +12,13 @@ class DeployOptimize extends Base | ||
| 12 | protected $table = 'gl_project_deploy_optimize'; | 12 | protected $table = 'gl_project_deploy_optimize'; |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | - public function setMinorLanguagesAttribute($value){ | ||
| 16 | - $this->attributes['minor_languages'] = Arr::a2s($value); | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | - public function getMinorLanguagesAttribute($value){ | ||
| 20 | - return Arr::s2a($value); | ||
| 21 | - } | 15 | +// public function setMinorLanguagesAttribute($value){ |
| 16 | +// $this->attributes['minor_languages'] = Arr::a2s($value); | ||
| 17 | +// } | ||
| 18 | +// | ||
| 19 | +// public function getMinorLanguagesAttribute($value){ | ||
| 20 | +// return Arr::s2a($value); | ||
| 21 | +// } | ||
| 22 | public function getGTopPlanAttribute($value){ | 22 | public function getGTopPlanAttribute($value){ |
| 23 | return Arr::s2a($value); | 23 | return Arr::s2a($value); |
| 24 | } | 24 | } |
| @@ -162,6 +162,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -162,6 +162,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 162 | Route::get('/', [Aside\Project\ProjectController::class, 'lists'])->name('admin.project'); | 162 | Route::get('/', [Aside\Project\ProjectController::class, 'lists'])->name('admin.project'); |
| 163 | Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info'); | 163 | Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info'); |
| 164 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); | 164 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); |
| 165 | + Route::any('/deleteMinorLanguages', [Aside\Project\ProjectController::class, 'deleteMinorLanguages'])->name('admin.project_deleteMinorLanguages'); | ||
| 165 | Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set'); | 166 | Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set'); |
| 166 | Route::any('/get_process_records', [Aside\Project\ProjectController::class, 'get_process_records'])->name('admin.project_get_process_records'); | 167 | Route::any('/get_process_records', [Aside\Project\ProjectController::class, 'get_process_records'])->name('admin.project_get_process_records'); |
| 167 | Route::any('/save_process_records', [Aside\Project\ProjectController::class, 'save_process_records'])->name('admin.project_save_process_records'); | 168 | Route::any('/save_process_records', [Aside\Project\ProjectController::class, 'save_process_records'])->name('admin.project_save_process_records'); |
| @@ -188,6 +189,8 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -188,6 +189,8 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 188 | Route::any('/saveInquiryFilterConfig', [Aside\Project\ProjectController::class, 'saveInquiryFilterConfig'])->name('admin.project_inquiry_filter_config_save');//保存询盘过滤配置 | 189 | Route::any('/saveInquiryFilterConfig', [Aside\Project\ProjectController::class, 'saveInquiryFilterConfig'])->name('admin.project_inquiry_filter_config_save');//保存询盘过滤配置 |
| 189 | Route::any('/saveWebTrafficConfig', [Aside\Project\ProjectController::class, 'saveWebTrafficConfig'])->name('admin.project_web_traffic_config_save');//保存引流配置 | 190 | Route::any('/saveWebTrafficConfig', [Aside\Project\ProjectController::class, 'saveWebTrafficConfig'])->name('admin.project_web_traffic_config_save');//保存引流配置 |
| 190 | Route::any('/updateProjectManager', [Aside\Project\ProjectController::class, 'updateProjectManager'])->name('admin.project_updateProjectManager');//更改项目人员配置 | 191 | Route::any('/updateProjectManager', [Aside\Project\ProjectController::class, 'updateProjectManager'])->name('admin.project_updateProjectManager');//更改项目人员配置 |
| 192 | + Route::any('/setIsParticiple', [Aside\Project\ProjectController::class, 'setIsParticiple'])->name('admin.project_setIsParticiple');//开启/关闭分词 | ||
| 193 | + | ||
| 191 | //获取关键词前缀和后缀 | 194 | //获取关键词前缀和后缀 |
| 192 | Route::prefix('keyword')->group(function () { | 195 | Route::prefix('keyword')->group(function () { |
| 193 | Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); | 196 | Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); |
-
请 注册 或 登录 后发表评论