作者 刘锟

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

@@ -94,16 +94,16 @@ class RemainDay extends Command @@ -94,16 +94,16 @@ class RemainDay extends Command
94 } 94 }
95 } 95 }
96 $item->remain_day = ($remain_day > 0 ? $remain_day : 0); 96 $item->remain_day = ($remain_day > 0 ? $remain_day : 0);
97 - if($item->remain_day == 0){  
98 - $item->extend_type = Project::TYPE_FIVE;  
99 - $item->site_status = Project::TYPE_ONE;//关闭站点  
100 - //TODO::未续费网站禁止登录及通知C端禁止网站  
101 - $domainModel = new DomainInfoModel();  
102 - $domainInfos = $domainModel->read(['project_id'=>$item->id]);  
103 - if($domainInfos !== false){  
104 - curl_get('https://'.$domainInfos['domain'].'/api/stop_or_start_website/');  
105 - }  
106 - } 97 +// if($item->remain_day == 0){
  98 +// $item->extend_type = Project::TYPE_FIVE;
  99 +// $item->site_status = Project::TYPE_ONE;//关闭站点
  100 +// //TODO::未续费网站禁止登录及通知C端禁止网站
  101 +// $domainModel = new DomainInfoModel();
  102 +// $domainInfos = $domainModel->read(['project_id'=>$item->id]);
  103 +// if($domainInfos !== false){
  104 +// curl_get('https://'.$domainInfos['domain'].'/api/stop_or_start_website/');
  105 +// }
  106 +// }
107 $item->save(); 107 $item->save();
108 } 108 }
109 } 109 }
@@ -38,6 +38,7 @@ class SyncFile extends Command @@ -38,6 +38,7 @@ class SyncFile extends Command
38 }else{ 38 }else{
39 $code = $this->synchronizationFile($v['path']); 39 $code = $this->synchronizationFile($v['path']);
40 } 40 }
  41 + echo date('Y-m-d H:i:s') . 'code:'. $code . PHP_EOL;
41 if((int)$code == 200){ 42 if((int)$code == 200){
42 echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL; 43 echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
43 $errorFileModel->edit(['status'=>1],['id'=>$v['id']]); 44 $errorFileModel->edit(['status'=>1],['id'=>$v['id']]);
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :HandleNewsText.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/11/8 9:14
  8 + */
  9 +
  10 +namespace App\Console\Commands\Test;
  11 +
  12 +use App\Models\News\News;
  13 +use App\Services\CosService;
  14 +use Illuminate\Console\Command;
  15 +use App\Models\Project\Project;
  16 +use App\Models\Template\BTemplateCom;
  17 +use App\Services\ProjectServer;
  18 +use Illuminate\Support\Facades\DB;
  19 +class HandleNewsText extends Command
  20 +{
  21 +
  22 + /**
  23 + * The name and signature of the console command.
  24 + *
  25 + * @var string
  26 + */
  27 + protected $signature = 'news_text';
  28 +
  29 + /**
  30 + * The console command description.
  31 + *
  32 + * @var string
  33 + */
  34 + protected $description = 'news_text';
  35 + /**
  36 + * Execute the job.
  37 + *
  38 + * @return void
  39 + */
  40 + protected $project_id = 0;
  41 + public function handle()
  42 + {
  43 + $projectModel = new Project();
  44 + $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);
  45 + $data = [];
  46 + foreach ($list as $v){
  47 + $this->project_id = $v['id'];
  48 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  49 + ProjectServer::useProject($v['id']);
  50 + DB::connection('custom_mysql')->statement('DROP TABLE IF EXISTS gl_news_copy');
  51 + DB::connection('custom_mysql')->statement('CREATE TABLE gl_news_copy LIKE gl_news');
  52 + DB::connection('custom_mysql')->statement('INSERT INTO gl_news_copy SELECT * FROM gl_news');
  53 + $newsModel = new News();
  54 + $news_list = $newsModel->list(['status'=>['!=',2]],'id',['id','text']);
  55 + if(!empty($news_list)){
  56 + foreach ($news_list as $key => $values){
  57 + echo date('Y-m-d H:i:s') . '处理的数据id:'.$values['id'] . PHP_EOL;
  58 + $text = $this->handleText($values['text']);
  59 + $newsModel->edit(['text'=>$text],['id'=>$values['id']]);
  60 + }
  61 + }
  62 + DB::disconnect('custom_mysql');
  63 + }
  64 + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
  65 + }
  66 +
  67 + /**
  68 + * @remark :处理text
  69 + * @name :handleText
  70 + * @author :lyh
  71 + * @method :post
  72 + * @time :2024/11/7 17:20
  73 + */
  74 + public function handleText($text){
  75 + $pattern = '/<img\s+[^>]*src=["\']([^"\']+)["\']/i';
  76 + $matches = [];
  77 + preg_match_all($pattern, $text, $matches);
  78 + $text = $this->saveBase64Images($matches[1],$text);
  79 + return ($text);
  80 + }
  81 +
  82 + /**
  83 + * @remark :解码图片
  84 + * @name :saveBase64Images
  85 + * @author :lyh
  86 + * @method :post
  87 + * @time :2024/11/7 16:52
  88 + */
  89 + public function saveBase64Images($imageSources,&$text)
  90 + {
  91 + foreach ($imageSources as $src) {
  92 + if (preg_match('/^data:image\/(png|jpg|jpeg|gif);base64,/', $src, $match)) {
  93 + echo date('Y-m-d H:i:s') . '当前数据包含base64图片流。' . PHP_EOL;
  94 + $imageType = $match[1]; // Image type (png, jpg, etc.)
  95 + $imageUrl = $this->manager_uploads($src,$imageType);
  96 + $text = str_replace($src, $imageUrl, $text);
  97 + }
  98 + }
  99 + return ($text);
  100 + }
  101 + /**
  102 + * @remark :自调用
  103 + * @name :manager_uploads
  104 + * @author :lyh
  105 + * @method :post
  106 + * @time :2024/11/7 11:00
  107 + */
  108 + public function manager_uploads($files,$type = 'png'){
  109 + $this->uploads = config('upload.default_image');
  110 + $path = $this->uploads['path_b'].'/'.($this->project_id).'/image_news/'.date('Y-m');
  111 + $cosService = new CosService();
  112 + $fileName = md5(uniqid() . '_' . time() . '.' . ($this->project_id).rand(1,10000)) . '.' .$type;
  113 + return getImageUrl($cosService->uploadFile($files,$path,$fileName));
  114 + }
  115 +}
@@ -11,6 +11,7 @@ namespace App\Console\Commands\Test; @@ -11,6 +11,7 @@ namespace App\Console\Commands\Test;
11 11
12 use App\Models\File\ErrorFile; 12 use App\Models\File\ErrorFile;
13 use App\Models\File\File; 13 use App\Models\File\File;
  14 +use App\Models\File\Image;
14 use Illuminate\Console\Command; 15 use Illuminate\Console\Command;
15 16
16 class SyncTimeFiles extends Command 17 class SyncTimeFiles extends Command
@@ -32,8 +33,9 @@ class SyncTimeFiles extends Command @@ -32,8 +33,9 @@ class SyncTimeFiles extends Command
32 public function handle() 33 public function handle()
33 { 34 {
34 $fileModel = new File(); 35 $fileModel = new File();
35 - $start = '2024-08-26 00:00:00';  
36 - $end = date('Y-m-d H:i:s'); 36 +// $imagesModel = new Image();
  37 + $start = '2024-11-07 15:00:00';
  38 + $end = '2024-11-07 15:25:00';
37 $lists = $fileModel->list(['created_at'=>['between',[$start,$end]]]); 39 $lists = $fileModel->list(['created_at'=>['between',[$start,$end]]]);
38 foreach ($lists as $v){ 40 foreach ($lists as $v){
39 $path = $v['path']; 41 $path = $v['path'];
@@ -36,7 +36,9 @@ class SyncVideo extends Command @@ -36,7 +36,9 @@ class SyncVideo extends Command
36 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php'; 36 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php';
37 echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL; 37 echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL;
38 $code = shell_exec($cmd); 38 $code = shell_exec($cmd);
  39 + echo date('Y-m-d H:i:s') . ' | ' . $code . PHP_EOL;
39 if(200 != (int)$code){ 40 if(200 != (int)$code){
  41 + echo date('Y-m-d H:i:s') . ' | ' . $code . PHP_EOL;
40 $errorFileModel = new ErrorFile(); 42 $errorFileModel = new ErrorFile();
41 $errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]); 43 $errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
42 } 44 }
@@ -17,6 +17,7 @@ use App\Models\CustomModule\CustomModuleContent; @@ -17,6 +17,7 @@ use App\Models\CustomModule\CustomModuleContent;
17 use App\Models\Product\CategoryRelated; 17 use App\Models\Product\CategoryRelated;
18 use App\Models\Product\Keyword; 18 use App\Models\Product\Keyword;
19 use App\Models\Product\Product; 19 use App\Models\Product\Product;
  20 +use App\Models\Project\ProcessRecords;
20 use App\Models\Project\Project; 21 use App\Models\Project\Project;
21 use App\Models\RouteMap\RouteMap; 22 use App\Models\RouteMap\RouteMap;
22 use App\Services\ProjectServer; 23 use App\Services\ProjectServer;
@@ -55,20 +56,26 @@ class UpdateRoute extends Command @@ -55,20 +56,26 @@ class UpdateRoute extends Command
55 * @time :2023/11/20 15:13 56 * @time :2023/11/20 15:13
56 */ 57 */
57 public function handle(){ 58 public function handle(){
58 - $projectModel = new Project();  
59 - $list = $projectModel->list(['id'=>['in',[1653]]]);  
60 - $data = [];  
61 - foreach ($list as $v){  
62 - echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;  
63 - ProjectServer::useProject($v['id']);  
64 -// $this->getProduct();  
65 -// $this->setProductKeyword();  
66 -// $this->getBlog();  
67 -// $this->setCustomRoute($v['id']);  
68 - $this->editProductAlt();  
69 -// $this->custom_to_blogs();  
70 - DB::disconnect('custom_mysql');  
71 - } 59 + $recordModel = new ProcessRecords();
  60 + $lists = $recordModel->list();
  61 + foreach ($lists as $k => $v){
  62 + $date = $v['record'][0]['date'];
  63 + $recordModel->edit(['date'=>$date],['id'=>$v['id']]);
  64 + }
  65 +// $projectModel = new Project();
  66 +// $list = $projectModel->list(['delete_status'=>['=',0]]);
  67 +// $data = [];
  68 +// foreach ($list as $v){
  69 +// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  70 +// ProjectServer::useProject($v['id']);
  71 +//// $this->getProduct();
  72 +//// $this->setProductKeyword();
  73 +//// $this->getBlog();
  74 +//// $this->setCustomRoute($v['id']);
  75 +// $this->editProductAlt();
  76 +//// $this->custom_to_blogs();
  77 +// DB::disconnect('custom_mysql');
  78 +// }
72 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 79 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
73 } 80 }
74 81
@@ -71,6 +71,7 @@ class ProjectController extends BaseController @@ -71,6 +71,7 @@ class ProjectController extends BaseController
71 $this->response('success',Code::SUCCESS,$lists); 71 $this->response('success',Code::SUCCESS,$lists);
72 } 72 }
73 73
  74 +
74 /** 75 /**
75 * 需要查询的字段 76 * 需要查询的字段
76 * @return array 77 * @return array
@@ -359,12 +360,20 @@ class ProjectController extends BaseController @@ -359,12 +360,20 @@ class ProjectController extends BaseController
359 } 360 }
360 if($item['type'] == Project::TYPE_ONE){//建站中 361 if($item['type'] == Project::TYPE_ONE){//建站中
361 $processModel = new ProcessRecords(); 362 $processModel = new ProcessRecords();
362 - $item['sign_project'] = 0;  
363 - $proInfo = $processModel->read(['project_id'=>$item['id'],'updated_at'=>['>=',time() - 3 * 12 * 3600]],['id']);  
364 - if($proInfo === false){  
365 - $item['sign_project'] = 1; 363 + $item['sign_project'] = 1;
  364 + $count = $processModel->counts(['project_id'=>$item['id']]);
  365 + if($count < 1){
  366 + $item['sign_project'] = 0;
  367 + }else{
  368 + $proInfo = $processModel->read(['project_id'=>$item['id'],'date'=>['>=',date('Y-m-d', strtotime('-3 days'))]],['id']);
  369 + if($proInfo !== false){
  370 + $item['sign_project'] = 0;
  371 + }
366 } 372 }
367 } 373 }
  374 + if(!empty($item['extend_type'])){
  375 + $item['type'] = $item['extend_type'];
  376 + }
368 $manageModel = new ManageHr(); 377 $manageModel = new ManageHr();
369 $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0); 378 $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
370 $item['build_leader'] = $manageModel->getName($item['leader_mid']); 379 $item['build_leader'] = $manageModel->getName($item['leader_mid']);
@@ -383,7 +392,6 @@ class ProjectController extends BaseController @@ -383,7 +392,6 @@ class ProjectController extends BaseController
383 $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : ''; 392 $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : '';
384 $item['product_num'] = $data['product'] ?? 0; 393 $item['product_num'] = $data['product'] ?? 0;
385 $item['keyword_num'] = $data['key'] ?? 0; 394 $item['keyword_num'] = $data['key'] ?? 0;
386 - $item['autologin_code'] = getAutoLoginCode($item['id']);  
387 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0); 395 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
388 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); 396 $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
389 $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); 397 $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]);
@@ -232,6 +232,7 @@ class AdsController extends BaseController @@ -232,6 +232,7 @@ class AdsController extends BaseController
232 $form_id = intval($request->input('form_id')); 232 $form_id = intval($request->input('form_id'));
233 $country = intval($request->input('country')); 233 $country = intval($request->input('country'));
234 $page_size = intval($request->input('row', '20')); 234 $page_size = intval($request->input('row', '20'));
  235 + $domain = trim($request->input('domain', ''));
235 $result = ReInquiryDetail::with('detailLog') 236 $result = ReInquiryDetail::with('detailLog')
236 ->when($status, function ($query, $status) { 237 ->when($status, function ($query, $status) {
237 return $query->where('status', $status); 238 return $query->where('status', $status);
@@ -245,6 +246,9 @@ class AdsController extends BaseController @@ -245,6 +246,9 @@ class AdsController extends BaseController
245 ->when($country, function ($query, $country) { 246 ->when($country, function ($query, $country) {
246 return $query->where('country', 'like', '%'.$country.'%'); 247 return $query->where('country', 'like', '%'.$country.'%');
247 }) 248 })
  249 + ->when($domain, function ($query, $domain) {
  250 + return $query->where('re_website', 'like', '%'.$domain.'%');
  251 + })
248 ->orderBy('id', 'desc') 252 ->orderBy('id', 'desc')
249 ->paginate($page_size); 253 ->paginate($page_size);
250 return $this->response('success', Code::SUCCESS, $result); 254 return $this->response('success', Code::SUCCESS, $result);
@@ -275,7 +279,18 @@ class AdsController extends BaseController @@ -275,7 +279,18 @@ class AdsController extends BaseController
275 279
276 foreach ($result as &$item){ 280 foreach ($result as &$item){
277 $item->tasks = $item->tasks; //调用访问器 281 $item->tasks = $item->tasks; //调用访问器
278 - $item['project_id'] = DomainInfo::where('domain', $item['domain'])->value('project_id') ?: 0; 282 + $is_v6 = 0;
  283 + foreach ($item->tasks as $task){
  284 + if($task['is_v6']){
  285 + $is_v6 = 1;
  286 + }
  287 + }
  288 + if($is_v6){
  289 + $item['project_id'] = DomainInfo::where('domain', $item['domain'])->value('project_id') ?: 0;
  290 + }else{
  291 + $item['project_id'] = 0;
  292 + }
  293 +
279 } 294 }
280 295
281 return $this->response('success', Code::SUCCESS, $result); 296 return $this->response('success', Code::SUCCESS, $result);
@@ -168,7 +168,8 @@ class InquiryController extends BaseController @@ -168,7 +168,8 @@ class InquiryController extends BaseController
168 $data = $data['list'] ?? []; 168 $data = $data['list'] ?? [];
169 foreach ($data as &$item){ 169 foreach ($data as &$item){
170 //非正常登录的 170 //非正常登录的
171 - if($this->param['login_source']??0 != 2){ 171 +
  172 + if(($this->user['login_source']??0) != 2 && ($this->user['login_source']??0) != 3){
172 //脱敏 173 //脱敏
173 !empty($item['email']) && $item['email'] = email_desensitize($item['email']); 174 !empty($item['email']) && $item['email'] = email_desensitize($item['email']);
174 !empty($item['phone']) && $item['phone'] = substr($item['phone'], 0, -4) . '****'; 175 !empty($item['phone']) && $item['phone'] = substr($item['phone'], 0, -4) . '****';
@@ -195,6 +195,13 @@ class ProductController extends BaseController @@ -195,6 +195,13 @@ class ProductController extends BaseController
195 $this->map['title'] = str_replace('+',' ',$this->map['title']); 195 $this->map['title'] = str_replace('+',' ',$this->map['title']);
196 $query = $query->where('title','like','%'.$this->map['title'].'%'); 196 $query = $query->where('title','like','%'.$this->map['title'].'%');
197 } 197 }
  198 + if(isset($this->map['keyword_title']) && !empty($this->map['keyword_title'])){
  199 + $keywordModel = new Keyword();
  200 + $keywordInfo = $keywordModel->read(['title'=>$this->map['keyword_title']],['id']);
  201 + if(!empty($keywordInfo)){
  202 + $query = $query->where('keyword_id','like','%,'.$keywordInfo['id'].',%');
  203 + }
  204 + }
198 if(isset($this->map['status'])){ 205 if(isset($this->map['status'])){
199 if($this->map['status'] == 0){ 206 if($this->map['status'] == 0){
200 $query = $query->whereIn('status',[0,3]); 207 $query = $query->whereIn('status',[0,3]);
@@ -65,6 +65,7 @@ class ProcessRecordsLogic extends BaseLogic @@ -65,6 +65,7 @@ class ProcessRecordsLogic extends BaseLogic
65 public function recordSave(){ 65 public function recordSave(){
66 $info = $this->model->read(['project_id'=>$this->param['project_id']]); 66 $info = $this->model->read(['project_id'=>$this->param['project_id']]);
67 $this->param['operator_id'] = $this->manager['id']; 67 $this->param['operator_id'] = $this->manager['id'];
  68 + $this->param['date'] = $this->param['record'][0]['date'] ?? null;
68 $this->param['record'] = json_encode($this->param['record']); 69 $this->param['record'] = json_encode($this->param['record']);
69 if($info === false){ 70 if($info === false){
70 $res = $this->model->add($this->param); 71 $res = $this->model->add($this->param);
@@ -68,19 +68,21 @@ class RenewLogic extends BaseLogic @@ -68,19 +68,21 @@ class RenewLogic extends BaseLogic
68 * @time :2023/9/19 10:21 68 * @time :2023/9/19 10:21
69 */ 69 */
70 public function editProjectRenew(){ 70 public function editProjectRenew(){
71 - //获取续费单详情  
72 - $info = $this->model->read(['id'=>$this->param['renew_id']]);  
73 - if($info === false){  
74 - $this->fail('当前续费单不存在');  
75 - }  
76 - if($info['project_id'] != 0){  
77 - $this->fail('当前续费单已关联项目,请重新选择'); 71 + if($this->param['renew_id'] != 0){
  72 + //获取续费单详情
  73 + $info = $this->model->read(['id'=>$this->param['renew_id']]);
  74 + if($info === false){
  75 + $this->fail('当前续费单不存在');
  76 + }
  77 + if($info['project_id'] != 0){
  78 + $this->fail('当前续费单已关联项目,请重新选择');
  79 + }
78 } 80 }
79 DB::beginTransaction(); 81 DB::beginTransaction();
80 try { 82 try {
81 $this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id']],['id'=>$this->param['renew_id']]); 83 $this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id']],['id'=>$this->param['renew_id']]);
82 $param = $this->param; 84 $param = $this->param;
83 - $param['api_no'] = $info['api_no']; 85 + $param['api_no'] = $info['api_no'] ?? 0;
84 $this->saveLog($param); 86 $this->saveLog($param);
85 $this->updateProject($this->param['id'],$this->param['type']); 87 $this->updateProject($this->param['id'],$this->param['type']);
86 $this->updateProjectBuild($this->param['id'],$this->param['service_duration'],$this->param['plan']); 88 $this->updateProjectBuild($this->param['id'],$this->param['service_duration'],$this->param['plan']);
@@ -207,6 +207,9 @@ class CustomTemplateLogic extends BaseLogic @@ -207,6 +207,9 @@ class CustomTemplateLogic extends BaseLogic
207 public function handleSaveParam(){ 207 public function handleSaveParam(){
208 $this->param['url'] = str_replace_url($this->param['url']); 208 $this->param['url'] = str_replace_url($this->param['url']);
209 $this->param['operator_id'] = $this->user['id']; 209 $this->param['operator_id'] = $this->user['id'];
  210 + if(empty($this->project)){
  211 + $this->fail('登录已过期,请重新登录');
  212 + }
210 if(($this->project['deploy_build']['is_search'] == 0) && ($this->param['url'] == 'search')){ 213 if(($this->project['deploy_build']['is_search'] == 0) && ($this->param['url'] == 'search')){
211 $this->fail('请先开启搜索页可视化'); 214 $this->fail('请先开启搜索页可视化');
212 } 215 }
@@ -175,6 +175,9 @@ class BaseLogic extends Logic @@ -175,6 +175,9 @@ class BaseLogic extends Logic
175 $str = http_build_query($data); 175 $str = http_build_query($data);
176 $url = $this->user['domain'].'api/delHtml/?'.$str; 176 $url = $this->user['domain'].'api/delHtml/?'.$str;
177 $serverIpModel = new ServersIp(); 177 $serverIpModel = new ServersIp();
  178 + if(empty($this->project)){
  179 + $this->fail('登录已过期,请重新登录');
  180 + }
178 $serversIpInfo = $serverIpModel->read(['id'=>$this->project['serve_id']],['servers_id']); 181 $serversIpInfo = $serverIpModel->read(['id'=>$this->project['serve_id']],['servers_id']);
179 if($serversIpInfo && ($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID)){ 182 if($serversIpInfo && ($serversIpInfo['servers_id'] == ServerConfig::SELF_SITE_ID)){
180 //自建站服务器直接返回 183 //自建站服务器直接返回
@@ -10,6 +10,7 @@ use App\Models\News\NewsCategory; @@ -10,6 +10,7 @@ use App\Models\News\NewsCategory;
10 use App\Models\News\NewsCategory as NewsCategoryModel; 10 use App\Models\News\NewsCategory as NewsCategoryModel;
11 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
12 use App\Models\Template\BTemplate; 12 use App\Models\Template\BTemplate;
  13 +use App\Services\CosService;
13 use Illuminate\Support\Facades\DB; 14 use Illuminate\Support\Facades\DB;
14 use mysql_xdevapi\Exception; 15 use mysql_xdevapi\Exception;
15 16
@@ -186,7 +187,9 @@ class NewsLogic extends BaseLogic @@ -186,7 +187,9 @@ class NewsLogic extends BaseLogic
186 if(isset($param['image'])){ 187 if(isset($param['image'])){
187 $param['image'] = str_replace_url($param['image'] ?? ''); 188 $param['image'] = str_replace_url($param['image'] ?? '');
188 } 189 }
189 - 190 + if(isset($this->param['text'])){
  191 + $param['text'] = $this->handleText($this->param['text']);
  192 + }
190 if(isset($this->param['id'])){ 193 if(isset($this->param['id'])){
191 $param['operator_id'] = $this->user['id']; 194 $param['operator_id'] = $this->user['id'];
192 }else{ 195 }else{
@@ -210,6 +213,53 @@ class NewsLogic extends BaseLogic @@ -210,6 +213,53 @@ class NewsLogic extends BaseLogic
210 } 213 }
211 214
212 /** 215 /**
  216 + * @remark :处理text
  217 + * @name :handleText
  218 + * @author :lyh
  219 + * @method :post
  220 + * @time :2024/11/7 17:20
  221 + */
  222 + public function handleText($text){
  223 + $pattern = '/<img\s+[^>]*src=["\']([^"\']+)["\']/i';
  224 + $matches = [];
  225 + preg_match_all($pattern, $text, $matches);
  226 + $text = $this->saveBase64Images($matches[1],$text);
  227 + return $this->success($text);
  228 + }
  229 +
  230 + /**
  231 + * @remark :解码图片
  232 + * @name :saveBase64Images
  233 + * @author :lyh
  234 + * @method :post
  235 + * @time :2024/11/7 16:52
  236 + */
  237 + public function saveBase64Images($imageSources,&$text)
  238 + {
  239 + foreach ($imageSources as $src) {
  240 + if (preg_match('/^data:image\/(png|jpg|jpeg|gif);base64,/', $src, $match)) {
  241 + $imageType = $match[1]; // Image type (png, jpg, etc.)
  242 + $imageUrl = $this->manager_uploads($src,$imageType);
  243 + $text = str_replace($src, $imageUrl, $text);
  244 + }
  245 + }
  246 + return $this->success($text);
  247 + }
  248 + /**
  249 + * @remark :自调用
  250 + * @name :manager_uploads
  251 + * @author :lyh
  252 + * @method :post
  253 + * @time :2024/11/7 11:00
  254 + */
  255 + public function manager_uploads($files,$type = 'png'){
  256 + $this->uploads = config('upload.default_image');
  257 + $path = $this->uploads['path_b'].'/'.($this->user['project_id']).'/image_news/'.date('Y-m');
  258 + $cosService = new CosService();
  259 + $fileName = md5(uniqid() . '_' . time() . '.' . ($this->user['project_id']).rand(1,10000)) . '.' .$type;
  260 + return getImageUrl($cosService->uploadFile($files,$path,$fileName));
  261 + }
  262 + /**
213 * @remark :获取分类(字符串) 263 * @remark :获取分类(字符串)
214 * @name :getLastCategory 264 * @name :getLastCategory
215 * @author :lyh 265 * @author :lyh
@@ -163,48 +163,7 @@ class UserLoginLogic @@ -163,48 +163,7 @@ class UserLoginLogic
163 if($project['site_status'] != 0){//关闭站点 163 if($project['site_status'] != 0){//关闭站点
164 $this->fail('当前网站已过期,请联系管理员及时续费。'); 164 $this->fail('当前网站已过期,请联系管理员及时续费。');
165 } 165 }
166 - $info['title'] = $project['title'] ?? '';  
167 - $info['company'] = $project['company'] ?? '';  
168 - $info['from_order_id'] = $project['from_order_id'] ?? '';  
169 - $info['aicc'] = $project['aicc'] ?? '';  
170 - $info['hagro'] = $project['hagro'] ?? '';  
171 - $info['plan'] = Project::planMap()[$project['deploy_build']['plan']];  
172 - $info['test_domain'] = $project['deploy_build']['test_domain'] ?? '';  
173 - $info['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? ''));  
174 - $info['is_customized'] = $project['is_customized'];  
175 - $info['is_upload_manage'] = $project['is_upload_manage'];  
176 - $info['is_upgrade'] = $project['is_upgrade'];  
177 - $info['is_show_blog'] = $project['is_show_blog'];  
178 - $info['upload_config'] = $project['upload_config'];  
179 - $info['main_lang_id'] = $project['main_lang_id'];  
180 - $info['image_max'] = $project['image_max'];  
181 - $info['uptime_type'] = $this->getHistory($project);  
182 - $info['uptime'] = $project['uptime'];  
183 - $info['storage_type'] = $project['storage_type'];  
184 - $info['project_location'] = $project['project_location'];  
185 - $info['open_export_product'] = $project['open_export_product'];  
186 - $info['is_update_language'] = $project['is_update_language'];  
187 - $info['is_watermark'] = $project['is_watermark'];  
188 - $project['deploy_build']['configuration']['is_product'] = $project['deploy_build']['configuration']['is_news'] = $project['deploy_build']['configuration']['is_blogs'] = $project['deploy_build']['configuration']['is_module'] = "1";  
189 - $info['configuration'] = $project['deploy_build']['configuration'];  
190 - $info['file_cdn'] = $project['deploy_build']['file_cdn'];  
191 - $info['project_type'] = $project['type'];  
192 - $info['service_duration'] = $project['deploy_build']['service_duration'];  
193 - $info['remain_day'] = $project['remain_day'];  
194 - if($info['is_customized'] == 1){  
195 - $info['is_visualization'] = json_decode($project['is_visualization']);  
196 - }  
197 - $info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0;  
198 - $info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority'];  
199 - $info['is_inquiry_country'] = $project['is_inquiry_country'];  
200 - $info['is_subscribe'] = $project['is_subscribe'];  
201 - //是否开通AMP  
202 - $is_amp = 0;  
203 - if(!empty($project['deploy_optimize']['domain'])){  
204 - $amp_info = (new DomainInfo())->read(['id'=>$project['deploy_optimize']['domain']],['amp_status']);  
205 - $is_amp = $amp_info ? $amp_info['amp_status'] : 0;  
206 - }  
207 - $info['is_amp'] = $is_amp; 166 + $info = $this->handleInfo($info,$project);
208 $info['login_source'] = $login_source; 167 $info['login_source'] = $login_source;
209 //保存项目缓存 168 //保存项目缓存
210 Cache::put('user-'.$info['project_id'],$project,12 * 3600); 169 Cache::put('user-'.$info['project_id'],$project,12 * 3600);
@@ -212,6 +171,27 @@ class UserLoginLogic @@ -212,6 +171,27 @@ class UserLoginLogic
212 } 171 }
213 172
214 /** 173 /**
  174 + * @remark :组装返回数据
  175 + * @name :getProjectInfo
  176 + * @author :lyh
  177 + * @method :post
  178 + * @time :2023/8/29 15:26
  179 + */
  180 + public function assembleParam($mobile,$project_id){
  181 + $info = $this->model->read(['mobile'=>$mobile,'project_id'=>$project_id],['id','mobile','status','role_id','token','name','wechat','project_id']);
  182 + //获取项目详情
  183 + $project = $this->getProjectInfo($project_id);
  184 + if($project['site_status'] != 0){//关闭站点
  185 + $this->fail('当前网站已过期,请联系管理员及时续费。');
  186 + }
  187 + $info = $this->handleInfo($info,$project);
  188 + $info['login_source'] = User::LOGIN_PASSWORD_SOURCE;//账号密码登录返回
  189 + //保存项目缓存
  190 + Cache::put('user-'.$info['project_id'],$project,12 * 3600);
  191 + return $this->success($info);
  192 + }
  193 +
  194 + /**
215 * @remark :获取问卷调查记录(阶段记录) 195 * @remark :获取问卷调查记录(阶段记录)
216 * @name :getHistory 196 * @name :getHistory
217 * @author :lyh 197 * @author :lyh
@@ -260,19 +240,13 @@ class UserLoginLogic @@ -260,19 +240,13 @@ class UserLoginLogic
260 } 240 }
261 241
262 /** 242 /**
263 - * @remark :组装返回数据  
264 - * @name :getProjectInfo 243 + * @remark :登录返回数据处理
  244 + * @name :handleInfo
265 * @author :lyh 245 * @author :lyh
266 * @method :post 246 * @method :post
267 - * @time :2023/8/29 15:26 247 + * @time :2024/11/5 16:51
268 */ 248 */
269 - public function assembleParam($mobile,$project_id){  
270 - $info = $this->model->read(['mobile'=>$mobile,'project_id'=>$project_id],['id','mobile','status','role_id','token','name','wechat','project_id']);  
271 - //获取项目详情  
272 - $project = $this->getProjectInfo($project_id);  
273 - if($project['site_status'] != 0){//关闭站点  
274 - $this->fail('当前网站已过期,请联系管理员及时续费。');  
275 - } 249 + public function handleInfo($info,$project){
276 $info['title'] = $project['title'] ?? ''; 250 $info['title'] = $project['title'] ?? '';
277 $info['company'] = $project['company'] ?? ''; 251 $info['company'] = $project['company'] ?? '';
278 $info['from_order_id'] = $project['from_order_id'] ?? ''; 252 $info['from_order_id'] = $project['from_order_id'] ?? '';
@@ -309,6 +283,7 @@ class UserLoginLogic @@ -309,6 +283,7 @@ class UserLoginLogic
309 $info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority']; 283 $info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority'];
310 $info['is_inquiry_country'] = $project['is_inquiry_country']; 284 $info['is_inquiry_country'] = $project['is_inquiry_country'];
311 $info['is_subscribe'] = $project['is_subscribe']; 285 $info['is_subscribe'] = $project['is_subscribe'];
  286 + $info['is_news'] = $project['is_news'] ?? 0;
312 //是否开通AMP 287 //是否开通AMP
313 $is_amp = 0; 288 $is_amp = 0;
314 if(!empty($project['deploy_optimize']['domain'])){ 289 if(!empty($project['deploy_optimize']['domain'])){
@@ -316,13 +291,9 @@ class UserLoginLogic @@ -316,13 +291,9 @@ class UserLoginLogic
316 $is_amp = $amp_info ? $amp_info['amp_status'] : 0; 291 $is_amp = $amp_info ? $amp_info['amp_status'] : 0;
317 } 292 }
318 $info['is_amp'] = $is_amp; 293 $info['is_amp'] = $is_amp;
319 - $info['login_source'] = User::LOGIN_PASSWORD_SOURCE;//账号密码登录返回  
320 - //保存项目缓存  
321 - Cache::put('user-'.$info['project_id'],$project,12 * 3600);  
322 - return $this->success($info); 294 + return $info;
323 } 295 }
324 296
325 -  
326 /** 297 /**
327 * @remark :获取项目数据详情 298 * @remark :获取项目数据详情
328 * @name :getProjectInfo 299 * @name :getProjectInfo
@@ -4,6 +4,7 @@ namespace App\Models\Channel; @@ -4,6 +4,7 @@ namespace App\Models\Channel;
4 4
5 use App\Models\Base; 5 use App\Models\Base;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
  7 +use Illuminate\Support\Facades\Cache;
7 use phpDocumentor\Reflection\Types\Self_; 8 use phpDocumentor\Reflection\Types\Self_;
8 9
9 /** 10 /**
@@ -56,11 +57,16 @@ class Channel extends Base @@ -56,11 +57,16 @@ class Channel extends Base
56 } 57 }
57 58
58 public static function getChannelText($sales_id){ 59 public static function getChannelText($sales_id){
59 - $user = User::where('id', $sales_id)->select(['name', 'channel_id'])->first();  
60 - if(!$user){  
61 - return $sales_id; 60 + $channel_alias = Cache::get('channel_alias_'.$sales_id);
  61 + if(empty($channel_alias)){
  62 + $user = User::where('id', $sales_id)->select(['name', 'channel_id'])->first();
  63 + if(!$user){
  64 + return $sales_id;
  65 + }
  66 + $channel_alias = self::where('id', $user['channel_id'])->value('alias');
  67 + $channel_alias = $channel_alias . '-' . $user['name'];
  68 + Cache::put('channel_alias_'.$sales_id,$channel_alias,24 * 3600);
62 } 69 }
63 - $channel_alias = self::where('id', $user['channel_id'])->value('alias');  
64 - return $channel_alias . '-' . $user['name']; 70 + return $channel_alias;
65 } 71 }
66 } 72 }
@@ -4,6 +4,7 @@ namespace App\Models\Domain; @@ -4,6 +4,7 @@ namespace App\Models\Domain;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
6 use App\Models\Base; 6 use App\Models\Base;
  7 +use Illuminate\Support\Facades\Cache;
7 8
8 /** 9 /**
9 * Class DomainInfo 10 * Class DomainInfo
@@ -61,11 +62,16 @@ class DomainInfo extends Base @@ -61,11 +62,16 @@ class DomainInfo extends Base
61 * @time :2023/9/4 17:05 62 * @time :2023/9/4 17:05
62 */ 63 */
63 public function getDomain($domain){ 64 public function getDomain($domain){
64 - $info = $this->read(['id'=>$domain]);  
65 - if($info === false){  
66 - return ''; 65 + $res_domain = Cache::get('domain_'.$domain);
  66 + if(empty($res_domain)){
  67 + $info = $this->read(['id'=>$domain]);
  68 + if($info === false){
  69 + return '';
  70 + }
  71 + $res_domain = 'https://'.$info['domain'].'/';
  72 + Cache::put('domain_'.$domain,$res_domain,24 * 3600);
67 } 73 }
68 - return 'https://'.$info['domain'].'/'; 74 + return $res_domain;
69 } 75 }
70 76
71 /** 77 /**
@@ -7,6 +7,7 @@ use App\Models\Base; @@ -7,6 +7,7 @@ use App\Models\Base;
7 use App\Utils\LogUtils; 7 use App\Utils\LogUtils;
8 use Illuminate\Database\Eloquent\SoftDeletes; 8 use Illuminate\Database\Eloquent\SoftDeletes;
9 use Illuminate\Support\Facades\DB; 9 use Illuminate\Support\Facades\DB;
  10 +use Illuminate\Support\Facades\Log;
10 11
11 /** 12 /**
12 * Class InquiryFormData 13 * Class InquiryFormData
@@ -67,6 +68,8 @@ class InquiryFormData extends Base @@ -67,6 +68,8 @@ class InquiryFormData extends Base
67 $model->save(); 68 $model->save();
68 69
69 if(!empty($data['name']) && !empty($data['email']) && !empty($data['message'])){ 70 if(!empty($data['name']) && !empty($data['email']) && !empty($data['message'])){
  71 + Log::channel('inquiry')->info('开始发邮件' . PHP_EOL);
  72 +
70 unset($data['globalso-domain_host_url']); 73 unset($data['globalso-domain_host_url']);
71 unset($data['globalso-domain']); 74 unset($data['globalso-domain']);
72 unset($data['globalso-edition']); 75 unset($data['globalso-edition']);
@@ -86,7 +89,7 @@ class InquiryFormData extends Base @@ -86,7 +89,7 @@ class InquiryFormData extends Base
86 } 89 }
87 if(!$has_file) { 90 if(!$has_file) {
88 $res = (new FormGlobalsoApi())->submitInquiry($ip, $referer, $submit_at, $data); 91 $res = (new FormGlobalsoApi())->submitInquiry($ip, $referer, $submit_at, $data);
89 - LogUtils::info('询盘提交', $data, $res?: []); 92 + Log::channel('inquiry')->info('询盘发送邮件', [$data, $res]);
90 } 93 }
91 } 94 }
92 return $model->id; 95 return $model->id;
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Models\Manage; 3 namespace App\Models\Manage;
4 use App\Models\Base; 4 use App\Models\Base;
  5 +use Illuminate\Support\Facades\Cache;
5 6
6 class ManageHr extends Base 7 class ManageHr extends Base
7 { 8 {
@@ -190,9 +191,13 @@ class ManageHr extends Base @@ -190,9 +191,13 @@ class ManageHr extends Base
190 public function getName($id){ 191 public function getName($id){
191 $name = ''; 192 $name = '';
192 if(!empty($id)){ 193 if(!empty($id)){
193 - $info = $this->read(['id'=>$id],['id','name']);  
194 - if($info !== false){  
195 - $name = $info['name']; 194 + $name = Cache::get('manager_hr_'.$id);
  195 + if(empty($name)){
  196 + $info = $this->read(['id'=>$id],['id','name']);
  197 + if($info !== false){
  198 + $name = $info['name'];
  199 + Cache::put('manager_hr_'.$id,$name,24 * 3600);
  200 + }
196 } 201 }
197 } 202 }
198 return $name; 203 return $name;
@@ -5,6 +5,7 @@ namespace App\Services; @@ -5,6 +5,7 @@ namespace App\Services;
5 use App\Exceptions\InquiryFilterException; 5 use App\Exceptions\InquiryFilterException;
6 use App\Models\File\ImageSetting; 6 use App\Models\File\ImageSetting;
7 use App\Utils\LogUtils; 7 use App\Utils\LogUtils;
  8 +use Illuminate\Support\Str;
8 use Qcloud\Cos\Client; 9 use Qcloud\Cos\Client;
9 /** 10 /**
10 * @remark :对象存储cos 11 * @remark :对象存储cos
@@ -34,7 +35,19 @@ class CosService @@ -34,7 +35,19 @@ class CosService
34 ], 35 ],
35 ]); 36 ]);
36 $key = $path.'/'.$filename; 37 $key = $path.'/'.$filename;
37 - $Body = $binary ? $files : fopen($files->getRealPath(), 'r'); 38 + // 判断是否为 Base64 编码的图片流文件
  39 + if (Str::startsWith($files, 'data:image')) {
  40 + // 分离 Base64 头部和数据部分
  41 + [$meta, $base64Data] = explode(',', $files);
  42 + // 解码 Base64 数据
  43 + $Body = base64_decode($base64Data);
  44 + if ($Body === false) {
  45 + throw new \Exception("Base64 数据解码失败");
  46 + }
  47 + } else {
  48 + // 如果不是 Base64 流文件,处理为普通文件上传
  49 + $Body = $binary ? $files : fopen($files->getRealPath(), 'r');
  50 + }
38 $options = [ 51 $options = [
39 'Bucket' => $cos['bucket'], 52 'Bucket' => $cos['bucket'],
40 'Key' => $key, 53 'Key' => $key,